message.proto 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. // Licensed to the Apache Software Foundation (ASF) under one
  2. // or more contributor license agreements. See the NOTICE file
  3. // distributed with this work for additional information
  4. // regarding copyright ownership. The ASF licenses this file
  5. // to you under the Apache License, Version 2.0 (the
  6. // "License"); you may not use this file except in compliance
  7. // with the License. You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing,
  12. // software distributed under the License is distributed on an
  13. // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. // KIND, either express or implied. See the License for the
  15. // specific language governing permissions and limitations
  16. // under the License.
  17. syntax="proto2";
  18. package gss.message;
  19. //------------------------------------gss_src_req_t---------------------------------
  20. //struct gss_src_req_t
  21. //{
  22. // string TransQuery[] = optional(); /**< transquery from da tranfered by us */
  23. // int32_t ExtType[] = optional(); /**< 扩展query类型 */
  24. // int32_t SrcID = optional(); /**< table id */
  25. // int32_t SrcId = optional(); /**< table id */
  26. // int32_t Pos = optional(); /**< pos */
  27. // int32_t Place = optional(); /**< place */
  28. // int32_t Degree = optional(); /**< degree */
  29. // string Key = optional(),default(""); /**< us建议key */
  30. // string ReqKey = optional(),default(""); /**< us建议 ReqKey */
  31. // int32_t QueryType = optional(),default(0); /**< 类型,default=0 */
  32. // binary HighLight = optional(),default(""); /**< da飘红词 */
  33. // string RetFormat = optional(),default("html"); /**< 回传格式 */
  34. // string TagFilter = optional(),default(""); /**< Tag过滤信息 */
  35. // //SPEC REQ
  36. // int32_t SpReqType = optional(),default(0); /**< 特殊请求类型,正常为0 */
  37. // //FRO ZHIXIN USE
  38. // string UriKey = optional(); /**< UriKey 知心卡片使用 */
  39. // string EntityName = optional(); /**< 实体名 知心卡片使用 */
  40. //};
  41. message gss_src_req_t {
  42. repeated string TransQuery = 1; /**< transquery from da tranfered by us */
  43. repeated int32 ExtType = 2; /**< 扩展query类型 */
  44. optional int32 SrcID = 3; /**< table id */
  45. //optional int32 SrcId = 4; /**< table id */
  46. optional int32 Pos = 5; /**< pos */
  47. optional int32 Place = 6; /**< place */
  48. optional int32 Degree = 7; /**< degree */
  49. optional string Key = 8; /**< us建议key */
  50. optional string ReqKey = 9; /**< us建议 ReqKey */
  51. optional int32 QueryType = 10; /**< 类型,default=0 */
  52. optional bytes HighLight = 11; /**< da飘红词 */
  53. optional string RetFormat = 12 [default ="html"]; /**< 回传格式 */
  54. optional string TagFilter = 13; /**< Tag过滤信息 */
  55. //SPEC REQ
  56. optional int32 SpReqType = 14; /**< 特殊请求类型,正常为0 */
  57. //FRO ZHIXIN USE
  58. optional string UriKey = 15; /**< UriKey 知心卡片使用 */
  59. optional string EntityName = 16; /**< 实体名 知心卡片使用 */
  60. };
  61. //------------------------------------终端 ua 信息:us_gss_req_t---------------------------------
  62. //struct ua_info_t
  63. //{
  64. // string ua_os = optional(); /**< 操作系统 */
  65. // string ua_browser = optional(); /**< 浏览器 */
  66. // string ua_modal = optional(); /**< 机型 */
  67. // string ua_measure = optional(); /**< 尺寸 */
  68. // int32_t ua_res_x = optional(); /**< 分辨率宽 */
  69. // int32_t ua_res_y = optional(); /**< 分辨率高 */
  70. // binary ua_ext = optional(); /**< 扩展(预计会放操作系统版本os_version、浏览器版本browser_version)*/
  71. //};
  72. message ua_info_t {
  73. optional string ua_os = 1; /**< 操作系统 */
  74. optional string ua_browser = 2; /**< 浏览器 */
  75. optional string ua_modal = 3; /**< 机型 */
  76. optional string ua_measure = 4; /**< 尺寸 */
  77. optional int32 ua_res_x = 5; /**< 分辨率宽 */
  78. optional int32 ua_res_y = 6; /**< 分辨率高 */
  79. optional bytes ua_ext = 7; /**< 扩展(预计会放操作系统版本os_version、浏览器版本browser_version)*/
  80. };
  81. //------------------------------------app_info_t------------------------------------------------
  82. //struct app_info_t
  83. //{
  84. // string package; /*应用的packagename*/
  85. // int32_t version; /*应用的version code*/
  86. // uint32_t signmd5; /*包体签名*/
  87. //};
  88. message app_info_t {
  89. required string package = 1; /*应用的packagename*/
  90. required int32 version = 2; /*应用的version code*/
  91. required uint32 signmd5 = 3; /*包体签名*/
  92. }
  93. //------------------------------------us请求gss结构体:us_gss_req_t---------------------------------
  94. //struct us_gss_req_t
  95. //{
  96. // string OriginQuery; /**< 原始query */
  97. // int32_t UserIP; /**< 用户IP */
  98. // int32_t TimingNeed; /**< 时效性查询 */
  99. // uint64_t QueryID64 = optional(),default(0); /**< QueryID */
  100. // string ClientName = optional(),default("unknow"); /**< 调用方名称 */
  101. // int32_t ResNum = range(0,2000),default(20),optional(); /**< 翻页参数,当页结果数 */
  102. // int32_t PageNum = range(0,2000),default(0),optional(); /**< 翻页参数,结果偏移量 */
  103. // int32_t ctpl_or_php = optional(),default(0),range(0,1); /**< 是否smarty渲染 */
  104. // int32_t SeType = optional(),default(0); /**< 请求类型 0:US, 1:US_MID, 2:UI */
  105. // //int32_t KeepAlive; /**< 保持连接 */
  106. // string TemplateName; /**< 模版名 ex. baidu wisexmlnew */
  107. // int32_t sid[] = optional(); /**< 抽样id */
  108. // binary UrlParaPack = optional(); /**< Uri参数包 */
  109. // binary gssqa = optional(); /**< 经us透传的DA分析结果 */
  110. // string Cookie = optional(),default(""); /**< 用户cookie */
  111. // string province_name = optional(); /**< 省份信息 */
  112. // string city_name = optional(); /**< 城市信息 */
  113. // string isp_name = optional(); /**< 运营商信息 */
  114. // uint32_t SrcNum; /**< 请求table数量 */
  115. // string From = optional(),default("www"); /**< 请求来源 */
  116. // string Fmt = optional(),default("html"); /**< 请求格式 */
  117. // binary HighLight = optional(),default(""); /**< da飘红词 */
  118. // int32_t NeedHilightStr = optional(),default(0); /**< 是否回传飘红词 */
  119. // gss_src_req_t SrcArr[] = optional(); /**< table请求信息 */
  120. // //国际化新增参数
  121. // int64_t resultLang = optional(); /**< 用户需要的结果语言设置 */
  122. // int64_t resultLocale = optional(); /**< 用户需要的结果地域 */
  123. // //终端app 信息
  124. // app_info_t AppInfoArr[] = optional(); /**< 用户安装的app信息*/
  125. // //终端ua 信息
  126. // ua_info_t uaInfo = optional(); /**< 请求的终端信息 */
  127. // string useragent_full = optional(); /**< 请求的终端全部信息 */
  128. // //百度账号信息
  129. // int32_t uid = optional();
  130. // string uname = optional();
  131. // int32_t open_gssda_recall = optional();
  132. // int32_t prefetch_flag = optional(); /**< 针对wise-us。值为1表示预取请求,值为0表示正常检索请求 */
  133. //};
  134. // pb for us_gss_req_t:
  135. message us_gss_req_t {
  136. required string OriginQuery = 1; /**< 原始query */
  137. required int32 UserIP = 2; /**< 用户IP */
  138. required int32 TimingNeed = 3; /**< 时效性查询 */
  139. optional uint64 QueryID64 = 4 [default = 0]; /**< QueryID */
  140. optional string ClientName = 5 [default = "unknow"]; /**< 调用方名称 */
  141. //reserved 6 - 10
  142. optional int32 ResNum = 11 [default = 20]; /**< 翻页参数,当页结果数 */
  143. optional int32 PageNum = 12 [default = 0]; /**< 翻页参数,结果偏移量 */
  144. optional int32 ctpl_or_php = 13 [default = 0]; /**< 是否smarty渲染 */
  145. optional int32 SeType = 14 [default = 0]; /**< 请求类型 0:US, 1:US_MID, 2:UI */
  146. //int32_t KeepAlive; /**< 保持连接 */
  147. required string TemplateName = 15; /**< 模版名 ex. baidu wisexmlnew */
  148. repeated int32 sid = 16; /**< 抽样id */
  149. optional bytes UrlParaPack = 17; /**< Uri参数包*/
  150. optional bytes gssqa = 18; /**< 经us透传的DA分析结果 */
  151. optional string Cookie = 19; /**< 用户cookie */
  152. //reserved 20 - 30
  153. optional string province_name = 31; /**< 省份信息 */
  154. optional string city_name = 32; /**< 城市信息 */
  155. optional string isp_name = 33; /**< 运营商信息 */
  156. required uint32 SrcNum = 34; /**< 请求table数量 */
  157. optional string From = 35 [default = "www"]; /**< 请求来源 */
  158. optional string Fmt = 36 [default = "html"]; /**< 请求格式 */
  159. optional bytes HighLight = 37; /**< da飘红词 */
  160. optional int32 NeedHilightStr = 38 [default = 0]; /**< 是否回传飘红词 */
  161. repeated gss_src_req_t SrcArr = 39; /**< table请求信息 */
  162. //国际化新增参数
  163. optional int64 resultLang = 40; /**< 用户需要的结果语言设置 */
  164. optional int64 resultLocale = 41; /**< 用户需要的结果地域 */
  165. //终端app 信息
  166. repeated app_info_t AppInfoArr = 42; /**< 用户安装的app信息*/
  167. //终端ua 信息
  168. optional ua_info_t uaInfo = 43; /**< 请求的终端信息 */
  169. optional string useragent_full = 44; /**< 请求的终端全部信息 */
  170. //百度账号信息
  171. optional int32 uid = 45;
  172. optional string uname = 46;
  173. optional int32 open_gssda_recall = 47;
  174. optional int32 prefetch_flag = 48; /**< 针对wise-us。值为1表示预取请求,值为0表示正常检索请求*/
  175. //reserved 50 - 70
  176. //added by new gss:
  177. //for service distribution:
  178. optional string service_name = 71;
  179. //for normalized caller:
  180. optional string caller = 72;
  181. //for parsing UrlParaPack:
  182. optional UserAgent user_agent = 73;
  183. };
  184. /** uri相关请求参数, gss代码中定义的结构体: */
  185. //struct uri_req_t {
  186. // unsigned int uri_len; /**< uri长度 */
  187. // char uri[US2GSS_MAX_URI_LEN]; /**< uribuffer */
  188. // u_int uri_sign[2]; /**< 对uri的签名 */
  189. // char dsp[GSS_GEN_STR_LEN]; /**< dsp参数 */
  190. // npoint_t crd; /**< 用户百度地图墨卡托坐标 for lbs */
  191. // char os[GSS_GEN_STR_LEN]; /**< os操作系统参数 */
  192. // char osv[GSS_GEN_STR_LEN]; /**< osv操作系统版本参数 */
  193. // char mb[GSS_GEN_STR_LEN]; /**< mb浏览器参数 */
  194. // char mbv[GSS_GEN_STR_LEN]; /**< mbv浏览器版本参数*/
  195. // int apn; /**< opendata api的co参数中传递的翻页信息类似大搜索的pn */
  196. // int arn; /**< opendata api的co参数中传递的翻页信息类似大搜索的rn */
  197. // char cuid[GSS_GEN_STR_LEN]; /**< 移动用户唯一标识*/
  198. // char net_type[GSS_GEN_STR_LEN]; /**< 移动网络类型,0=>unknown,1=>wifi, 2=>2G, 3=>3G*/
  199. // int ignore_caller_auth; /**< 忽略调用方认证 */
  200. //};
  201. // 对应uri_req_t中的部分信息:
  202. message UserAgent {
  203. optional string dsp = 1; /**< dsp参数 */
  204. optional string os = 2; /**< os操作系统参数 */
  205. optional string osv = 3; /**< osv操作系统版本参数 */
  206. optional string mb = 4; /**< mb浏览器参数 */
  207. optional string mbv = 5; /**< mbv浏览器版本参数*/
  208. optional int32 apn = 6; /**< opendata api的co参数中传递的翻页信息类似大搜索的pn */
  209. optional int32 arn = 7; /**< opendata api的co参数中传递的翻页信息类似大搜索的rn */
  210. optional string cuid = 8; /**< 移动用户唯一标识*/
  211. optional string net_type = 9; /**< 移动网络类型,0=>unknown,1=>wifi, 2=>2G, 3=>3G*/
  212. };
  213. //------------------------------------gss给us子链接结构体: sub_url_t---------------------------------
  214. //struct sub_url_t
  215. //{
  216. // string SubURL; /**< sub url */
  217. // string SubURI = optional(); /**< sub uri */
  218. // string SubName = optional();
  219. // string SubPath = optional();
  220. // int32_t SiteId = optional(); /**< 子链接site id */
  221. // string SubEx = optional(); /**< extend */
  222. //};
  223. message sub_url_t {
  224. required string SubURL = 1; /**< sub url */
  225. optional string SubURI = 2; /**< sub uri */
  226. optional string SubName = 3;
  227. optional string SubPath = 4;
  228. optional int32 SiteId = 5; /**< 子链接site id */
  229. optional string SubEx = 6; /**< extend */
  230. };
  231. //------------------------------------gss单个结果结构体:gss_res_t---------------------------------
  232. //struct gss_res_t
  233. //{
  234. // string ResultURL; /**< 结果URL */
  235. // string Display = optional(),default(""); /**< 展现结果 */
  236. // int32_t Weight; /**< 权重 */
  237. // int32_t Sort = optional(); /**< 插入位置 */
  238. // int32_t SrcID = optional(); /**< id */
  239. // int32_t TimingNeed; /**< 时效性 */
  240. // uint32_t WiseStrategyFlag = optional(); /**< wise策略bitmap */
  241. // int32_t Degree = optional(); /**< 需求强度 */
  242. // int32_t ClickNeed = optional(); /**< 点击调权 */
  243. // int32_t StrategyInfo = optional(); /**< 策略附加信息 */
  244. // //SPEC REQ
  245. // int32_t SpReqType = optional(); /**< 特殊请求类型,正常为0 */
  246. // //FRO ZHIXIN USE
  247. // string UriKey = optional(); /**< UriKey 知心卡片使用 */
  248. // string EntityName = optional(); /**< 实体名 知心卡片使用 */
  249. // sub_url_t SubResult[50]; /**< 50条子链接 */
  250. // int32_t SubResNum = optional(),default(0); /**< 子链接 */
  251. // string DisplayLog = optional(); /**< 展现日志 */
  252. // binary DisplayData = optional(); /**< 特型展现数据 */
  253. // uint32_t ResType = optional(); /**< 资源是否带图*/
  254. // string Title = optional(); /**< 右侧去重名称*/
  255. // int32_t RecoverCacheTime = optional(); /**< us容灾cache,过滤不进人容灾的资源*/
  256. //};
  257. message gss_res_t {
  258. // pb for gss_res_t:
  259. required string ResultURL = 2; /**< 结果URL */
  260. optional string Display = 3; /**< 展现结果 */
  261. required int32 Weight = 4; /**< 权重 */
  262. optional int32 Sort = 5; /**< 插入位置 */
  263. optional int32 SrcID = 6; /**< id */
  264. required int32 TimingNeed = 7; /**< 时效性 */
  265. optional uint32 WiseStrategyFlag = 8; /**< wise策略bitmap */
  266. optional int32 Degree = 9; /**< 需求强度 */
  267. optional int32 ClickNeed = 10; /**< 点击调权 */
  268. optional int32 StrategyInfo = 11; /**< 策略附加信息 */
  269. //SPEC REQ
  270. optional int32 SpReqType = 12; /**< 特殊请求类型,正常为0 */
  271. //FRO ZHIXIN USE
  272. optional string UriKey = 13; /**< UriKey 知心卡片使用 */
  273. optional string EntityName = 14; /**< 实体名 知心卡片使用 */
  274. repeated sub_url_t SubResult = 15; /**< 50条子链接 */
  275. optional int32 SubResNum = 16; /**< 子链接 */
  276. optional string DisplayLog = 17; /**< 展现日志 */
  277. optional bytes DisplayData = 18; /**< 特型展现数据 */
  278. optional uint32 ResType = 19; /**< 资源是否带图*/
  279. optional string Title = 20; /**< 右侧去重名称*/
  280. optional int32 RecoverCacheTime = 21; /**< us容灾cache,过滤不进人容灾的资源*/
  281. //customized result messages:
  282. };
  283. //------------------------------------debug_info_t---------------------------------
  284. //struct item_t
  285. //{
  286. // string title;
  287. // string content;
  288. // int32_t parent;
  289. //};
  290. //struct strategy_bits_t
  291. //{
  292. // uint32_t bits[STRATEGY_INT_NUM];
  293. //};
  294. //struct debug_info_t
  295. //{
  296. // ///废弃, 使用idebug代替
  297. // item_t debug_info[] = optional();
  298. // string item_info[] = optional();
  299. // string anchor_info[] = optional();
  300. // ///通过ivar 发送的全部debug信息, 取代原debug_info
  301. // binary idebug = optional();
  302. //};
  303. message item_t {
  304. required string title = 1;
  305. required string content = 2;
  306. required int32 parent = 3;
  307. };
  308. message debug_info_t {
  309. optional bytes idebug = 1;
  310. repeated string item_info = 2;
  311. repeated string anchor_info = 3;
  312. ///废弃, 使用idebug代替
  313. repeated item_t debug_info = 4 [deprecated=true];
  314. };
  315. //------------------------------------gss_us_res_t---------------------------------
  316. // gss返回给us结构体
  317. //struct gss_us_res_t
  318. //{
  319. // int32_t ResultCode; /**< 返回状态码 */
  320. // uint64_t QueryID; /**< query id */
  321. // //集群合并后,加大最大返回结果包大小
  322. // gss_res_t Result[40]; /**< 返回结果 */
  323. // uint32_t ResultNum = range(0,40); /**< 返回结果数 */
  324. // debug_info_t info = optional(); /**< debug info */
  325. // int32_t bfe_cached_time = optional(); /**< cache失效时间 */
  326. // int32_t bfe_cached_islocate = optional(); /**< 是否有地域扩展 */
  327. // binary disp_data_url_ex = optional(); /**< 展现日志中url级别信息 */
  328. // binary disp_data_query_ex = optional(); /**< 展现日志中query级别信息 */
  329. //};
  330. // pb for gss_us_res_t:
  331. message gss_us_res_t {
  332. required int32 ResultCode = 1; /**< 返回状态码 */
  333. required uint64 QueryID = 2; /**< query id */
  334. //集群合并后,加大最大返回结果包大小
  335. repeated gss_res_t Result = 3; /**< 返回结果 */
  336. required uint32 ResultNum = 4; /**< 返回结果数 */
  337. optional debug_info_t info = 5; /**< debug info */
  338. optional int32 bfe_cached_time = 6; /**< cache失效时间 */
  339. optional int32 bfe_cached_islocate = 7; /**< 是否有地域扩展 */
  340. optional bytes disp_data_url_ex = 8; /**< 展现日志中url级别信息 */
  341. optional bytes disp_data_query_ex = 9; /**< 展现日志中query级别信息 */
  342. optional string name = 20; /* response name*/
  343. };