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

Layer 4 (Transport) - the passive OPEN: bound ports and their accept-time gates. More...

Go to the source code of this file.

Classes

struct  TcpBindArgs
 RFC 9293 sec 3.9.1.1 passive OPEN: what a bound port is. More...
 
struct  TcpGateArgs
 The accept-time gates: what a throttle or an allowlist judges. Nothing a bind reads. More...
 
struct  TcpQueueArgs
 Event routing: whose queue an event goes to, and what it names. More...
 
struct  TcpListenerVars
 
struct  TcpListenerNs
 The entries. More...
 

Functions

PROTOCORE_BEGIN_DECLS protocore_net_err listener_accept_cb (void *arg, protocore_pcb *newpcb, protocore_net_err err)
 Accept callback from the lower-level module - single handler for all listener ports.
 
void protocore_tcp_listener_stop (uint8_t *work)
 
void protocore_tcp_listener_stop_all (uint8_t *work)
 
void protocore_tcp_listener_stop_dynamic (uint8_t *work)
 
void protocore_tcp_listener_add (uint8_t *work)
 
void protocore_tcp_listener_add_dynamic (uint8_t *work)
 
void protocore_tcp_listener_enqueue (uint8_t *work)
 
void protocore_tcp_listener_set_dscp (uint8_t *work)
 
void protocore_tcp_listener_listener_queue (uint8_t *work)
 
void protocore_tcp_listener_accept_allowed (uint8_t *work)
 
void protocore_tcp_listener_accept_throttle_reset (uint8_t *work)
 
void protocore_tcp_listener_accept_allowed_ip (uint8_t *work)
 
void protocore_tcp_listener_per_ip_throttle_reset (uint8_t *work)
 
void protocore_tcp_listener_ip_allow_add (uint8_t *work)
 
void protocore_tcp_listener_ip_allow_add_cidr (uint8_t *work)
 
void protocore_tcp_listener_ip_allowed (uint8_t *work)
 
void protocore_tcp_listener_ip_allowlist_reset (uint8_t *work)
 
uint8_t * protocore_tcp_listener_span (void)
 The PROTOCORE_TCP_LISTENER_BORROW bytes this module's state lives in.
 

Variables

TcpListenerVars TcpListenerV
 The operands and the outcome.
 

Detailed Description

Layer 4 (Transport) - the passive OPEN: bound ports and their accept-time gates.

RFC 9293 sec 3.9.1.1: "If the active/passive flag is set to passive, then this is a call to LISTEN for an incoming connection." This is that side of OPEN. The dialing side is client.h.

Each active listener owns one listening control block and one event queue. When a new client connects, listener_accept_cb claims a slot from the shared conn_pool, wires the standard per-connection callbacks, and posts EVT_CONNECT to the owning listener's queue.

The session layer drains all active listener queues each Session.tick(), routing events to the correct protocol handler via TcpConn::proto.

Single accept callback protocore_net_arg(listen_pcb, (void*)(uintptr_t)idx) embeds the listener index in the control block's user data so a single static listener_accept_cb handles all ports.

Event posting The queue belongs to the listener, so the connection callbacks in protocol/protocol.c post to it through ::TcpListener's enqueue rather than writing a queue they do not own.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file server.h.

Function Documentation

◆ listener_accept_cb()

PROTOCORE_BEGIN_DECLS protocore_net_err listener_accept_cb ( void *  arg,
protocore_pcb *  newpcb,
protocore_net_err  err 
)

Accept callback from the lower-level module - single handler for all listener ports.

Non-static so the host unit tests can call it directly with a fabricated control block, the same convention protocol.c uses for lowlevel_recv_cb / lowlevel_sent_cb / lowlevel_err_cb - production code never calls this directly, the add binds it to the listening block.

◆ protocore_tcp_listener_stop()

void protocore_tcp_listener_stop ( uint8_t *  work)

◆ protocore_tcp_listener_stop_all()

void protocore_tcp_listener_stop_all ( uint8_t *  work)

◆ protocore_tcp_listener_stop_dynamic()

void protocore_tcp_listener_stop_dynamic ( uint8_t *  work)

◆ protocore_tcp_listener_add()

void protocore_tcp_listener_add ( uint8_t *  work)

◆ protocore_tcp_listener_add_dynamic()

void protocore_tcp_listener_add_dynamic ( uint8_t *  work)

◆ protocore_tcp_listener_enqueue()

void protocore_tcp_listener_enqueue ( uint8_t *  work)

◆ protocore_tcp_listener_set_dscp()

void protocore_tcp_listener_set_dscp ( uint8_t *  work)

◆ protocore_tcp_listener_listener_queue()

void protocore_tcp_listener_listener_queue ( uint8_t *  work)

◆ protocore_tcp_listener_accept_allowed()

void protocore_tcp_listener_accept_allowed ( uint8_t *  work)

◆ protocore_tcp_listener_accept_throttle_reset()

void protocore_tcp_listener_accept_throttle_reset ( uint8_t *  work)

◆ protocore_tcp_listener_accept_allowed_ip()

void protocore_tcp_listener_accept_allowed_ip ( uint8_t *  work)

◆ protocore_tcp_listener_per_ip_throttle_reset()

void protocore_tcp_listener_per_ip_throttle_reset ( uint8_t *  work)

◆ protocore_tcp_listener_ip_allow_add()

void protocore_tcp_listener_ip_allow_add ( uint8_t *  work)

◆ protocore_tcp_listener_ip_allow_add_cidr()

void protocore_tcp_listener_ip_allow_add_cidr ( uint8_t *  work)

◆ protocore_tcp_listener_ip_allowed()

void protocore_tcp_listener_ip_allowed ( uint8_t *  work)

◆ protocore_tcp_listener_ip_allowlist_reset()

void protocore_tcp_listener_ip_allowlist_reset ( uint8_t *  work)

◆ protocore_tcp_listener_span()

uint8_t * protocore_tcp_listener_span ( void  )

The PROTOCORE_TCP_LISTENER_BORROW bytes this module's state lives in.

Stated beside the namespace rather than on it: an entry takes a borrow, and this is where that borrow comes from. Taken once from the end of the pool, which no mark and no release walks, so the state lasts the life of the program.

Returns
the span.

Variable Documentation

◆ TcpListenerV

TcpListenerVars TcpListenerV
extern

The operands and the outcome.