Skip to main content

StreamRouter

Trait StreamRouter 

Source
pub trait StreamRouter {
    // Required methods
    fn basic_streams(&self) -> Vec<Box<dyn AsyncStream>>;
    fn connect_stream<'future>(
        &'future self,
        addr: &'future str,
        local_addr: Option<&'future mut String>,
        peer_addr: Option<&'future mut String>,
    ) -> Pin<Box<dyn Future<Output = IoResult<Box<dyn AsyncStream>>> + Send + 'future>>;
    fn bind_stream<'future>(
        &'future self,
        addr: &'future str,
        local_addr: Option<&'future mut String>,
    ) -> Pin<Box<dyn Future<Output = IoResult<Box<dyn AsyncListener>>> + Send + 'future>>;
}

Required Methods§

Source

fn basic_streams(&self) -> Vec<Box<dyn AsyncStream>>

Obtain a list of basic streams that are available to every enclave. Enclaves access these streams by numeric index in a platform-dependent way.

Implementers must ensure that the streams returned by any call to this function represent the same streams as those returned by any other call. Synchronization must be taken care of by the implementation.

Most enclaves expect that the first elements are those returned by an instance of OsStreamRouter.

Source

fn connect_stream<'future>( &'future self, addr: &'future str, local_addr: Option<&'future mut String>, peer_addr: Option<&'future mut String>, ) -> Pin<Box<dyn Future<Output = IoResult<Box<dyn AsyncStream>>> + Send + 'future>>

Serve a connect call by the enclave. The runner should determine the service that the enclave is trying to connect to by looking at addr.

Most enclaves expect that unrecognized addrs are forwarded to an instance of OsStreamRouter.

The enclave may optionally request the local or peer addresses be returned in local_addr or peer_addr, respectively. If local_addr and/or peer_addr are not None, they will point to an empty String. On success, user-space can fill in the strings as appropriate.

The enclave must not make any security decisions based on the local or peer address received.

Source

fn bind_stream<'future>( &'future self, addr: &'future str, local_addr: Option<&'future mut String>, ) -> Pin<Box<dyn Future<Output = IoResult<Box<dyn AsyncListener>>> + Send + 'future>>

Serve a bind call by the enclave. The runner should determine the service that the enclave is trying to bind to by looking at addr.

Most enclaves expect that unrecognized addrs are forwarded to an instance of OsStreamRouter.

The enclave may optionally request the local address be returned in local_addr. If local_addr is not None, it will point to an empty String. On success, user-space can fill in the string as appropriate.

The enclave must not make any security decisions based on the local address received.

Implementors§