From 41efd33a3e165ac329f14b6e1cea935076a8b790 Mon Sep 17 00:00:00 2001 From: Determinant Date: Fri, 20 Jul 2018 20:09:24 -0400 Subject: improve msg & msg network interface --- include/hotstuff/client.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'include/hotstuff/client.h') diff --git a/include/hotstuff/client.h b/include/hotstuff/client.h index 95a003d..92b4eec 100644 --- a/include/hotstuff/client.h +++ b/include/hotstuff/client.h @@ -8,22 +8,21 @@ namespace hotstuff { -enum { - REQ_CMD = 0x4, - RESP_CMD = 0x5, - CHK_CMD = 0x6 +struct MsgReqCmd { + static const opcode_t opcode = 0x4; + DataStream serialized; + command_t cmd; + MsgReqCmd(const Command &cmd); + MsgReqCmd(DataStream &&s): serialized(std::move(s)) {} + void postponed_parse(HotStuffCore *hsc); }; -struct MsgClient: public salticidae::MsgBase<> { - using MsgBase::MsgBase; - void gen_reqcmd(const Command &cmd); - void parse_reqcmd(command_t &cmd, HotStuffCore *hsc) const; - - void gen_respcmd(const Finality &fin); - void parse_respcmd(Finality &fin) const; - - void gen_chkcmd(const uint256_t &cmd_hash); - void parse_chkcmd(uint256_t &cmd_hash) const; +struct MsgRespCmd { + static const opcode_t opcode = 0x5; + DataStream serialized; + Finality fin; + MsgRespCmd(const Finality &fin); + MsgRespCmd(DataStream &&s); }; class CommandDummy: public Command { -- cgit v1.2.3-70-g09d2