#[non_exhaustive]pub enum StreamCommand {
Listen {
listener: ListenerId,
local: SocketAddr,
reuse_address: bool,
},
StopListening {
listener: ListenerId,
},
Connect {
id: StreamId,
local: SocketAddr,
remote: SocketAddr,
reuse_address: bool,
},
Close {
id: StreamId,
},
Reset {
id: StreamId,
},
Resolve {
query: u64,
host: String,
port: u16,
},
ResolveRecords {
query: u64,
name: String,
kind: RecordKind,
},
}Expand description
What the engine asks the driver to do with its sockets.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Listen
Listen for TCP connections on local (port 0: any free port) and accept them, each
reported with StreamTable::accept. Answer with StreamEvent::Listening, naming
the bound address, or StreamEvent::ListenFailed.
StopListening
Close the listener. Connections it accepted stay open.
Fields
listener: ListenerIdThe listener’s id.
Connect
Open a TCP connection from local (port 0: an ephemeral port on that address) to
remote. Answer with StreamEvent::Connected, naming the local address the
connection got, or StreamEvent::ConnectFailed.
Close
Write what was handed out for the connection, then close it (FIN). Report
StreamEvent::Closed when it is closed.
Reset
Abort the connection now (RST), discarding what was not written. The engine has forgotten the id: nothing needs to be reported.
Resolve
Resolve host (a server’s name, both IPv6 and IPv4 at once, RFC 8305 section 3) and
answer with StreamEvent::Resolved, port on every address.
ResolveRecords
Look up the kind records of name (SRV, RFC 2782; NAPTR, RFC 3403) and answer with
StreamEvent::ResolvedRecords, an empty list when there are none or the driver
cannot look them up. Used to find a STUN or TURN server whose URI gives no port (RFC
5928 section 3, RFC 8489 section 8); an answer that does not come within
RECORDS_TIMEOUT counts as empty.