FtpControlSocket.h 5.6 KB

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