home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 217 / DPCS0306DVD.ISO / Toolkit / Internet / FileZilla / Server / FileZilla_Server-0.9.11.exe / source / ControlSocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-08-29  |  4.2 KB  |  155 lines

  1. // FileZilla Server - a Windows ftp server
  2.  
  3. // Copyright (C) 2002-2004 - Tim Kosse <tim.kosse@gmx.de>
  4.  
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9.  
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14.  
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. #if !defined(AFX_CONTROLSOCKET_H__17DD46FD_8A4A_4394_9F90_C14BA65F6BF6__INCLUDED_)
  20. #define AFX_CONTROLSOCKET_H__17DD46FD_8A4A_4394_9F90_C14BA65F6BF6__INCLUDED_
  21.  
  22. #if _MSC_VER > 1000
  23. #pragma once
  24. #endif // _MSC_VER > 1000
  25. // ControlSocket.h : Header-Datei
  26. //
  27.  
  28. class CAsyncGssSocketLayer;
  29. class CAsyncSslSocketLayer;
  30. class CTransferSocket;
  31.  
  32. #ifndef TRANSFERMODE_NOTSET
  33. #define TRANSFERMODE_NOTSET 0
  34. #endif
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // Befehlsziel CControlSocket
  38.  
  39. class CControlSocket : public CAsyncSocketEx
  40. {
  41. // Attribute
  42. public:
  43.  
  44. // Operationen
  45. public:
  46.     CControlSocket(CServerThread *pOwner);
  47.     virtual ~CControlSocket();
  48.  
  49. // ▄berschreibungen
  50. public:
  51.     CServerThread * m_pOwner;
  52.     CStdString m_RemoteIP;
  53.     void WaitGoOffline(bool wait = true);
  54.     BOOL m_bWaitGoOffline;
  55.     void CheckForTimeout();
  56.     void ForceClose(int nReason);
  57.     CTransferSocket* GetTransferSocket();
  58.     void ProcessTransferMsg();
  59.     void ParseCommand();
  60.     int m_userid;
  61.     BOOL Send(LPCTSTR str, bool sendStatus = true);
  62.     void SendStatus(LPCTSTR status,int type);
  63.     BOOL GetCommand(CStdString &command,CStdString &args);
  64.     bool InitImplicitSsl();
  65.  
  66.     virtual void OnReceive(int nErrorCode);
  67.     virtual void OnClose(int nErrorCode);
  68.     virtual void OnSend(int nErrorCode);
  69.     void AntiHammerIncrease(int amount = 1);
  70.  
  71.     void Continue();
  72.  
  73. // Implementierung
  74. protected:
  75.     BOOL DoUserLogin(const char* sendme, bool skipPass = false);
  76.     BOOL UnquoteArgs(CStdString &args);
  77.     static int GetUserCount(const CStdString &user);
  78.     static void IncUserCount(const CStdString &user);
  79.     static void DecUserCount(const CStdString &user);
  80.     void ResetTransferstatus();
  81.     BOOL CreateTransferSocket(CTransferSocket *pTransferSocket);
  82.     bool CheckIpForZlib();
  83.     void SendTransferinfoNotification(const char transfermode = TRANSFERMODE_NOTSET, const CStdString& physicalFile = "", const CStdString& logicalFile = "", __int64 startOffset = 0, __int64 totalSize = -1);
  84.     bool CanQuit();
  85.  
  86.     virtual int OnLayerCallback(std::list<t_callbackMsg>& callbacks);
  87.  
  88.     CAsyncGssSocketLayer *m_pGssLayer;
  89.     CAsyncSslSocketLayer *m_pSslLayer;
  90.  
  91.     std::list<CStdString> m_RecvLineBuffer;
  92.     char m_RecvBuffer[2048];
  93.     int m_nRecvBufferPos;
  94.     char *m_pSendBuffer;
  95.     int m_nSendBufferLen;
  96.  
  97.     int m_nTelnetSkip;
  98.     BOOL m_bQuitCommand;
  99.     SYSTEMTIME m_LastCmdTime, m_LastTransferTime, m_LoginTime;
  100.     static std::map<CStdString, int> m_UserCount;
  101.     CStdString m_CurrentServerDir;
  102.     static CCriticalSectionWrapper m_Sync;
  103.     struct t_status
  104.     {
  105.         BOOL loggedon;
  106.         CStdString user;
  107.         CStdString ip;
  108.  
  109.         int hammerValue;
  110.     } m_status;
  111.     struct t_transferstatus
  112.     {
  113.         int pasv;
  114.         _int64 rest;
  115.         int type;
  116.         CStdString ip;
  117.         int port;
  118.         CTransferSocket *socket;
  119.     } m_transferstatus;
  120.  
  121.     CStdString RenName;
  122.     BOOL bRenFile;
  123.  
  124.     enum TransferMode
  125.     {
  126.         mode_stream,
  127.         mode_zlib
  128.     };
  129.  
  130.     TransferMode m_transferMode;
  131.     int m_zlibLevel;
  132.  
  133.     int m_antiHammeringWaitTime;
  134.  
  135.     bool m_bProtP;
  136.  
  137. public:
  138.     int GetSpeedLimit(enum sltype);
  139.  
  140.     typedef struct {
  141.         bool bContinue;
  142.         int nBytesAllowedToTransfer;
  143.         int nTransferred;
  144.         bool bBypassed;
  145.     } t_Quota;
  146.     t_Quota m_SlQuotas[2];
  147. };
  148.  
  149. /////////////////////////////////////////////////////////////////////////////
  150.  
  151. //{{AFX_INSERT_LOCATION}}
  152. // Microsoft Visual C++ fⁿgt unmittelbar vor der vorhergehenden Zeile zusΣtzliche Deklarationen ein.
  153.  
  154. #endif // AFX_CONTROLSOCKET_H__17DD46FD_8A4A_4394_9F90_C14BA65F6BF6__INCLUDED_
  155.