|
Listing 4:
A function to search the ARP cache for a hardware address
|
INT8U *
NetArpLookup(INT32U ip_addr)
{
int i;
/*
* Search the ARP cache for a matching record.
*/
for (i = 0; i
<
NET_ARP_CACHE_SIZE; i++)
{
if (gArpCache[i].ip_addr == ip_addr)
{
/*
* Found a match, return the hardware address.
*/
return (gArpCache[i].hw_addr);
}
}
/*
* Not found, return a pointer to the broadcast address.
*/
return (broadcast);
} /* NetArpLookup() */
|
|
|
|
|