tinyrpc/includes/net/tinypb/tinypb_data.hpp

31 lines
1.4 KiB
C++
Raw Permalink Normal View History

2025-01-21 16:35:26 +08:00
#pragma once
#include "abstract_coder.hpp"
#include <cstdint>
#include <string>
namespace tinyrpc {
struct TinypbData : public AbstractData {
TinypbData() {};
~TinypbData() {};
// char start = 0x02; // indentify start of a TinyPb protocal data
int32_t pk_len {0}; // len of all package(include start char and end char)
int32_t msg_req_len {0}; // len of msg_req
std::string msg_req; // msg_req, which identify a request
int32_t service_name_len {0}; // len of service full name
std::string service_full_name; // service full name, like QueryService.query_name
int32_t err_code {0}; // err_code, 0 -- call rpc success, otherwise -- call rpc failed. it only be seted by RpcController
int32_t err_info_len {0}; // len of err_info
std::string err_info; // err_info, empty -- call rpc success, otherwise -- call rpc failed, it will display details of reason why call rpc failed. it only be seted by RpcController
std::string pb_data; // business pb data
int32_t check_num {-1}; // check_num of all package. to check legality of data
// char end = 0x03; // identify end of a TinyPb protocal data
};
}