API for the Address Resolution Protocol
More...
|
| int | net_arp_init (void) |
| | Init ARP.
|
| |
| void | net_arp_shutdown (void) |
| | Shutdown ARP.
|
| |
| int | net_arp_insert (netif_t *nif, const uint8 mac[6], const uint8 ip[4], uint64 timestamp) |
| | Add an entry to the ARP cache manually.
|
| |
| int | net_arp_lookup (netif_t *nif, const uint8 ip_in[4], uint8 mac_out[6], const ip_hdr_t *pkt, const uint8 *data, int data_size) |
| | Look up an entry from the ARP cache.
|
| |
| int | net_arp_revlookup (netif_t *nif, uint8 ip_out[4], const uint8 mac_in[6]) |
| | Do a reverse ARP lookup.
|
| |
| int | net_arp_input (netif_t *nif, const uint8 *pkt, int len) |
| | Receive an ARP packet and process it (called by net_input).
|
| |
| int | net_arp_query (netif_t *nif, const uint8 ip[4]) |
| | Generate an ARP who-has query on the given device.
|
| |
API for the Address Resolution Protocol
◆ net_arp_init()
| int net_arp_init |
( |
void | | ) |
|
Init ARP.
- Return values
-
| 0 | On success (no error conditions defined). |
◆ net_arp_input()
| int net_arp_input |
( |
netif_t * | nif, |
|
|
const uint8 * | pkt, |
|
|
int | len ) |
Receive an ARP packet and process it (called by net_input).
- Parameters
-
| nif | The network device in use. |
| pkt | The packet received. |
| len | The length of the packet. |
- Return values
-
| 0 | On success (no error conditions defined). |
◆ net_arp_insert()
Add an entry to the ARP cache manually.
- Parameters
-
| nif | The network device in use. |
| mac | The MAC address of the entry. |
| ip | The IPv4 address of the entry. |
| timestamp | The entry's timestamp. Set to 0 for a permanent entry, otherwise set to the current number of milliseconds since boot (i.e, timer_ms_gettime64()). |
- Return values
-
| 0 | On success. |
| -1 | Error allocating memory. |
◆ net_arp_lookup()
Look up an entry from the ARP cache.
If no entry is found, then an ARP query will be sent and an error will be returned. If you specify a packet with the call, it will be sent when the reply comes in.
- Parameters
-
| nif | The network device in use. |
| ip_in | The IP address to lookup. |
| mac_out | Storage for the MAC address, if found. |
| pkt | A simple IPv4 header, if you want to send one when a response comes in (if not found immediately). |
| data | Packet data to go with the header. |
| data_size | The size of data. |
- Return values
-
| 0 | On success. |
| -1 | A query is outstanding for that address. |
| -2 | Address not found, query generated. |
| -3 | Error allocating memory. |
◆ net_arp_query()
Generate an ARP who-has query on the given device.
- Parameters
-
| nif | The network device to use. |
| ip | The IP to query. |
- Return values
-
| 0 | On success (no error conditions defined). |
◆ net_arp_revlookup()
Do a reverse ARP lookup.
This function looks for an IP for a given mac address; note that if this fails, you have no recourse.
- Parameters
-
| nif | The network device in use. |
| ip_out | Storage for the IPv4 address. |
| mac_in | The MAC address to look up. |
- Return values
-
| 0 | On success. |
| -1 | On failure. |
◆ net_arp_shutdown()
| void net_arp_shutdown |
( |
void | | ) |
|