pub struct S0Manager { /* private fields */ }Expand description
Security 0 state for one node.
Implementations§
Source§impl S0Manager
impl S0Manager
Sourcepub fn new(own_node: u16, network_key: &NetworkKey) -> Self
pub fn new(own_node: u16, network_key: &NetworkKey) -> Self
A manager for own_node with the network key.
Sourcepub fn set_own_node(&mut self, own_node: u16)
pub fn set_own_node(&mut self, own_node: u16)
Changes the own node id (after being included).
Sourcepub fn set_network_key(&mut self, key: &NetworkKey)
pub fn set_network_key(&mut self, key: &NetworkKey)
Replaces the network key (a node receiving Network Key Set).
Sourcepub fn nonce_report(&mut self, peer: u16) -> Result<Vec<u8>, Error>
pub fn nonce_report(&mut self, peer: u16) -> Result<Vec<u8>, Error>
Issues a nonce for peer and returns the Nonce Report carrying it.
Sourcepub fn handle_nonce_report(
&mut self,
peer: u16,
frame: &[u8],
) -> Result<(), Error>
pub fn handle_nonce_report( &mut self, peer: u16, frame: &[u8], ) -> Result<(), Error>
Stores the nonce from a peer’s Nonce Report (frame starts at 0x98 0x80).
Sourcepub fn has_peer_nonce(&self, peer: u16) -> bool
pub fn has_peer_nonce(&self, peer: u16) -> bool
Whether we hold a live nonce from peer.
Sourcepub fn encapsulate(
&mut self,
peer: u16,
command: &[u8],
temp_key: bool,
) -> Result<Vec<u8>, Error>
pub fn encapsulate( &mut self, peer: u16, command: &[u8], temp_key: bool, ) -> Result<Vec<u8>, Error>
Encapsulates command for peer with its stored nonce (consumed).
A command longer than MAX_PAYLOAD needs two frames; this returns
the first and the caller sends it, fetches a new nonce and calls
again with the rest via encapsulate_part.
Sourcepub fn split(&mut self, command: &[u8]) -> Option<[(Vec<u8>, u8); 2]>
pub fn split(&mut self, command: &[u8]) -> Option<[(Vec<u8>, u8); 2]>
Splits a long command into the two halves S0 sends in sequence.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for S0Manager
impl RefUnwindSafe for S0Manager
impl Send for S0Manager
impl Sync for S0Manager
impl Unpin for S0Manager
impl UnsafeUnpin for S0Manager
impl UnwindSafe for S0Manager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more