1
0

MainThread.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // FileZilla - a Windows ftp client
  2. // Copyright (C) 2002-2004 - Tim Kosse <[email protected]>
  3. // This program is free software; you can redistribute it and/or
  4. // modify it under the terms of the GNU General Public License
  5. // as published by the Free Software Foundation; either version 2
  6. // of the License, or (at your option) any later version.
  7. // This program is distributed in the hope that it will be useful,
  8. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. // GNU General Public License for more details.
  11. // You should have received a copy of the GNU General Public License
  12. // along with this program; if not, write to the Free Software
  13. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. /*CMainThread
  15. Main thread of FileZilla. Processes the command messages passed by the main window
  16. */
  17. #ifndef MPEXT_NO_CACHE
  18. #include "DirectoryCache.h" // Hinzugefügt von der Klassenansicht
  19. #endif
  20. #pragma once
  21. #include "controlsocket.h"
  22. #ifndef MPEXT_NO_SFTP
  23. #include "SFtpControlSocket.h"
  24. #endif
  25. #include "FtpControlSocket.h"
  26. #include "structures.h" // Hinzugefügt von der Klassenansicht
  27. #include "FileZillaApi.h" // Hinzugefügt von der Klassenansicht
  28. #include "ApiLog.h"
  29. /////////////////////////////////////////////////////////////////////////////
  30. // Thread CMainThread
  31. #define FZAPI_THREADMSG_PROCESSREPLY 0
  32. #define FZAPI_THREADMSG_COMMAND 1
  33. #define FZAPI_THREADMSG_TRANSFEREND 2
  34. #define FZAPI_THREADMSG_CANCEL 3
  35. #define FZAPI_THREADMSG_DISCONNECT 4
  36. #define FZAPI_THREADMSG_ASYNCREQUESTREPLY 5
  37. #define FZAPI_THREADMSG_POSTKEEPALIVE 6
  38. #ifndef MPEXT_NO_IDENT
  39. class CIdentServerControl;
  40. #endif
  41. class CMainThread : public CApiLog
  42. {
  43. protected:
  44. CMainThread(); // Dynamische Erstellung verwendet geschützten Konstruktor
  45. // Attribute
  46. public:
  47. // Operationen
  48. public:
  49. DWORD m_dwThreadId;
  50. HANDLE m_hThread;
  51. static CMainThread *Create(int nPriority = THREAD_PRIORITY_NORMAL, DWORD dwCreateFlags = 0);
  52. bool GetWorkingDirPath(CServerPath &path);
  53. void SetWorkingDir(t_directory *pWorkingDir);
  54. BOOL GetWorkingDir(t_directory* pWorkingDir);
  55. #ifndef MPEXT
  56. void SetOption(int nOption, int nValue);
  57. int GetOption(int nOption);
  58. #else
  59. bool UsingMlsd();
  60. bool UsingUtf8();
  61. std::string GetTlsVersionStr();
  62. std::string GetCipherName();
  63. #endif
  64. t_command m_LastCommand;
  65. #ifndef MPEXT_NO_CACHE
  66. CDirectoryCache *m_pDirectoryCache;
  67. #endif
  68. void SetCurrentPath(CServerPath path);
  69. void Quit();
  70. BOOL GetCurrentServer(t_server &server);
  71. bool GetCurrentPath(CServerPath &dir);
  72. CServerPath GetCurrentPath();
  73. void SetConnected(BOOL bConnected = TRUE);
  74. BOOL m_bConnected;
  75. void SetBusy(BOOL bBusy);
  76. BOOL LastOperationSuccessful();
  77. void Command(const t_command& command);
  78. BOOL IsBusy();
  79. HWND m_hOwnerWnd;
  80. CFileZillaTools * m_pTools;
  81. BOOL m_bBusy;
  82. unsigned int m_nReplyMessageID;
  83. unsigned int m_nInternalMessageID;
  84. BOOL IsConnected();
  85. __int64 GetAsyncRequestID() const;
  86. __int64 GetNextAsyncRequestID();
  87. virtual int OnThreadMessage(UINT Msg, WPARAM wParam, LPARAM lParam);
  88. DWORD SuspendThread();
  89. DWORD ResumeThread();
  90. BOOL PostThreadMessage( UINT message , WPARAM wParam, LPARAM lParam);
  91. BOOL IsValid() const;
  92. protected:
  93. BOOL InitInstance();
  94. DWORD ExitInstance();
  95. DWORD Run();
  96. static DWORD WINAPI ThreadProc(LPVOID lpParameter);
  97. CCriticalSection m_CriticalSection;
  98. void ShowStatus(CString status,int type);
  99. void ShowStatus(UINT nID, int type);
  100. CControlSocket *m_pControlSocket;
  101. CFtpControlSocket *m_pFtpControlSocket;
  102. #ifndef MPEXT_NO_SFTP
  103. CSFtpControlSocket *m_pSFtpControlSocket;
  104. #endif
  105. __int64 m_nAsyncRequestID;
  106. void OnTimer(WPARAM wParam,LPARAM lParam);
  107. // Überschreibungen
  108. // Implementierung
  109. protected:
  110. #ifndef MPEXT_NO_IDENT
  111. CIdentServerControl *m_pIdentServer;
  112. #endif
  113. t_directory *m_pWorkingDir;
  114. std::map<int, int> m_Options;
  115. BOOL m_bQuit;
  116. t_command *m_pPostKeepAliveCommand;
  117. CServerPath m_CurrentPath;
  118. UINT m_nTimerID;
  119. virtual ~CMainThread();
  120. CEvent m_EventStarted;
  121. };
  122. /////////////////////////////////////////////////////////////////////////////