mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-16 16:13:45 +00:00
Implement API function to iterate over stable ARP table entries
This commit is contained in:
parent
73bb986737
commit
39370db55d
@ -198,6 +198,7 @@ struct etharp_q_entry {
|
|||||||
void etharp_tmr(void);
|
void etharp_tmr(void);
|
||||||
s8_t etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr,
|
s8_t etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr,
|
||||||
struct eth_addr **eth_ret, const ip4_addr_t **ip_ret);
|
struct eth_addr **eth_ret, const ip4_addr_t **ip_ret);
|
||||||
|
u8_t etharp_get_entry(u8_t i, ip4_addr_t **ipaddr, struct netif **netif, struct eth_addr **eth_ret);
|
||||||
err_t etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr);
|
err_t etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr);
|
||||||
err_t etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q);
|
err_t etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q);
|
||||||
err_t etharp_request(struct netif *netif, const ip4_addr_t *ipaddr);
|
err_t etharp_request(struct netif *netif, const ip4_addr_t *ipaddr);
|
||||||
|
@ -650,6 +650,32 @@ etharp_find_addr(struct netif *netif, const ip4_addr_t *ipaddr,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Possibility to iterate over stable ARP table entries
|
||||||
|
*
|
||||||
|
* @param i entry number, 0 to ARP_TABLE_SIZE
|
||||||
|
* @param ipaddr return value: IP address
|
||||||
|
* @param netif return value: points to interface
|
||||||
|
* @param eth_ret return value: ETH address
|
||||||
|
* @return 1 on valid index, 0 otherwise
|
||||||
|
*/
|
||||||
|
u8_t
|
||||||
|
etharp_get_entry(u8_t i, ip4_addr_t **ipaddr, struct netif **netif, struct eth_addr **eth_ret)
|
||||||
|
{
|
||||||
|
LWIP_ASSERT("ipaddr != NULL", ipaddr != NULL);
|
||||||
|
LWIP_ASSERT("netif != NULL", netif != NULL);
|
||||||
|
LWIP_ASSERT("eth_ret != NULL", eth_ret != NULL);
|
||||||
|
|
||||||
|
if((i < ARP_TABLE_SIZE) && (arp_table[i].state >= ETHARP_STATE_STABLE)) {
|
||||||
|
*ipaddr = &arp_table[i].ipaddr;
|
||||||
|
*netif = arp_table[i].netif;
|
||||||
|
*eth_ret = &arp_table[i].ethaddr;
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if ETHARP_TRUST_IP_MAC
|
#if ETHARP_TRUST_IP_MAC
|
||||||
/**
|
/**
|
||||||
* Updates the ARP table using the given IP packet.
|
* Updates the ARP table using the given IP packet.
|
||||||
|
Loading…
Reference in New Issue
Block a user