Title: arp_cache_t


Each entry in an arp table is of type arp_cache_t:

typedef struct arp_cache

{
int ac_flags;
int ac_state;
ether_addr_t ac_ethaddr;
ipaddr_t ac_ipaddr;
arp_port_t *ac_port;
time_t ac_expire;
time_t ac_lastuse;
} arp_cache_t;
int ac_flags:

ac_flags can be one of the following:

#define ACF_EMPTY 0
#define ACF_GOTREQ 1

When an arp-request is received, an entry in the arp table is created for the system that sent the arp-request (if an entry doesn't already exist) and, if the system was requesting the ethernet address that corresponds to the local system's ip address, the ACF_GOTREQ flag for the entry is set.


int ac_state:

The possible states for an arp table entry are:

#define ACS_UNUSED 0
#define ACS_INCOMPLETE 1
#define ACS_VALID 2
#define ACS_UNREACHABLE 3

ACS_INCOMPLETE indicates that the arp code has sent out an arp broadcast to determine the ethernet address that matches an ip address but a valid response has not yet been received. The other states are self-explanatory.


ether_addr_t ac_ethaddr: The ethernet address.


ipaddr_t ac_ipaddr: The ip address.


arp_port_t *ac_port: The arp port associated with the entry. If you have more than one ethernet port, there will be more than one arp port.


time_t ac_expire: The expiration time for the entry. If the system is found to be unreachable, the expiration time for the entry's unreachable status is 5 seconds.


time_t ac_lastuse: The time of the entry's last access. If the arp table is full and an entry is needed for a new ip address to ethernet mapping, the entry with the earliest ac_lastuse is claimed.