Struct quinn_proto::Endpoint
source · pub struct Endpoint { /* private fields */ }
Expand description
The main entry point to the library
This object performs no I/O whatsoever. Instead, it generates a stream of packets to send via
poll_transmit
, and consumes incoming packets and connection-generated events via handle
and
handle_event
.
Implementations§
source§impl Endpoint
impl Endpoint
sourcepub fn new(
config: Arc<EndpointConfig>,
server_config: Option<Arc<ServerConfig>>
) -> Self
pub fn new( config: Arc<EndpointConfig>, server_config: Option<Arc<ServerConfig>> ) -> Self
Create a new endpoint
Returns Err
if the configuration is invalid.
sourcepub fn poll_transmit(&mut self) -> Option<Transmit>
pub fn poll_transmit(&mut self) -> Option<Transmit>
Get the next packet to transmit
sourcepub fn set_server_config(&mut self, server_config: Option<Arc<ServerConfig>>)
pub fn set_server_config(&mut self, server_config: Option<Arc<ServerConfig>>)
Replace the server configuration, affecting new incoming connections only
sourcepub fn handle_event(
&mut self,
ch: ConnectionHandle,
event: EndpointEvent
) -> Option<ConnectionEvent>
pub fn handle_event( &mut self, ch: ConnectionHandle, event: EndpointEvent ) -> Option<ConnectionEvent>
Process EndpointEvent
s emitted from related Connection
s
In turn, processing this event may return a ConnectionEvent
for the same Connection
.
sourcepub fn handle(
&mut self,
now: Instant,
remote: SocketAddr,
local_ip: Option<IpAddr>,
ecn: Option<EcnCodepoint>,
data: BytesMut
) -> Option<(ConnectionHandle, DatagramEvent)>
pub fn handle( &mut self, now: Instant, remote: SocketAddr, local_ip: Option<IpAddr>, ecn: Option<EcnCodepoint>, data: BytesMut ) -> Option<(ConnectionHandle, DatagramEvent)>
Process an incoming UDP datagram
sourcepub fn connect(
&mut self,
config: ClientConfig,
remote: SocketAddr,
server_name: &str
) -> Result<(ConnectionHandle, Connection), ConnectError>
pub fn connect( &mut self, config: ClientConfig, remote: SocketAddr, server_name: &str ) -> Result<(ConnectionHandle, Connection), ConnectError>
Initiate a connection
sourcepub fn set_socket_buffer_fill(&mut self, len: usize)
pub fn set_socket_buffer_fill(&mut self, len: usize)
Set the socket_buffer_fill
to the input len
sourcepub fn reject_new_connections(&mut self)
pub fn reject_new_connections(&mut self)
Unconditionally reject future incoming connections
sourcepub fn config(&self) -> &EndpointConfig
pub fn config(&self) -> &EndpointConfig
Access the configuration used by this endpoint
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Endpoint
impl Send for Endpoint
impl !Sync for Endpoint
impl Unpin for Endpoint
impl !UnwindSafe for Endpoint
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more