LYFZReceiveMsg.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // LYFZReceiveMsg.h: interface for the CLYFZReceiveMsg class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_LYFZReceiveMsg_H__144E8B64_2004_4709_B55A_242FE5F07BD2__INCLUDED_)
  5. #define AFX_LYFZReceiveMsg_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 CLYFZReceiveMsg : 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. CLYFZReceiveMsg();
  28. virtual ~CLYFZReceiveMsg();
  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(CLYFZReceiveMsg)
  69. //}}AFX_VIRTUAL
  70. // Generated message map functions
  71. protected:
  72. int m_nSecurityMode;
  73. int m_nStatisticsInterval;
  74. //{{AFX_MSG(CLYFZReceiveMsg)
  75. afx_msg void OnTimer(UINT nIDEvent);
  76. //}}AFX_MSG
  77. LRESULT OnThreadClose(WPARAM wParam, LPARAM lParam);
  78. LRESULT OnThreadStart(WPARAM wParam, LPARAM);
  79. LRESULT OnThreadMessage(WPARAM wParam, LPARAM lParam);
  80. DECLARE_MESSAGE_MAP()
  81. };
  82. #endif // !defined(AFX_LYFZReceiveMsg_H__144E8B64_2004_4709_B55A_242FE5F07BD2__INCLUDED_)