artdaq  v2_03_02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
RoutingPacket.hh
1 #ifndef artdaq_Application_Routing_RoutingPacket_hh
2 #define artdaq_Application_Routing_RoutingPacket_hh
3 
4 #include "artdaq-core/Data/Fragment.hh"
5 
6 namespace artdaq
7 {
8  namespace detail
9  {
10  struct RoutingPacketEntry;
16  using RoutingPacket = std::vector<RoutingPacketEntry>;
17  struct RoutingPacketHeader;
18  struct RoutingAckPacket;
19  struct RoutingToken;
20 
24  enum class RoutingMasterMode : uint8_t
25  {
26  RouteBySequenceID,
27  RouteBySendCount,
28  INVALID
29  };
30  }
31 }
36 {
40  RoutingPacketEntry() : sequence_id(Fragment::InvalidSequenceID), destination_rank(-1) {}
46  RoutingPacketEntry(Fragment::sequence_id_t seq, int rank) : sequence_id(seq), destination_rank(rank) {}
47  Fragment::sequence_id_t sequence_id;
49 };
50 
51 
55 #define ROUTING_MAGIC 0x1337beef
56 
61 {
62  uint32_t header;
63  RoutingMasterMode mode;
64  size_t nEntries;
65 
71  explicit RoutingPacketHeader(RoutingMasterMode m, size_t n) : header(ROUTING_MAGIC), mode(m), nEntries(n) {}
75  RoutingPacketHeader() : header(0), mode(RoutingMasterMode::INVALID), nEntries(0) {}
76 };
77 
82 {
83  int rank;
84  Fragment::sequence_id_t first_sequence_id;
85  Fragment::sequence_id_t last_sequence_id;
86 };
87 
88 
92 #define TOKEN_MAGIC 0xbeefcafe
93 
99 {
100  uint32_t header;
101  int rank;
102  unsigned new_slots_free;
103 };
104 
105 #endif //artdaq_Application_Routing_RoutingPacket_hh
RoutingMasterMode
Mode indicating whether the RoutingMaster is routing events by Sequence ID or by Send Count...
A row of the Routing Table.
A RoutingAckPacket contains the rank of the table receiver, plus the first and last sequence IDs in t...
unsigned new_slots_free
The number of slots free in the token sender (usually 1)
The RoutingToken contains the magic bytes, the rank of the token sender, and the number of slots free...
Fragment::sequence_id_t first_sequence_id
The first sequence ID in the received RoutingPacket.
RoutingPacketEntry(Fragment::sequence_id_t seq, int rank)
Construct a RoutingPacketEntry with the given sequence ID and destination rank.
The header of the Routing Table, containing the magic bytes and the number of entries.
uint32_t header
Magic bytes to make sure the packet wasn&#39;t garbled.
int destination_rank
The destination rank for this sequence ID.
Fragment::sequence_id_t last_sequence_id
The last sequence ID in the received RoutingPacket.
RoutingPacketHeader(RoutingMasterMode m, size_t n)
Construct a RoutingPacketHeader declaring a given number of entries.
std::vector< RoutingPacketEntry > RoutingPacket
A RoutingPacket is simply a vector of RoutingPacketEntry objects. It is not suitable for network tran...
int rank
The rank from which the RoutingToken came.
int rank
The rank from which the RoutingAckPacket came.
Fragment::sequence_id_t sequence_id
The sequence ID of the RoutingPacketEntry.
size_t nEntries
The number of RoutingPacketEntries in the RoutingPacket.
RoutingPacketHeader()
Default Constructor.
RoutingPacketEntry()
Default Constructor.
uint32_t header
The magic bytes that help validate the RoutingToken.