Struct rustls::unbuffered::UnbufferedConnectionCommon

source ·
pub struct UnbufferedConnectionCommon<Data> { /* private fields */ }
Expand description

Interface shared by unbuffered client and server connections.

Implementations§

source§

impl UnbufferedConnectionCommon<ClientConnectionData>

source

pub fn process_tls_records<'c, 'i>( &'c mut self, incoming_tls: &'i mut [u8], ) -> UnbufferedStatus<'c, 'i, ClientConnectionData>

Processes the TLS records in incoming_tls buffer until a new UnbufferedStatus is reached.

source§

impl UnbufferedConnectionCommon<ServerConnectionData>

source

pub fn process_tls_records<'c, 'i>( &'c mut self, incoming_tls: &'i mut [u8], ) -> UnbufferedStatus<'c, 'i, ServerConnectionData>

Processes the TLS records in incoming_tls buffer until a new UnbufferedStatus is reached.

Methods from Deref<Target = CommonState>§

source

pub fn wants_write(&self) -> bool

Returns true if the caller should call Connection::write_tls as soon as possible.

source

pub fn is_handshaking(&self) -> bool

Returns true if the connection is currently performing the TLS handshake.

During this time plaintext written to the connection is buffered in memory. After Connection::process_new_packets() has been called, this might start to return false while the final handshake packets still need to be extracted from the connection’s buffers.

source

pub fn peer_certificates(&self) -> Option<&[CertificateDer<'static>]>

Retrieves the certificate chain used by the peer to authenticate.

The order of the certificate chain is as it appears in the TLS protocol: the first certificate relates to the peer, the second certifies the first, the third certifies the second, and so on.

This is made available for both full and resumed handshakes.

For clients, this is the certificate chain of the server.

For servers, this is the certificate chain of the client, if client authentication was completed.

The return value is None until this value is available.

source

pub fn alpn_protocol(&self) -> Option<&[u8]>

Retrieves the protocol agreed with the peer via ALPN.

A return value of None after handshake completion means no protocol was agreed (because no protocols were offered or accepted by the peer).

source

pub fn negotiated_cipher_suite(&self) -> Option<SupportedCipherSuite>

Retrieves the ciphersuite agreed with the peer.

This returns None until the ciphersuite is agreed.

source

pub fn negotiated_key_exchange_group( &self, ) -> Option<&'static dyn SupportedKxGroup>

Retrieves the key exchange group agreed with the peer.

This function may return None depending on the state of the connection, the type of handshake, and the protocol version.

If CommonState::is_handshaking() is true this function will return None. Similarly, if the CommonState::handshake_kind() is HandshakeKind::Resumed and the CommonState::protocol_version() is TLS 1.2, then no key exchange will have occurred and this function will return None.

source

pub fn protocol_version(&self) -> Option<ProtocolVersion>

Retrieves the protocol version agreed with the peer.

This returns None until the version is agreed.

source

pub fn handshake_kind(&self) -> Option<HandshakeKind>

Which kind of handshake was performed.

This tells you whether the handshake was a resumption or not.

This will return None before it is known which sort of handshake occurred.

source

pub fn wants_read(&self) -> bool

Returns true if the caller should call Connection::read_tls as soon as possible.

If there is pending plaintext data to read with Connection::reader, this returns false. If your application respects this mechanism, only one full TLS message will be buffered by rustls.

Trait Implementations§

source§

impl<T> Deref for UnbufferedConnectionCommon<T>

source§

type Target = CommonState

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<Data> Freeze for UnbufferedConnectionCommon<Data>
where Data: Freeze,

§

impl<Data> !RefUnwindSafe for UnbufferedConnectionCommon<Data>

§

impl<Data> Send for UnbufferedConnectionCommon<Data>
where Data: Send,

§

impl<Data> Sync for UnbufferedConnectionCommon<Data>
where Data: Sync,

§

impl<Data> Unpin for UnbufferedConnectionCommon<Data>
where Data: Unpin,

§

impl<Data> !UnwindSafe for UnbufferedConnectionCommon<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.