From 94e30af2ef983a919ccd49872a333819db228c28 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 20 Jan 2013 19:55:35 +0000 Subject: HTTPServer adopted git-svn-id: http://svn.miranda-ng.org/main/trunk@3200 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/HTTPServer/src/FileShareNode.h | 103 +++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 plugins/HTTPServer/src/FileShareNode.h (limited to 'plugins/HTTPServer/src/FileShareNode.h') diff --git a/plugins/HTTPServer/src/FileShareNode.h b/plugins/HTTPServer/src/FileShareNode.h new file mode 100644 index 0000000000..706a31f093 --- /dev/null +++ b/plugins/HTTPServer/src/FileShareNode.h @@ -0,0 +1,103 @@ +//This file is part of HTTPServer a Miranda IM plugin +//Copyright (C)2002 Kennet Nielsen +// +//This program is free software; you can redistribute it and/or +//modify it under the terms of the GNU General Public License +//as published by the Free Software Foundation; either +//version 2 of the License, or (at your option) any later version. +// +//This program is distributed in the hope that it will be useful, +//but WITHOUT ANY WARRANTY; without even the implied warranty of +//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//GNU General Public License for more details. +// +//You should have received a copy of the GNU General Public License +//along with this program; if not, write to the Free Software +//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +#ifndef FILE_SHARE_NODE_H +#define FILE_SHARE_NODE_H + +#include +#include "m_HTTPServer.h" + +class CLShareUser { +public: + CLShareUser(HANDLE hCon, in_addr stAdd); + virtual ~CLShareUser(); + CLShareUser * pclNext; + in_addr stAddr; + DWORD dwCurrentDL; + DWORD dwTotalSize; + char szCurrentDLSrvPath[MAX_PATH]; + virtual DWORD dwGetDownloadSpeed(); + virtual bool bCloseTransfers() = NULL; + virtual const char * pszCustomInfo() = NULL; + void CloseSocket(); +protected: + HANDLE hConnection; + DWORD dwSpeed; +}; + +class CLFileShareNode { +public://, DWORD dwAllowedIP, DWORD dwAllowedMask, int nMaxDownloads ); + CLFileShareNode(char * pszSrvPath, char * pszRealPath); + CLFileShareNode(STFileShareInfo * pstInfo); + ~CLFileShareNode(); + bool bSetPaths(char * pszSrvPath, char * pszRealPath); + bool bSetInfo(STFileShareInfo * pstInfo); + int nGetSrvPathLen() { + return st.dwMaxSrvPath -1; + } + bool bIsDirectory() { + return st.pszSrvPath[st.dwMaxSrvPath-2] == '/'; + } + + STFileShareInfo st; + char *pszOrigRealPath; + CLFileShareNode * pclNext; + //CLHttpUser * pclAddHttpUser( HANDLE hConnection, in_addr stAddr ); + //bool bRemoveHttpUser( CLHttpUser * pclUser ); + bool bAddUser(CLShareUser * pclUser); + bool bRemoveUser(CLShareUser * pclUser); + bool bAnyUsers() { + return pclCurrentUsers != 0; + } + void CloseAllTransfers(); + CLShareUser *pclGetUsers() { + return pclCurrentUsers; + } +private: + CLShareUser * pclCurrentUsers; + +}; + +extern CLFileShareNode * pclFirstNode; +extern CRITICAL_SECTION csFileShareListAccess; + +class CLFileShareListAccess { + bool bLocked; +public: + CLFileShareListAccess() { + bLocked = false; + Lock(); + } + ~CLFileShareListAccess() { + Unlock(); + } + void Lock() { + if (bLocked) + return; + EnterCriticalSection(&csFileShareListAccess); + bLocked = true; + } + void Unlock() { + if (!bLocked) + return; + LeaveCriticalSection(&csFileShareListAccess); + bLocked = false; + } + +}; + +#endif \ No newline at end of file -- cgit v1.2.3