Class DNSPacketConstructor
Defined in File dns_packet_constructor.h
Class Documentation
-
class DNSPacketConstructor
Class that contains methods to construct Ipv4/Ipv6 DNS packets Constructs the Ethernet, Ip, Udp, and DNS headers.
Public Static Functions
-
static inline size_t ConstructIpv4DNSPacket(RTEMbuf<DefaultPacket> &pkt, const rte_ether_addr &src_mac_addr, const rte_ether_addr &dst_mac_addr, const uint32_t src_ipv4_addr, const uint32_t dst_ipv4_addr, uint16_t src_port, uint16_t dns_id, const char *domain_name, const uint16_t len, DnsQType q_type)
Constructs a Ipv4 DNS packet in pkt.
Constructs the Ethernet, Ip, Udp, and DNS headers Checksums are not calculated
- Parameters:
pkt – Pointer to the MBuf to fill
src_mac_addr – Source MAC address
dst_mac_addr – Destination MAC address
src_ipv4_addr – Source Ipv4 address
dst_ipv4_addr – Destination Ipv4 address
src_port – Source port must be highter than 49152, destination port is always 53
dns_id – 16 bits DNS ID
domain_name – Pointer to buffer with domain name, can have trailing dot
len – Length of domain_name
q_type – Question type to ask the resolver
- Returns:
size_t
-
static inline size_t ConstructIpv6DNSPacket(RTEMbuf<DefaultPacket> &pkt, const rte_ether_addr &src_mac_addr, const rte_ether_addr &dst_mac_addr, const in6_addr &src_ipv6_addr, const in6_addr &dst_ipv6_addr, uint16_t src_port, uint16_t dns_id, const char *domain_name, const uint16_t len, DnsQType q_type)
Constructs a Ipv6 DNS packet in pkt.
Constructs the Ethernet, Ip, Udp, and DNS headers Checksums are not calculated
- Parameters:
pkt –
src_mac_addr –
dst_mac_addr –
src_ipv6_addr –
dst_ipv6_addr –
src_port –
dns_id –
domain_name –
len –
q_type –
- Returns:
size_t
-
static inline size_t GetMinIpv4PacketSize()
Get the minimum size of a Ipv4 DNS packet, size is counted from the ethernet header To get the total size of a DNS packet the domain name length with trailing dot should be added to this packet size.
- Returns:
size_t length
-
static inline size_t GetMinIpv6PacketSize()
Get the minimum size of a Ipv6 DNS packet, size is counted from the ethernet header To get the total size of a DNS packet the domain name length with trailing dot should be added to this packet size.
- Returns:
size_t length
-
static inline size_t ConstructIpv4DNSPacket(RTEMbuf<DefaultPacket> &pkt, const rte_ether_addr &src_mac_addr, const rte_ether_addr &dst_mac_addr, const uint32_t src_ipv4_addr, const uint32_t dst_ipv4_addr, uint16_t src_port, uint16_t dns_id, const char *domain_name, const uint16_t len, DnsQType q_type)