The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
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
15
extern
const
uint8_t
eth_broadcast
[
ETH_ADDR_LEN
];
16
17
/**
18
* a received frame (net_lock held): checks the address and gives the
19
* payload to ARP or IPv4.
20
*/
21
void
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
*/
27
bool
eth_send
(
netif_t
*
netif
,
const
uint8_t
dst[
ETH_ADDR_LEN
],
uint16_t
type,
28
const
void
*payload,
uint32_t
length);
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.
Definition
ethernet.c:18
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).
Definition
ethernet.c:44
eth_broadcast
const uint8_t eth_broadcast[ETH_ADDR_LEN]
Definition
ethernet.c:13
uint32_t
unsigned int uint32_t
Definition
fb.h:17
uint8_t
unsigned char uint8_t
Definition
fb.h:18
uint16_t
unsigned short uint16_t
Definition
stdint.h:13
netif.h
network interfaces: the devices that send and receive frames.
ETH_ADDR_LEN
#define ETH_ADDR_LEN
Definition
netif.h:23
netif_t
struct netif netif_t
netif
Definition
netif.h:37
src
kernel
net
ethernet.h
Generated by
1.18.0