ScionStack

Struct ScionStack 

Source
pub struct ScionStack { /* private fields */ }
Expand description

The SCION stack can be used to create path-aware SCION sockets or even Quic over SCION connections.

The SCION stack abstracts over the underlay stack that is used for the underlying transport.

Implementations§

Source§

impl ScionStack

Source

pub async fn bind( &self, bind_addr: Option<SocketAddr>, ) -> Result<UdpScionSocket, ScionSocketBindError>

Create a path-aware SCION socket with automatic path management.

§Arguments
  • bind_addr - The address to bind the socket to. If None, an available address will be used.
§Returns

A path-aware SCION socket.

Source

pub async fn bind_with_config( &self, bind_addr: Option<SocketAddr>, socket_config: SocketConfig, ) -> Result<UdpScionSocket, ScionSocketBindError>

Create a path-aware SCION socket with custom configuration.

§Arguments
  • bind_addr - The address to bind the socket to. If None, an available address will be used.
  • socket_config - Configuration for the socket.
§Returns

A path-aware SCION socket.

Source

pub async fn connect( &self, remote_addr: SocketAddr, bind_addr: Option<SocketAddr>, ) -> Result<UdpScionSocket, ScionSocketBindError>

Create a connected path-aware SCION socket with automatic path management.

§Arguments
  • remote_addr - The remote address to connect to.
  • bind_addr - The address to bind the socket to. If None, an available address will be used.
§Returns

A connected path-aware SCION socket.

Source

pub async fn connect_with_config( &self, remote_addr: SocketAddr, bind_addr: Option<SocketAddr>, socket_config: SocketConfig, ) -> Result<UdpScionSocket, ScionSocketBindError>

Create a connected path-aware SCION socket with custom configuration.

§Arguments
  • remote_addr - The remote address to connect to.
  • bind_addr - The address to bind the socket to. If None, an available address will be used.
  • socket_config - Configuration for the socket
§Returns

A connected path-aware SCION socket.

Source

pub async fn bind_with_time( &self, bind_addr: Option<SocketAddr>, now: Instant, ) -> Result<UdpScionSocket, ScionSocketBindError>

Bind a socket with controlled time for port allocation.

This allows tests to control port reservation timing without sleeping.

Source

pub async fn bind_scmp( &self, bind_addr: Option<SocketAddr>, ) -> Result<ScmpScionSocket, ScionSocketBindError>

Create a socket that can send and receive SCMP messages.

§Arguments
  • bind_addr - The address to bind the socket to. If None, an available address will be used.
§Returns

A SCMP socket.

Source

pub async fn bind_raw( &self, bind_addr: Option<SocketAddr>, ) -> Result<RawScionSocket, ScionSocketBindError>

Create a raw SCION socket. A raw SCION socket can be used to send and receive raw SCION packets. It is still bound to a specific UDP port because this is needed for packets to be routed in a dispatcherless autonomous system. See https://docs.scion.org/en/latest/dev/design/router-port-dispatch.html for a more detailed explanation.

§Arguments
  • bind_addr - The address to bind the socket to. If None, an available address will be used.
§Returns

A raw SCION socket.

Source

pub async fn bind_path_unaware( &self, bind_addr: Option<SocketAddr>, ) -> Result<PathUnawareUdpScionSocket, ScionSocketBindError>

Create a path-unaware SCION socket for advanced use cases.

This socket can send and receive datagrams, but requires explicit paths for sending. Use this when you need full control over path selection.

§Arguments
  • bind_addr - The address to bind the socket to. If None, an available address will be used.
§Returns

A path-unaware SCION socket.

Source

pub async fn quic_endpoint( &self, bind_addr: Option<SocketAddr>, config: EndpointConfig, server_config: Option<ServerConfig>, runtime: Option<Arc<dyn Runtime>>, ) -> Result<Endpoint>

Create a QUIC over SCION endpoint.

This is a convenience method that creates a QUIC (quinn) endpoint over a SCION socket.

§Arguments
  • bind_addr - The address to bind the socket to. If None, an available address will be used.
  • config - The quinn endpoint configuration.
  • server_config - The quinn server configuration.
  • runtime - The runtime to spawn tasks on.
§Returns

A QUIC endpoint that can be used to accept or create QUIC connections.

Source

pub async fn quic_endpoint_with_config( &self, bind_addr: Option<SocketAddr>, config: EndpointConfig, server_config: Option<ServerConfig>, runtime: Option<Arc<dyn Runtime>>, socket_config: SocketConfig, ) -> Result<Endpoint>

Create a QUIC over SCION endpoint using custom socket configuration.

This is a convenience method that creates a QUIC (quinn) endpoint over a SCION socket.

§Arguments
  • bind_addr - The address to bind the socket to. If None, an available address will be used.
  • config - The quinn endpoint configuration.
  • server_config - The quinn server configuration.
  • runtime - The runtime to spawn tasks on.
  • socket_config - Scion Socket configuration
§Returns

A QUIC endpoint that can be used to accept or create QUIC connections.

Source

pub fn local_addresses(&self) -> Vec<EndhostAddr>

Get the list of local addresses assigned to the endhost.

§Returns

A list of local addresses assigned to the endhost.

Source

pub fn create_path_manager(&self) -> Arc<CachingPathManager>

Creates a path manager with default configuration.

Trait Implementations§

Source§

impl Debug for ScionStack

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,