TARAXA
packet_types.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include "common/types.hpp"
6 
7 namespace taraxa::network {
8 
12 enum SubprotocolPacketType : uint32_t {
13  // Consensus packets with high processing priority
15  VotePacket, // Vote packer can contain (optional) also pbft block
18 
19  // Standard packets with mid processing priority
22  // DagSyncPacket has mid priority as it is also used for ad-hoc syncing in case new dag blocks miss tips/pivot
25 
26  // Non critical packets with low processing priority
35 
37 };
38 
43 inline std::string convertPacketTypeToString(SubprotocolPacketType packet_type) {
44  switch (packet_type) {
45  case StatusPacket:
46  return "StatusPacket";
47  case DagBlockPacket:
48  return "DagBlockPacket";
49  case GetDagSyncPacket:
50  return "GetDagSyncPacket";
51  case DagSyncPacket:
52  return "DagSyncPacket";
53  case TransactionPacket:
54  return "TransactionPacket";
55  case VotePacket:
56  return "VotePacket";
58  return "GetNextVotesSyncPacket";
59  case VotesBundlePacket:
60  return "VotesBundlePacket";
61  case GetPbftSyncPacket:
62  return "GetPbftSyncPacket";
63  case PbftSyncPacket:
64  return "PbftSyncPacket";
65  case PillarVotePacket:
66  return "PillarVotePacket";
68  return "GetPillarVotesBundlePacket";
70  return "PillarVotesBundlePacket";
71  default:
72  break;
73  }
74 
75  return "Unknown packet type: " + std::to_string(packet_type);
76 }
77 
78 } // namespace taraxa::network
Definition: vote_manager.hpp:23
std::string convertPacketTypeToString(SubprotocolPacketType packet_type)
Definition: packet_types.hpp:43
SubprotocolPacketType
SubprotocolPacketType is used in networking layer to differentiate packet types.
Definition: packet_types.hpp:12
@ GetPbftSyncPacket
Definition: packet_types.hpp:29
@ StatusPacket
Definition: packet_types.hpp:28
@ HighPriorityPackets
Definition: packet_types.hpp:14
@ GetDagSyncPacket
Definition: packet_types.hpp:31
@ DagBlockPacket
Definition: packet_types.hpp:21
@ PbftSyncPacket
Definition: packet_types.hpp:30
@ TransactionPacket
Definition: packet_types.hpp:24
@ GetNextVotesSyncPacket
Definition: packet_types.hpp:16
@ PacketCount
Definition: packet_types.hpp:36
@ DagSyncPacket
Definition: packet_types.hpp:23
@ MidPriorityPackets
Definition: packet_types.hpp:20
@ PillarVotesBundlePacket
Definition: packet_types.hpp:34
@ GetPillarVotesBundlePacket
Definition: packet_types.hpp:33
@ VotePacket
Definition: packet_types.hpp:15
@ VotesBundlePacket
Definition: packet_types.hpp:17
@ LowPriorityPackets
Definition: packet_types.hpp:27
@ PillarVotePacket
Definition: packet_types.hpp:32
std::string to_string(Json::Value const &json, bool no_indent=true)
Definition: jsoncpp.cpp:27