Skip to main content

tf_types/generated/
packet.rs

1// GENERATED by `tf-schema codegen --target rust` — DO NOT EDIT BY HAND.
2
3#![allow(unused_imports, non_camel_case_types, non_snake_case, clippy::all)]
4
5use serde::{Deserialize, Serialize};
6use super::*;
7
8/// Standalone signed/encrypted object that may be delivered offline, relayed, stored, or transferred and verified later. Implements TF-0011 packet mode: packet priority, expiration, route constraints, fragmentation, emergency packets.
9#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
10pub struct Packet {
11    /// Version of the packet schema itself.
12    pub packet_version: Packet_PacketVersion,
13    /// Stable packet identifier; used for de-duplication, fragmentation reassembly, and audit lookup.
14    pub packet_id: String,
15    /// Originating actor.
16    pub source: ActorId,
17    /// Final destination actor.
18    pub destination: ActorId,
19    /// Packet priority class. P0 is reserved for emergency / break-glass and is policy-controlled.
20    pub priority: Packet_Priority,
21    /// When true, the packet is invoking break-glass emergency authority. Must be scoped, logged, and reviewable per TF-0011.
22    #[serde(skip_serializing_if = "Option::is_none", default)]
23    pub emergency: Option<bool>,
24    pub created_at: Timestamp,
25    #[serde(skip_serializing_if = "Option::is_none", default)]
26    pub expires_at: Option<Timestamp>,
27    /// Maximum number of relay hops the packet may traverse.
28    #[serde(skip_serializing_if = "Option::is_none", default)]
29    pub ttl_hops: Option<i64>,
30    /// Optional ordered/unordered hints ("only-trusted-relays", "avoid:internet", ...).
31    #[serde(skip_serializing_if = "Option::is_none", default)]
32    pub route_constraints: Option<Vec<String>>,
33    /// Wire encoding of the payload bytes.
34    #[serde(skip_serializing_if = "Option::is_none", default)]
35    pub encoding: Option<Packet_Encoding>,
36    /// Optional payload compression.
37    #[serde(skip_serializing_if = "Option::is_none", default)]
38    pub compression: Option<Packet_Compression>,
39    /// Base64-encoded canonical payload bytes (the body the source signed).
40    pub payload: String,
41    /// Optional session identifier this packet relates to.
42    #[serde(skip_serializing_if = "Option::is_none", default)]
43    pub session_ref: Option<String>,
44    /// Set when the packet is itself a fragment of a larger packet.
45    #[serde(skip_serializing_if = "Option::is_none", default)]
46    pub fragment: Option<PacketFragment>,
47    pub signature: SignatureEnvelope,
48}
49
50/// Optional payload compression.
51#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
52pub enum Packet_Compression {
53    #[serde(rename = "none")]
54    None,
55    #[serde(rename = "deflate")]
56    Deflate,
57}
58
59/// Wire encoding of the payload bytes.
60#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
61pub enum Packet_Encoding {
62    #[serde(rename = "json")]
63    Json,
64    #[serde(rename = "cbor")]
65    Cbor,
66}
67
68/// Version of the packet schema itself.
69#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
70pub enum Packet_PacketVersion {
71    #[serde(rename = "1")]
72    V1,
73}
74
75/// Packet priority class. P0 is reserved for emergency / break-glass and is policy-controlled.
76#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
77pub enum Packet_Priority {
78    #[serde(rename = "P0")]
79    P0,
80    #[serde(rename = "P1")]
81    P1,
82    #[serde(rename = "P2")]
83    P2,
84    #[serde(rename = "P3")]
85    P3,
86    #[serde(rename = "P4")]
87    P4,
88    #[serde(rename = "P5")]
89    P5,
90}