TransferSocket.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //---------------------------------------------------------------------------
  2. #ifndef TransferSocketH
  3. #define TransferSocketH
  4. //---------------------------------------------------------------------------
  5. #include "FtpListResult.h"
  6. //---------------------------------------------------------------------------
  7. #include "FtpControlSocket.h"
  8. #include "ApiLog.h"
  9. //---------------------------------------------------------------------------
  10. class CFtpControlSocket;
  11. class CAsyncProxySocketLayer;
  12. class CAsyncSslSocketLayer;
  13. #ifndef MPEXT_NO_GSS
  14. class CAsyncGssSocketLayer;
  15. #endif
  16. //---------------------------------------------------------------------------
  17. class CTransferSocket : public CAsyncSocketEx, public CApiLog
  18. {
  19. public:
  20. CFtpListResult * m_pListResult;
  21. public:
  22. CTransferSocket(CFtpControlSocket * pOwner, int nMode);
  23. virtual ~CTransferSocket();
  24. public:
  25. int m_nInternalMessageID;
  26. virtual void Close();
  27. virtual BOOL Create(BOOL bUseSsl);
  28. BOOL m_bListening;
  29. CFile * m_pFile;
  30. TTransferOutEvent m_OnTransferOut;
  31. TTransferInEvent m_OnTransferIn;
  32. t_transferdata m_transferdata;
  33. __int64 m_uploaded;
  34. void SetActive();
  35. int CheckForTimeout(int delay);
  36. #ifndef MPEXT_NO_GSS
  37. void UseGSS(CAsyncGssSocketLayer * pGssLayer);
  38. #endif
  39. public:
  40. virtual void OnReceive(int nErrorCode);
  41. virtual void OnAccept(int nErrorCode);
  42. virtual void OnConnect(int nErrorCode);
  43. virtual void OnClose(int nErrorCode);
  44. virtual void OnSend(int nErrorCode);
  45. virtual void SetState(int nState);
  46. protected:
  47. virtual int OnLayerCallback(std::list<t_callbackMsg> & callbacks);
  48. int ReadDataFromFile(char * buffer, int len);
  49. int ReadData(char * buffer, int len);
  50. void WriteData(const char * buffer, int len);
  51. virtual void LogSocketMessageRaw(int nMessageType, LPCTSTR pMsg);
  52. virtual int GetSocketOptionVal(int OptionID) const;
  53. virtual void ConfigureSocket();
  54. bool Activate();
  55. void Start();
  56. CFtpControlSocket * m_pOwner;
  57. CAsyncProxySocketLayer * m_pProxyLayer;
  58. CAsyncSslSocketLayer * m_pSslLayer;
  59. #ifndef MPEXT_NO_GSS
  60. CAsyncGssSocketLayer * m_pGssLayer;
  61. #endif
  62. void UpdateStatusBar(bool forceUpdate);
  63. BOOL m_bSentClose;
  64. int m_bufferpos;
  65. char * m_pBuffer;
  66. BOOL m_bCheckTimeout;
  67. CTime m_LastActiveTime;
  68. int m_nTransferState;
  69. int m_nMode;
  70. int m_nNotifyWaiting;
  71. bool m_bActivationPending;
  72. void CloseAndEnsureSendClose(int Mode);
  73. void EnsureSendClose(int Mode);
  74. void CloseOnShutDownOrError(int Mode);
  75. void SetBuffers();
  76. _int64 GetTransferSize(CFtpControlSocket::transferDirection direction, bool & beenWaiting);
  77. LARGE_INTEGER m_LastUpdateTime;
  78. unsigned int m_LastSendBufferUpdate;
  79. DWORD m_SendBuf;
  80. };
  81. //---------------------------------------------------------------------------
  82. #endif // TransferSocketH