iPXE
Data Structures | Macros | Functions | Variables
if_arp.h File Reference

Address Resolution Protocol constants and types. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  arphdr
 An ARP header. More...
 

Macros

#define ARPHRD_NETROM   0
 from KA9Q: NET/ROM pseudo More...
 
#define ARPHRD_ETHER   1
 Ethernet 10Mbps. More...
 
#define ARPHRD_EETHER   2
 Experimental Ethernet. More...
 
#define ARPHRD_AX25   3
 AX.25 Level 2. More...
 
#define ARPHRD_PRONET   4
 PROnet token ring. More...
 
#define ARPHRD_CHAOS   5
 Chaosnet. More...
 
#define ARPHRD_IEEE802   6
 IEEE 802.2 Ethernet/TR/TB. More...
 
#define ARPHRD_ARCNET   7
 ARCnet. More...
 
#define ARPHRD_APPLETLK   8
 APPLEtalk. More...
 
#define ARPHRD_DLCI   15
 Frame Relay DLCI. More...
 
#define ARPHRD_ATM   19
 ATM. More...
 
#define ARPHRD_METRICOM   23
 Metricom STRIP (new IANA id) More...
 
#define ARPHRD_IEEE1394   24
 IEEE 1394 IPv4 - RFC 2734. More...
 
#define ARPHRD_EUI64   27
 EUI-64. More...
 
#define ARPHRD_INFINIBAND   32
 InfiniBand. More...
 
#define ARPOP_REQUEST   1
 ARP request. More...
 
#define ARPOP_REPLY   2
 ARP reply. More...
 
#define ARPOP_RREQUEST   3
 RARP request. More...
 
#define ARPOP_RREPLY   4
 RARP reply. More...
 
#define ARPOP_InREQUEST   8
 InARP request. More...
 
#define ARPOP_InREPLY   9
 InARP reply. More...
 
#define ARPOP_NAK   10
 (ATM)ARP NAK More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
struct arphdr __attribute__ ((packed))
 
static void * arp_sender_ha (struct arphdr *arphdr)
 ARP packet sender hardware address. More...
 
static void * arp_sender_pa (struct arphdr *arphdr)
 ARP packet sender protocol address. More...
 
static void * arp_target_ha (struct arphdr *arphdr)
 ARP packet target hardware address. More...
 
static void * arp_target_pa (struct arphdr *arphdr)
 ARP packet target protocol address. More...
 
static size_t arp_len (struct arphdr *arphdr)
 ARP packet length. More...
 

Variables

uint16_t ar_hrd
 Link-layer protocol. More...
 
uint16_t ar_pro
 Network-layer protocol. More...
 
uint8_t ar_hln
 Link-layer address length. More...
 
uint8_t ar_pln
 Network-layer address length. More...
 
uint16_t ar_op
 ARP opcode. More...
 

Detailed Description

Address Resolution Protocol constants and types.

Definition in file if_arp.h.

Macro Definition Documentation

◆ ARPHRD_NETROM

#define ARPHRD_NETROM   0

from KA9Q: NET/ROM pseudo

Definition at line 15 of file if_arp.h.

◆ ARPHRD_ETHER

#define ARPHRD_ETHER   1

Ethernet 10Mbps.

Definition at line 16 of file if_arp.h.

◆ ARPHRD_EETHER

#define ARPHRD_EETHER   2

Experimental Ethernet.

Definition at line 17 of file if_arp.h.

◆ ARPHRD_AX25

#define ARPHRD_AX25   3

AX.25 Level 2.

Definition at line 18 of file if_arp.h.

◆ ARPHRD_PRONET

#define ARPHRD_PRONET   4

PROnet token ring.

Definition at line 19 of file if_arp.h.

◆ ARPHRD_CHAOS

#define ARPHRD_CHAOS   5

Chaosnet.

Definition at line 20 of file if_arp.h.

◆ ARPHRD_IEEE802

#define ARPHRD_IEEE802   6

IEEE 802.2 Ethernet/TR/TB.

Definition at line 21 of file if_arp.h.

◆ ARPHRD_ARCNET

#define ARPHRD_ARCNET   7

ARCnet.

Definition at line 22 of file if_arp.h.

◆ ARPHRD_APPLETLK

#define ARPHRD_APPLETLK   8

APPLEtalk.

Definition at line 23 of file if_arp.h.

◆ ARPHRD_DLCI

#define ARPHRD_DLCI   15

Frame Relay DLCI.

Definition at line 24 of file if_arp.h.

◆ ARPHRD_ATM

#define ARPHRD_ATM   19

ATM.

Definition at line 25 of file if_arp.h.

◆ ARPHRD_METRICOM

#define ARPHRD_METRICOM   23

Metricom STRIP (new IANA id)

Definition at line 26 of file if_arp.h.

◆ ARPHRD_IEEE1394

#define ARPHRD_IEEE1394   24

IEEE 1394 IPv4 - RFC 2734.

Definition at line 27 of file if_arp.h.

◆ ARPHRD_EUI64

#define ARPHRD_EUI64   27

EUI-64.

Definition at line 28 of file if_arp.h.

◆ ARPHRD_INFINIBAND

#define ARPHRD_INFINIBAND   32

InfiniBand.

Definition at line 29 of file if_arp.h.

◆ ARPOP_REQUEST

#define ARPOP_REQUEST   1

ARP request.

Definition at line 32 of file if_arp.h.

◆ ARPOP_REPLY

#define ARPOP_REPLY   2

ARP reply.

Definition at line 33 of file if_arp.h.

◆ ARPOP_RREQUEST

#define ARPOP_RREQUEST   3

RARP request.

Definition at line 34 of file if_arp.h.

◆ ARPOP_RREPLY

#define ARPOP_RREPLY   4

RARP reply.

Definition at line 35 of file if_arp.h.

◆ ARPOP_InREQUEST

#define ARPOP_InREQUEST   8

InARP request.

Definition at line 36 of file if_arp.h.

◆ ARPOP_InREPLY

#define ARPOP_InREPLY   9

InARP reply.

Definition at line 37 of file if_arp.h.

◆ ARPOP_NAK

#define ARPOP_NAK   10

(ATM)ARP NAK

Definition at line 38 of file if_arp.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ __attribute__()

struct arphdr __attribute__ ( (packed)  )

◆ arp_sender_ha()

static void* arp_sender_ha ( struct arphdr arphdr)
inlinestatic

ARP packet sender hardware address.

Parameters
arphdrARP header
Return values
ar_shaSender hardware address

Definition at line 71 of file if_arp.h.

71  {
72  return ( ( ( void * ) arphdr ) + sizeof ( *arphdr ) );
73 }
An ARP header.
Definition: if_arp.h:47

Referenced by arp_rx(), arp_sender_pa(), gdbudp_recv(), ipoib_translate_rx_arp(), and ipoib_translate_tx_arp().

◆ arp_sender_pa()

static void* arp_sender_pa ( struct arphdr arphdr)
inlinestatic

ARP packet sender protocol address.

Parameters
arphdrARP header
Return values
ar_spaSender protocol address

Definition at line 80 of file if_arp.h.

80  {
81  return ( arp_sender_ha ( arphdr ) + arphdr->ar_hln );
82 }
uint8_t ar_hln
Link-layer address length.
Definition: if_arp.h:59
An ARP header.
Definition: if_arp.h:47
static void * arp_sender_ha(struct arphdr *arphdr)
ARP packet sender hardware address.
Definition: if_arp.h:71

References arphdr::ar_hln, and arp_sender_ha().

Referenced by arp_rx(), arp_target_ha(), gdbudp_recv(), ipoib_translate_rx_arp(), and ipoib_translate_tx_arp().

◆ arp_target_ha()

static void* arp_target_ha ( struct arphdr arphdr)
inlinestatic

ARP packet target hardware address.

Parameters
arphdrARP header
Return values
ar_thaTarget hardware address

Definition at line 89 of file if_arp.h.

89  {
90  return ( arp_sender_pa ( arphdr ) + arphdr->ar_pln );
91 }
static void * arp_sender_pa(struct arphdr *arphdr)
ARP packet sender protocol address.
Definition: if_arp.h:80
An ARP header.
Definition: if_arp.h:47
uint8_t ar_pln
Network-layer address length.
Definition: if_arp.h:61

References arphdr::ar_pln, and arp_sender_pa().

Referenced by arp_rx(), arp_target_pa(), gdbudp_recv(), ipoib_translate_rx_arp(), and ipoib_translate_tx_arp().

◆ arp_target_pa()

static void* arp_target_pa ( struct arphdr arphdr)
inlinestatic

ARP packet target protocol address.

Parameters
arphdrARP header
Return values
ar_tpaTarget protocol address

Definition at line 98 of file if_arp.h.

98  {
99  return ( arp_target_ha ( arphdr ) + arphdr->ar_hln );
100 }
static void * arp_target_ha(struct arphdr *arphdr)
ARP packet target hardware address.
Definition: if_arp.h:89
uint8_t ar_hln
Link-layer address length.
Definition: if_arp.h:59
An ARP header.
Definition: if_arp.h:47

References arphdr::ar_hln, and arp_target_ha().

Referenced by arp_rx(), gdbudp_recv(), ipoib_translate_rx_arp(), and ipoib_translate_tx_arp().

◆ arp_len()

static size_t arp_len ( struct arphdr arphdr)
inlinestatic

ARP packet length.

Parameters
arphdrARP header
Return values
lenLength (including header)

Definition at line 107 of file if_arp.h.

107  {
108  return ( sizeof ( *arphdr ) +
109  ( 2 * ( arphdr->ar_hln + arphdr->ar_pln ) ) );
110 }
uint8_t ar_hln
Link-layer address length.
Definition: if_arp.h:59
An ARP header.
Definition: if_arp.h:47
uint8_t ar_pln
Network-layer address length.
Definition: if_arp.h:61

References arphdr::ar_hln, and arphdr::ar_pln.

Referenced by arp_rx().

Variable Documentation

◆ ar_hrd

uint16_t ar_hrd

Link-layer protocol.

This is an ARPHRD_XXX constant

Definition at line 15 of file if_arp.h.

◆ ar_pro

uint16_t ar_pro

Network-layer protocol.

This is, for Ethernet, an ETH_P_XXX constant.

Definition at line 20 of file if_arp.h.

◆ ar_hln

uint8_t ar_hln

Link-layer address length.

Definition at line 22 of file if_arp.h.

◆ ar_pln

uint8_t ar_pln

Network-layer address length.

Definition at line 24 of file if_arp.h.

◆ ar_op

uint16_t ar_op

ARP opcode.

Definition at line 26 of file if_arp.h.