CatapultServer  v0.5.0.1 (Elephant)
PacketType.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include <iosfwd>
24 #include <stdint.h>
25 
26 namespace catapult { namespace ionet {
27 
28 #define FACILITY_BASED_CODE(BASE_VALUE, FACILITY_CODE) (BASE_VALUE + static_cast<uint8_t>(model::FacilityCode::FACILITY_CODE))
29 
30 #define PACKET_TYPE_LIST \
31  /* An undefined packet type. */ \
32  ENUM_VALUE(Undefined, 0) \
33  \
34  /* p2p packets have types [1, 500) */ \
35  \
36  /* A challenge from a server to a client. */ \
37  ENUM_VALUE(Server_Challenge, 1) \
38  \
39  /* A challenge from a client to a server. */ \
40  ENUM_VALUE(Client_Challenge, 2) \
41  \
42  /* Blocks have been pushed by a peer. */ \
43  ENUM_VALUE(Push_Block, 3) \
44  \
45  /* A block has been requested by a peer. */ \
46  ENUM_VALUE(Pull_Block, 4) \
47  \
48  /* Chain information has been requested by a peer. */ \
49  ENUM_VALUE(Chain_Info, 5) \
50  \
51  /* Block hashes have been requested by a peer. */ \
52  ENUM_VALUE(Block_Hashes, 7) \
53  \
54  /* Blocks have been requested by a peer. */ \
55  ENUM_VALUE(Pull_Blocks, 8) \
56  \
57  /* Transactions have been pushed by an api-node or a peer. */ \
58  ENUM_VALUE(Push_Transactions, 9) \
59  \
60  /* Unconfirmed transactions have been requested by a peer. */ \
61  ENUM_VALUE(Pull_Transactions, 10) \
62  \
63  /* A secure packet with a signature. */ \
64  ENUM_VALUE(Secure_Signed, 11) \
65  \
66  /* Sub cache merkle roots have been requested. */ \
67  ENUM_VALUE(Sub_Cache_Merkle_Roots, 12) \
68  \
69  /* api only packets have types [500, 600) */ \
70  \
71  /* Partial aggregate transactions have been pushed by an api-node. */ \
72  ENUM_VALUE(Push_Partial_Transactions, 500) \
73  \
74  /* Detached cosignatures have been pushed by an api-node. */ \
75  ENUM_VALUE(Push_Detached_Cosignatures, 501) \
76  \
77  /* Partial transaction infos have been requested by an api-node. */ \
78  ENUM_VALUE(Pull_Partial_Transaction_Infos, 502) \
79  \
80  /* node discovery packets have types [600, 700) */ \
81  \
82  /* Node information has been pushed by a peer. */ \
83  ENUM_VALUE(Node_Discovery_Push_Ping, 600) \
84  \
85  /* Node information has been requested by a peer. */ \
86  ENUM_VALUE(Node_Discovery_Pull_Ping, 601) \
87  \
88  /* Peers information has been pushed by a peer. */ \
89  ENUM_VALUE(Node_Discovery_Push_Peers, 602) \
90  \
91  /* Peers information has been requested by a peer. */ \
92  ENUM_VALUE(Node_Discovery_Pull_Peers, 603) \
93  \
94  /* time sync packets have types [700, 710) */ \
95  \
96  /* Network time information has been requested by a peer. */ \
97  ENUM_VALUE(Time_Sync_Network_Time, 700) \
98  \
99  /* state path packets have types [800, 1100) - ordered by facility code name */ \
100  \
101  /* Account state path has been requested by a client. */ \
102  ENUM_VALUE(Account_State_Path, FACILITY_BASED_CODE(800, Core)) \
103  \
104  /* Hash lock state path has been requested by a client. */ \
105  ENUM_VALUE(Hash_Lock_State_Path, FACILITY_BASED_CODE(800, LockHash)) \
106  \
107  /* Secret lock state path has been requested by a client. */ \
108  ENUM_VALUE(Secret_Lock_State_Path, FACILITY_BASED_CODE(800, LockSecret)) \
109  \
110  /* Metadata state path has been requested by a client. */ \
111  ENUM_VALUE(Metadata_State_Path, FACILITY_BASED_CODE(800, Metadata)) \
112  \
113  /* Mosaic state path has been requested by a client. */ \
114  ENUM_VALUE(Mosaic_State_Path, FACILITY_BASED_CODE(800, Mosaic)) \
115  \
116  /* Multisig state path has been requested by a client. */ \
117  ENUM_VALUE(Multisig_State_Path, FACILITY_BASED_CODE(800, Multisig)) \
118  \
119  /* Namespace state path has been requested by a client. */ \
120  ENUM_VALUE(Namespace_State_Path, FACILITY_BASED_CODE(800, Namespace)) \
121  \
122  /* Account restrictions state path has been requested by a client. */ \
123  ENUM_VALUE(Account_Restrictions_State_Path, FACILITY_BASED_CODE(800, RestrictionAccount)) \
124  \
125  /* Mosaic restrictions state path has been requested by a client. */ \
126  ENUM_VALUE(Mosaic_Restrictions_State_Path, FACILITY_BASED_CODE(800, RestrictionMosaic)) \
127  \
128  /* diagnostic packets have types [1100, 2000) - ordered by facility code name */ \
129  \
130  /* Request for the current diagnostic counter values. */ \
131  ENUM_VALUE(Diagnostic_Counters, 1100) \
132  \
133  /* Request from a client to confirm timestamped hashes. */ \
134  ENUM_VALUE(Confirm_Timestamped_Hashes, 1101) \
135  \
136  /* Node infos for active nodes have been requested. */ \
137  ENUM_VALUE(Active_Node_Infos, 1102) \
138  \
139  /* Block statement has been requested by a client. */ \
140  ENUM_VALUE(Block_Statement, 1103) \
141  \
142  /* Account infos have been requested by a client. */ \
143  ENUM_VALUE(Account_Infos, FACILITY_BASED_CODE(1200, Core)) \
144  \
145  /* Hash lock infos have been requested by a client. */ \
146  ENUM_VALUE(Hash_Lock_Infos, FACILITY_BASED_CODE(1200, LockHash)) \
147  \
148  /* Secret lock infos have been requested by a client. */ \
149  ENUM_VALUE(Secret_Lock_Infos, FACILITY_BASED_CODE(1200, LockSecret)) \
150  \
151  /* Metadata infos have been requested by a client. */ \
152  ENUM_VALUE(Metadata_Infos, FACILITY_BASED_CODE(1200, Metadata)) \
153  \
154  /* Mosaic infos have been requested by a client. */ \
155  ENUM_VALUE(Mosaic_Infos, FACILITY_BASED_CODE(1200, Mosaic)) \
156  \
157  /* Multisig infos have been requested by a client. */ \
158  ENUM_VALUE(Multisig_Infos, FACILITY_BASED_CODE(1200, Multisig)) \
159  \
160  /* Namespace infos have been requested by a client. */ \
161  ENUM_VALUE(Namespace_Infos, FACILITY_BASED_CODE(1200, Namespace)) \
162  \
163  /* Account restrictions infos have been requested by a client. */ \
164  ENUM_VALUE(Account_Restrictions_Infos, FACILITY_BASED_CODE(1200, RestrictionAccount)) \
165  \
166  /* Mosaic restrictions infos have been requested by a client. */ \
167  ENUM_VALUE(Mosaic_Restrictions_Infos, FACILITY_BASED_CODE(1200, RestrictionMosaic))
168 
169 #define ENUM_VALUE(LABEL, VALUE) LABEL = VALUE,
170  enum class PacketType : uint32_t {
173  };
174 #undef ENUM_VALUE
175 
177  std::ostream& operator<<(std::ostream& out, PacketType value);
178 }}
catapult::ionet::PacketType::PACKET_TYPE_LIST
catapult::ionet::PacketType
PacketType
An enumeration of known packet types.
Definition: PacketType.h:171
catapult::ionet::operator<<
std::ostream & operator<<(std::ostream &out, ConnectionSecurityMode value)
Insertion operator for outputting value to out.
catapult
Definition: AddressExtractionExtension.cpp:28
FacilityCode.h