tiny.reticulum.wire.context
Defined in wire.
API (3)
Actions
Public operations.
Types and contracts
Public types and contracts.
Context: The header's last byte names what the payload is for: nothing in particular, one of the seven resource-transfer kinds, a cache request, a request or its response, a path response, a command or its status, a channel message, a keepalive, or one of the five link control values, following Reticulum@1.5.0 RNS/Packet.py:…
Source
Source: lib/reticulum/src/wire/context.zig
zig
const std = @import("std");/// The header's last byte names what the payload is for: nothing in particular,/// one of the seven resource-transfer kinds, a cache request, a request or its/// response, a path response, a command or its status, a channel message, a/// keepalive, or one of the five link control values, following Reticulum@1.5.0/// RNS/Packet.py:72-92. A caller reads this byte to learn what an arriving/// payload is for, and sets it on a payload it sends. A byte this list leaves/// unnamed decodes to a value that encodes back to the same byte, so a payload/// from a peer running a newer build survives the trip through this code.pub const Context = enum(u8) { none = 0x00, resource = 0x01, resource_adv = 0x02, resource_req = 0x03, resource_hmu = 0x04, resource_prf = 0x05, resource_icl = 0x06, resource_rcl = 0x07, cache_request = 0x08, request = 0x09, response = 0x0a, path_response = 0x0b, command = 0x0c, command_status = 0x0d, channel = 0x0e, keepalive = 0xfa, linkidentify = 0xfb, linkclose = 0xfc, linkproof = 0xfd, lrrtt = 0xfe, lrproof = 0xff, _, pub fn decode(byte: u8) Context { return @fromBackingInt(@intCast(byte)); } pub fn encode(self: Context) u8 { return @backingInt(self); }};test "Reticulum@1.5.0 RNS/Packet.py:72-92 preserves unknown contexts" { const unknown = Context.decode(0x80); try std.testing.expectEqual(@as(u8, 0x80), unknown.encode());}Source: lib/reticulum/src/wire/root.zig:48
zig
pub const context = @import("context.zig");Audit
| Definitions | 4 |
|---|---|
| Public names | 10 |
| Members | 22 |
| Version | 26.7.0 |
| Revision | daab053ee433 |