Collaboration diagram for ARP:
ARP is used to map IP addresses to hardware addresses. Each network interface of Nut/Net keeps its own mapping table.
When an IP packet has to be sent out, IP needs the hardware address to pass it to the Ethernet layer. If the mapping is not in the ARP cache, an Ethernet broadcast packet is sent to the local network requesting the physical hardware address for the given IP address.
Data Structures | |
struct | _ARPENTRY |
ARP entry structure. More... | |
struct | _ARPENTRY |
ARP entry structure. More... | |
ARP Configuration | |
The Nut/OS Configurator may be used to override the default values. | |
#define | MAX_ARPAGE 9 |
Maximum age of an entry in the ARP cache in minutes. | |
#define | MAX_ARPREQUESTS 1 |
Maximum number of ARP requests generated per query. | |
#define | MIN_ARPWAIT 500 |
Minimum wait before sending out a new ARP request. | |
Defines | |
#define | ATF_REM 0x01 |
Entry marked for removal. | |
#define | ATF_COM 0x02 |
Completed entry. | |
#define | ATF_PERM 0x04 |
Permanent entry. | |
Typedefs | |
typedef _ARPENTRY | ARPENTRY |
ARP entry type. | |
Functions | |
void | NutArpCacheUpdate (NUTDEVICE *dev, u_long ip, u_char *ha) |
Update an ARP entry. | |
int | NutArpCacheQuery (NUTDEVICE *dev, CONST u_long ip, u_char *mac) |
Query MAC address for a specified IP address. | |
void | NutArpInput (NUTDEVICE *dev, NETBUF *nb) |
Handle incoming ARP packets. | |
NETBUF * | NutArpAllocNetBuf (u_short type, u_long ip, u_char *mac) |
Allocate an ARP network buffer structure. | |
int | NutArpOutput (NUTDEVICE *dev, NETBUF *nb) |
Send an ARP packet. |
|
Maximum age of an entry in the ARP cache in minutes. Outdated entries will be regularly removed, forcing the Ethernet interface to generate new ARP requests. This way MAC address changes are detected. |
|
Maximum number of ARP requests generated per query. If no ARP response is received after sending out the specified number of request, the related IP address is considered unreachable. |
|
Minimum wait before sending out a new ARP request. The specified number of milliseconds will be doubled on each retry. |
|
Update an ARP entry. If an entry with the same IP address exists, then this entry is updated. If no entry exists, a new one is created. All threads waiting for address resolution are woken up.
|
|
Query MAC address for a specified IP address. If no entry is available in the ARP cache, an incomplete entry is created and ARP requests are generated on increasing time intervals. The calling thread is suspended until a matching ARP response is received or until a number of requests have been generated without receiving a response.
|
|
Handle incoming ARP packets. Packets not destined to us or packets with unsupported address type or item length are silently discarded.
|
|
Allocate an ARP network buffer structure.
|
|
Send an ARP packet.
|