Struct quicr_core::Endpoint [−][src]
pub struct Endpoint { /* fields omitted */ }
The main entry point to the library
This object performs no I/O whatsoever. Instead, it generates a stream of I/O operations for a backend to perform
via poll_io
, and consumes incoming packets and timer expirations via handle
and timeout
.
Methods
impl Endpoint
[src]
impl Endpoint
pub fn new(
log: Logger,
config: Config,
cert: Option<CertConfig>,
listen: Option<ListenKeys>
) -> Result<Self, EndpointError>
[src]
pub fn new(
log: Logger,
config: Config,
cert: Option<CertConfig>,
listen: Option<ListenKeys>
) -> Result<Self, EndpointError>
pub fn poll(&mut self) -> Option<(ConnectionHandle, Event)>
[src]
pub fn poll(&mut self) -> Option<(ConnectionHandle, Event)>
Get an application-facing event
pub fn poll_io(&mut self, now: u64) -> Option<Io>
[src]
pub fn poll_io(&mut self, now: u64) -> Option<Io>
Get a pending IO operation
pub fn handle(&mut self, now: u64, remote: SocketAddrV6, data: Bytes)
[src]
pub fn handle(&mut self, now: u64, remote: SocketAddrV6, data: Bytes)
Process an incoming UDP datagram
pub fn connect(
&mut self,
remote: SocketAddrV6,
config: ClientConfig
) -> Result<ConnectionHandle, ConnectError>
[src]
pub fn connect(
&mut self,
remote: SocketAddrV6,
config: ClientConfig
) -> Result<ConnectionHandle, ConnectError>
Initiate a connection
pub fn timeout(&mut self, now: u64, conn: ConnectionHandle, timer: Timer)
[src]
pub fn timeout(&mut self, now: u64, conn: ConnectionHandle, timer: Timer)
Handle a timer expiring
pub fn write(
&mut self,
conn: ConnectionHandle,
stream: StreamId,
data: &[u8]
) -> Result<usize, WriteError>
[src]
pub fn write(
&mut self,
conn: ConnectionHandle,
stream: StreamId,
data: &[u8]
) -> Result<usize, WriteError>
Transmit data on a stream
Returns the number of bytes written on success.
Panics
- when applied to a stream that does not have an active outgoing channel
pub fn finish(&mut self, conn: ConnectionHandle, stream: StreamId)
[src]
pub fn finish(&mut self, conn: ConnectionHandle, stream: StreamId)
Indicate that no more data will be sent on a stream
All previously transmitted data will still be delivered. Incoming data on bidirectional streams is unaffected.
Panics
- when applied to a stream that does not have an active outgoing channel
pub fn read(
&mut self,
conn: ConnectionHandle,
stream: StreamId,
buf: &mut [u8]
) -> Result<usize, ReadError>
[src]
pub fn read(
&mut self,
conn: ConnectionHandle,
stream: StreamId,
buf: &mut [u8]
) -> Result<usize, ReadError>
Read data from a stream
Treats a stream like a simple pipe, similar to a TCP connection. Subject to head-of-line blocking within the
stream. Consider read_unordered
for higher throughput.
Panics
- when applied to a stream that does not have an active incoming channel
pub fn read_unordered(
&mut self,
conn: ConnectionHandle,
stream: StreamId
) -> Result<(Bytes, u64), ReadError>
[src]
pub fn read_unordered(
&mut self,
conn: ConnectionHandle,
stream: StreamId
) -> Result<(Bytes, u64), ReadError>
Read data from a stream out of order
Unlike read
, this interface is not subject to head-of-line blocking within the stream, and hence can achieve
higher throughput over lossy links.
Some segments may be received multiple times.
On success, returns Ok((data, offset))
where offset
is the position data
begins in the stream.
Panics
- when applied to a stream that does not have an active incoming channel
pub fn reset(
&mut self,
conn: ConnectionHandle,
stream: StreamId,
error_code: u16
)
[src]
pub fn reset(
&mut self,
conn: ConnectionHandle,
stream: StreamId,
error_code: u16
)
Abandon transmitting data on a stream
Panics
- when applied to a receive stream or an unopened send stream
pub fn stop_sending(
&mut self,
conn: ConnectionHandle,
stream: StreamId,
error_code: u16
)
[src]
pub fn stop_sending(
&mut self,
conn: ConnectionHandle,
stream: StreamId,
error_code: u16
)
Instruct the peer to abandon transmitting data on a stream
Panics
- when applied to a stream that has not begin receiving data
pub fn open(
&mut self,
conn: ConnectionHandle,
direction: Directionality
) -> Option<StreamId>
[src]
pub fn open(
&mut self,
conn: ConnectionHandle,
direction: Directionality
) -> Option<StreamId>
Create a new stream
Returns None
if the maximum number of streams currently permitted by the remote endpoint are already open.
pub fn ping(&mut self, conn: ConnectionHandle)
[src]
pub fn ping(&mut self, conn: ConnectionHandle)
Ping the remote endpoint
Useful for preventing an otherwise idle connection from timing out.
pub fn close(
&mut self,
now: u64,
conn: ConnectionHandle,
error_code: u16,
reason: Bytes
)
[src]
pub fn close(
&mut self,
now: u64,
conn: ConnectionHandle,
error_code: u16,
reason: Bytes
)
Close a connection immediately
This does not ensure delivery of outstanding data. It is the application's responsibility to call this only when all important communications have been completed.
pub fn get_side(&self, conn: ConnectionHandle) -> Side
[src]
pub fn get_side(&self, conn: ConnectionHandle) -> Side
Look up whether we're the client or server of conn
.
pub fn get_local_id(&self, conn: ConnectionHandle) -> &ConnectionId
[src]
pub fn get_local_id(&self, conn: ConnectionHandle) -> &ConnectionId
The ConnectionId
used for conn
locally.
pub fn get_remote_id(&self, conn: ConnectionHandle) -> &ConnectionId
[src]
pub fn get_remote_id(&self, conn: ConnectionHandle) -> &ConnectionId
The ConnectionId
used for conn
by the peer.
pub fn get_remote_address(&self, conn: ConnectionHandle) -> &SocketAddrV6
[src]
pub fn get_remote_address(&self, conn: ConnectionHandle) -> &SocketAddrV6
pub fn get_protocol(&self, conn: ConnectionHandle) -> Option<&[u8]>
[src]
pub fn get_protocol(&self, conn: ConnectionHandle) -> Option<&[u8]>
pub fn get_bytes_in_flight(&self, conn: ConnectionHandle) -> u64
[src]
pub fn get_bytes_in_flight(&self, conn: ConnectionHandle) -> u64
The number of bytes of packets containing retransmittable frames that have not been acknowleded or declared lost
pub fn get_congestion_state(&self, conn: ConnectionHandle) -> u64
[src]
pub fn get_congestion_state(&self, conn: ConnectionHandle) -> u64
Number of bytes worth of non-ack-only packets that may be sent.
pub fn get_servername(&self, conn: ConnectionHandle) -> Option<&str>
[src]
pub fn get_servername(&self, conn: ConnectionHandle) -> Option<&str>
The name a client supplied via SNI.
None if no name was supplied or if this connection was locally-initiated.
pub fn get_session_resumed(&self, conn: ConnectionHandle) -> bool
[src]
pub fn get_session_resumed(&self, conn: ConnectionHandle) -> bool
Whether a previous session was successfully resumed by conn
.
pub fn accept(&mut self) -> Option<ConnectionHandle>
[src]
pub fn accept(&mut self) -> Option<ConnectionHandle>