pub struct UdpScionSocket<P: PathManager = MultiPathManager> { /* private fields */ }Expand description
A path aware UDP socket generic over the underlay socket and path manager.
Implementations§
Source§impl<P: PathManager> UdpScionSocket<P>
impl<P: PathManager> UdpScionSocket<P>
Sourcepub fn new(
socket: PathUnawareUdpScionSocket,
pather: Arc<P>,
connect_timeout: Duration,
send_error_receivers: Subscribers<dyn SendErrorReceiver>,
) -> Self
pub fn new( socket: PathUnawareUdpScionSocket, pather: Arc<P>, connect_timeout: Duration, send_error_receivers: Subscribers<dyn SendErrorReceiver>, ) -> Self
Creates a new path aware UDP SCION socket.
Sourcepub async fn connect(
self,
remote_addr: SocketAddr,
) -> Result<Self, ScionSocketConnectError>
pub async fn connect( self, remote_addr: SocketAddr, ) -> Result<Self, ScionSocketConnectError>
Connects the socket to a remote address.
Ensures a Path to the Destination exists, returns an error if not.
Timeouts after configured connect_timeout
Sourcepub async fn send(&self, payload: &[u8]) -> Result<(), ScionSocketSendError>
pub async fn send(&self, payload: &[u8]) -> Result<(), ScionSocketSendError>
Send a datagram to the connected remote address.
Sourcepub async fn send_to(
&self,
payload: &[u8],
destination: SocketAddr,
) -> Result<(), ScionSocketSendError>
pub async fn send_to( &self, payload: &[u8], destination: SocketAddr, ) -> Result<(), ScionSocketSendError>
Send a datagram to the specified destination.
Sourcepub async fn send_to_via(
&self,
payload: &[u8],
destination: SocketAddr,
path: &Path<&[u8]>,
) -> Result<(), ScionSocketSendError>
pub async fn send_to_via( &self, payload: &[u8], destination: SocketAddr, path: &Path<&[u8]>, ) -> Result<(), ScionSocketSendError>
Send a datagram to the specified destination via the specified path.
Sourcepub async fn recv_from_with_path<'a>(
&'a self,
buffer: &'a mut [u8],
path_buffer: &'a mut [u8],
) -> Result<(usize, SocketAddr, Path<&'a mut [u8]>), ScionSocketReceiveError>
pub async fn recv_from_with_path<'a>( &'a self, buffer: &'a mut [u8], path_buffer: &'a mut [u8], ) -> Result<(usize, SocketAddr, Path<&'a mut [u8]>), ScionSocketReceiveError>
Receive a datagram from any address, along with the sender address and path.
Sourcepub async fn recv_from(
&self,
buffer: &mut [u8],
) -> Result<(usize, SocketAddr), ScionSocketReceiveError>
pub async fn recv_from( &self, buffer: &mut [u8], ) -> Result<(usize, SocketAddr), ScionSocketReceiveError>
Receive a datagram from the connected remote address and write it into the provided buffer.
Sourcepub async fn recv(
&self,
buffer: &mut [u8],
) -> Result<usize, ScionSocketReceiveError>
pub async fn recv( &self, buffer: &mut [u8], ) -> Result<usize, ScionSocketReceiveError>
Receive a datagram from the connected remote address.
Datagrams from other addresses are silently discarded.
Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
Returns the local socket address.
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for UdpScionSocket<P>
impl<P = MultiPathManager> !RefUnwindSafe for UdpScionSocket<P>
impl<P> Send for UdpScionSocket<P>
impl<P> Sync for UdpScionSocket<P>
impl<P> Unpin for UdpScionSocket<P>
impl<P = MultiPathManager> !UnwindSafe for UdpScionSocket<P>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request