Skip to main content

NeedsInput

Struct NeedsInput 

Source
pub struct NeedsInput { /* private fields */ }
Expand description

More data needs to be processed to make progress.

Provide the data to Self::process().

This type dereferences to ConnectionOutputs. Individual outputs are None until they are learned during the handshake.

Implementations§

Source§

impl NeedsInput

Source

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

Return the TLS-encoded transport parameters received from the peer.

While the transport parameters are available before the handshake completes, they cannot be fully trusted until then. Reliance on them should be minimized. Any tampering with the parameters will cause the handshake to fail.

Source

pub fn zero_rtt_keys(&self) -> Option<DirectionalKeys>

Compute the keys for decrypting 0-RTT packets, if available.

Source

pub fn server_name(&self) -> Option<&DnsName<'_>>

Retrieves the server name supplied by the client, if any.

Source

pub fn process( self, input: &mut dyn TlsInputBuffer, output: &mut Vec<QuicEvent>, ) -> Result<ServerHandshake, Error>

Progress the handshake by receiving further unencrypted TLS handshake data.

The input should be ordered QUIC CRYPTO stream data for one encryption level.

Handshake data obtained from separate encryption levels should be supplied in separate calls.

How much of the input buffer is consumed is recorded by a call to TlsInputBuffer::discard(). Unconsumed data should be presented again on the next call.

An error from this function is fatal to the connection, as it consumes the NeedsInput object.

On success, this returns:

output has any resulting handshake messages or key changes appended to it.

Methods from Deref<Target = ConnectionOutputs>§

Source

pub fn peer_identity(&self) -> Option<&VerifiedIdentity<'static>>

Retrieves the certificate chain or the raw public key used by the peer to authenticate.

This is made available for both full and resumed handshakes.

For clients, this is the identity of the server. For servers, this is the identity 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<&ApplicationProtocol<'static>>

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 cipher suite agreed with the peer.

This returns None until the cipher suite 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 ConnectionOutputs::handshake_kind() is HandshakeKind::Resumed and the ConnectionOutputs::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 extended_main_secret(&self) -> Option<bool>

Whether the Extended Main Secret extension was negotiated.

Returns:

  • None until the handshake reaches the point where this is known.
  • None for TLS 1.3, where the extension does not apply.
  • Some(true) for TLS 1.2 if the extension was negotiated.
  • Some(false) otherwise.
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.

Trait Implementations§

Source§

impl Debug for NeedsInput

Source§

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

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

impl Deref for NeedsInput

Source§

type Target = ConnectionOutputs

The resulting type after dereferencing.
Source§

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

Dereferences the value.

Auto Trait Implementations§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more