Functions

arp_list_typearp_check_ip_address (uint32_t ip, uint16_t dev_nr)
 Perform MAC address lookup in local ARP cache to find MAC address for specified IP address. More...
 
arp_list_typecheck_arp_address (SOCKET *so, uint32_t request_time)
 Perform address resolution. More...
 
void arp_clear_cache (void)
 Invalidate ARP cache. More...
 
void arp_set_timeout (uint32_t val)
 Set timebase for ARP cache. More...
 
void arp_invalid_ip_address (uint32_t ip)
 Invalidates specific IP address. More...
 

Detailed Description

Function Documentation

arp_list_type * arp_check_ip_address ( uint32_t  ip,
uint16_t  dev_nr 
)

Before a message can be sent over Ethernet the destination MAC address must be known. Use this function to search the local ARP cache for a valid MAC address. The returned pointer to the valid MAC address (arp->addr) can be used as parameter for send_ip(). All higher level send functions (net_send(), net_send_ready() and net_send_string() ) use this function and arp_check_address() for address resolution.

Note
This function does not perform an ARP request if address is not found
Parameters
ip- IP address ( in network byte order)
dev_nr- Adapter
Returns
  • pointer to mac address
  • NULL if nothing found
Library:
net.lib
Prototype:
net.h
See also
inet_ntoa(), inet_aton() for address conversion
1 arp_list_type *arp;
2 
3 arp = arp_check_ip_address (socket-> dest_addr);
arp_list_type * check_arp_address ( SOCKET *  so,
uint32_t  request_time 
)

This function performs a ARP cache lookup for the destination IP address the socket so is configured to. If the address is not found or invalid a new ARP request is started. In case of a new ARP request the function configures the stack for the time between two consecutive requests and returns after sending the first request. Please note that in this case the returned pointer is NULL because a wait for the ARP answer could take a undetermined period of time.

Parameters
so- socket with unresolved or resolved IP address
request_time- time between two requests
Returns
  • pointer to MAC address
  • NULL if request timed out
Library:
net.lib
Prototype:
net.h
//**************************************************************************
// if arp-> send is not set to 100000, the stack uses the
// internal backoff algorithm to trigger a new ARP request;
// the backoff algorithm results in the following sequence:
// 2, 3, 5, 9, 17, 26, 37, 50, 65, 82... x ARP_REQUEST_TIME
//**************************************************************************
arp-> send = 100000;
void arp_clear_cache ( void  )

When the device is plugged from one hub or router to another it may be necessary to clear the ARP cache. Use this function to initiate a full ARP cache clear.

Parameters
-
Returns
nothing
Warning
Consecutive function calls to net_send() may fail due to unresolved addresses after calling this function.
Library:
net.lib
Prototype:
net.h
Examples:
BoardSpecific.c.
void arp_set_timeout ( uint32_t  val)

Set the ageing for ARP addresses.

Parameters
val- timeout counter (number of net_isq() loop counts)
Returns
nothing
Library:
net.lib
Prototype:
net.h
void arp_invalid_ip_address ( uint32_t  ip)

If a specific IP address is known to be invalid or is going to be invalid in the future, use this function to invalidate this address.

Parameters
ip- IP address
Returns
nothing
Library:
net.lib
Prototype:
net.h