Expand description
Pure ZMTP 3.1 framing — zero I/O, zero async, wasm32-safe.
This module provides synchronous byte-manipulation functions for ZMTP 3.1 frame encoding/decoding, greeting construction/validation, and command parsing. It is compiled on all targets (including wasm32) and serves as the single source of truth for ZMTP wire format logic.
Async I/O wrappers live in transport::zmtp_quic::ZmtpStream.
Structs§
- Zmtp
Command - A parsed ZMTP command.
- Zmtp
Frame - A parsed ZMTP frame (owned, no
Bytesdependency).
Enums§
- ZmqSocket
Type - ZMQ socket types for ZMTP handshake.
Constants§
- GREETING_
SIZE - ZMTP greeting size (always 64 bytes).
- MAX_
FRAME_ SIZE - Maximum allowed frame size (64 MiB) — prevents unbounded allocation from malicious frames.
- MECHANISM_
NULL - ZMTP mechanism name for NULL (no encryption at ZMTP layer).
- ZMTP_
VERSION_ MAJOR - ZMTP protocol version.
- ZMTP_
VERSION_ MINOR
Functions§
- build_
greeting - Build the 64-byte ZMTP greeting.
- build_
ready_ metadata - Build READY metadata with size-prefixed property encoding (RFC 37).
- decode_
flat_ parts - Decode flat-encoded parts:
[4B-len, data, 4B-len, data, ...] - decode_
frame - Decode a single ZMTP frame from a buffer.
- decode_
frames_ to_ flat - Decode ZMTP frames to flat encoding for WASM boundary.
- decode_
multipart - Decode a multipart message from a buffer of concatenated ZMTP frames.
- encode_
command - Encode a ZMTP command frame.
- encode_
frame - Encode a single ZMTP frame to bytes.
- encode_
multipart - Encode a multipart message as ZMTP frames.
- encode_
multipart_ flat - Encode multipart with flat encoding for WASM boundary.
- validate_
greeting - Validate a peer’s ZMTP greeting.
- validate_
ready_ command - Validate a READY command.