Skip to main content

rns_hooks/
context.rs

1/// Packet context shared between host and WASM guest via linear memory.
2///
3/// Uses raw primitives (`u64` for interface IDs, `[u8; N]` for hashes) so that
4/// `rns-hooks` has zero dependency on `rns-core`.
5#[repr(C)]
6#[derive(Debug, Clone, Copy)]
7pub struct PacketContext {
8    pub flags: u8,
9    pub hops: u8,
10    pub destination_hash: [u8; 16],
11    pub context: u8,
12    pub packet_hash: [u8; 32],
13    pub interface_id: u64,
14    /// Offset from the start of this struct to variable-length packet data.
15    pub data_offset: u32,
16    /// Length of the variable-length packet data.
17    pub data_len: u32,
18}