artdaq  v3_04_01
RoutingPacket.hh
1 #ifndef artdaq_DAQrate_detail_RoutingPacket_hh
2 #define artdaq_DAQrate_detail_RoutingPacket_hh
3 
4 #include "artdaq-core/Data/Fragment.hh"
5 #define MAX_ROUTING_TABLE_SIZE 65000
6 
7 namespace artdaq
8 {
9  namespace detail
10  {
11  struct RoutingPacketEntry;
17  using RoutingPacket = std::vector<RoutingPacketEntry>;
18  struct RoutingPacketHeader;
19  struct RoutingAckPacket;
20  struct RoutingToken;
21 
25  enum class RoutingMasterMode : uint8_t
26  {
29  INVALID
30  };
31  }
32 }
37 {
41  RoutingPacketEntry() : sequence_id(Fragment::InvalidSequenceID), destination_rank(-1) {}
47  RoutingPacketEntry(Fragment::sequence_id_t seq, int rank) : sequence_id(seq), destination_rank(rank) {}
48  Fragment::sequence_id_t sequence_id;
50 };
51 
52 
56 #define ROUTING_MAGIC 0x1337beef
57 
62 {
63  uint32_t header;
65  size_t nEntries;
66 
72  explicit RoutingPacketHeader(RoutingMasterMode m, size_t n) : header(ROUTING_MAGIC), mode(m), nEntries(n) {}
77 };
78 
83 {
84  int rank;
85  Fragment::sequence_id_t first_sequence_id;
86  Fragment::sequence_id_t last_sequence_id;
87 };
88 
89 
93 #define TOKEN_MAGIC 0xbeefcafe
94 
100 {
101  uint32_t header;
102  int rank;
103  unsigned new_slots_free;
104  unsigned run_number;
105 };
106 
107 #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)
Events should be routed by sequence ID (BR -&gt; EB)
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.
RoutingMasterMode mode
The current mode of the RoutingMaster.
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.
unsigned run_number
The Run with which this token should be associated.
RoutingPacketEntry()
Default Constructor.
Events should be routed by send count (EB -&gt; Agg)
uint32_t header
The magic bytes that help validate the RoutingToken.