Expand description
TCP control-channel framing for the Mumble protocol.
Every TCP message (after TLS termination) is length-prefixed with a fixed six-byte header:
[ type: u16 big-endian ][ length: u32 big-endian ][ payload: `length` bytes ]REF: references/vendored/protocol/Connection.cpp : Connection::socketRead
(reads 6 header bytes, then iPacketLength payload bytes; incremental).
REF: references/vendored/protocol/Connection.cpp : if (iPacketLength > 0x7fffff)
(a larger declared length is a “huge packet” and the peer is dropped).
REF: references/vendored/protocol/MumbleProtocol.h : TCPMessageType (type codes 0..=26).
This module is deliberately dumb about semantics: it extracts the raw type
code and the payload bytes. Mapping the code to a known message type, and
rejecting unknown codes, is TcpMessageType::try_from’s job, kept separate
so a partial or unknown frame is never confused with a malformed one.
Structs§
- Frame
- One complete TCP frame borrowed from an input buffer.
Enums§
- Framing
Error - Errors produced while framing the TCP control channel.
- TcpMessage
Type - The TCP message type register.
Constants§
- HEADER_
LEN - Fixed size of a TCP message header: a 2-byte type plus a 4-byte length.
REF: Connection.cpp :
unsigned char a_ucBuffer[6]. - MAX_
PAYLOAD_ LEN - Largest payload length the framer accepts. A declared length above this is
treated as hostile; the caller must drop the connection (fail closed, R6).
REF: Connection.cpp :
if (iPacketLength > 0x7fffff) { ... "huge packet" ... }.
Functions§
- parse_
frame - Try to parse a single frame from the front of
buf. - write_
frame - Encode a frame (header plus payload) onto
out. The inverse ofparse_frame;parse_frame(write_frame(t, p)) == (t, p).