Transport Layer¶
Status: Planned
All transport layer modules are in the design phase. Implementations will follow the same header-only, zero-allocation pattern as existing modules.
Overview¶
Transport layer protocols for reliable and unreliable data delivery. Focused on low-latency implementations suitable for trading systems, telemetry, and real-time control.
┌─────────────────────────────────────────────────────────────────────┐
│ Application │
├──────────────────┬──────────────────┬──────────────────────────────┤
│ TCP Stack │ UDP Multicast │ QUIC │
│ (State Machine) │ (Group Mgmt) │ (0-RTT + TLS) │
├──────────────────┼──────────────────┼──────────────────────────────┤
│ raw_socket / │ raw_socket / │ UDP + TLS 1.3 │
│ kernel TCP │ kernel UDP │ │
├──────────────────┴──────────────────┴──────────────────────────────┤
│ Network Layer (L2/L3) │
└─────────────────────────────────────────────────────────────────────┘
Modules¶
| Module | Status | Description | Target Latency |
|---|---|---|---|
| TCP Stack | 🔲 Planned | Userspace TCP state machine | < 10 µs handshake |
| UDP Multicast | 🔲 Planned | IGMP group management, multicast send/recv | < 5 µs |
| QUIC | 🔲 Planned | QUIC 0-RTT connection establishment | < 1 ms |
Design Goals¶
- Deterministic latency Bound worst-case times, avoid kernel scheduling jitter
- Userspace-first Bypass kernel stack where possible (raw_socket + state machine)
- Zero allocation in fast path Pre-allocate all buffers at startup
- Integration with epoll reactor All sockets register as FDs in the event loop
- Protocol correctness RFC-compliant state machines with exhaustive testing
Architecture Decisions¶
| Decision | Rationale |
|---|---|
| Userspace TCP | Avoid kernel TCP's buffering, congestion control overhead |
| Kernel UDP multicast | IGMP handled by kernel; userspace for packet processing |
| QUIC over UDP | 0-RTT reduces connection latency; built-in encryption |
| Pre-allocated buffers | Memory pool supplies all packet buffers |
Dependencies¶
| Module | Depends On |
|---|---|
| TCP Stack | raw_socket, epoll_reactor, ring_buffer |
| UDP Multicast | epoll_reactor, memory_pool |
| QUIC | UDP multicast, memory_pool, (TLS library) |