FtpControlSocket.h 5.2 KB

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