Skip to main content

EngineAccess

Trait EngineAccess 

Source
pub trait EngineAccess {
    // Required methods
    fn has_path(&self, dest: &[u8; 16]) -> bool;
    fn hops_to(&self, dest: &[u8; 16]) -> Option<u8>;
    fn next_hop(&self, dest: &[u8; 16]) -> Option<[u8; 16]>;
    fn is_blackholed(&self, identity: &[u8; 16]) -> bool;
    fn interface_name(&self, id: u64) -> Option<String>;
    fn interface_mode(&self, id: u64) -> Option<u8>;
    fn identity_hash(&self) -> Option<[u8; 16]>;
    fn announce_rate(&self, id: u64) -> Option<i32>;
    fn link_state(&self, link_hash: &[u8; 16]) -> Option<u8>;
}
Expand description

Trait for querying engine state from within WASM host functions.

rns-hooks cannot depend on rns-core, so this trait defines the interface in neutral terms. rns-net provides the concrete implementation via a thin wrapper around TransportEngine.

Required Methods§

Source

fn has_path(&self, dest: &[u8; 16]) -> bool

Source

fn hops_to(&self, dest: &[u8; 16]) -> Option<u8>

Source

fn next_hop(&self, dest: &[u8; 16]) -> Option<[u8; 16]>

Source

fn is_blackholed(&self, identity: &[u8; 16]) -> bool

Source

fn interface_name(&self, id: u64) -> Option<String>

Source

fn interface_mode(&self, id: u64) -> Option<u8>

Source

fn identity_hash(&self) -> Option<[u8; 16]>

Source

fn announce_rate(&self, id: u64) -> Option<i32>

Outgoing announce rate for an interface, in millihertz (Hz * 1000). Returns None if the interface is not found.

Link state as a raw u8: Pending=0, Handshake=1, Active=2, Stale=3, Closed=4. Returns None if the link is not found.

Implementors§