13 {protocol::mtVALIDATORLISTCOLLECTION,
17 {protocol::mtPROOF_PATH_REQ,
19 {protocol::mtPROOF_PATH_RESPONSE,
21 {protocol::mtREPLAY_DELTA_REQ,
23 {protocol::mtREPLAY_DELTA_RESPONSE,
25 {protocol::mtHAVE_TRANSACTIONS,
27 {protocol::mtTRANSACTIONS,
34 ::google::protobuf::Message
const& message,
35 protocol::MessageType type,
41 if (type == protocol::mtHAVE_SET)
45 if (
auto msg =
dynamic_cast<protocol::TMLedgerData const*
>(&message))
47 if (msg->type() == protocol::liTS_CANDIDATE)
48 return (inbound && !msg->has_requestcookie())
52 if (msg->type() == protocol::liTX_NODE)
53 return (inbound && !msg->has_requestcookie())
57 if (msg->type() == protocol::liAS_NODE)
58 return (inbound && !msg->has_requestcookie())
62 return (inbound && !msg->has_requestcookie())
67 if (
auto msg =
dynamic_cast<protocol::TMGetLedger const*
>(&message))
69 if (msg->itype() == protocol::liTS_CANDIDATE)
70 return (inbound || msg->has_requestcookie())
74 if (msg->itype() == protocol::liTX_NODE)
75 return (inbound || msg->has_requestcookie())
79 if (msg->itype() == protocol::liAS_NODE)
80 return (inbound || msg->has_requestcookie())
84 return (inbound || msg->has_requestcookie())
89 if (
auto msg =
dynamic_cast<protocol::TMGetObjectByHash const*
>(&message))
91 if (msg->type() == protocol::TMGetObjectByHash::otLEDGER)
92 return (msg->query() == inbound)
96 if (msg->type() == protocol::TMGetObjectByHash::otTRANSACTION)
97 return (msg->query() == inbound)
101 if (msg->type() == protocol::TMGetObjectByHash::otTRANSACTION_NODE)
102 return (msg->query() == inbound)
106 if (msg->type() == protocol::TMGetObjectByHash::otSTATE_NODE)
107 return (msg->query() == inbound)
111 if (msg->type() == protocol::TMGetObjectByHash::otCAS_OBJECT)
112 return (msg->query() == inbound)
116 if (msg->type() == protocol::TMGetObjectByHash::otFETCH_PACK)
117 return (msg->query() == inbound)
121 if (msg->type() == protocol::TMGetObjectByHash::otTRANSACTIONS)
static category categorize(::google::protobuf::Message const &message, protocol::MessageType type, bool inbound)
Given a protocol message, determine which traffic category it belongs to.