Class Arp
Defined in File arp.h
Class Documentation
-
class Arp
This class is repsonsible for managing ARP requests.
Generates an ARP response based on a request.
Public Types
Public Functions
-
inline Arp(const in_addr_t own_ip, const rte_ether_addr own_mac)
-
template<typename Send>
inline Error ReceivePacket(RTEMbuf<DefaultPacket> &pkt, RTEMempool<DefaultPacket, MbufType::Pkt> &mpool, Send send) Receive an ARP packet and generate an optional response.
- Parameters:
arp_pkt – The received ARP packet.
resp – mbuf for the response.
send – Function with signature
[] (rte_mbuf*) -> bool
that sends a single packet over the active network interface.
- Returns:
An error code.
-
template<typename Send, typename Recv>
inline Error RequestAddr(const in_addr_t addr, RTEMempool<DefaultPacket, MbufType::Pkt> &mpool, Send &send, Recv &recv) Perform entire request sequence for an IPv4 address.
If a the requested (ip, mac) pair already exists it is deleted and retrieved again.
- Parameters:
addr – The IPv4 address.
mmpool – An rte_mempool used to allocate packets.
send – Function with signature
[] (rte_mbuf*) -> bool
that sends a single packet over the active network interface.recv – Function with signature
[] (rte_mbuf**, uint16_t)
-> uint16_t that receives a single packet on the active network interface.
- Returns:
An error code.
-
std::optional<rte_ether_addr> GetEtherAddr(const in_addr_t addr)
Get the Ethernet address for a particular address.
- Parameters:
addr – The address needed to be resolved.
- Returns:
optional Ethernet address for the Ipv4 address. If std::nullopt is returned, address should be looked up explictely.
-
void InsertAddr(const in_addr_t ip, const rte_ether_addr mac)
Manually insert an (ip, mac) pair.
- Parameters:
ip – The Ipv4 address.
mac – The MAC address.
-
size_t EraseAddr(const in_addr_t ip)
Erases the (ip, mac) pair identified by ip, if it exists.
- Parameters:
ip – The Ipv4 address.
- Returns:
Number of elements removed from map (0 or 1)
-
inline Arp(const in_addr_t own_ip, const rte_ether_addr own_mac)