Enum rustls::unbuffered::ConnectionState

source ·
#[non_exhaustive]
pub enum ConnectionState<'c, 'i, Data> { ReadTraffic(ReadTraffic<'c, 'i, Data>), Closed, ReadEarlyData(ReadEarlyData<'c, 'i, Data>), EncodeTlsData(EncodeTlsData<'c, Data>), TransmitTlsData(TransmitTlsData<'c, Data>), BlockedHandshake, WriteTraffic(WriteTraffic<'c, Data>), }
Expand description

The state of the UnbufferedConnectionCommon object

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

ReadTraffic(ReadTraffic<'c, 'i, Data>)

One, or more, application data records are available

See ReadTraffic for more details on how to use the enclosed object to access the received data.

§

Closed

Connection has been cleanly closed by the peer

§

ReadEarlyData(ReadEarlyData<'c, 'i, Data>)

One, or more, early (RTT-0) data records are available

§

EncodeTlsData(EncodeTlsData<'c, Data>)

A Handshake record is ready for encoding

Call EncodeTlsData::encode on the enclosed object, providing an outgoing_tls buffer to store the encoding

§

TransmitTlsData(TransmitTlsData<'c, Data>)

Previously encoded handshake records need to be transmitted

Transmit the contents of the outgoing_tls buffer that was passed to previous EncodeTlsData::encode calls to the peer.

After transmitting the contents, call TransmitTlsData::done on the enclosed object. The transmitted contents MUST not be sent to the peer more than once so they SHOULD be discarded at this point.

At some stages of the handshake process, it’s possible to send application-data alongside handshake records. Call TransmitTlsData::may_encrypt_app_data on the enclosed object to probe if that’s allowed.

§

BlockedHandshake

More TLS data is needed to continue with the handshake

Request more data from the peer and append the contents to the incoming_tls buffer that was passed to UnbufferedConnectionCommon::process_tls_records.

§

WriteTraffic(WriteTraffic<'c, Data>)

The handshake process has been completed.

WriteTraffic::encrypt can be called on the enclosed object to encrypt application data into an outgoing_tls buffer. Similarly, WriteTraffic::queue_close_notify can be used to encrypt a close_notify alert message into a buffer to signal the peer that the connection is being closed. Data written into outgoing_buffer by either method MAY be transmitted to the peer during this state.

Once this state has been reached, data MAY be requested from the peer and appended to an incoming_tls buffer that will be passed to a future UnbufferedConnectionCommon::process_tls_records invocation. When enough data has been appended to incoming_tls, UnbufferedConnectionCommon::process_tls_records will yield the ConnectionState::ReadTraffic state.

Trait Implementations§

source§

impl<Data> Debug for ConnectionState<'_, '_, Data>

source§

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

Formats the value using the given formatter. Read more
source§

impl<'c, 'i, Data> From<EncodeTlsData<'c, Data>> for ConnectionState<'c, 'i, Data>

source§

fn from(v: EncodeTlsData<'c, Data>) -> Self

Converts to this type from the input type.
source§

impl<'c, 'i, Data> From<ReadEarlyData<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>

source§

fn from(v: ReadEarlyData<'c, 'i, Data>) -> Self

Converts to this type from the input type.
source§

impl<'c, 'i, Data> From<ReadTraffic<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>

source§

fn from(v: ReadTraffic<'c, 'i, Data>) -> Self

Converts to this type from the input type.
source§

impl<'c, 'i, Data> From<TransmitTlsData<'c, Data>> for ConnectionState<'c, 'i, Data>

source§

fn from(v: TransmitTlsData<'c, Data>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'c, 'i, Data> Freeze for ConnectionState<'c, 'i, Data>

§

impl<'c, 'i, Data> !RefUnwindSafe for ConnectionState<'c, 'i, Data>

§

impl<'c, 'i, Data> Send for ConnectionState<'c, 'i, Data>
where Data: Send,

§

impl<'c, 'i, Data> Sync for ConnectionState<'c, 'i, Data>
where Data: Sync,

§

impl<'c, 'i, Data> Unpin for ConnectionState<'c, 'i, Data>

§

impl<'c, 'i, Data> !UnwindSafe for ConnectionState<'c, 'i, Data>

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