Skip to documentation
SLOP

tiny.reticulum.wire

Reference tiny.reticulum wire

Defined in tiny.reticulum.

The byte layouts of one datagram on a mesh network, with a reader and a writer for each: the header and its flag bits, the byte that says what the payload is for, the digest that names the packet, the two shapes of the signed reply that says a packet arrived, and the payloads that open an encrypted session.

API (24)

Actions

Public operations.

Types and contracts

Public types and contracts.

Namespaces

Public namespaces.

Values and defaults

Public values and defaults.

No direct callersNo direct callstiny.reticulumwire
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/reticulum/src/root.zig:60

zig
pub const wire = @import("wire/root.zig");

Source: lib/reticulum/src/wire/root.zig

zig
//! The byte layouts of one datagram on a mesh network, with a reader and a//! writer for each: the header and its flag bits, the byte that says what the//! payload is for, the digest that names the packet, the two shapes of the//! signed reply that says a packet arrived, and the payloads that open an//! encrypted session. That network is Reticulum, in which nodes find each other//! by broadcasting signed announcements and reach each other over any medium//! that moves bytes.//!//! Two programs that have never met have to agree on every byte of a 500-byte//! datagram, down to the order of the bits inside its first byte. The code that//! reads those bytes runs where memory is fixed before the program starts, so//! it works in buffers its caller owns and hands back slices of them. One//! packet needs one name that both ends and every node between them compute the//! same way, because a signed reply travels back naming the packet it answers.//!//! The bytes a device hands over are whatever the wire delivered, so a reader//! settles every length question before it indexes into them. A packet changes//! as it travels, because the hop count rises at every node and a node carrying//! it for someone else inserts sixteen bytes of its own ahead of the address. A//! field can arrive holding a value this release has no name for, and//! discarding it would break a peer running a newer build.//!//! The subtree follows Reticulum 1.5.0, the reference implementation, pinned to//! one upstream commit by the package README and the generated conformance//! corpus. What it takes from the reference is the field order, the bit//! positions, and the length rule of each layout, and each declaration names//! the reference file and line range it follows. The package generates byte//! vectors from that release and replays them in tests, so each of those claims//! is checkable from this tree.//!//! Reading and writing both work in a slice the caller supplies and return a//! slice of it, so this code calls no allocator. The 32-byte SHA-256 digest//! that names a packet (*packet hash*) covers the low four bits of the first//! byte and everything from the address onward, which leaves out the hop count//! and the sixteen bytes a carrying node inserts, so the name holds still as//! the packet crosses the mesh. Each enum here names every bit pattern its//! field can hold, and the header's last byte, which says what the payload is//! for (*context byte*), carries an unnamed value through a decode and an//! encode unchanged. The subtree names its pieces: the flag bits, the context//! byte, the packet hash, the header, the proof payloads, and the link//! payloads.//!//! - *proof*: a packet carrying a signature over an earlier packet's hash, sent//!   back so the sender learns the packet arrived.//! - *link*: an encrypted session between two endpoints, named by a 16-byte//!   link id that both ends derive from the request packet.pub const context = @import("context.zig");pub const flags = @import("flags.zig");pub const hash = @import("hash.zig");pub const header = @import("header.zig");pub const link = @import("link.zig");pub const proof = @import("proof.zig");pub const Context = context.Context;pub const Flags = flags.Flags;pub const HeaderType = flags.HeaderType;pub const TransportType = flags.TransportType;pub const DestinationType = flags.DestinationType;pub const PacketType = flags.PacketType;pub const Packet = header.Packet;pub const DecodeError = header.DecodeError;pub const EncodeError = header.EncodeError;pub const decode = header.decode;pub const encode = header.encode;pub const encodedLength = header.encodedLength;pub const headerLength = header.headerLength;pub const header_one_bytes = header.header_one_bytes;pub const header_two_bytes = header.header_two_bytes;pub const mtu = header.mtu;pub const pathfinder_hops = header.pathfinder_hops;pub const truncated_hash_bytes = header.truncated_hash_bytes;

Audit

Definitions1
Public names1
Members0
Version26.7.0
Revisiondaab053ee433