FtpControlSocket.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. #if !defined(AFX_FTPCONTROLSOCKET_H__AE6AA44E_B09D_487A_8EF2_A23697434945__INCLUDED_)
  15. #define AFX_FTPCONTROLSOCKET_H__AE6AA44E_B09D_487A_8EF2_A23697434945__INCLUDED_
  16. #include "structures.h" // Hinzugefügt von der Klassenansicht
  17. #include "StdAfx.h" // Hinzugefügt von der Klassenansicht
  18. #include "FileZillaApi.h"
  19. #include "FileZillaIntf.h"
  20. #include "ControlSocket.h"
  21. #if _MSC_VER > 1000
  22. #pragma once
  23. #endif // _MSC_VER > 1000
  24. // FtpControlSocket.h : Header-Datei
  25. //
  26. class CTransferSocket;
  27. class CMainThread;
  28. /////////////////////////////////////////////////////////////////////////////
  29. // Befehlsziel CFtpControlSocket
  30. class CAsyncProxySocketLayer;
  31. class CMainThread;
  32. class CFtpControlSocket : public CControlSocket
  33. {
  34. friend CTransferSocket;
  35. // Attribute
  36. public:
  37. // Operationen
  38. public:
  39. CFtpControlSocket(CMainThread *pMainThread, CFileZillaTools * pTools);
  40. virtual ~CFtpControlSocket();
  41. // Überschreibungen
  42. public:
  43. virtual void Connect(t_server &server);
  44. virtual void OnTimer();
  45. virtual BOOL IsReady();
  46. virtual void List(BOOL bFinish, int nError=0, CServerPath path=CServerPath(), CString subdir=_MPT(""), int nListMode = 0);
  47. #ifdef MPEXT
  48. virtual void ListFile(CString filename, const CServerPath &path);
  49. #endif
  50. virtual void FtpCommand(LPCTSTR pCommand);
  51. virtual void Disconnect();
  52. virtual void FileTransfer(t_transferfile *transferfile = 0, BOOL bFinish = FALSE, int nError = 0);
  53. virtual void Delete(CString filename, const CServerPath &path);
  54. virtual void Rename(CString oldName, CString newName, const CServerPath &path, const CServerPath &newPath);
  55. virtual void MakeDir(const CServerPath &path);
  56. virtual void RemoveDir(CString dirname, const CServerPath &path);
  57. virtual void Chmod(CString filename, const CServerPath &path, int nValue);
  58. virtual void ProcessReply();
  59. virtual void TransferEnd(int nMode);
  60. virtual void Cancel(BOOL bQuit=FALSE);
  61. virtual void SetAsyncRequestResult(int nAction, CAsyncRequestData *pData);
  62. int CheckOverwriteFile();
  63. virtual BOOL Create();
  64. void TransfersocketListenFinished(unsigned int ip,unsigned short port);
  65. BOOL m_bKeepAliveActive;
  66. #ifndef MPEXT_NO_SSL
  67. BOOL m_bDidRejectCertificate;
  68. #endif
  69. // Some servers are broken. Instead of an empty listing, some MVS servers
  70. // for example they return something "550 no members found"
  71. // Other servers return "550 No files found."
  72. bool IsMisleadingListResponse();
  73. #ifdef MPEXT
  74. virtual bool UsingMlsd();
  75. virtual bool UsingUtf8();
  76. virtual std::string GetTlsVersionStr();
  77. virtual std::string GetCipherName();
  78. bool HandleSize(int code, __int64 & size);
  79. bool HandleMdtm(int code, t_directory::t_direntry::t_date & date);
  80. void TransferHandleListError();
  81. #endif
  82. // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen
  83. //{{AFX_VIRTUAL(CFtpControlSocket)
  84. public:
  85. virtual void OnReceive(int nErrorCode);
  86. virtual void OnConnect(int nErrorCode);
  87. virtual void OnClose(int nErrorCode);
  88. virtual void OnSend(int nErrorCode);
  89. //}}AFX_VIRTUAL
  90. // Generierte Nachrichtenzuordnungsfunktionen
  91. //{{AFX_MSG(CFtpControlSocket)
  92. // HINWEIS - Der Klassen-Assistent fügt hier Member-Funktionen ein und entfernt diese.
  93. //}}AFX_MSG
  94. // Implementierung
  95. protected:
  96. //Called by OnTimer()
  97. void ResumeTransfer();
  98. void CheckForTimeout();
  99. void SendKeepAliveCommand();
  100. virtual int OnLayerCallback(std::list<t_callbackMsg>& callbacks);
  101. void SetFileExistsAction(int nAction, COverwriteRequestData *pData);
  102. #ifndef MPEXT_NO_SSL
  103. void SetVerifyCertResult( int nResult, t_SslCertData *pData );
  104. #endif
  105. void ResetOperation(int nSuccessful = -1);
  106. virtual void DoClose(int nError = 0);
  107. int GetReplyCode();
  108. CString GetReply();
  109. void LogOnToServer(BOOL bSkipReply = FALSE);
  110. BOOL Send(CString str);
  111. BOOL ParsePwdReply(CString& rawpwd);
  112. BOOL ParsePwdReply(CString& rawpwd, CServerPath & realPath);
  113. BOOL SendAuthSsl();
  114. void DiscardLine(CStringA line);
  115. bool NeedModeCommand();
  116. bool NeedOptsCommand();
  117. CString GetListingCmd();
  118. bool InitConnect();
  119. int InitConnectState();
  120. #ifdef MPEXT
  121. bool IsRoutableAddress(const CString & host);
  122. bool CheckForcePasvIp(CString & host);
  123. void TransferFinished(bool preserveFileTimeForUploads);
  124. #endif
  125. CFile *m_pDataFile;
  126. CTransferSocket *m_pTransferSocket;
  127. CStringA m_MultiLine;
  128. CTime m_LastSendTime;
  129. CString m_ServerName;
  130. std::list<CStringA> m_RecvBuffer;
  131. CTime m_LastRecvTime;
  132. class CLogonData;
  133. class CListData;
  134. class CListFileData;
  135. class CFileTransferData;
  136. class CMakeDirData;
  137. #ifndef MPEXT_NO_ZLIB
  138. bool m_useZlib;
  139. bool m_zlibSupported;
  140. int m_zlibLevel;
  141. #endif
  142. bool m_bUTF8;
  143. bool m_bAnnouncesUTF8;
  144. bool m_hasClntCmd;
  145. #ifdef MPEXT
  146. TFTPServerCapabilities m_serverCapabilities;
  147. CStringA m_ListFile;
  148. __int64 m_ListFileSize;
  149. #endif
  150. bool m_isFileZilla;
  151. bool m_awaitsReply;
  152. bool m_skipReply;
  153. char* m_sendBuffer;
  154. int m_sendBufferLen;
  155. bool m_bProtP;
  156. bool m_mayBeMvsFilesystem;
  157. bool m_mayBeBS2000Filesystem;
  158. private:
  159. BOOL m_bCheckForTimeout;
  160. };
  161. /////////////////////////////////////////////////////////////////////////////
  162. //{{AFX_INSERT_LOCATION}}
  163. // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.
  164. #endif // AFX_FTPCONTROLSOCKET_H__AE6AA44E_B09D_487A_8EF2_A23697434945__INCLUDED_