Struct oasis_core_runtime::enclave_rpc::session::Session
source · pub struct Session { /* private fields */ }
Expand description
An encrypted and authenticated RPC session.
Implementations§
source§impl Session
impl Session
sourcepub async fn process_data<W: Write>(
&mut self,
data: &[u8],
writer: W,
) -> Result<Option<Message>>
pub async fn process_data<W: Write>( &mut self, data: &[u8], writer: W, ) -> Result<Option<Message>>
Process incoming data.
In case the session is in transport mode the returned result will
contained a parsed message. The writer
will be used in case any
protocol replies need to be generated.
sourcepub fn write_message<W: Write>(&mut self, msg: Message, writer: W) -> Result<()>
pub fn write_message<W: Write>(&mut self, msg: Message, writer: W) -> Result<()>
Write message to session.
The writer
will be used for protocol message output which should
be transmitted to the remote session counterpart.
sourcepub fn close(&mut self)
pub fn close(&mut self)
Mark the session as closed.
After the session is closed it can no longer be used to transmit or receive messages and any such use will result in an error.
sourcepub fn session_info(&self) -> Option<Arc<SessionInfo>>
pub fn session_info(&self) -> Option<Arc<SessionInfo>>
Session information.
sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether the session handshake has completed and the session is in transport mode.
sourcepub fn is_connected_to(&self, nodes: &Vec<PublicKey>) -> bool
pub fn is_connected_to(&self, nodes: &Vec<PublicKey>) -> bool
Whether the session is connected to one of the given nodes.
sourcepub fn is_unauthenticated(&self) -> bool
pub fn is_unauthenticated(&self) -> bool
Whether the session is in unauthenticated transport state. In this state the session can only be used to transmit a close notification.
sourcepub fn get_remote_node(&self) -> Result<PublicKey>
pub fn get_remote_node(&self) -> Result<PublicKey>
Return remote node identifier.
sourcepub fn set_remote_node(&mut self, node: PublicKey) -> Result<()>
pub fn set_remote_node(&mut self, node: PublicKey) -> Result<()>
Set the remote node identifier.