artdaq  v3_07_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 namespace detail {
9 struct RoutingPacketEntry;
15 using RoutingPacket = std::vector<RoutingPacketEntry>;
16 struct RoutingPacketHeader;
17 struct RoutingAckPacket;
18 struct RoutingToken;
19 
23 enum class RoutingMasterMode : uint8_t
24 {
27  INVALID
28 };
29 } // namespace detail
30 } // namespace artdaq
35 {
40  : sequence_id(Fragment::InvalidSequenceID), destination_rank(-1) {}
46  RoutingPacketEntry(Fragment::sequence_id_t seq, int rank)
47  : sequence_id(seq), destination_rank(rank) {}
48  Fragment::sequence_id_t sequence_id;
50 };
51 
55 #define ROUTING_MAGIC 0x1337beef
56 
61 {
62  uint32_t header;
64  size_t nEntries;
65  std::bitset<1024> already_acknowledged_ranks;
66 
72  explicit RoutingPacketHeader(RoutingMasterMode m, size_t n)
73  : header(ROUTING_MAGIC), mode(m), nEntries(n) {}
79 };
80 
85 {
86  int rank;
87  Fragment::sequence_id_t first_sequence_id;
88  Fragment::sequence_id_t last_sequence_id;
89 };
90 
94 #define TOKEN_MAGIC 0xbeefcafe
95 
101 {
102  uint32_t header;
103  int rank;
104  unsigned new_slots_free;
105  unsigned run_number;
106 };
107 
108 #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.
std::bitset< 1024 > already_acknowledged_ranks
Bitset of ranks which have already sent valid acknowledgements and therefore do not need to send agai...
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.