My Kernel v0.1.0
Layer 3 - Address Resolution Protocol (ARP)

TCP/IP Illustrated Vol I - Chapter 4 - ARP RFC 826 More...

Collaboration diagram for Layer 3 - Address Resolution Protocol (ARP):

Data Structures

struct  arp_header
 An ARP header. More...
 

Macros

#define ARP_PACKET_SIZE    (sizeof(struct ethernet_header) + sizeof(struct arp_header))
 The maximum total size of an ARP packet.
 

Enumerations

enum  arp_hw_type { ARP_HW_ETHERNET = 1 }
 The different accepted types of hardware addresses. More...
 
enum  arp_operation { ARP_REQUEST = 1 , ARP_REPLY = 2 }
 The different ARP operations. More...
 

Functions

static size_t arp_header_size (struct arp_header *hdr)
 Compute the size of an ARP header. More...
 
error_t arp_add (__be ipv4_t, mac_address_t)
 Add a new entry inside the ARP table. More...
 
const mac_address_tarp_get (__be ipv4_t)
 Retreive the MAC address associated with an IPv4 address. More...
 
error_t arp_receive_packet (struct packet *)
 Handle a received ARP packet.
 
error_t arp_send_packet (struct arp_header *)
 Send an ARP request/reply.
 

Detailed Description

Enumeration Type Documentation

◆ arp_hw_type

Enumerator
ARP_HW_ETHERNET 

Ethernet MAC address.

◆ arp_operation

Enumerator
ARP_REQUEST 

Request. Sent first to try and find a MAC address.

ARP_REPLY 

Reply. Sent back to the sender if a match was found.

Function Documentation

◆ arp_add()

error_t arp_add ( __be  ipv4_t,
mac_address_t  mac 
)
Parameters
ipThe IP address (in network order)
macThe MAC address associated with the IP

◆ arp_get()

const mac_address_t * arp_get ( __be  ipv4_t)
Parameters
ipThe IP address (in network order)
Returns
The MAC address, or NULL if the IP isn't inside the table

◆ arp_header_size()

static size_t arp_header_size ( struct arp_header hdr)
inlinestatic

The ARP protocol header size is of variable length, always use this function instead of the usual sizeof(struct arp_header).