MessageType.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. METHOD_SYSTEM_START = 0x2F0000,
  31. METHOD_SYSTEM_LOG_DEBUG,
  32. METHOD_SYSTEM_LOG_INFO,
  33. METHOD_SYSTEM_LOG_WARN,
  34. METHOD_SYSTEM_LOG_ERROR,
  35. METHOD_SYSTEM_DETAIL_LOG_DEBUG,
  36. METHOD_SYSTEM_DETAIL_LOG_INFO,
  37. METHOD_SYSTEM_DETAIL_LOG_WARN,
  38. METHOD_SYSTEM_DETAIL_LOG_ERROR,
  39. METHOD_SYSTEM_END = 0x2FFFFF,
  40. METHOD_BEIDOU_LOG = 0x3F0001,
  41. };
  42. #define PARAMLIST_HEAD "{e12a3dc0-3a0b-47c4-a8c3-75190a42ae68}"
  43. #define PKT_TYPE_CONTROL_LINKCONTEXT (1 << 31)
  44. typedef struct {
  45. char businessId[32]; //32
  46. char traceId[32]; //32
  47. char spanId[16]; //16
  48. char parentSpanId[16]; //16
  49. char timestamp[16]; //16
  50. int reservedControl;
  51. }link_context;
  52. std::string GetMessageTypeString(int messageType);
  53. #endif
  54. /* log detail
  55. MessageType include£ºMETHOD_SYSTEM_DETAIL_LOG_DEBUG(3080197), METHOD_SYSTEM_DETAIL_LOG_INFO, METHOD_SYSTEM_DETAIL_LOG_WARN, METHOD_SYSTEM_DETAIL_LOG_ERROR,
  56. {
  57. "messageType": 3080198,
  58. "EntityName": "postmanpostman",
  59. "ResultMsg": "for LogTest from postman",
  60. "LogType": "VTMWeb",
  61. "CostTime": 444,
  62. "ResultCode": "RTA444444",
  63. "LogCode": "ASDASSD",
  64. "API": "postman::test",
  65. "SourceType": "test.cpp",
  66. "BussID":"asdfafwerwqerqwerwerqwerwqerwerwqerwqerqwer",
  67. "TipMsg":"fjoawjerfownfojinwiqfneuiwnefionwfnewqionr",
  68. "BeginTime":123456,
  69. "EndTime":234567,
  70. "CmptId":"232323",
  71. "CmptName":"sldfoeofoefbo"
  72. }
  73. messageType must have
  74. EntityName must have, it mean your upload entityName
  75. ResultMsg must have, it means your log
  76. LogType Not necessarily needed, if it equals to User, means upload it as LOG_TYPE_USER, otherwise, upload as LOG_TYPE_SYSTEM
  77. CostTime Not necessarily needed, it means how much time used
  78. ResultCode Not necessarily needed, Commonly, filling it with error code.
  79. LogCode Not necessarily needed, Commonly, filling it such as QLR0402402Z00001
  80. API Not necessarily needed, current API which you are using
  81. SourceType Not necessarily needed, current file and line when the code is running
  82. BussID Not necessarily needed,like the beidou
  83. TipMsg Not necessarily needed,what the msg you desired to show when errors cause
  84. BegtinTime Not necessarily needed, begin Time
  85. EndTime Not necessarily needed, end Time
  86. CmptId Not necessarily needed
  87. CmptName Not necessarily needed
  88. httptest
  89. WS ws://99.12.43.134:9002
  90. {
  91. "messageType": 3080198,
  92. "EntityName": "postmanpostman",
  93. "ResultMsg": "for LogTest from postman",
  94. "LogType": "User",
  95. "CostTime": 444,
  96. "ResultCode": "RTA444444",
  97. "LogCode": "ASDASSD",
  98. "API": "postman::test",
  99. "SourceType": "test.cpp",
  100. "BussID":"asdfafwerwqerqwerwerqwerwqerwerwqerwqerqwer",
  101. "TipMsg":"fjoawjerfownfojinwiqfneuiwnefionwfnewqionr",
  102. "BeginTime":123456,
  103. "EndTime":234567
  104. }
  105. {{@streaming
  106. async function writeStream(){
  107. await sleep(3000);
  108. $requestClient.send({
  109. "event": "ping",
  110. "reqid": 45
  111. });
  112. await sleep(1000);
  113. }
  114. exports.waitPromise = writeStream();
  115. }}
  116. vtmweb
  117. WS ws://99.12.43.134:9002
  118. {
  119. "messageType": 3080198,
  120. "EntityName": "postmanpostman",
  121. "ResultMsg": "for LogTest from postman",
  122. "LogType": "VTMWeb",
  123. "CostTime": 444,
  124. "ResultCode": "RTA444444",
  125. "LogCode": "ASDASSD",
  126. "API": "postman::test",
  127. "SourceType": "test.cpp",
  128. "BussID":"asdfafwerwqerqwerwerqwerwqerwerwqerwqerqwer",
  129. "TipMsg":"fjoawjerfownfojinwiqfneuiwnefionwfnewqionr",
  130. "BeginTime":123456,
  131. "EndTime":234567,
  132. "CmptId":"232323",
  133. "CmptName":"sldfoeofoefbo"
  134. }
  135. {{@streaming
  136. async function writeStream(){
  137. await sleep(1000);
  138. $requestClient.send({
  139. "event": "ping",
  140. "reqid": 45
  141. });
  142. await sleep(1000);
  143. }
  144. exports.waitPromise = writeStream();
  145. }}
  146. */
  147. /*
  148. beidou
  149. [[tracing]]
  150. {
  151. "api": "testBeidouAPI",
  152. "businessId": "testBeidou",
  153. "callStack": [],
  154. "dbStack": [],
  155. "deployUnitId": "testBeidouPostdeployUnitId",
  156. "host": "vtmtlog.paas.cmbchina.cn:8080",
  157. "parentSpanId": "0",
  158. "responseTime": "0",
  159. "returnCode": "SUC0000",
  160. "serviceUnitId": "testBeidouserviceUintId",
  161. "spanId": "e11f264333564b54",
  162. "tags": {
  163. "TerminalNo": "7555980277"
  164. },
  165. "timestamp": "1722310468000",
  166. "traceId": "a2bcd4e10afc420b9e46a0b0030f7247"
  167. }
  168. [[tracing]]
  169. http_beidou
  170. WS ws://99.12.43.134:9002
  171. {
  172. "messageType": 4128769,
  173. "BusinessId": "testBeidou",
  174. "TraceId": "a2bcd4e10afc420b9e46a0b0030f7247",
  175. "SpanId": "e11f264333564b54",
  176. "ParentSpanId": "0",
  177. "Timestamp": "",
  178. "Host": "",
  179. "CallStack": "",
  180. "DbStack": "",
  181. "Tags":"",
  182. "API":"testBeidouAPI",
  183. "deployUnitId":"testBeidouPostdeployUnitId",
  184. "serviceUintId":"testBeidouserviceUintId"
  185. }
  186. {{@streaming
  187. async function writeStream(){
  188. await sleep(3000);
  189. $requestClient.send({
  190. "event": "ping",
  191. "reqid": 45
  192. });
  193. await sleep(1000);
  194. }
  195. exports.waitPromise = writeStream();
  196. }}
  197. */