The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
ethernet.h File Reference

Ethernet II frames: the 14-byte header in front of ARP and IPv4. More...

#include "netif.h"

Go to the source code of this file.

Macros

#define ETH_HEADER_SIZE   14
#define ETH_FRAME_MIN   60
#define ETH_TYPE_IPV4   0x0800
#define ETH_TYPE_ARP   0x0806

Functions

void eth_receive (netif_t *netif, const uint8_t *frame, uint32_t length)
 a received frame (net_lock held): checks the address and gives the payload to ARP or IPv4.
bool eth_send (netif_t *netif, const uint8_t dst[ETH_ADDR_LEN], uint16_t type, const void *payload, uint32_t length)
 send a payload in a frame to dst (net_lock held).

Variables

const uint8_t eth_broadcast [ETH_ADDR_LEN]

Detailed Description

Ethernet II frames: the 14-byte header in front of ARP and IPv4.

Macro Definition Documentation

◆ ETH_HEADER_SIZE

#define ETH_HEADER_SIZE   14

◆ ETH_FRAME_MIN

#define ETH_FRAME_MIN   60

◆ ETH_TYPE_IPV4

#define ETH_TYPE_IPV4   0x0800

◆ ETH_TYPE_ARP

#define ETH_TYPE_ARP   0x0806

Function Documentation

◆ eth_receive()

void eth_receive ( netif_t * netif,
const uint8_t * frame,
uint32_t length )

a received frame (net_lock held): checks the address and gives the payload to ARP or IPv4.

◆ eth_send()

bool eth_send ( netif_t * netif,
const uint8_t dst[ETH_ADDR_LEN],
uint16_t type,
const void * payload,
uint32_t length )

send a payload in a frame to dst (net_lock held).

short frames are padded to ETH_FRAME_MIN.

Variable Documentation

◆ eth_broadcast

const uint8_t eth_broadcast[ETH_ADDR_LEN]
extern