ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
TcpConn Struct Reference

A single TCP connection context. More...

#include <common.h>

Public Member Functions

 EMBED_ALIGN (MMGR_ALIGN_BYTES) uint8_t rx_buffer[RX_BUF_SIZE]
 The ring's bytes, owned here.
 

Public Attributes

uint8_t id
 Fixed slot index (0 … MAX_CONNS-1).
 
_Atomic ConnState state
 Lifecycle state; acquire/release for inter-task visibility.
 
protocore_pcb * pcb
 Stack control block; null when slot is free.
 
uint32_t last_activity_ms
 protocore_millis() timestamp of last TX/RX event.
 
mmgr_ring rx
 The receive ring over rx_buffer.
 
size_t rx_unacked
 
uint8_t listener_id
 Index into listener_pool[]; set at accept time.
 
uint8_t owner
 Worker that owns this slot (round-robin at accept). Always 0 at N=1.
 
ProtoConn proto
 Application protocol for this connection.
 
uint8_t proto_slot
 Per-protocol session/pool index (0xFF = none): the SSH session, an MQTT/Modbus session, etc.
 
protocore_if_kind iface
 Interface this connection arrived on; set at accept time.
 
uint8_t tls
 Non-zero when this connection is TLS (set at accept time).
 

Detailed Description

A single TCP connection context.

Sized so that MAX_CONNS instances fit in a static array without fragmentation. All fields except the ring and the state may only be accessed from the main-loop task.

Definition at line 59 of file common.h.

Member Function Documentation

◆ EMBED_ALIGN()

TcpConn::EMBED_ALIGN ( MMGR_ALIGN_BYTES  )

The ring's bytes, owned here.

Member Data Documentation

◆ id

uint8_t TcpConn::id

Fixed slot index (0 … MAX_CONNS-1).

Definition at line 61 of file common.h.

◆ state

_Atomic ConnState TcpConn::state

Lifecycle state; acquire/release for inter-task visibility.

Definition at line 62 of file common.h.

◆ pcb

protocore_pcb* TcpConn::pcb

Stack control block; null when slot is free.

Definition at line 63 of file common.h.

◆ last_activity_ms

uint32_t TcpConn::last_activity_ms

protocore_millis() timestamp of last TX/RX event.

Definition at line 64 of file common.h.

◆ rx

mmgr_ring TcpConn::rx

The receive ring over rx_buffer.

Definition at line 67 of file common.h.

◆ rx_unacked

size_t TcpConn::rx_unacked

Bytes drained since the last ACK to the stack. Worker-only: the window is reopened by exactly these, so it tracks ring occupancy (ack-on-consume) rather than copy.

Definition at line 68 of file common.h.

◆ listener_id

uint8_t TcpConn::listener_id

Index into listener_pool[]; set at accept time.

Definition at line 72 of file common.h.

◆ owner

uint8_t TcpConn::owner

Worker that owns this slot (round-robin at accept). Always 0 at N=1.

Definition at line 73 of file common.h.

◆ proto

ProtoConn TcpConn::proto

Application protocol for this connection.

Definition at line 74 of file common.h.

◆ proto_slot

uint8_t TcpConn::proto_slot

Per-protocol session/pool index (0xFF = none): the SSH session, an MQTT/Modbus session, etc.

Definition at line 76 of file common.h.

◆ iface

protocore_if_kind TcpConn::iface

Interface this connection arrived on; set at accept time.

Definition at line 77 of file common.h.

◆ tls

uint8_t TcpConn::tls

Non-zero when this connection is TLS (set at accept time).

Definition at line 78 of file common.h.


The documentation for this struct was generated from the following file: