#[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
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>
impl<Data> Debug for ConnectionState<'_, '_, Data>
Source§impl<'c, Data> From<EncodeTlsData<'c, Data>> for ConnectionState<'c, '_, Data>
impl<'c, Data> From<EncodeTlsData<'c, Data>> for ConnectionState<'c, '_, Data>
Source§fn from(v: EncodeTlsData<'c, Data>) -> Self
fn from(v: EncodeTlsData<'c, Data>) -> Self
Source§impl<'c, 'i, Data> From<ReadEarlyData<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>
impl<'c, 'i, Data> From<ReadEarlyData<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>
Source§fn from(v: ReadEarlyData<'c, 'i, Data>) -> Self
fn from(v: ReadEarlyData<'c, 'i, Data>) -> Self
Source§impl<'c, 'i, Data> From<ReadTraffic<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>
impl<'c, 'i, Data> From<ReadTraffic<'c, 'i, Data>> for ConnectionState<'c, 'i, Data>
Source§fn from(v: ReadTraffic<'c, 'i, Data>) -> Self
fn from(v: ReadTraffic<'c, 'i, Data>) -> Self
Source§impl<'c, Data> From<TransmitTlsData<'c, Data>> for ConnectionState<'c, '_, Data>
impl<'c, Data> From<TransmitTlsData<'c, Data>> for ConnectionState<'c, '_, Data>
Source§fn from(v: TransmitTlsData<'c, Data>) -> Self
fn from(v: TransmitTlsData<'c, Data>) -> Self
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes
Size for each variant:
ReadTraffic
: 56 bytesClosed
: 0 bytesReadEarlyData
: 56 bytesEncodeTlsData
: 32 bytesTransmitTlsData
: 8 bytesBlockedHandshake
: 0 bytesWriteTraffic
: 8 bytes