The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
ethernet.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * @file ethernet.h
5 * @brief Ethernet II frames: the 14-byte header in front of ARP and IPv4.
6 */
7
8#include "netif.h"
9
10#define ETH_HEADER_SIZE 14
11#define ETH_FRAME_MIN 60 // without the checksum the card adds
12#define ETH_TYPE_IPV4 0x0800
13#define ETH_TYPE_ARP 0x0806
14
16
17/**
18 * a received frame (net_lock held): checks the address and gives the
19 * payload to ARP or IPv4.
20 */
21void eth_receive(netif_t *netif, const uint8_t *frame, uint32_t length);
22
23/**
24 * send a payload in a frame to dst (net_lock held). short frames are
25 * padded to ETH_FRAME_MIN.
26 */
27bool eth_send(netif_t *netif, const uint8_t dst[ETH_ADDR_LEN], uint16_t type,
28 const void *payload, uint32_t length);
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.
Definition ethernet.c:18
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).
Definition ethernet.c:44
const uint8_t eth_broadcast[ETH_ADDR_LEN]
Definition ethernet.c:13
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
unsigned short uint16_t
Definition stdint.h:13
network interfaces: the devices that send and receive frames.
#define ETH_ADDR_LEN
Definition netif.h:23
struct netif netif_t
Definition netif.h:37