theDBServer.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // DBServer.h: interface for the CtheDBServer class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_DBServer_H__144E8B64_2004_4709_B55A_242FE5F07BD2__INCLUDED_)
  5. #define AFX_DBServer_H__144E8B64_2004_4709_B55A_242FE5F07BD2__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "ConnectThread.h"
  10. #include "ListenSocket.h"
  11. #include "FTPEventSink.h"
  12. #include "UserManager.h"
  13. #include "SecurityManager.h"
  14. class CtheDBServer : public CWnd
  15. {
  16. friend CConnectSocket;
  17. public:
  18. void SetGoodbyeMessage(LPCTSTR lpszText);
  19. void SetWelcomeMessage(LPCTSTR lpszText);
  20. void SetTimeout(int nValue);
  21. void SetPort(int nValue);
  22. void SetMaxUsers(int nValue);
  23. void SetStatisticsInterval(int nValue);
  24. BOOL IsActive();
  25. void Stop();
  26. BOOL Start();
  27. CtheDBServer();
  28. virtual ~CtheDBServer();
  29. CUserManager m_UserManager;
  30. CSecurityManager m_SecurityManager;
  31. CCriticalSection m_CriticalSection;
  32. // list of thread pointers
  33. CTypedPtrList<CObList, CConnectThread*> m_ThreadList;
  34. int GetPort() { return m_nPort; };
  35. int GetMaxUsers() { return m_nMaxUsers; }
  36. int GetTimeout() { return m_nTimeout; }
  37. int GetConnectionCount() { return m_nConnectionCount; }
  38. CString GetWelcomeMessage() { return m_strWelcomeMessage; };
  39. CString GetGoodbyeMessage() { return m_strGoodbyeMessage; };
  40. void AddTraceLine(int nType, LPCTSTR pstrFormat, ...);
  41. private:
  42. // socket member that listens for new connections
  43. CListenSocket m_ListenSocket;
  44. CFTPEventSink *m_pEventSink;
  45. int m_nPort;
  46. int m_nMaxUsers;
  47. CString m_strWelcomeMessage;
  48. CString m_strGoodbyeMessage;
  49. int m_nTimeout;
  50. BOOL m_bRunning;
  51. // statistics
  52. DWORD m_dwTotalReceivedBytes;
  53. DWORD m_dwTotalSentBytes;
  54. int m_nConnectionCount;
  55. int m_nTotalConnections;
  56. int m_nFilesDownloaded;
  57. int m_nFilesUploaded;
  58. int m_nFailedDownloads;
  59. int m_nFailedUploads;
  60. // Operations
  61. public:
  62. BOOL IsIPAddressAllowed(LPCTSTR lpszIPAddress);
  63. void SetSecurityMode(BOOL bBlockSpecific = TRUE);
  64. BOOL CheckMaxUsers();
  65. void Initialize(CFTPEventSink *pEventSink);
  66. // Overrides
  67. // ClassWizard generated virtual function overrides
  68. //{{AFX_VIRTUAL(CtheDBServer)
  69. //}}AFX_VIRTUAL
  70. // Generated message map functions
  71. protected:
  72. int m_nSecurityMode;
  73. int m_nStatisticsInterval;
  74. afx_msg void OnTimer(UINT nIDEvent);
  75. //}}AFX_MSG
  76. LRESULT OnThreadClose(WPARAM wParam, LPARAM lParam);
  77. LRESULT OnThreadStart(WPARAM wParam, LPARAM);
  78. LRESULT OnThreadMessage(WPARAM wParam, LPARAM lParam);
  79. DECLARE_MESSAGE_MAP()
  80. };
  81. #endif // !defined(AFX_DBServer_H__144E8B64_2004_4709_B55A_242FE5F07BD2__INCLUDED_)