Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 22 variants Frame { interface_id: InterfaceId, data: Vec<u8>, }, InterfaceUp(InterfaceId, Option<Box<dyn Writer>>, Option<InterfaceInfo>), InterfaceDown(InterfaceId), Tick, Shutdown, SendOutbound { raw: Vec<u8>, dest_type: u8, attached_interface: Option<InterfaceId>, }, RegisterDestination { dest_hash: [u8; 16], dest_type: u8, }, DeregisterDestination { dest_hash: [u8; 16], }, Query(QueryRequest, Sender<QueryResponse>), RegisterLinkDestination { dest_hash: [u8; 16], sig_prv_bytes: [u8; 32], sig_pub_bytes: [u8; 32], }, RegisterRequestHandler { path: String, allowed_list: Option<Vec<[u8; 16]>>, handler: Box<dyn Fn([u8; 16], &str, &[u8], Option<&([u8; 16], [u8; 64])>) -> Option<Vec<u8>> + Send>, }, CreateLink { dest_hash: [u8; 16], dest_sig_pub_bytes: [u8; 32], response_tx: Sender<[u8; 16]>, }, SendRequest { link_id: [u8; 16], path: String, data: Vec<u8>, }, IdentifyOnLink { link_id: [u8; 16], identity_prv_key: [u8; 64], }, TeardownLink { link_id: [u8; 16], }, SendResource { link_id: [u8; 16], data: Vec<u8>, metadata: Option<Vec<u8>>, }, SetResourceStrategy { link_id: [u8; 16], strategy: u8, }, AcceptResource { link_id: [u8; 16], resource_hash: Vec<u8>, accept: bool, }, SendChannelMessage { link_id: [u8; 16], msgtype: u16, payload: Vec<u8>, }, SendOnLink { link_id: [u8; 16], data: Vec<u8>, context: u8, }, RequestPath { dest_hash: [u8; 16], }, RegisterProofStrategy { dest_hash: [u8; 16], strategy: ProofStrategy, signing_key: Option<[u8; 64]>, },
}
Expand description

Events sent to the driver thread.

Variants§

§

Frame

A decoded frame arrived from an interface.

Fields

§interface_id: InterfaceId
§data: Vec<u8>
§

InterfaceUp(InterfaceId, Option<Box<dyn Writer>>, Option<InterfaceInfo>)

An interface came online after (re)connecting. Carries a new writer if the connection was re-established. Carries InterfaceInfo if this is a new dynamic interface (e.g. TCP server client).

§

InterfaceDown(InterfaceId)

An interface went offline (socket closed, error).

§

Tick

Periodic maintenance tick (1s interval).

§

Shutdown

Shut down the driver loop.

§

SendOutbound

Send an outbound packet.

Fields

§raw: Vec<u8>
§dest_type: u8
§attached_interface: Option<InterfaceId>
§

RegisterDestination

Register a local destination.

Fields

§dest_hash: [u8; 16]
§dest_type: u8
§

DeregisterDestination

Deregister a local destination.

Fields

§dest_hash: [u8; 16]
§

Query(QueryRequest, Sender<QueryResponse>)

Query driver state. Response is sent via the provided channel.

§

RegisterLinkDestination

Register a link destination (accepts incoming LINKREQUEST).

Fields

§dest_hash: [u8; 16]
§sig_prv_bytes: [u8; 32]
§sig_pub_bytes: [u8; 32]
§

RegisterRequestHandler

Register a request handler for a path on established links.

Fields

§path: String
§allowed_list: Option<Vec<[u8; 16]>>
§handler: Box<dyn Fn([u8; 16], &str, &[u8], Option<&([u8; 16], [u8; 64])>) -> Option<Vec<u8>> + Send>

Create an outbound link. Response sends (link_id) back.

Fields

§dest_hash: [u8; 16]
§dest_sig_pub_bytes: [u8; 32]
§response_tx: Sender<[u8; 16]>
§

SendRequest

Send a request on an established link.

Fields

§link_id: [u8; 16]
§path: String
§data: Vec<u8>

Identify on a link (send identity to remote peer).

Fields

§link_id: [u8; 16]
§identity_prv_key: [u8; 64]

Tear down a link.

Fields

§link_id: [u8; 16]
§

SendResource

Send a resource on a link.

Fields

§link_id: [u8; 16]
§data: Vec<u8>
§metadata: Option<Vec<u8>>
§

SetResourceStrategy

Set the resource acceptance strategy for a link.

Fields

§link_id: [u8; 16]
§strategy: u8
§

AcceptResource

Accept or reject a pending resource (for AcceptApp strategy).

Fields

§link_id: [u8; 16]
§resource_hash: Vec<u8>
§accept: bool
§

SendChannelMessage

Send a channel message on a link.

Fields

§link_id: [u8; 16]
§msgtype: u16
§payload: Vec<u8>

Send generic data on a link with a given context.

Fields

§link_id: [u8; 16]
§data: Vec<u8>
§context: u8
§

RequestPath

Request a path to a destination from the network.

Fields

§dest_hash: [u8; 16]
§

RegisterProofStrategy

Register a proof strategy for a destination.

Fields

§dest_hash: [u8; 16]
§strategy: ProofStrategy
§signing_key: Option<[u8; 64]>

Full identity private key (64 bytes) for signing proofs.

Trait Implementations§

Source§

impl Debug for Event

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Event

§

impl !RefUnwindSafe for Event

§

impl Send for Event

§

impl !Sync for Event

§

impl Unpin for Event

§

impl !UnwindSafe for Event

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.