Struct PartialDecode
pub struct PartialDecode { /* private fields */ }quic only.Expand description
Decodes a QUIC packet’s invariant header
Due to packet number encryption, it is impossible to fully decode a header
(which includes a variable-length packet number) without crypto context.
The crypto context (the packet protection keys) is usually
part of the Connection, or can be derived from the destination CID for
Initial packets.
To cope with this, we decode the invariant header (which should be stable across QUIC versions), which gives us the destination CID and allows us to inspect the version and packet type (which depends on the version). This information allows us to fully decode and decrypt the packet.
Implementations§
§impl PartialDecode
impl PartialDecode
pub fn new(
bytes: BytesMut,
cid_parser: &(impl ConnectionIdParser + ?Sized),
supported_versions: &[Version],
grease_quic_bit: bool,
) -> Result<(PartialDecode, Option<BytesMut>), PacketDecodeError>
pub fn new( bytes: BytesMut, cid_parser: &(impl ConnectionIdParser + ?Sized), supported_versions: &[Version], grease_quic_bit: bool, ) -> Result<(PartialDecode, Option<BytesMut>), PacketDecodeError>
Begin decoding a QUIC packet from bytes, returning any trailing data not part of that packet
pub fn initial_header(&self) -> Option<&ProtectedInitialHeader>
pub fn has_long_header(&self) -> bool
pub fn is_initial(&self) -> bool
pub fn space(&self) -> Option<SpaceId>
pub fn is_0rtt(&self) -> bool
pub fn wire_version(&self) -> Option<WireVersion>
pub fn wire_version(&self) -> Option<WireVersion>
The wire-bearing version a long header carries; short headers have none.
pub fn dst_cid(&self) -> &ConnectionId
pub fn dst_cid(&self) -> &ConnectionId
The destination connection ID of the packet
pub fn finish_protected(
self,
header_crypto: &dyn HeaderKey,
) -> Result<Packet, PacketDecodeError>
pub fn finish_protected( self, header_crypto: &dyn HeaderKey, ) -> Result<Packet, PacketDecodeError>
Finish decoding a header that carries a protected packet number (Initial, Handshake,
0-RTT, 1-RTT), removing header protection with header_crypto. The key is mandatory, so a
caller cannot reach a number-bearing header without one.
pub fn finish_unprotected(self) -> Result<Packet, PacketDecodeError>
pub fn finish_unprotected(self) -> Result<Packet, PacketDecodeError>
Finish decoding a header that carries no packet number (Retry, Version Negotiation), which needs no key. A number-bearing header handed here is reported as an invalid header rather than decoded without protection.
Trait Implementations§
§impl Clone for PartialDecode
impl Clone for PartialDecode
§fn clone(&self) -> PartialDecode
fn clone(&self) -> PartialDecode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PartialDecode
impl RefUnwindSafe for PartialDecode
impl Send for PartialDecode
impl Sync for PartialDecode
impl Unpin for PartialDecode
impl UnsafeUnpin for PartialDecode
impl UnwindSafe for PartialDecode
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more