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

Layer 4 (Transport) - DiffServ QoS marking (RFC 2474) for outbound traffic. More...

#include "protocore_config.h"

Go to the source code of this file.

Detailed Description

Layer 4 (Transport) - DiffServ QoS marking (RFC 2474) for outbound traffic.

Stamps the 6-bit DSCP into the DS field (the high 6 bits of the IPv4 TOS / IPv6 Traffic-Class byte) of outbound TCP connections and UDP datagrams so a QoS-aware network - and the Wi-Fi driver's 802.11e WMM access-category mapping - can prioritize real-time / safety packets over best-effort. The marking is applied on the stack's own thread where the pcb is created (accept / connect / udp create), so nothing is added to the send hot path. This module owns the two server-wide DSCP defaults; the per-listener override lives with its control block (tcp/server/server.c) but reads the defaults through here.

Two levels of control, coarse to fine, each set through the object it marks:

  • DiffServ.set_default: every outbound TCP connection, accepted and client, starts here.
  • TcpListener.set_dscp: every connection accepted on one port, overriding that default. A live connection has no third level. RFC 9293 sec 3.9.2 SHLD-23: an application should not change the Diffserv field during a connection, so the port is the finest granularity. DiffServ.set_udp is the same default for outbound datagrams. A DSCP of 0 is best-effort: no marking, TOS left 0.
Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file diffserv.h.