| | |
| | | syntax = "proto3"; |
| | | |
| | | option optimize_for = LITE_RUNTIME; |
| | | |
| | | import "google/protobuf/descriptor.proto"; |
| | | import "error_msg.proto"; |
| | | // import "google/protobuf/descriptor.proto"; |
| | | import "bhome_msg_api.proto"; |
| | | |
| | | package bhome.msg; |
| | | |
| | | |
| | | // message format : header(BHMsgHead) + body(variable types) |
| | | message BHAddress { |
| | | bytes mq_id = 1; // mqid, uuid |
| | | bytes ip = 2; // |
| | | int32 port = 3; |
| | | } |
| | | |
| | | message ProcInfo |
| | | { |
| | | bytes id = 1; // serial number, maybe managed |
| | | bytes name = 2; |
| | | bytes public_info = 3; |
| | | bytes private_info = 4; |
| | | } |
| | | // message format : head_len(4) + head(BHMsgHead) + body_len(4) + body(variable types) |
| | | |
| | | message BHMsgHead { |
| | | bytes msg_id = 1; |
| | | repeated BHAddress route = 2; // for reply and proxy. |
| | | int64 timestamp = 3; |
| | | int32 type = 4; |
| | | ProcInfo proc = 5; |
| | | bytes proc_id = 5; |
| | | bytes topic = 6; // for request route |
| | | } |
| | | |
| | | message BHMsgBody { |
| | | bytes data = 1; |
| | | } |
| | | |
| | | message BHMsg { // deprecated |
| | |
| | | |
| | | enum MsgType { |
| | | kMsgTypeInvalid = 0; |
| | | kMsgTypeRawData = 1; |
| | | |
| | | kMsgTypeCommonReply = 2; |
| | | |
| | |
| | | kMsgTypeQueryTopicReply = 15; |
| | | kMsgTypeRequestTopic = 16; |
| | | kMsgTypeRequestTopicReply = 17; |
| | | kMsgTypeRegisterRPC = 18; |
| | | // reply |
| | | |
| | | kMsgTypePublish = 100; |
| | | // kMsgTypePublishReply = 101; |
| | | kMsgTypeSubscribe = 102; |
| | | // kMsgTypeSubscribeReply = 103; |
| | | kMsgTypeUnsubscribe = 104; |
| | | // kMsgTypeUnsubscribeReply = 105; |
| | | kMsgTypePublish = 20; |
| | | // kMsgTypePublishReply = 21; |
| | | kMsgTypeSubscribe = 22; |
| | | // kMsgTypeSubscribeReply = 23; |
| | | kMsgTypeUnsubscribe = 24; |
| | | // kMsgTypeUnsubscribeReply = 25; |
| | | |
| | | } |
| | | |
| | | message MsgPub { |
| | | bytes topic = 1; |
| | | bytes data = 2; |
| | | } |
| | | |
| | | message MsgSub { |
| | | repeated bytes topics = 1; |
| | | } |
| | | |
| | | message MsgCommonReply { |
| | | ErrorMsg errmsg = 1; |
| | | } |
| | | |
| | | message MsgRequestTopic { |
| | | bytes topic = 1; |
| | | bytes data = 2; |
| | | } |
| | | |
| | | message MsgRequestTopicReply { |
| | | ErrorMsg errmsg = 1; |
| | | bytes data = 2; |
| | | } |
| | | |
| | | message MsgRegister |
| | | { |
| | | ProcInfo proc = 1; |
| | | repeated bytes topics = 2; |
| | | } |
| | | |
| | | message MsgHeartbeat |
| | | { |
| | | ProcInfo proc = 1; |
| | | } |
| | | |
| | | message MsgQueryTopic { |
| | | bytes topic = 1; |
| | | } |
| | | |
| | | message MsgQueryTopicReply { |
| | | ErrorMsg errmsg = 1; |
| | | BHAddress address = 2; |
| | | } |
| | | |
| | | service TopicRPC { |