Crate umsh_core

Crate umsh_core 

Source
Expand description

Core wire-format types and packet construction/parsing utilities for UMSH.

Note: This reference implementation is a work in progress and was developed with the assistance of an LLM. It should be considered experimental.

This crate stays focused on byte layout, typed header fields, and zero-copy parsing. It does not perform any cryptographic operations or I/O.

The main entry points are:

§Example

use umsh_core::{MicSize, NodeHint, PacketBuilder, PacketHeader, PublicKey};

let mut buf = [0u8; 128];
let src = PublicKey([0x11; 32]);
let dst = NodeHint([0xAA, 0xBB, 0xCC]);

let packet = PacketBuilder::new(&mut buf)
    .unicast(dst)
    .source_full(&src)
    .frame_counter(7)
    .encrypted()
    .mic_size(MicSize::Mic16)
    .payload(b"hello")
    .build()
    .unwrap();

let header = PacketHeader::parse(packet.as_bytes()).unwrap();
assert_eq!(header.dst, Some(dst));
assert_eq!(header.body_range.len(), 5);

Modules§

base58
Fixed-width base58 codec for 32-byte addresses.
options
state
Typestate markers used by PacketBuilder and its specialized builders.

Structs§

ChannelId
Two-byte multicast channel identifier.
ChannelKey
Raw 32-byte multicast channel secret.
ChannelTag
Sixteen-byte channel tag: a local identity for a channel, wide enough to distinguish channels that a ChannelId cannot.
Fcf
Frame-control field wrapper.
FloodHops
Combined remaining/accumulated flood-hop counters.
NodeHint
Three-byte node hint derived from a public key.
PacketBuilder
Entry point for typestate packet construction.
PacketHeader
Parsed packet header with borrowed ranges into the original frame.
ParsedOptions
PublicKey
Node public key, which also acts as the full network address.
RegionCode
A 2-byte region identifier.
RouterHint
Two-byte router hint used in learned routes.
Scf
Security-control field wrapper.
SecInfo
Decoded SECINFO structure.
UnsealedPacket

Enums§

AddressParseError
Errors returned while parsing a textual UMSH address.
BuildError
Errors returned while assembling a full packet with crate::PacketBuilder.
EncodeError
Errors returned while encoding wire-format values into caller-provided buffers.
MicSize
Authenticator size carried by secured packets.
OptionNumber
Known packet-option numbers.
PacketType
Packet class encoded in the frame-control field.
ParseError
Errors returned while parsing on-wire UMSH structures.
PayloadType
Application payload type carried inside the MAC body.
RegionCodeError
Why a string could not be read as a region code.
SourceAddr
Source address supplied while constructing packets.
SourceAddrRef
Parsed source-address location used by zero-copy packet processing.

Constants§

UMSH_VERSION
Current UMSH packet version encoded in the FCF high bits.

Functions§

feed_aad
iter_options

Type Aliases§

BlindUnicastBuilder
Blind-unicast packet builder alias.
BroadcastBuilder
Broadcast packet builder alias.
MacAckBuilder
MAC ACK packet builder alias.
MulticastBuilder
Multicast packet builder alias.
UnicastBuilder
Unicast packet builder alias.