DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dpdklibs
include
dpdklibs
udp
Utils.hpp
Go to the documentation of this file.
1
8
#ifndef DPDKLIBS_SRC_UTILS_HPP_
9
#define DPDKLIBS_SRC_UTILS_HPP_
10
11
#include "
IPV4UDPPacket.hpp
"
12
13
#include "
detdataformats/DAQEthHeader.hpp
"
14
#include "
logging/Logging.hpp
"
// NOTE: if ISSUES ARE DECLARED BEFORE include logging/Logging.hpp, TLOG_DEBUG<<issue wont work.
15
16
#include "fmt/core.h"
17
#include "rte_ether.h"
18
#include "rte_mbuf.h"
19
20
#include <cstdint>
21
#include <iostream>
22
#include <mutex>
23
#include <set>
24
#include <string>
25
#include <utility>
26
#include <vector>
27
28
namespace
dunedaq
{
29
30
ERS_DECLARE_ISSUE
(
dpdklibs
,
31
BadPacketHeaderIssue,
32
"BadPacketHeaderIssue: \""
<< ers_messg <<
"\""
,
33
((std::string)ers_messg))
34
35
namespace
dpdklibs
{
36
namespace
udp {
37
38
uint16_t
39
get_payload_size_udp_hdr
(
struct
rte_udp_hdr* udp_hdr);
40
uint16_t
41
get_payload_size
(
struct
ipv4_udp_packet_hdr* ipv4_udp_hdr);
42
43
rte_be32_t
44
ip_address_dotdecimal_to_binary
(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4);
45
struct
ipaddr
46
ip_address_binary_to_dotdecimal
(rte_le32_t binary_ipv4_address);
47
48
std::string
49
get_ipv4_decimal_addr_str
(
struct
ipaddr ipv4_address);
50
51
char
*
52
get_udp_payload
(
const
rte_mbuf* mbuf);
53
54
// void dump_udp_header(struct ipv4_udp_packet_hdr * pkt);
55
std::string
56
get_udp_header_str
(
struct
rte_mbuf* mbuf);
57
58
std::string
59
get_udp_packet_str
(
struct
rte_mbuf* mbuf);
60
61
void
62
add_file_contents_to_vector
(
const
std::string&
filename
, std::vector<char>& buffervec);
63
64
std::vector<std::pair<const void*, int>>
65
get_ethernet_packets
(
const
std::vector<char>& buffervec);
66
67
void
68
set_daqethheader_test_values
(
detdataformats::DAQEthHeader
& daqethheader_obj)
noexcept
;
69
70
std::string
71
get_rte_mbuf_str
(
const
rte_mbuf* mbuf)
noexcept
;
72
73
struct
StreamUID
74
{
75
uint64_t det_id : 6;
76
uint64_t crate_id : 10;
77
uint64_t slot_id : 4;
78
uint64_t stream_id : 8;
79
80
StreamUID() =
default
;
81
82
StreamUID(
const
detdataformats::DAQEthHeader
& daq_hdr)
83
: det_id(daq_hdr.
det_id
)
84
, crate_id(daq_hdr.
crate_id
)
85
, slot_id(daq_hdr.
slot_id
)
86
, stream_id(daq_hdr.
stream_id
){};
87
88
bool
operator<(
const
StreamUID& rhs)
const
{
return
std::tie(det_id, crate_id, slot_id, stream_id) < std::tie(rhs.det_id, rhs.crate_id, rhs.slot_id, rhs.stream_id); }
89
90
bool
operator==
(
const
StreamUID& rhs)
const
{
return
det_id == rhs.det_id && crate_id == rhs.crate_id && slot_id == rhs.slot_id && stream_id == rhs.stream_id; }
91
operator
std::string()
const
{
return
fmt::format(
"({}, {}, {}, {})"
, det_id, crate_id, slot_id, stream_id); }
92
};
93
94
}
// namespace udp
95
}
// namespace dpdklibs
96
}
// namespace dunedaq
97
98
#endif
// DPDKLIBS_SRC_UTILS_HPP_
DAQEthHeader.hpp
operator==
bool operator==(const OksSystem::File &a, const OksSystem::File &b)
Definition
File.cpp:862
IPV4UDPPacket.hpp
Logging.hpp
ERS_DECLARE_ISSUE
#define ERS_DECLARE_ISSUE( namespace_name, class_name, message_, attributes)
Definition
macro.hpp:65
dunedaq::dpdklibs::udp::ip_address_dotdecimal_to_binary
rte_be32_t ip_address_dotdecimal_to_binary(std::uint8_t byte1, std::uint8_t byte2, std::uint8_t byte3, std::uint8_t byte4)
Definition
Utils.cpp:41
dunedaq::dpdklibs::udp::get_payload_size
std::uint16_t get_payload_size(struct ipv4_udp_packet_hdr *ipv4_udp_hdr)
Definition
Utils.cpp:35
dunedaq::dpdklibs::udp::get_udp_packet_str
std::string get_udp_packet_str(struct rte_mbuf *mbuf)
Definition
Utils.cpp:153
dunedaq::dpdklibs::udp::get_ethernet_packets
std::vector< std::pair< const void *, int > > get_ethernet_packets(const std::vector< char > &buffervec)
Definition
Utils.cpp:188
dunedaq::dpdklibs::udp::get_udp_payload
char * get_udp_payload(const rte_mbuf *mbuf)
Definition
Utils.cpp:70
dunedaq::dpdklibs::udp::get_ipv4_decimal_addr_str
std::string get_ipv4_decimal_addr_str(struct ipaddr ipv4_address)
Definition
Utils.cpp:56
dunedaq::dpdklibs::udp::get_udp_header_str
std::string get_udp_header_str(struct rte_mbuf *mbuf)
Definition
Utils.cpp:108
dunedaq::dpdklibs::udp::ip_address_binary_to_dotdecimal
struct ipaddr ip_address_binary_to_dotdecimal(rte_le32_t binary_ipv4_address)
Definition
Utils.cpp:48
dunedaq::dpdklibs::udp::add_file_contents_to_vector
void add_file_contents_to_vector(const std::string &filename, std::vector< char > &buffervec)
Definition
Utils.cpp:168
dunedaq::dpdklibs::udp::get_payload_size_udp_hdr
std::uint16_t get_payload_size_udp_hdr(struct rte_udp_hdr *udp_hdr)
Definition
Utils.cpp:29
dunedaq::dpdklibs::udp::get_rte_mbuf_str
std::string get_rte_mbuf_str(const rte_mbuf *mbuf) noexcept
Definition
Utils.cpp:246
dunedaq::dpdklibs::udp::set_daqethheader_test_values
void set_daqethheader_test_values(detdataformats::DAQEthHeader &daqethheader_obj) noexcept
Definition
Utils.cpp:232
dunedaq::dpdklibs
Definition
ARP.hpp:16
dunedaq
Including Qt Headers.
Definition
module.cpp:16
dunedaq::detdataformats::DAQEthHeader
DAQEthHeader is a versioned and unified structure for every FE electronics.
Definition
DAQEthHeader.hpp:23
dunedaq::detdataformats::DAQEthHeader::det_id
word_t det_id
Definition
DAQEthHeader.hpp:26
dunedaq::detdataformats::DAQEthHeader::slot_id
word_t slot_id
Definition
DAQEthHeader.hpp:26
dunedaq::detdataformats::DAQEthHeader::stream_id
word_t stream_id
Definition
DAQEthHeader.hpp:26
dunedaq::detdataformats::DAQEthHeader::crate_id
word_t crate_id
Definition
DAQEthHeader.hpp:26
tablepositions::filename
@ filename
Definition
ui_constants.hpp:11
Generated on
for DUNE-DAQ by
1.17.0