epb_MmBp.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. // epb_MmBp.h
  2. // WeChat Embedded Proto Buffer
  3. //
  4. // Generated by harlliu@tencent.com on 14-11-26.
  5. // Copyright 2014 Tencent. All rights reserved.
  6. //
  7. // Version : 1.0.4
  8. #ifndef __EPB_MMBP_H__
  9. #define __EPB_MMBP_H__
  10. #include <stdint.h>
  11. #include <stdbool.h>
  12. #include "epb.h"
  13. typedef enum
  14. {
  15. ECI_none = 0,
  16. ECI_req_auth = 10001,
  17. ECI_req_sendData = 10002,
  18. ECI_req_init = 10003,
  19. ECI_resp_auth = 20001,
  20. ECI_resp_sendData = 20002,
  21. ECI_resp_init = 20003,
  22. ECI_push_recvData = 30001,
  23. ECI_push_switchView = 30002,
  24. ECI_push_switchBackgroud = 30003,
  25. ECI_err_decode = 29999
  26. } EmCmdId;
  27. typedef enum
  28. {
  29. EEC_system = -1,
  30. EEC_needAuth = -2,
  31. EEC_sessionTimeout = -3,
  32. EEC_decode = -4,
  33. EEC_deviceIsBlock = -5,
  34. EEC_serviceUnAvalibleInBackground = -6,
  35. EEC_deviceProtoVersionNeedUpdate = -7,
  36. EEC_phoneProtoVersionNeedUpdate = -8,
  37. EEC_maxReqInQueue = -9,
  38. EEC_userExitWxAccount = -10
  39. } EmErrorCode;
  40. typedef enum
  41. {
  42. EAM_md5 = 1,
  43. EAM_macNoEncrypt = 2
  44. } EmAuthMethod;
  45. typedef enum
  46. {
  47. EIRFF_userNickName = 0x1,
  48. EIRFF_platformType = 0x2,
  49. EIRFF_model = 0x4,
  50. EIRFF_os = 0x8,
  51. EIRFF_time = 0x10,
  52. EIRFF_timeZone = 0x20,
  53. EIRFF_timeString = 0x40
  54. } EmInitRespFieldFilter;
  55. typedef enum
  56. {
  57. EIS_deviceChat = 1,
  58. EIS_autoSync = 2
  59. } EmInitScence;
  60. typedef enum
  61. {
  62. EPT_ios = 1,
  63. EPT_andriod = 2,
  64. EPT_wp = 3,
  65. EPT_s60v3 = 4,
  66. EPT_s60v5 = 5,
  67. EPT_s40 = 6,
  68. EPT_bb = 7
  69. } EmPlatformType;
  70. typedef enum
  71. {
  72. EDDT_manufatureSvr = 0,
  73. EDDT_wxWristBand = 1,
  74. EDDT_wxDeviceHtmlChatView = 10001
  75. } EmDeviceDataType;
  76. typedef enum
  77. {
  78. ESVO_enter = 1,
  79. ESVO_exit = 2
  80. } EmSwitchViewOp;
  81. typedef enum
  82. {
  83. EVI_deviceChatView = 1,
  84. EVI_deviceChatHtmlView = 2
  85. } EmViewId;
  86. typedef enum
  87. {
  88. ESBO_enterBackground = 1,
  89. ESBO_enterForground = 2,
  90. ESBO_sleep = 3
  91. } EmSwitchBackgroundOp;
  92. typedef struct
  93. {
  94. void *none;
  95. } BaseRequest;
  96. typedef struct
  97. {
  98. int32_t err_code;
  99. bool has_err_msg;
  100. CString err_msg;
  101. } BaseResponse;
  102. typedef struct
  103. {
  104. void *none;
  105. } BasePush;
  106. typedef struct
  107. {
  108. BaseRequest *base_request;
  109. bool has_md5_device_type_and_device_id;
  110. Bytes md5_device_type_and_device_id;
  111. int32_t proto_version;
  112. int32_t auth_proto;
  113. EmAuthMethod auth_method;
  114. bool has_aes_sign;
  115. Bytes aes_sign;
  116. bool has_mac_address;
  117. Bytes mac_address;
  118. bool has_time_zone;
  119. String time_zone;
  120. bool has_language;
  121. String language;
  122. bool has_device_name;
  123. String device_name;
  124. } AuthRequest;
  125. typedef struct
  126. {
  127. BaseResponse *base_response;
  128. CBytes aes_session_key;
  129. } AuthResponse;
  130. typedef struct
  131. {
  132. BaseRequest *base_request;
  133. bool has_resp_field_filter;
  134. Bytes resp_field_filter;
  135. bool has_challenge;
  136. Bytes challenge;
  137. } InitRequest;
  138. typedef struct
  139. {
  140. BaseResponse *base_response;
  141. uint32_t user_id_high;
  142. uint32_t user_id_low;
  143. bool has_challeange_answer;
  144. uint32_t challeange_answer;
  145. bool has_init_scence;
  146. EmInitScence init_scence;
  147. bool has_auto_sync_max_duration_second;
  148. uint32_t auto_sync_max_duration_second;
  149. bool has_user_nick_name;
  150. CString user_nick_name;
  151. bool has_platform_type;
  152. EmPlatformType platform_type;
  153. bool has_model;
  154. CString model;
  155. bool has_os;
  156. CString os;
  157. bool has_time;
  158. int32_t time;
  159. bool has_time_zone;
  160. int32_t time_zone;
  161. bool has_time_string;
  162. CString time_string;
  163. } InitResponse;
  164. typedef struct
  165. {
  166. BaseRequest *base_request;
  167. Bytes data;
  168. bool has_type;
  169. EmDeviceDataType type;
  170. } SendDataRequest;
  171. typedef struct
  172. {
  173. BaseResponse *base_response;
  174. bool has_data;
  175. CBytes data;
  176. } SendDataResponse;
  177. typedef struct
  178. {
  179. BasePush *base_push;
  180. CBytes data;
  181. bool has_type;
  182. EmDeviceDataType type;
  183. } RecvDataPush;
  184. typedef struct
  185. {
  186. BasePush *base_push;
  187. EmSwitchViewOp switch_view_op;
  188. EmViewId view_id;
  189. } SwitchViewPush;
  190. typedef struct
  191. {
  192. BasePush *base_push;
  193. EmSwitchBackgroundOp switch_background_op;
  194. } SwitchBackgroudPush;
  195. BaseResponse *epb_unpack_base_response(const uint8_t *buf, int buf_len);
  196. void epb_unpack_base_response_free(BaseResponse *response);
  197. int epb_auth_request_pack_size(AuthRequest *request);
  198. int epb_pack_auth_request(AuthRequest *request, uint8_t *buf, int buf_len);
  199. AuthResponse *epb_unpack_auth_response(const uint8_t *buf, int buf_len);
  200. void epb_unpack_auth_response_free(AuthResponse *response);
  201. int epb_init_request_pack_size(InitRequest *request);
  202. int epb_pack_init_request(InitRequest *request, uint8_t *buf, int buf_len);
  203. InitResponse *epb_unpack_init_response(const uint8_t *buf, int buf_len);
  204. void epb_unpack_init_response_free(InitResponse *response);
  205. int epb_send_data_request_pack_size(SendDataRequest *request);
  206. int epb_pack_send_data_request(SendDataRequest *request, uint8_t *buf, int buf_len);
  207. SendDataResponse *epb_unpack_send_data_response(const uint8_t *buf, int buf_len);
  208. void epb_unpack_send_data_response_free(SendDataResponse *response);
  209. RecvDataPush *epb_unpack_recv_data_push(const uint8_t *buf, int buf_len);
  210. void epb_unpack_recv_data_push_free(RecvDataPush *push);
  211. SwitchViewPush *epb_unpack_switch_view_push(const uint8_t *buf, int buf_len);
  212. void epb_unpack_switch_view_push_free(SwitchViewPush *push);
  213. SwitchBackgroudPush *epb_unpack_switch_backgroud_push(const uint8_t *buf, int buf_len);
  214. void epb_unpack_switch_backgroud_push_free(SwitchBackgroudPush *push);
  215. #endif