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.
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.
RegisterDestination
Register a local destination.
DeregisterDestination
Deregister a local destination.
Query(QueryRequest, Sender<QueryResponse>)
Query driver state. Response is sent via the provided channel.
RegisterLinkDestination
Register a link destination (accepts incoming LINKREQUEST).
RegisterRequestHandler
Register a request handler for a path on established links.
Fields
CreateLink
Create an outbound link. Response sends (link_id) back.
SendRequest
Send a request on an established link.
IdentifyOnLink
Identify on a link (send identity to remote peer).
TeardownLink
Tear down a link.
SendResource
Send a resource on a link.
SetResourceStrategy
Set the resource acceptance strategy for a link.
AcceptResource
Accept or reject a pending resource (for AcceptApp strategy).
SendChannelMessage
Send a channel message on a link.
SendOnLink
Send generic data on a link with a given context.
RequestPath
Request a path to a destination from the network.
RegisterProofStrategy
Register a proof strategy for a destination.