struct ArpHeader

an ARP packet. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Types

Public Methods

Public Static Methods

Public Members


Detailed Description

typedef vector<uint8_t> PAYLOAD

PAYLOAD

enum Op { ARP_REQUEST = 1, ARP_REPLY }

Op

enum HwFmt { HW_ETHER = 1 }

HwFmt

ArpHeader&  assign (uint8_t* data)

assign

[static]

Create an ARP packet. The caller must allocate memory and ensure enough space (sizeof(ArpHeader) + (2 hw addresses) + (2 network addresses)).

Parameters:

datapointer where data should be stored.

Returns: the ARP header.

const ArpHeader&  assign (const PAYLOAD& payload)

assign

[static]

Parse an ARP packet.

Parameters:

payloadthe ARP header and data.

Returns: the ARP header.

void  make_gratuitous (PAYLOAD& payload, const Mac& mac, const IPv4& ip)

make_gratuitous

[static]

Create a gratuitous ARP. I.e., an ARP request for my own IP address - the one used in the source section of the ARP packet.

Parameters:

outputdata (output argument).
MACaddress of IP.
ipIP address to create request for.
void  set_sender (const Mac& mac, const IPv4& ip)

set_sender

Set the sender information in the ARP packet.

Parameters:

macsource MAC address.
ipsource IP address.
void  set_request (const IPv4& ip)

set_request

Create an ARP request for an IP address.

Parameters:

ipIP address to ask request for.
void  set_reply (const Mac& mac, const IPv4& ip)

set_reply

Create an ARP reply.

Parameters:

macMAC address of requested IP address.
ipIP address requested in the ARP request.
uint32_t  size ()

size

[const]

The size of the ARP packet (ARP header + data).

Returns: the size of the ARP packet.

bool  is_request ()

is_request

[const]

Determine whether it is an ARP request. This (usually) implies whether or not it is an ARP reply.

Returns: true if it is an ARP request.

IPv4  get_request ()

get_request

[const]

If an ARP request, return the IP address that is being asked for.

Returns: the IP address being asked for.

void  make_reply (PAYLOAD& out, const Mac& mac)

make_reply

[const]

If this is an ARP request, create an ARP reply with the give MAC address.

Parameters:

outthe ARP reply data (output parameter).
macthe MAC address of the requested IP address.
uint16_t ah_hw_fmt

ah_hw_fmt

uint16_t ah_proto_fmt

ah_proto_fmt

uint8_t ah_hw_len

ah_hw_len

uint8_t ah_proto_len

ah_proto_len

uint16_t ah_op

ah_op

uint8_t ah_data[0]

ah_data[0]


Generated by: pavlin on kobe.xorp.net on Wed Jan 7 19:10:46 2009, using kdoc 2.0a54+XORP.