Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

XgARP


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.

NETBUFNutArpAllocNetBuf (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.


Detailed Description

Todo:
Response may reuse received ARP packet.

Function Documentation

NETBUF* NutArpAllocNetBuf u_short    type,
u_long    ip,
u_char   mac
 

Allocate an ARP network buffer structure.

Parameters:
type  Type of ARP packet.
ip  Target IP address.
mac  Target MAC address, null pointer for broadcast.
Returns:
Pointer to the allocated network buffer structure or 0 on failure.

int NutArpCacheQuery NUTDEVICE   dev,
CONST u_long    ip,
u_char   mac
 

Query MAC address for a specified IP address.

If no entry is available in the ARP cache, an ARP request is generated, sent out to the network and the calling thread will be suspended.

Parameters:
dev  Identifies the device to be used for sending. This pointer must have been retrieved previously by using the NutDeviceOpen() function.
ip  IP address of which the caller asked the MAC address.
mac  Buffer for the retrieved MAC address.
Returns:
0 if address resolved, -1 otherwise.

void NutArpCacheUpdate NUTDEVICE   dev,
u_long    ip,
u_char   ha
 

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.

Note:
This function is automatically called on each incoming ARP telegram. Applications typically do not call this function.
Parameters:
dev  Identifies the device, which cache is updated. This pointer must have been retrieved previously by using the NutDeviceOpen() function.
ip  Requested IP address in network byte order.
ha  Pointer to a buffer which receives the MAC address.

void NutArpInput NUTDEVICE   dev,
NETBUF   nb
 

Handle incoming ARP packets.

Packets not destined to us or packets with unsupported address type or item length are silently discarded.

Note:
This routine is called by the Ethernet layer on incoming ARP packets. Applications typically do not call this function.
Parameters:
dev  Identifies the device that received the packet.
nb  Pointer to a network buffer structure containing the ARP packet.

int NutArpOutput NUTDEVICE   dev,
NETBUF   nb
 

Send an ARP packet.

Note:
Applications typically do not call this function.
Parameters:
dev  Identifies the device to use.
nb  Network buffer structure containing the packet to be sent. The structure must have been allocated by a previous call NutNetBufAlloc().
Returns:
0 on success, -1 in case of any errors.


Generated on Thu Jan 30 22:30:59 2003 for EduNet by doxygen1.2.18