Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions quic/s2n-quic-core/src/connection/limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const MAX_KEEP_ALIVE_PERIOD_DEFAULT: Duration = Duration::from_secs(30);
pub const ANTI_AMPLIFICATION_MULTIPLIER: u8 = 3;

pub const DEFAULT_STREAM_BATCH_SIZE: u8 = 1;
pub const DEFAULT_STORED_PACKET_SIZE: usize = 0;

#[non_exhaustive]
#[derive(Debug)]
Expand Down Expand Up @@ -104,6 +105,7 @@ pub struct Limits {
pub(crate) migration_support: MigrationSupport,
pub(crate) anti_amplification_multiplier: u8,
pub(crate) stream_batch_size: u8,
pub(crate) stored_packet_size: usize,
}

impl Default for Limits {
Expand Down Expand Up @@ -151,6 +153,7 @@ impl Limits {
migration_support: MigrationSupport::RECOMMENDED,
anti_amplification_multiplier: ANTI_AMPLIFICATION_MULTIPLIER,
stream_batch_size: DEFAULT_STREAM_BATCH_SIZE,
stored_packet_size: DEFAULT_STORED_PACKET_SIZE,
}
}

Expand Down Expand Up @@ -254,6 +257,7 @@ impl Limits {
u64
);
setter!(with_stream_batch_size, stream_batch_size, u8);
setter!(with_stored_packet_size, stored_packet_size, usize);
setter!(with_ack_elicitation_interval, ack_elicitation_interval, u8);
setter!(with_max_ack_ranges, ack_ranges_limit, u8);
setter!(
Expand Down Expand Up @@ -422,6 +426,12 @@ impl Limits {
pub fn stream_batch_size(&self) -> u8 {
self.stream_batch_size
}

#[doc(hidden)]
#[inline]
pub fn stored_packet_size(&self) -> usize {
self.stored_packet_size
}
}

#[must_use]
Expand Down
7 changes: 7 additions & 0 deletions quic/s2n-quic-core/src/packet/handshake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use crate::{
transport,
varint::VarInt,
};
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use s2n_codec::{CheckedRange, DecoderBufferMut, DecoderBufferMutResult, Encoder, EncoderValue};

//= https://www.rfc-editor.org/rfc/rfc9000#section-17.2.4
Expand Down Expand Up @@ -65,6 +67,11 @@ pub type EncryptedHandshake<'a> =
pub type CleartextHandshake<'a> = Handshake<&'a [u8], &'a [u8], PacketNumber, DecoderBufferMut<'a>>;

impl<'a> ProtectedHandshake<'a> {
#[cfg(feature = "alloc")]
pub fn get_wire_bytes(&self) -> Vec<u8> {
self.payload.buffer.encode_to_vec()
}

#[inline]
pub(crate) fn decode(
_tag: Tag,
Expand Down
6 changes: 6 additions & 0 deletions quic/s2n-quic-core/src/packet/short.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use crate::{
},
transport,
};
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use s2n_codec::{CheckedRange, DecoderBufferMut, DecoderBufferMutResult, Encoder, EncoderValue};

//= https://www.rfc-editor.org/rfc/rfc9000#section-17.3.1
Expand Down Expand Up @@ -194,6 +196,10 @@ impl<'a> ProtectedShort<'a> {
.get_checked_range(&self.destination_connection_id)
.into_less_safe_slice()
}
#[cfg(feature = "alloc")]
pub fn get_wire_bytes(&self) -> Vec<u8> {
self.payload.buffer.encode_to_vec()
}
}

impl<'a> EncryptedShort<'a> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ impl connection::Trait for TestConnection {
_datagram: &mut <Self::Config as endpoint::Config>::DatagramEndpoint,
_dc_endpoint: &mut <Self::Config as endpoint::Config>::DcEndpoint,
_conn_limits_endpoint: &mut <Self::Config as endpoint::Config>::ConnectionLimits,
_random_generator: &mut <Self::Config as endpoint::Config>::RandomGenerator,
_packet_interceptor: &mut <Self::Config as endpoint::Config>::PacketInterceptor,
_connection_id_format: &mut <Self::Config as endpoint::Config>::ConnectionIdFormat,
) -> Result<(), connection::Error> {
Ok(())
}
Expand All @@ -153,6 +156,7 @@ impl connection::Trait for TestConnection {
_datagram_endpoint: &mut <Self::Config as endpoint::Config>::DatagramEndpoint,
_dc_endpoint: &mut <Self::Config as endpoint::Config>::DcEndpoint,
_conn_limits_endpoint: &mut <Self::Config as endpoint::Config>::ConnectionLimits,
_connection_id_format: &<Self::Config as endpoint::Config>::ConnectionIdFormat,
) -> Result<(), ProcessingError> {
Ok(())
}
Expand All @@ -169,6 +173,7 @@ impl connection::Trait for TestConnection {
_datagram_endpoint: &mut <Self::Config as endpoint::Config>::DatagramEndpoint,
_dc_endpoint: &mut <Self::Config as endpoint::Config>::DcEndpoint,
_conn_limits_endpoint: &mut <Self::Config as endpoint::Config>::ConnectionLimits,
_connection_id_format: &<Self::Config as endpoint::Config>::ConnectionIdFormat,
) -> Result<(), ProcessingError> {
Ok(())
}
Expand All @@ -185,6 +190,7 @@ impl connection::Trait for TestConnection {
_datagram_endpoint: &mut <Self::Config as endpoint::Config>::DatagramEndpoint,
_dc_endpoint: &mut <Self::Config as endpoint::Config>::DcEndpoint,
_connection_limits_endpoint: &mut <Self::Config as endpoint::Config>::ConnectionLimits,
_connection_id_format: &<Self::Config as endpoint::Config>::ConnectionIdFormat,
) -> Result<(), ProcessingError> {
Ok(())
}
Expand Down
Loading
Loading