|
ArvernOS
|
Data Structures | |
| struct | arp_packet_t |
Functions | |
| void | arp_request (net_interface_t *interface, uint8_t ip[4]) |
| void | arp_wait_reply (uint8_t *dst_mac) |
| void | arp_receive_packet (net_interface_t *interface, uint8_t *data, uint32_t len) |
The Address Resolution Protocol (ARP) is used for dynamically mapping a local MAC address (Ethernet) to a protocol address (IPv4) by broadcasting a packet to all the machines on the LAN. If one of the machines uses this address, it should send a ARP reply.
This module allows to send a ARP request on a given interface. The current "wait for a response" implementation is not bound to an interface, though, and it is implemented as a busyloop. There is no ARP cache either. Apart from that, it works great!
| void arp_receive_packet | ( | net_interface_t * | interface, |
| uint8_t * | data, | ||
| uint32_t | len ) |
Handles ARP packets that are received on an interface.
| interface | the interface that received the ARP packet |
| data | the data containing the ARP packet |
| len | the length of the data |
| void arp_request | ( | net_interface_t * | interface, |
| uint8_t | ip[4] ) |
ARP request.
| interface | the interface to use to send the ARP request |
| ip | an IPv4 address |
| void arp_wait_reply | ( | uint8_t * | dst_mac | ) |
Wait a bit to hopefully get a ARP reply. If a ARP reply is received, the buffer will be updated with the MAC address. Otherwise, the buffer will contain 0 values only.
| dst_mac | a pointer to a buffer large enough to receive a MAC address |