MainThread.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //---------------------------------------------------------------------------
  2. #ifndef MainThreadH
  3. #define MainThreadH
  4. //---------------------------------------------------------------------------
  5. #include "FtpControlSocket.h"
  6. #include "structures.h"
  7. #include "FileZillaApi.h"
  8. #include "ApiLog.h"
  9. //---------------------------------------------------------------------------
  10. #define FZAPI_THREADMSG_PROCESSREPLY 0
  11. #define FZAPI_THREADMSG_COMMAND 1
  12. #define FZAPI_THREADMSG_TRANSFEREND 2
  13. #define FZAPI_THREADMSG_CANCEL 3
  14. #define FZAPI_THREADMSG_DISCONNECT 4
  15. #define FZAPI_THREADMSG_ASYNCREQUESTREPLY 5
  16. #define FZAPI_THREADMSG_POSTKEEPALIVE 6
  17. //---------------------------------------------------------------------------
  18. class CMainThread : public CApiLog
  19. {
  20. protected:
  21. CMainThread();
  22. public:
  23. // Operationen
  24. DWORD m_dwThreadId;
  25. HANDLE m_hThread;
  26. static CMainThread * Create(int nPriority, DWORD dwCreateFlags);
  27. void SetWorkingDir(t_directory * pWorkingDir);
  28. BOOL GetWorkingDir(t_directory * pWorkingDir);
  29. void SendDirectoryListing(t_directory * pDirectoryToSend);
  30. bool UsingMlsd();
  31. bool UsingUtf8();
  32. std::string GetTlsVersionStr();
  33. std::string GetCipherName();
  34. t_command m_LastCommand;
  35. void SetCurrentPath(CServerPath path);
  36. void Quit();
  37. BOOL GetCurrentServer(t_server & server);
  38. bool GetCurrentPath(CServerPath & dir);
  39. CServerPath GetCurrentPath();
  40. void SetConnected(BOOL bConnected = TRUE);
  41. BOOL m_bConnected;
  42. void SetBusy(BOOL bBusy);
  43. BOOL LastOperationSuccessful();
  44. void Command(const t_command & command);
  45. BOOL IsBusy();
  46. CFileZillaTools * m_pTools;
  47. BOOL m_bBusy;
  48. unsigned int m_nInternalMessageID;
  49. BOOL IsConnected();
  50. __int64 GetAsyncRequestID() const;
  51. __int64 GetNextAsyncRequestID();
  52. virtual int OnThreadMessage(UINT Msg, WPARAM wParam, LPARAM lParam);
  53. DWORD ResumeThread();
  54. BOOL PostThreadMessage( UINT message , WPARAM wParam, LPARAM lParam);
  55. protected:
  56. BOOL InitInstance();
  57. DWORD ExitInstance();
  58. DWORD Run();
  59. static DWORD WINAPI ThreadProc(LPVOID lpParameter);
  60. CCriticalSectionWrapper m_CriticalSection;
  61. CFtpControlSocket * m_pControlSocket;
  62. __int64 m_nAsyncRequestID;
  63. void OnTimer(WPARAM wParam, LPARAM lParam);
  64. protected:
  65. t_directory * m_pWorkingDir;
  66. std::map<int, int> m_Options;
  67. BOOL m_bQuit;
  68. t_command * m_pPostKeepAliveCommand;
  69. CServerPath m_CurrentPath;
  70. UINT m_nTimerID;
  71. virtual ~CMainThread();
  72. bool m_Started;
  73. };
  74. //---------------------------------------------------------------------------
  75. #endif MainThreadH