From 58d904a328c0d849769b483e901a0be9426b8209 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期二, 20 七月 2021 20:20:44 +0800 Subject: [PATCH] 调整Request C.BHFree的位置 --- src/proto.h | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/proto.h b/src/proto.h index b418342..29ff290 100644 --- a/src/proto.h +++ b/src/proto.h @@ -22,22 +22,23 @@ #include "bhome_msg_api.pb.h" #include <chrono> -using namespace bhome::msg; +using namespace bhome_msg; template <class Msg> struct MsgToType { }; -#define BHOME_MAP_MSG_AND_TYPE(mSG, tYPE) \ - template <> \ - struct MsgToType<mSG> { \ - static const bhome::msg::MsgType value = tYPE; \ +#define BHOME_MAP_MSG_AND_TYPE(mSG, tYPE) \ + template <> \ + struct MsgToType<mSG> { \ + static const MsgType value = tYPE; \ }; #define BHOME_SIMPLE_MAP_MSG(name) BHOME_MAP_MSG_AND_TYPE(Msg##name, kMsgType##name) BHOME_SIMPLE_MAP_MSG(CommonReply); BHOME_SIMPLE_MAP_MSG(Register); +BHOME_SIMPLE_MAP_MSG(Unregister); BHOME_SIMPLE_MAP_MSG(RegisterRPC); BHOME_SIMPLE_MAP_MSG(Heartbeat); BHOME_SIMPLE_MAP_MSG(QueryTopic); @@ -47,12 +48,16 @@ BHOME_SIMPLE_MAP_MSG(Publish); BHOME_SIMPLE_MAP_MSG(Subscribe); BHOME_SIMPLE_MAP_MSG(Unsubscribe); +BHOME_SIMPLE_MAP_MSG(ProcInit); +BHOME_SIMPLE_MAP_MSG(ProcInitReply); +BHOME_SIMPLE_MAP_MSG(QueryProc); +BHOME_SIMPLE_MAP_MSG(QueryProcReply); #undef BHOME_SIMPLE_MAP_MSG #undef BHOME_MAP_MSG_AND_TYPE template <class Msg> -constexpr inline bhome::msg::MsgType GetType(const Msg &) +constexpr inline MsgType GetType(const Msg &) { return MsgToType<Msg>::value; } @@ -73,8 +78,8 @@ return msg; } std::string NewMsgId(); -BHMsgHead InitMsgHead(const MsgType type, const std::string &proc_id, const std::string &msgid); -BHMsgHead InitMsgHead(const MsgType type, const std::string &proc_id); +BHMsgHead InitMsgHead(const MsgType type, const std::string &proc_id, const uint64_t ssn_id, const std::string &msgid); +BHMsgHead InitMsgHead(const MsgType type, const std::string &proc_id, const uint64_t ssn_id); // inline void AddRoute(BHMsgHead &head, const MQId &id) { head.add_route()->set_mq_id(&id, sizeof(id)); } inline bool IsSuccess(const ErrorCode ec) { return ec == eSuccess; } bool IsMsgExpired(const BHMsgHead &head); -- Gitblit v1.8.0