Skip to main content

AsyncSecureChannel

Struct AsyncSecureChannel 

Source
pub struct AsyncSecureChannel<T> { /* private fields */ }
Expand description

High-level async facade that combines Session, FoctetFramed, and TLV helpers.

This wrapper is intended for async runtimes where callers want:

  • automatic session-aware control/rekey handling
  • application-data TLV framing by default
  • an async send/receive application-data API

Implementations§

Source§

impl<T> AsyncSecureChannel<T>

Source

pub fn with_app_stream_id(self, stream_id: u32) -> Self

Sets the default stream ID for application-data frames.

Source

pub fn with_app_flags(self, flags: u8) -> Self

Sets the default plaintext frame flags for application-data frames.

Source

pub fn session(&self) -> &Session

Returns immutable reference to the underlying Session.

Source

pub fn session_mut(&mut self) -> &mut Session

Returns mutable reference to the underlying Session.

Source

pub fn framed_ref(&self) -> &FoctetFramed<T>

Returns immutable reference to inner framed transport.

Source

pub fn framed_mut(&mut self) -> &mut FoctetFramed<T>

Returns mutable reference to inner framed transport.

Source

pub fn into_parts(self) -> (FoctetFramed<T>, Session)

Consumes the wrapper and returns (framed, session).

Source§

impl<T: PollIo + Unpin> AsyncSecureChannel<T>

Source

pub fn from_active_session(io: T, session: Session) -> Result<Self, CoreError>

Constructs an async secure channel from an active session.

The session must already be in Active state with derived traffic keys.

Source

pub async fn send_data(&mut self, plaintext: &[u8]) -> Result<(), CoreError>

Sends application data in an APPLICATION_DATA TLV with session-aware rekey handling.

Source

pub async fn send_tlvs(&mut self, tlvs: &[Tlv]) -> Result<(), CoreError>

Sends explicit TLVs with session-aware rekey handling.

This bypasses APPLICATION_DATA convenience framing.

Source

pub async fn recv_application(&mut self) -> Result<Vec<u8>, CoreError>

Receives the next application-data payload.

Control frames are handled automatically. The method loops internally until it receives a non-control frame, then decodes TLVs and returns the first APPLICATION_DATA value.

Source

pub async fn recv_tlvs(&mut self) -> Result<Vec<Tlv>, CoreError>

Receives the next non-control frame and returns decoded TLVs.

Source§

impl<T> AsyncSecureChannel<TokioIo<T>>
where T: AsyncRead + AsyncWrite + Unpin,

Source

pub fn from_tokio(io: T, session: Session) -> Result<Self, CoreError>

Constructs async secure channel from a Tokio I/O object and an active session.

Source§

impl<T> AsyncSecureChannel<FuturesIo<T>>
where T: AsyncRead + AsyncWrite + Unpin,

Source

pub fn from_futures(io: T, session: Session) -> Result<Self, CoreError>

Constructs async secure channel from a futures-io object and an active session.

Trait Implementations§

Source§

impl<T: Debug> Debug for AsyncSecureChannel<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for AsyncSecureChannel<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for AsyncSecureChannel<T>
where T: RefUnwindSafe,

§

impl<T> Send for AsyncSecureChannel<T>
where T: Send,

§

impl<T> Sync for AsyncSecureChannel<T>
where T: Sync,

§

impl<T> Unpin for AsyncSecureChannel<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for AsyncSecureChannel<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for AsyncSecureChannel<T>
where T: UnwindSafe,

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, 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> 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.