netMain.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //netMain.h
  2. /////////////////////////////////////////////////////////////////////////////
  3. #ifndef _NET_MAIN_H_
  4. #define _NET_MAIN_H_
  5. /////////////////////////////////////////////////////////////////////////////
  6. /*/////////////////////////////////////////////////////////////////////////*/
  7. #if defined(__cplusplus)
  8. extern "C" {
  9. #endif
  10. /*/////////////////////////////////////////////////////////////////////////*/
  11. #include "data_def.h"
  12. /////////////////////////////////////////////////////////////////////////////
  13. #ifdef VC60
  14. #define MAX_HOSTNAME_LEN (256)
  15. #endif
  16. #define MAX_IPADDRESS_LEN (16)
  17. /////////////////////////////////////////////////////////////////////////////
  18. class CTransport;
  19. class CTransportImpl
  20. {
  21. public:
  22. CTransportImpl();
  23. virtual ~CTransportImpl();
  24. int net_Init();
  25. int net_UnInit();
  26. virtual SOCKET net_OpenSocket(IN ETransportType eType,
  27. IN unsigned short usPort,
  28. IN LPTRANSPORT_EVENT eventHandler,
  29. IN LPTRANSPORT_GETDATABUFLEN cbHandler,
  30. IN unsigned long ulHeaderLen,
  31. void *pContext);
  32. virtual void net_CloseSocket();
  33. virtual int net_Connect(IN unsigned long ulIPValue, IN unsigned short usPort);
  34. virtual unsigned long net_Send(IN SOCKET hSocket,
  35. IN void *pMessage,
  36. IN unsigned long ulDataLen);
  37. public:
  38. virtual unsigned long net_GetLocalHostIp(OUT char *pIpAddress, OUT char *pHostName);
  39. private:
  40. CTransport *m_ptTransport;
  41. };
  42. /*/////////////////////////////////////////////////////////////////////////*/
  43. #if defined(__cplusplus)
  44. }
  45. #endif
  46. /*/////////////////////////////////////////////////////////////////////////*/
  47. #endif /*_NET_MAIN_H_*/