ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
datalink.h File Reference

Layer 2 (Data Link) - the LINK LAYER of RFC 1122 sec 2. More...

#include "protocore_config.h"

Go to the source code of this file.

Classes

struct  DatalinkNs
 Dispatch table. Addressed by offset, so the layout is asserted below. More...
 

Functions

 PROTOCORE_NS_LAYOUT (DatalinkNs, init)
 
proto_bool protocore_datalink_init (uint8_t *work)
 Bring the layer up: sets ok. The platform's link driver performs.
 

Variables

PROTOCORE_NS DatalinkNs Datalink PROTOCORE_UNUSED = {.init = protocore_datalink_init}
 Module namespace.
 

Detailed Description

Layer 2 (Data Link) - the LINK LAYER of RFC 1122 sec 2.

RFC 1122 sec 2.3.3 "Ethernet and IEEE 802 Encapsulation" states what a host on the cable does with a frame: it MUST send and receive RFC 894 encapsulation (RFC 894 "Frame Format": Ether-Type 0x0800, a data field of 46 to 1500 octets, zero-padded to the minimum), SHOULD receive RFC 1042 encapsulation intermixed with it (802.2 LLC/SNAP, K1=170), and MUST NOT send 802 packets using K1=6. RFC 1122 sec 2.4 fixes the interface this layer presents upward: a receive carries the link-layer-broadcast flag, a send carries the 5-bit TOS field.

The platform's own link driver and IP stack port perform all of it - MAC framing, medium access, address resolution - and this module is the seam a target with direct MAC-level access extends. Its one call only reports the layer up.

The module exports one symbol, Datalink. Everything in datalink.c has internal linkage.

No argument members: init takes none. No storage member: the layer holds nothing of its own, so there is no state to hand out.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file datalink.h.

Function Documentation

◆ PROTOCORE_NS_LAYOUT()

PROTOCORE_NS_LAYOUT ( DatalinkNs  ,
init   
)

◆ protocore_datalink_init()

proto_bool protocore_datalink_init ( uint8_t *  work)

Bring the layer up: sets ok. The platform's link driver performs.

Parameters
workPROTOCORE_DATALINK_BORROW bytes the caller took. Not held past the call.
Returns
PROTO_TRUE on success.

Variable Documentation

◆ PROTOCORE_UNUSED

PROTOCORE_NS DatalinkNs Datalink PROTOCORE_UNUSED = {.init = protocore_datalink_init}

Module namespace.

Definition at line 54 of file datalink.h.