Skip to main content

reddb_wire/redwire/
mod.rs

1//! RedWire — RedDB's binary TCP/TLS wire protocol.
2//!
3//! ADR 0001 (`docs/adr/0001-redwire-tcp-protocol.md`) is the
4//! normative spec. This module owns the *transport-agnostic* parts:
5//! frame layout, message-kind discriminator, flags, and the
6//! encode/decode codec. Server-side dispatch (auth handshake,
7//! session loop, listener accept) stays in `reddb` and depends on
8//! these types.
9
10pub mod builder;
11pub mod codec;
12pub mod frame;
13
14pub use builder::{BuildError, FrameBuilder};
15pub use codec::{decode_frame, encode_frame, FrameError};
16pub use frame::{Flags, Frame, MessageKind, FRAME_HEADER_SIZE, MAX_FRAME_SIZE};
17
18/// Discriminator byte every RedWire client sends as the very first
19/// byte off the wire. The service-router detector keys off this
20/// (and so does the standalone listener path).
21pub const REDWIRE_MAGIC: u8 = 0xFE;
22
23/// Highest minor version the server supports. Wire-bumped as we
24/// add features that change the handshake; data-plane additions
25/// flow through `Hello.features` instead.
26pub const MAX_KNOWN_MINOR_VERSION: u8 = 0x01;
27
28/// Default port for the RedWire listener.
29pub const DEFAULT_REDWIRE_PORT: u16 = 5050;