Files | |
file | ethernet.c |
Ethernet implementation (license: GPLv2). | |
file | ethernet.h |
Ethernet header (license: GPLv2). | |
Modules | |
Ethernet configuration | |
Defines | |
#define | ETHERNET_FRAME_TYPE_IP |
Protocol identifier of the IP protocol. | |
#define | ETHERNET_FRAME_TYPE_ARP |
Protocol identifier of the ARP protocol. | |
#define | ethernet_get_buffer() |
Retrieves a pointer to the ethernet transmit buffer. | |
#define | ethernet_get_buffer_size() |
Retrieves the maximum payload size of the transmit buffer. | |
Functions | |
void | ethernet_init (const uint8_t *mac) |
Initializes the ethernet layer and assigns an ethernet address. | |
bool | ethernet_handle_packet () |
Reads incoming packets and forwards them to the appropriate higher-level protocol. | |
bool | ethernet_send_packet (const uint8_t *mac_dest, uint16_t type, uint16_t data_len) |
Sends data from the transmit buffer to a remote host. | |
const uint8_t * | ethernet_get_mac () |
Retrieves the current ethernet address. |
#define ETHERNET_FRAME_TYPE_IP |
Protocol identifier of the IP protocol.
#define ETHERNET_FRAME_TYPE_ARP |
Protocol identifier of the ARP protocol.
#define ethernet_get_buffer | ( | ) |
Retrieves a pointer to the ethernet transmit buffer.
For sending ethernet packets, write your data to the buffer returned by this function and call ethernet_send_packet() afterwards.
#define ethernet_get_buffer_size | ( | ) |
Retrieves the maximum payload size of the transmit buffer.
You may not send more bytes per ethernet packet than returned by this function.
void ethernet_init | ( | const uint8_t * | mac | ) |
Initializes the ethernet layer and assigns an ethernet address.
[in] | mac | The ethernet MAC address to configure for the network interface. Six bytes are used from this buffer. |
bool ethernet_handle_packet | ( | ) |
Reads incoming packets and forwards them to the appropriate higher-level protocol.
true
if a packet has been handled, false
if none has been waiting. bool ethernet_send_packet | ( | const uint8_t * | mac_dest, | |
uint16_t | type, | |||
uint16_t | data_len | |||
) |
Sends data from the transmit buffer to a remote host.
[in] | mac_dest | The six byte ethernet address of the remote host to which the packet gets sent. |
[in] | type | The protocol identifier of the upper layer protocol. |
[in] | data_len | The length of the packet payload which is read from the global transmit buffer. |
true
on success, false
on failure. const uint8_t * ethernet_get_mac | ( | ) |
Retrieves the current ethernet address.