sdc_common.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /***** (C) Copyright, Shenzhen SUNWIN Intelligent Co.,Ltd. ******source file****
  2. * File name : sdc_common.h
  3. * Author : ShengYin Li
  4. * Brief :
  5. ********************************************************************************
  6. * modify
  7. * Version Date Author Described
  8. * V1.00 2021/04/2 ShengYin Li Created
  9. *******************************************************************************/
  10. #pragma once
  11. #include <sys/socket.h>
  12. #include <netinet/in.h>
  13. #include <arpa/inet.h>
  14. #include <fcntl.h>
  15. #include <stdio.h>
  16. #include <errno.h>
  17. #include <iostream>
  18. #include <stdlib.h>
  19. #include <malloc.h>
  20. #include <sys/types.h>
  21. #include <sys/un.h>
  22. #include <sys/epoll.h>
  23. #include <sys/uio.h>
  24. #include <string.h>
  25. #include <unistd.h>
  26. // struct sdc_common_head
  27. // {
  28. // uint16_t version;
  29. // uint8_t url_ver;
  30. // #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)
  31. // #if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
  32. // uint8_t method: 7;
  33. // uint8_t response: 1;
  34. // #elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
  35. // uint8_t response: 1;
  36. // uint8_t method: 7;
  37. // #else
  38. // #error "unknown __BYTE_ORDER__"
  39. // #endif
  40. // #else
  41. // #error "don't define __BYTE_ORDER__ or __ORDER_LITTLE_ENDIAN__ or __ORDER_BIG_ENDIAN__"
  42. // #endif
  43. // uint16_t url;
  44. // uint16_t code;
  45. // uint16_t head_length;
  46. // uint16_t trans_id;
  47. // uint32_t content_length;
  48. // };
  49. #define SDC_VERSION 0x5331
  50. #define SDC_URL_HARDWARE_ID 100
  51. #define SDC_METHOD_CREATE 1
  52. #define SDC_METHOD_GET 2
  53. #define SDC_METHOD_UPDATE 3
  54. #define SDC_METHOD_DELETE 4
  55. #define SDC_CODE_200 200
  56. #define SDC_CODE_400 400
  57. #define SDC_CODE_401 401
  58. #define SDC_CODE_403 403
  59. #define SDC_CODE_500 500
  60. #define SDC_URL_TPROXY_SERVER 0x00
  61. #define SDC_URL_TPROXY_CONNECTION 0x01
  62. struct sdc_tproxy_server
  63. {
  64. int32_t domain;
  65. int32_t type;
  66. char addr[128];
  67. char filter[0];
  68. };
  69. struct sdc_tproxy_addr
  70. {
  71. int32_t domain;
  72. int32_t type;
  73. char addr[128];
  74. };
  75. /******** (C) Copyright, Shenzhen SUNWIN Intelligent Co.,Ltd. ******** End *****/