Sponge
CS144's user-space TCP library
|
#include <arp_message.hh>
Public Member Functions | |
ParseResult | parse (const Buffer buffer) |
Parse the ARP message from a string. More... | |
std::string | serialize () const |
Serialize the ARP message to a string. More... | |
bool | supported () const |
Is this type of ARP message supported by the parser? More... | |
std::string | to_string () const |
Return a string containing the ARP message in human-readable format. More... | |
Public Attributes | |
ARPheader fields | |
uint16_t | hardware_type = TYPE_ETHERNET |
Type of the link-layer protocol (generally Ethernet/Wi-Fi) More... | |
uint16_t | protocol_type = EthernetHeader::TYPE_IPv4 |
Type of the Internet-layer protocol (generally IPv4) More... | |
uint8_t | hardware_address_size = sizeof(EthernetHeader::src) |
uint8_t | protocol_address_size = sizeof(IPv4Header::src) |
uint16_t | opcode {} |
Request or reply. More... | |
EthernetAddress | sender_ethernet_address {} |
uint32_t | sender_ip_address {} |
EthernetAddress | target_ethernet_address {} |
uint32_t | target_ip_address {} |
Static Public Attributes | |
static constexpr size_t | LENGTH = 28 |
ARP message length in bytes. More... | |
static constexpr uint16_t | OPCODE_REPLY = 2 |
static constexpr uint16_t | OPCODE_REQUEST = 1 |
static constexpr uint16_t | TYPE_ETHERNET = 1 |
ARP type for Ethernet/Wi-Fi as link-layer protocol. More... | |
ARP message
This struct can be used to parse an existing ARP message or to create a new one.
Definition at line 10 of file arp_message.hh.
ParseResult ARPMessage::parse | ( | const Buffer | buffer | ) |
Parse the ARP message from a string.
Definition at line 9 of file arp_message.cc.
string ARPMessage::serialize | ( | ) | const |
Serialize the ARP message to a string.
Definition at line 47 of file arp_message.cc.
bool ARPMessage::supported | ( | ) | const |
Is this type of ARP message supported by the parser?
Definition at line 41 of file arp_message.cc.
string ARPMessage::to_string | ( | ) | const |
Return a string containing the ARP message in human-readable format.
Definition at line 75 of file arp_message.cc.
uint8_t ARPMessage::hardware_address_size = sizeof(EthernetHeader::src) |
Definition at line 20 of file arp_message.hh.
uint16_t ARPMessage::hardware_type = TYPE_ETHERNET |
Type of the link-layer protocol (generally Ethernet/Wi-Fi)
Definition at line 18 of file arp_message.hh.
|
staticconstexpr |
ARP message length in bytes.
Definition at line 11 of file arp_message.hh.
uint16_t ARPMessage::opcode {} |
Request or reply.
Definition at line 22 of file arp_message.hh.
|
staticconstexpr |
Definition at line 14 of file arp_message.hh.
|
staticconstexpr |
Definition at line 13 of file arp_message.hh.
uint8_t ARPMessage::protocol_address_size = sizeof(IPv4Header::src) |
Definition at line 21 of file arp_message.hh.
uint16_t ARPMessage::protocol_type = EthernetHeader::TYPE_IPv4 |
Type of the Internet-layer protocol (generally IPv4)
Definition at line 19 of file arp_message.hh.
EthernetAddress ARPMessage::sender_ethernet_address {} |
Definition at line 24 of file arp_message.hh.
uint32_t ARPMessage::sender_ip_address {} |
Definition at line 25 of file arp_message.hh.
EthernetAddress ARPMessage::target_ethernet_address {} |
Definition at line 27 of file arp_message.hh.
uint32_t ARPMessage::target_ip_address {} |
Definition at line 28 of file arp_message.hh.
|
staticconstexpr |
ARP type for Ethernet/Wi-Fi as link-layer protocol.
Definition at line 12 of file arp_message.hh.