// FileZilla Server - a Windows ftp server // Copyright (C) 2002-2004 - Tim Kosse // 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #if !defined(AFX_SERVERTHREAD_H__4F566540_62DF_4338_85DE_EC699EB6640C__INCLUDED_) #define AFX_SERVERTHREAD_H__4F566540_62DF_4338_85DE_EC699EB6640C__INCLUDED_ #include "Thread.h" #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // ServerThread.h : Header-Datei // class CControlSocket; class CServerThread; class COptions; class CPermissions; class t_user; class CExternalIpCheck; class CAutoBanManager; class CHashThread; typedef struct { CControlSocket *pSocket; CServerThread *pThread; } t_socketdata; ///////////////////////////////////////////////////////////////////////////// // Thread CServerThread class CServerThread : public CThread { public: virtual CStdString GetExternalIP(const CStdString& localIP); virtual void ExternalIPFailed(); CServerThread(int nNotificationMessageId); CPermissions *m_pPermissions; COptions *m_pOptions; CAutoBanManager* m_pAutoBanManager; void IncRecvCount(int count); void IncSendCount(int count); void IncIpCount(const CStdString &ip); void DecIpCount(const CStdString &ip); int GetIpCount(const CStdString &ip) const; BOOL IsReady(); static const int GetGlobalNumConnections(); void AddSocket(SOCKET sockethandle, bool ssl); const int GetNumConnections(); struct t_Notification { WPARAM wParam; LPARAM lParam; }; void SendNotification(WPARAM wParam, LPARAM lParam); /* * The parameter should be an empty list, since m_pendingNotifications and * list get swapped to increase performance. */ void GetNotifications(std::list& list); void AntiHammerIncrease(const CStdString& ip); CHashThread& GetHashThread(); protected: virtual ~CServerThread(); void GatherTransferedBytes(); void ProcessNewSlQuota(); virtual BOOL InitInstance(); virtual DWORD ExitInstance(); virtual int OnThreadMessage(UINT Msg, WPARAM wParam, LPARAM lParam); void OnTimer(WPARAM wParam, LPARAM lParam); void ProcessControlMessage(t_controlmessage *msg); CControlSocket * GetControlSocket(int userid); std::map m_LocalUserIDs; void AddNewSocket(SOCKET sockethandle, bool ssl); static int CalcUserID(); static std::map m_userids; static std::map m_userIPs; void AntiHammerDecrease(); int m_nRecvCount; int m_nSendCount; UINT m_nRateTimer; BOOL m_bQuit; CCriticalSectionWrapper m_threadsync; static CCriticalSectionWrapper m_GlobalThreadsync; unsigned int m_timerid; //Speed limit code static std::list m_sInstanceList; //First instance is the SL master BOOL m_bIsMaster; int m_nLoopCount; int m_lastLimits[2]; typedef struct { int nBytesAllowedToTransfer; int nTransferred; } t_Quota; t_Quota m_SlQuotas[2]; CStdString m_RawWelcomeMessage; std::list m_ParsedWelcomeMessage; CExternalIpCheck *m_pExternalIpCheck; std::list m_pendingNotifications; int m_throttled; int m_nNotificationMessageId; static std::map m_antiHammerInfo; int m_antiHammerTimer; static CHashThread* m_hashThread; }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein. #endif // AFX_SERVERTHREAD_H__4F566540_62DF_4338_85DE_EC699EB6640C__INCLUDED_