FtpControlSocket.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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(CServerPath path=CServerPath(), CString fileName="");
  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 std::string GetTlsVersionStr();
  76. virtual std::string GetCipherName();
  77. #endif
  78. // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen
  79. //{{AFX_VIRTUAL(CFtpControlSocket)
  80. public:
  81. virtual void OnReceive(int nErrorCode);
  82. virtual void OnConnect(int nErrorCode);
  83. virtual void OnClose(int nErrorCode);
  84. virtual void OnSend(int nErrorCode);
  85. //}}AFX_VIRTUAL
  86. // Generierte Nachrichtenzuordnungsfunktionen
  87. //{{AFX_MSG(CFtpControlSocket)
  88. // HINWEIS - Der Klassen-Assistent fügt hier Member-Funktionen ein und entfernt diese.
  89. //}}AFX_MSG
  90. // Implementierung
  91. protected:
  92. //Called by OnTimer()
  93. void ResumeTransfer();
  94. void CheckForTimeout();
  95. void SendKeepAliveCommand();
  96. virtual int OnLayerCallback(std::list<t_callbackMsg>& callbacks);
  97. void SetFileExistsAction(int nAction, COverwriteRequestData *pData);
  98. #ifndef MPEXT_NO_SSL
  99. void SetVerifyCertResult( int nResult, t_SslCertData *pData );
  100. #endif
  101. void ResetOperation(int nSuccessful = -1);
  102. virtual void DoClose(int nError = 0);
  103. int GetReplyCode();
  104. CString GetReply();
  105. void LogOnToServer(BOOL bSkipReply = FALSE);
  106. BOOL Send(CString str);
  107. BOOL ParsePwdReply(CString& rawpwd);
  108. void DiscardLine(CStringA line);
  109. bool NeedModeCommand();
  110. bool NeedOptsCommand();
  111. CString GetListingCmd();
  112. bool InitConnect();
  113. #ifdef MPEXT
  114. bool IsRoutableAddress(const CString & host);
  115. bool CheckForcePasvIp(CString & host);
  116. void TransferFinished(bool preserveFileTimeForUploads);
  117. #endif
  118. CFile *m_pDataFile;
  119. CTransferSocket *m_pTransferSocket;
  120. CStringA m_MultiLine;
  121. CTime m_LastSendTime;
  122. CString m_ServerName;
  123. std::list<CStringA> m_RecvBuffer;
  124. CTime m_LastRecvTime;
  125. class CLogonData;
  126. class CListData;
  127. class CFileTransferData;
  128. class CMakeDirData;
  129. #ifndef MPEXT_NO_ZLIB
  130. bool m_useZlib;
  131. bool m_zlibSupported;
  132. int m_zlibLevel;
  133. #endif
  134. bool m_bUTF8;
  135. bool m_bAnnouncesUTF8;
  136. bool m_hasClntCmd;
  137. #ifdef MPEXT
  138. TFTPServerCapabilities m_serverCapabilities;
  139. CStringA m_ListFile;
  140. #endif
  141. bool m_isFileZilla;
  142. bool m_awaitsReply;
  143. bool m_skipReply;
  144. char* m_sendBuffer;
  145. int m_sendBufferLen;
  146. bool m_bProtP;
  147. bool m_mayBeMvsFilesystem;
  148. bool m_mayBeBS2000Filesystem;
  149. private:
  150. BOOL m_bCheckForTimeout;
  151. };
  152. /////////////////////////////////////////////////////////////////////////////
  153. //{{AFX_INSERT_LOCATION}}
  154. // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.
  155. #endif // AFX_FTPCONTROLSOCKET_H__AE6AA44E_B09D_487A_8EF2_A23697434945__INCLUDED_