ClientTunnel.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //ClientTunnel.h
  2. ///////////////////////////////////////////////////////////////////////////////
  3. #ifndef _CLIENT_TUNNEL_H_
  4. #define _CLIENT_TUNNEL_H_
  5. #ifdef VC60
  6. #if defined(__cplusplus)
  7. extern "C" {
  8. #endif //#if defined(__cplusplus)
  9. #include "netMain.h"
  10. #include "protocolhdr.h"
  11. #include "struct_def.h"
  12. class CClientTunnel : public CTransportImpl
  13. {
  14. public:
  15. CClientTunnel();
  16. virtual ~CClientTunnel();
  17. public:
  18. int net_OpenSocket(IN ETransportType eType,
  19. IN unsigned short usPort,
  20. IN LPTRANSPORT_EVENT eventHandler,
  21. void *pContext);
  22. void net_CloseSocket();
  23. int net_Connect(IN unsigned long ulIPValue, IN unsigned short usPort);
  24. unsigned long net_Send(IN void *pHeader,
  25. IN void *pMessage,
  26. IN unsigned long ulDataLen);
  27. public:
  28. LPTRANSPORT_EVENT m_eventHandler;
  29. void *m_pContext;
  30. private:
  31. SOCKET m_hSocket;
  32. };
  33. #if defined(__cplusplus)
  34. }
  35. #endif //#if defined(__cplusplus)
  36. #else
  37. //#include ".\NetWork\data_def.h"
  38. #include ".\include\IClientImpl.h"
  39. class CClientTunnel
  40. {
  41. public:
  42. CClientTunnel();
  43. virtual ~CClientTunnel();
  44. public:
  45. static TransportStatus Transport_Init();
  46. static TransportStatus Transport_UnInit();
  47. int net_OpenSocket(
  48. IN CONST ETransportType& eType,
  49. IN CONST unsigned short& usPort,
  50. IN LPTRANSPORT_EVENT eventHandler,
  51. void *pContext);
  52. void net_CloseSocket();
  53. int net_Connect(IN LPCTSTR strAddr, IN LPCTSTR strPort);
  54. int net_Connect(IN LPCTSTR strAddr, IN CONST DWORD& dwPort);
  55. unsigned long net_Send(
  56. IN void *pHeader,
  57. IN void *pMessage,
  58. IN CONST unsigned long& ulDataLen);
  59. public:
  60. LPTRANSPORT_EVENT m_eventHandler;
  61. void* m_pContext;
  62. private:
  63. INT m_nIndex;
  64. IClientImpl m_Client;
  65. };
  66. #endif //#ifdef VC60
  67. /*/////////////////////////////////////////////////////////////////////////*/
  68. #endif /*_CLIENT_TUNNEL_H_*/