MessageType.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. #ifndef __MESSAGE_TYPE_H
  2. #define __MESSAGE_TYPE_H
  3. #pragma once
  4. #include <string>
  5. enum MessageType : int
  6. {
  7. Info = 0, //info message, no response
  8. BeginSession = 1, //start entity session
  9. EndSession = 2, //end entity session
  10. Request = 3, //call request
  11. RequestAck = 4, //request acknowledge
  12. SessionAck = 5, //start session acknowledge
  13. Register = 6, //register entity event
  14. Unregister = 7, //unregister entity event
  15. Event = 8, //event message
  16. LogEventMsgType = 9, //log event
  17. LogWarnMsgType = 10, //log warn
  18. SetVarReq = 11, //set sysvar request
  19. SetVarAck = 12, //set sysvar response
  20. GetVarReq = 13, //get sysvar request
  21. GetVarAck = 14, //get sysvar response
  22. Broadcast = 15, //broadcast msg to other entity
  23. GetSession = 16, //chromium session info
  24. // 0x00 00 00 00 - 0x00 00 FF FF for web to binary, communicate with other entity
  25. // 0x00 01 00 00 - 0x00 01 FF FF for web to chromium
  26. WEB_CHROMIUM_MSG_BEGIN = 0x00010000,
  27. RegisterNotify = 0x00010001, //web register Notify Msg
  28. UnRegisterNotify, //web unregister Notify
  29. WEB_CHROMIUM_MSG_END = 0x0001FFFF,
  30. WEB_SPECICAL_MANAGE_BEGIN = 0x00020000,
  31. WEB_GET_HTTP_HEADER,
  32. WEB_SPECICAL_MANAGE_END = 0x0002FFFF,
  33. METHOD_SYSTEM_START = 0x2F0000,
  34. METHOD_SYSTEM_LOG_DEBUG,
  35. METHOD_SYSTEM_LOG_INFO,
  36. METHOD_SYSTEM_LOG_WARN,
  37. METHOD_SYSTEM_LOG_ERROR,
  38. METHOD_SYSTEM_DETAIL_LOG_DEBUG,
  39. METHOD_SYSTEM_DETAIL_LOG_INFO,
  40. METHOD_SYSTEM_DETAIL_LOG_WARN,
  41. METHOD_SYSTEM_DETAIL_LOG_ERROR,
  42. METHOD_SYSTEM_END = 0x2FFFFF,
  43. METHOD_BEIDOU_LOG = 0x3F0001,
  44. };
  45. #define PARAMLIST_HEAD "{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}"
  46. #define PKT_TYPE_CONTROL_LINKCONTEXT (1 << 31)
  47. typedef struct {
  48. char businessId[32]; //32
  49. char traceId[32]; //32
  50. char spanId[16]; //16
  51. char parentSpanId[16]; //16
  52. char timestamp[16]; //16
  53. int reservedControl;
  54. }link_context;
  55. std::string GetMessageTypeString(int messageType);
  56. #endif
  57. /* log detail
  58. MessageType include£ºMETHOD_SYSTEM_DETAIL_LOG_DEBUG(3080197), METHOD_SYSTEM_DETAIL_LOG_INFO, METHOD_SYSTEM_DETAIL_LOG_WARN, METHOD_SYSTEM_DETAIL_LOG_ERROR,
  59. {
  60. "messageType": 3080198,
  61. "EntityName": "postmanpostman",
  62. "ResultMsg": "for LogTest from postman",
  63. "LogType": "VTMWeb",
  64. "CostTime": 444,
  65. "ResultCode": "RTA444444",
  66. "LogCode": "ASDASSD",
  67. "API": "postman::test",
  68. "SourceType": "test.cpp",
  69. "BussID":"asdfafwerwqerqwerwerqwerwqerwerwqerwqerqwer",
  70. "TipMsg":"fjoawjerfownfojinwiqfneuiwnefionwfnewqionr",
  71. "BeginTime":123456,
  72. "EndTime":234567,
  73. "CmptId":"232323",
  74. "CmptName":"sldfoeofoefbo"
  75. }
  76. messageType must have
  77. EntityName must have, it mean your upload entityName
  78. ResultMsg must have, it means your log
  79. LogType Not necessarily needed, if it equals to User, means upload it as LOG_TYPE_USER, otherwise, upload as LOG_TYPE_SYSTEM
  80. CostTime Not necessarily needed, it means how much time used
  81. ResultCode Not necessarily needed, Commonly, filling it with error code.
  82. LogCode Not necessarily needed, Commonly, filling it such as QLR0402402Z00001
  83. API Not necessarily needed, current API which you are using
  84. SourceType Not necessarily needed, current file and line when the code is running
  85. BussID Not necessarily needed,like the beidou
  86. TipMsg Not necessarily needed,what the msg you desired to show when errors cause
  87. BegtinTime Not necessarily needed, begin Time
  88. EndTime Not necessarily needed, end Time
  89. CmptId Not necessarily needed
  90. CmptName Not necessarily needed
  91. httptest
  92. WS ws://99.12.43.134:9002
  93. {
  94. "messageType": 3080198,
  95. "EntityName": "postmanpostman",
  96. "ResultMsg": "for LogTest from postman",
  97. "LogType": "User",
  98. "CostTime": 444,
  99. "ResultCode": "RTA444444",
  100. "LogCode": "ASDASSD",
  101. "API": "postman::test",
  102. "SourceType": "test.cpp",
  103. "BussID":"asdfafwerwqerqwerwerqwerwqerwerwqerwqerqwer",
  104. "TipMsg":"fjoawjerfownfojinwiqfneuiwnefionwfnewqionr",
  105. "BeginTime":123456,
  106. "EndTime":234567
  107. }
  108. {{@streaming
  109. async function writeStream(){
  110. await sleep(3000);
  111. $requestClient.send({
  112. "event": "ping",
  113. "reqid": 45
  114. });
  115. await sleep(1000);
  116. }
  117. exports.waitPromise = writeStream();
  118. }}
  119. vtmweb
  120. WS ws://99.12.43.134:9002
  121. {
  122. "messageType": 3080198,
  123. "EntityName": "postmanpostman",
  124. "ResultMsg": "for LogTest from postman",
  125. "LogType": "VTMWeb",
  126. "CostTime": 444,
  127. "ResultCode": "RTA444444",
  128. "LogCode": "ASDASSD",
  129. "API": "postman::test",
  130. "SourceType": "test.cpp",
  131. "BussID":"asdfafwerwqerqwerwerqwerwqerwerwqerwqerqwer",
  132. "TipMsg":"fjoawjerfownfojinwiqfneuiwnefionwfnewqionr",
  133. "BeginTime":123456,
  134. "EndTime":234567,
  135. "CmptId":"232323",
  136. "CmptName":"sldfoeofoefbo"
  137. }
  138. {{@streaming
  139. async function writeStream(){
  140. await sleep(1000);
  141. $requestClient.send({
  142. "event": "ping",
  143. "reqid": 45
  144. });
  145. await sleep(1000);
  146. }
  147. exports.waitPromise = writeStream();
  148. }}
  149. */
  150. /*
  151. beidou
  152. [[tracing]]
  153. {
  154. "api": "testBeidouAPI",
  155. "businessId": "testBeidou",
  156. "callStack": [],
  157. "dbStack": [],
  158. "deployUnitId": "testBeidouPostdeployUnitId",
  159. "host": "vtmtlog.paas.cmbchina.cn:8080",
  160. "parentSpanId": "0",
  161. "responseTime": "0",
  162. "returnCode": "SUC0000",
  163. "serviceUnitId": "testBeidouserviceUintId",
  164. "spanId": "e11f264333564b54",
  165. "tags": {
  166. "TerminalNo": "7555980277"
  167. },
  168. "timestamp": "1722310468000",
  169. "traceId": "a2bcd4e10afc420b9e46a0b0030f7247"
  170. }
  171. [[tracing]]
  172. http_beidou
  173. WS ws://99.12.43.134:9002
  174. {
  175. "messageType": 4128769,
  176. "BusinessId": "testBeidou",
  177. "TraceId": "a2bcd4e10afc420b9e46a0b0030f7247",
  178. "SpanId": "e11f264333564b54",
  179. "ParentSpanId": "0",
  180. "Timestamp": "",
  181. "Host": "",
  182. "CallStack": "",
  183. "DbStack": "",
  184. "Tags":"",
  185. "API":"testBeidouAPI",
  186. "deployUnitId":"testBeidouPostdeployUnitId",
  187. "serviceUintId":"testBeidouserviceUintId"
  188. }
  189. {{@streaming
  190. async function writeStream(){
  191. await sleep(3000);
  192. $requestClient.send({
  193. "event": "ping",
  194. "reqid": 45
  195. });
  196. await sleep(1000);
  197. }
  198. exports.waitPromise = writeStream();
  199. }}
  200. */