TyphoonServer.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef __TYPHOON_SERVER_H__
  2. #define __TYPHOON_SERVER_H__
  3. #include "stdint.h"
  4. #include "TyphoonProduct.h"
  5. #ifdef __cplusplus
  6. extern "C"
  7. {
  8. #endif
  9. #ifdef _WIN32
  10. #ifdef TYPHOON_SOCKS_DLL_IMPLEMENT
  11. #define TYPHOON_SERVER_EXTERN __declspec(dllexport)
  12. #else
  13. #define TYPHOON_SERVER_EXTERN __declspec(dllimport)
  14. #endif
  15. #define TYPHOON_STDCALL __stdcall
  16. #else
  17. #define TYPHOON_SERVER_EXTERN /* nothing */
  18. #define TYPHOON_STDCALL
  19. #endif
  20. typedef void (TYPHOON_STDCALL *TyphoonServerProxy_OnConnected)(void *pHandle, const char *userData, int userDataLen);
  21. typedef void (TYPHOON_STDCALL *TyphoonServerProxy_OnDisConnected)(void *pHandle);
  22. typedef struct TyphoonServerProxyConnectionStatusCb
  23. {
  24. TyphoonServerProxy_OnConnected pfnOnConnected;
  25. TyphoonServerProxy_OnDisConnected pfnOnDisConnected;
  26. }stTyphoonServerProxyConnectionStatusCb;
  27. struct InitServerPrama{
  28. char* listenAddr;
  29. uint32_t listenPort;
  30. uint32_t minSpeed;
  31. uint32_t maxSpeed;
  32. int logId;
  33. char *logPath;
  34. char *licensePath;
  35. char* caPath;
  36. TyphoonAppId_E licenseType;
  37. char* license;
  38. bool bUdpGSO;
  39. int32_t MaxSegmentSize;
  40. bool bSdnOn;
  41. void *rootsData;
  42. int rootsDataLen;
  43. int FecPercent;
  44. bool bCompress;
  45. };
  46. /*
  47. * 初始化代理服务器
  48. * 参数:
  49. * param:输入参数结构体
  50. * 返回值:
  51. * 0成功,非0失败
  52. */
  53. TYPHOON_SERVER_EXTERN int TyphoonProxy_InitServer(struct InitServerPrama *param);
  54. /*
  55. * 去初始化代理服务器
  56. * 参数:
  57. * 无
  58. * 返回值:
  59. * 0成功,非0失败
  60. */
  61. TYPHOON_SERVER_EXTERN int TyphoonProxy_UninitServer();
  62. TYPHOON_SERVER_EXTERN uint64_t TyphoonProxy_GetNodeId();
  63. TYPHOON_SERVER_EXTERN void * TyphoonProxy_GetServerInstance();
  64. TYPHOON_SERVER_EXTERN void TyphoonProxy_writeLog(const char * fileName,
  65. const char * funcName,
  66. unsigned int line,
  67. unsigned int level,
  68. const char * format,
  69. ...);
  70. TYPHOON_SERVER_EXTERN int TyphoonProxy_RestartSdnRoot(void *rootsData, int rootsDataLen);
  71. TYPHOON_SERVER_EXTERN int TyphoonProxy_CheckSdnIsOnline();
  72. TYPHOON_SERVER_EXTERN void TyphoonServerProxy_SetConnectionStatusCb(stTyphoonServerProxyConnectionStatusCb Cb);
  73. TYPHOON_SERVER_EXTERN stTyphoonServerProxyConnectionStatusCb TyphoonServerProxy_GetConnectionStatusCb();
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif