KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches

API for the Address Resolution Protocol More...

Functions

int net_arp_init (void)
 Init ARP.
 
void net_arp_shutdown (void)
 Shutdown ARP.
 
int net_arp_insert (netif_t *nif, const uint8 mac[6], const uint8 ip[4], uint64 timestamp)
 Add an entry to the ARP cache manually.
 
int net_arp_lookup (netif_t *nif, const uint8 ip_in[4], uint8 mac_out[6], const ip_hdr_t *pkt, const uint8 *data, int data_size)
 Look up an entry from the ARP cache.
 
int net_arp_revlookup (netif_t *nif, uint8 ip_out[4], const uint8 mac_in[6])
 Do a reverse ARP lookup.
 
int net_arp_input (netif_t *nif, const uint8 *pkt, int len)
 Receive an ARP packet and process it (called by net_input).
 
int net_arp_query (netif_t *nif, const uint8 ip[4])
 Generate an ARP who-has query on the given device.
 

Detailed Description

API for the Address Resolution Protocol

Function Documentation

◆ net_arp_init()

int net_arp_init ( void )

Init ARP.

Return values
0On success (no error conditions defined).

◆ net_arp_input()

int net_arp_input ( netif_t * nif,
const uint8 * pkt,
int len )

Receive an ARP packet and process it (called by net_input).

Parameters
nifThe network device in use.
pktThe packet received.
lenThe length of the packet.
Return values
0On success (no error conditions defined).

◆ net_arp_insert()

int net_arp_insert ( netif_t * nif,
const uint8 mac[6],
const uint8 ip[4],
uint64 timestamp )

Add an entry to the ARP cache manually.

Parameters
nifThe network device in use.
macThe MAC address of the entry.
ipThe IPv4 address of the entry.
timestampThe entry's timestamp. Set to 0 for a permanent entry, otherwise set to the current number of milliseconds since boot (i.e, timer_ms_gettime64()).
Return values
0On success.
-1Error allocating memory.

◆ net_arp_lookup()

int net_arp_lookup ( netif_t * nif,
const uint8 ip_in[4],
uint8 mac_out[6],
const ip_hdr_t * pkt,
const uint8 * data,
int data_size )

Look up an entry from the ARP cache.

If no entry is found, then an ARP query will be sent and an error will be returned. If you specify a packet with the call, it will be sent when the reply comes in.

Parameters
nifThe network device in use.
ip_inThe IP address to lookup.
mac_outStorage for the MAC address, if found.
pktA simple IPv4 header, if you want to send one when a response comes in (if not found immediately).
dataPacket data to go with the header.
data_sizeThe size of data.
Return values
0On success.
-1A query is outstanding for that address.
-2Address not found, query generated.
-3Error allocating memory.

◆ net_arp_query()

int net_arp_query ( netif_t * nif,
const uint8 ip[4] )

Generate an ARP who-has query on the given device.

Parameters
nifThe network device to use.
ipThe IP to query.
Return values
0On success (no error conditions defined).

◆ net_arp_revlookup()

int net_arp_revlookup ( netif_t * nif,
uint8 ip_out[4],
const uint8 mac_in[6] )

Do a reverse ARP lookup.

This function looks for an IP for a given mac address; note that if this fails, you have no recourse.

Parameters
nifThe network device in use.
ip_outStorage for the IPv4 address.
mac_inThe MAC address to look up.
Return values
0On success.
-1On failure.

◆ net_arp_shutdown()

void net_arp_shutdown ( void )

Shutdown ARP.