DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
PacketCtor.hpp
Go to the documentation of this file.
1
9#ifndef DPDKLIBS_INCLUDE_DPDKLIBS_UDP_PACKETCTOR_HPP_
10#define DPDKLIBS_INCLUDE_DPDKLIBS_UDP_PACKETCTOR_HPP_
11
12#include "IPV4UDPPacket.hpp"
13#include <rte_byteorder.h>
14
16
17#include <string>
18
19namespace dunedaq {
20namespace dpdklibs {
21namespace udp {
22
23rte_le16_t
24packet_fill(struct ipv4_udp_packet_hdr* packet_hdr);
25
26void
28 rte_le16_t packet_len,
29 int sport = 55677,
30 int dport = 55678);
31
32void
33pktgen_ipv4_ctor(struct ipv4_udp_packet_hdr* packet_hdr,
34 rte_le16_t packet_len,
35 const std::string& src_ip_addr = "0.0.0.0",
36 const std::string& dst_ip_addr = "0.0.0.0");
37
38void
40 const std::string& dst_mac_address = "0a:00:10:c2:15:c1",
41 const int port_id = 0);
42
43/* Convert 00:11:22:33:44:55 to ethernet address */
44bool
45get_ether_addr6(const char* s0, struct rte_ether_addr* ea);
46
47// n.b. The memory pool which bufs is pointing to must be allocated, otherwise you'll get a crash
48void
49construct_packets_for_burst(const int port_id,
50 const std::string& dst_mac_addr,
51 const int payload_bytes,
52 const int burst_size,
53 rte_mbuf** bufs);
54
55} // namespace udp
56} // namespace dpdklibs
57} // namespace dunedaq
58
59#endif // DPDKLIBS_INCLUDE_DPDKLIBS_PACKETCTOR_HPP_
void pktgen_ether_hdr_ctor(struct ipv4_udp_packet_hdr *packet_hdr, const std::string &dst_mac_address="0a:00:10:c2:15:c1", const int port_id=0)
void construct_packets_for_burst(const int port_id, const std::string &dst_mac_addr, const int payload_bytes, const int burst_size, rte_mbuf **bufs)
void pktgen_ipv4_ctor(struct ipv4_udp_packet_hdr *packet_hdr, rte_le16_t packet_len, const std::string &src_ip_addr="0.0.0.0", const std::string &dst_ip_addr="0.0.0.0")
rte_le16_t packet_fill(struct ipv4_udp_packet_hdr *packet_hdr)
void pktgen_udp_hdr_ctor(struct ipv4_udp_packet_hdr *packet_hdr, rte_le16_t packet_len, int sport=55677, int dport=55678)
bool get_ether_addr6(const char *s0, struct rte_ether_addr *ea)
The DUNE-DAQ namespace.