| | |
| | | msg.add_route()->set_mq_id(&src_id, sizeof(src_id)); |
| | | return msg; |
| | | } |
| | | BHMsg MakeRequest(const MQId &src_id, const std::string &topic, const void *data, const size_t size) |
| | | { |
| | | DataRequest req; |
| | | req.set_topic(topic); |
| | | req.set_data(data, size); |
| | | const std::string &body(req.SerializeAsString()); |
| | | return MakeRequest(src_id, body.data(), body.size()); |
| | | } |
| | | |
| | | BHMsg MakeReply(const void *data, const size_t size) |
| | | { |
| | | assert(data && size); |
| | | BHMsg msg(InitMsg(kMsgTypeReply)); |
| | | msg.set_body(data, size); |
| | | DataReply reply; |
| | | reply.set_data(data, size); |
| | | msg.set_body(reply.SerializeAsString()); |
| | | return msg; |
| | | } |
| | | |
| | |
| | | return msg; |
| | | } |
| | | |
| | | BHMsg MakeQueryTopic(const std::string &topic) |
| | | { |
| | | BHMsg msg(InitMsg(kMsgTypeQueryTopic)); |
| | | DataQueryTopic query; |
| | | query.set_topic(topic); |
| | | msg.set_body(query.SerializeAsString()); |
| | | return msg; |
| | | } |
| | | |
| | | void *Pack(SharedMemory &shm, const BHMsg &msg) |
| | | { |
| | | uint32_t msg_size = msg.ByteSizeLong(); |