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]
pub fn new(
log: Logger,
config: Config,
cert: Option<CertConfig>,
listen: Option<ListenKeys>
) -> Result<Self, EndpointError>
[src]
log: Logger,
config: Config,
cert: Option<CertConfig>,
listen: Option<ListenKeys>
) -> Result<Self, EndpointError>
pub fn poll(&mut self) -> Option<(ConnectionHandle, Event)>
[src]
Get an application-facing event
pub fn poll_io(&mut self, now: u64) -> Option<Io>
[src]
Get a pending IO operation
pub fn handle(&mut self, now: u64, remote: SocketAddrV6, data: Bytes)
[src]
Process an incoming UDP datagram
pub fn connect(
&mut self,
remote: SocketAddrV6,
hostname: Option<&[u8]>
) -> ConnectionHandle
[src]
&mut self,
remote: SocketAddrV6,
hostname: Option<&[u8]>
) -> ConnectionHandle
Initiate a connection
pub fn timeout(&mut self, now: u64, conn: ConnectionHandle, timer: Timer)
[src]
Handle a timer expiring
pub fn write(
&mut self,
conn: ConnectionHandle,
stream: StreamId,
data: &[u8]
) -> Result<usize, WriteError>
[src]
&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]
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]
&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]
&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]
&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]
&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]
&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]
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]
&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]
Look up whether we're the client or server of conn
.
pub fn get_local_id(&self, conn: ConnectionHandle) -> &ConnectionId
[src]
The ConnectionId
used for conn
locally.
pub fn get_remote_id(&self, conn: ConnectionHandle) -> &ConnectionId
[src]
The ConnectionId
used for conn
by the peer.
pub fn get_remote_address(&self, conn: ConnectionHandle) -> &SocketAddrV6
[src]
pub fn get_protocol(&self, conn: ConnectionHandle) -> Option<&[u8]>
[src]
pub fn get_congestion_state(&self, conn: ConnectionHandle) -> u64
[src]
Number of bytes worth of non-ack-only packets that may be sent