TransferSocket.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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_TRANSFERSOCKET_H__3F95A3A8_478E_45D4_BFD5_6102B42E12DA__INCLUDED_)
  15. #define AFX_TRANSFERSOCKET_H__3F95A3A8_478E_45D4_BFD5_6102B42E12DA__INCLUDED_
  16. #include "FtpListResult.h" // Hinzugefügt von der Klassenansicht
  17. #if _MSC_VER > 1000
  18. #pragma once
  19. #endif // _MSC_VER > 1000
  20. // TransferSocket.h : Header-Datei
  21. //
  22. /////////////////////////////////////////////////////////////////////////////
  23. // Befehlsziel CTransferSocket
  24. #include "controlsocket.h"
  25. #include "ApiLog.h"
  26. #ifndef MPEXT_NO_ZLIB
  27. #include <zlib.h>
  28. #endif
  29. class CFtpControlSocket;
  30. class CAsyncProxySocketLayer;
  31. #ifndef MPEXT_NO_SSL
  32. class CAsyncSslSocketLayer;
  33. #endif
  34. #ifndef MPEXT_NO_GSS
  35. class CAsyncGssSocketLayer;
  36. #endif
  37. #define SPEED_SECONDS 60
  38. class CTransferSocket : public CAsyncSocketEx, public CApiLog
  39. {
  40. // Attribute
  41. public:
  42. CFtpListResult *m_pListResult;
  43. // Operationen
  44. public:
  45. CTransferSocket(CFtpControlSocket *pOwner, int nMode);
  46. virtual ~CTransferSocket();
  47. // Überschreibungen
  48. public:
  49. int m_nInternalMessageID;
  50. virtual void Close();
  51. virtual BOOL Create(
  52. #ifndef MPEXT_NO_SSL
  53. BOOL bUseSsl
  54. #endif
  55. );
  56. BOOL m_bListening;
  57. CFile *m_pFile;
  58. t_transferdata m_transferdata;
  59. void SetActive();
  60. int CheckForTimeout(int delay);
  61. #ifndef MPEXT_NO_GSS
  62. void UseGSS(CAsyncGssSocketLayer *pGssLayer);
  63. #endif
  64. #ifndef MPEXT_NO_ZLIB
  65. bool InitZlib(int level);
  66. #endif
  67. // Vom Klassen-Assistenten generierte virtuelle Funktionsüberschreibungen
  68. //{{AFX_VIRTUAL(CTransferSocket)
  69. public:
  70. virtual void OnReceive(int nErrorCode);
  71. virtual void OnAccept(int nErrorCode);
  72. virtual void OnConnect(int nErrorCode);
  73. virtual void OnClose(int nErrorCode);
  74. virtual void OnSend(int nErrorCode);
  75. //}}AFX_VIRTUAL
  76. // Generierte Nachrichtenzuordnungsfunktionen
  77. //{{AFX_MSG(CTransferSocket)
  78. // HINWEIS - Der Klassen-Assistent fügt hier Member-Funktionen ein und entfernt diese.
  79. //}}AFX_MSG
  80. // Implementierung
  81. protected:
  82. virtual int OnLayerCallback(std::list<t_callbackMsg>& callbacks);
  83. int ReadDataFromFile(char *buffer, int len);
  84. virtual void LogSocketMessage(int nMessageType, LPCTSTR pMsgFormat);
  85. virtual void ConfigureSocket();
  86. CFtpControlSocket *m_pOwner;
  87. CAsyncProxySocketLayer* m_pProxyLayer;
  88. #ifndef MPEXT_NO_SSL
  89. CAsyncSslSocketLayer* m_pSslLayer;
  90. #endif
  91. #ifndef MPEXT_NO_GSS
  92. CAsyncGssSocketLayer* m_pGssLayer;
  93. #endif
  94. void UpdateRecvLed();
  95. void UpdateSendLed();
  96. void UpdateStatusBar(bool forceUpdate);
  97. BOOL m_bSentClose;
  98. int m_bufferpos;
  99. char *m_pBuffer;
  100. #ifndef MPEXT_NO_ZLIB
  101. char *m_pBuffer2; // Used by zlib transfers
  102. #endif
  103. BOOL m_bCheckTimeout;
  104. CTime m_LastActiveTime;
  105. BOOL m_bOK;
  106. CTime m_StartTime;
  107. BOOL m_nTransferState;
  108. int m_nMode;
  109. int m_nNotifyWaiting;
  110. BOOL m_bShutDown;
  111. void Transfered(int count, CTime time);
  112. void CloseAndEnsureSendClose(int Mode);
  113. void EnsureSendClose(int Mode);
  114. void CloseOnShutDownOrError(int Mode);
  115. void LogError(int Error);
  116. void SetBuffers();
  117. DWORD m_Transfered[SPEED_SECONDS];
  118. bool m_UsedForTransfer[SPEED_SECONDS];
  119. CTime m_TransferedFirst;
  120. LARGE_INTEGER m_LastUpdateTime;
  121. #ifndef MPEXT_NO_ZLIB
  122. z_stream m_zlibStream;
  123. bool m_useZlib;
  124. #endif
  125. };
  126. /////////////////////////////////////////////////////////////////////////////
  127. //{{AFX_INSERT_LOCATION}}
  128. // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.
  129. #endif // AFX_TRANSFERSOCKET_H__3F95A3A8_478E_45D4_BFD5_6102B42E12DA__INCLUDED_