rns_hooks/
engine_access.rs1pub trait EngineAccess {
7 fn has_path(&self, dest: &[u8; 16]) -> bool;
8 fn hops_to(&self, dest: &[u8; 16]) -> Option<u8>;
9 fn next_hop(&self, dest: &[u8; 16]) -> Option<[u8; 16]>;
10 fn is_blackholed(&self, identity: &[u8; 16]) -> bool;
11 fn interface_name(&self, id: u64) -> Option<String>;
12 fn interface_mode(&self, id: u64) -> Option<u8>;
13 fn identity_hash(&self) -> Option<[u8; 16]>;
14 fn announce_rate(&self, id: u64) -> Option<i32>;
17 fn link_state(&self, link_hash: &[u8; 16]) -> Option<u8>;
20}
21
22pub struct NullEngine;
25
26impl EngineAccess for NullEngine {
27 fn has_path(&self, _dest: &[u8; 16]) -> bool {
28 false
29 }
30 fn hops_to(&self, _dest: &[u8; 16]) -> Option<u8> {
31 None
32 }
33 fn next_hop(&self, _dest: &[u8; 16]) -> Option<[u8; 16]> {
34 None
35 }
36 fn is_blackholed(&self, _identity: &[u8; 16]) -> bool {
37 false
38 }
39 fn interface_name(&self, _id: u64) -> Option<String> {
40 None
41 }
42 fn interface_mode(&self, _id: u64) -> Option<u8> {
43 None
44 }
45 fn identity_hash(&self) -> Option<[u8; 16]> {
46 None
47 }
48 fn announce_rate(&self, _id: u64) -> Option<i32> {
49 None
50 }
51 fn link_state(&self, _link_hash: &[u8; 16]) -> Option<u8> {
52 None
53 }
54}