protobuf类进行嵌套时,协议描述如下:
/* 客户端拉取消息请求包 */
message Secret_Get_Req
{
required uint32 version = 1;
repeated Secret_Msg_Req msg_req_list = 2;
}
/* 消息请求包封装 */
message Secret_Msg_Req
{
optional string userid = 1; /* 请求者userid */
optional uint32 msg_beg = 2; /* 消息拉取的起始时间,unix时间戳 */
optional uint32 msg_end = 3; /* 消息拉取的终止时间,unix时间戳 */
}
1、进行打包时的操作如下:
Secret_Get_Req stGetReq;
stGetReq.set_version(1);
Secret_Msg_Req *pMsgReq &#