Skip to main content

Module types

Module types 

Source
Available on crate feature std only.
Expand description

Phantom Protocol - Types

Core types for the Phantom Protocol:

  • SessionId (256-bit, salt for encryption)
  • StreamId, SequenceNumber
  • PacketHeader, PacketFlags
  • PhantomPacket (the single on-wire data packet)

Structs§

PacketFlags
Packet flags bitfield (16-bit).
PacketHeader
Packet header — 15 bytes on the wire (PacketHeader::SIZE); the AEAD AAD is the separate, larger 47-byte image (PacketHeader::AAD_SIZE).
PhantomPacket
Full packet with header and payload — the single on-wire data packet.
RawPacket
A partially-decoded v6 packet: the cleartext envelope with the entire 15-byte header-protected region (version included) left opaque, plus the payload (the message remainder). The recv path produces this from the raw wire bytes before it has the per-session HP key — it locates the ciphertext sample (payload, at the fixed offset 15) and calls RawPacket::unmask_header with the mask computed from payload to recover the PacketHeader (including its version byte; the off-wire session_id is then set by Session::parse_protected). This is the codec half of header protection; the mask itself is computed by the session’s HeaderProtector (this module stays crypto-free). Routing is by the outer (rotating) ConnId.
SessionId
256-bit Session Identifier

Enums§

ControlMessage
Legacy control-message enum for session management. NOTE: this is not the live handshake / control wire format — the real handshake uses the borsh structs in transport::handshake (ClientHello / ServerHello / …) and post-handshake control rides in PacketFlags (REKEY / PATH_VALIDATION / KEEPALIVE / …). This enum is currently unreferenced; retained as a definitional placeholder.
LegType
Transport-leg discriminant, retained as the metric/telemetry label axis in crate::observability (the cardinality contract).
SchedulerMode
Scheduling strategy for the Scheduler. NOTE: the scheduler is vestigial — the project does single-path connection migration, not multipath aggregation, so select_paths is never called on the live data path. This enum is constructed (defaulting to LowLatency) and threaded through Session/config but does not steer production traffic.
WireError
Error decoding a packet header / packet from its on-wire bytes.

Constants§

HP_PROTECTED_LEN
Length of the header-protected region (PacketHeader::SIZE - HP_PROTECTED_OFFSET = 15 bytes in v6: version ‖ packet_number ‖ flags ‖ stream_id ‖ epoch ‖ path_id). The HeaderProtector produces a full 16-byte mask block; the first HP_PROTECTED_LEN bytes are used.
HP_PROTECTED_OFFSET
Wire offset where the header-protected region begins. WIRE v6 (anti-fingerprint): 0 — the masked region now covers the WHOLE 15-byte header, INCLUDING the version(1) byte, so the data-plane wire has no constant cleartext byte to fingerprint. (Was 1 in v5, after the cleartext version byte; 33 in v4, after version ‖ session_id.) Everything at [HP_PROTECTED_OFFSET..PacketHeader::SIZE] is XOR-masked on the wire.
WIRE_VERSION
The sole on-wire packet-header version byte. Pinned — the wire format is not negotiated (pre-1.0, no users); a decoder rejects anything else. 6 is the anti-fingerprint diet: the version byte is now itself HP-masked (the WHOLE 15-byte header [0..15] is masked — no constant cleartext byte), and the two cleartext u32 length prefixes are dropped (payload is the message remainder — recv_bytes is message-framed — and extensions leave the wire), saving 8 bytes/packet. 5 (ε) collapsed the two connection identifiers into one rotating CID: the 32-byte inner session_id left the data-plane wire (it stays in the AEAD AAD, reconstructed from session context), shrinking the header to 15 bytes. 4 (T4.6) added QUIC-style header protection (RFC 9001 §5.4) over a 47-byte header; 3 (Phase 4) widened the packet number to u64. See PROTOCOL.md § 4.2.

Type Aliases§

PacketNumber
Per-direction monotonic AEAD packet number (① — Phase 4). Feeds the AEAD nonce and the per-direction replay window. u64 so it never wraps within a session — this is what retires the C1 forced-rekey watermark.
SequenceNumber
Per-stream gap-free reliable-data offset (A.5). Stays u32.
StreamId
Stream identifier within a session