ArvernOS
|
Data Structures | |
struct | ethernet_header_t |
Functions | |
void | ethernet_receive_frame (net_interface_t *interface, uint8_t *data, uint32_t len) |
void | ethernet_send_frame (net_interface_t *interface, uint8_t dst_mac[6], uint16_t ethertype, uint8_t *data, uint32_t len) |
void ethernet_receive_frame | ( | net_interface_t * | interface, |
uint8_t * | data, | ||
uint32_t | len ) |
Receives an Ethernet frame on an interface. This is a handler that gets called by the lower layer (i.e. the network driver). After having decoded the frame, this handler will likely call a handler of this layer (2) or the layer above (3).
interface | the network interface that received the frame |
data | the data containing the Ethernet frame |
len | the length of the data |
void ethernet_send_frame | ( | net_interface_t * | interface, |
uint8_t | dst_mac[6], | ||
uint16_t | ethertype, | ||
uint8_t * | data, | ||
uint32_t | len ) |
Sends an Ethernet frame over an interface.
We are at the Ethernet level, so we can only communicate with machines in the same LAN and we use MAC addresses for that. The destination MAC address is therefore used by one of the machines in the LAN, usually the DNS server or the "gateway" (but it could be any other machine for LAN exchanges). We will use the MAC address of the gateway when we will send Internet packets for instance.
interface | the network interface used to send the frame |
dst_mac | the destination MAC address |
ethertype | a value indicating which protocol is encapsulated in the payload of the frame |
data | the encapsulated payload |
len | the length of the data |