Skip to content

Commit f304cc3

Browse files
committed
Adds minimal impl
1 parent f13f040 commit f304cc3

File tree

10 files changed

+291
-31
lines changed

10 files changed

+291
-31
lines changed

quic/s2n-quic-core/src/connection/limits.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const MAX_KEEP_ALIVE_PERIOD_DEFAULT: Duration = Duration::from_secs(30);
3939
pub const ANTI_AMPLIFICATION_MULTIPLIER: u8 = 3;
4040

4141
pub const DEFAULT_STREAM_BATCH_SIZE: u8 = 1;
42+
pub const DEFAULT_STORED_PACKET_SIZE: usize = 0;
4243

4344
#[non_exhaustive]
4445
#[derive(Debug)]
@@ -104,6 +105,7 @@ pub struct Limits {
104105
pub(crate) migration_support: MigrationSupport,
105106
pub(crate) anti_amplification_multiplier: u8,
106107
pub(crate) stream_batch_size: u8,
108+
pub(crate) stored_packet_size: usize,
107109
}
108110

109111
impl Default for Limits {
@@ -151,6 +153,7 @@ impl Limits {
151153
migration_support: MigrationSupport::RECOMMENDED,
152154
anti_amplification_multiplier: ANTI_AMPLIFICATION_MULTIPLIER,
153155
stream_batch_size: DEFAULT_STREAM_BATCH_SIZE,
156+
stored_packet_size: DEFAULT_STORED_PACKET_SIZE,
154157
}
155158
}
156159

@@ -254,6 +257,7 @@ impl Limits {
254257
u64
255258
);
256259
setter!(with_stream_batch_size, stream_batch_size, u8);
260+
setter!(with_stored_packet_size, stored_packet_size, usize);
257261
setter!(with_ack_elicitation_interval, ack_elicitation_interval, u8);
258262
setter!(with_max_ack_ranges, ack_ranges_limit, u8);
259263
setter!(
@@ -422,6 +426,12 @@ impl Limits {
422426
pub fn stream_batch_size(&self) -> u8 {
423427
self.stream_batch_size
424428
}
429+
430+
#[doc(hidden)]
431+
#[inline]
432+
pub fn stored_packet_size(&self) -> usize {
433+
self.stored_packet_size
434+
}
425435
}
426436

427437
#[must_use]

quic/s2n-quic-core/src/packet/handshake.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ pub type EncryptedHandshake<'a> =
6565
pub type CleartextHandshake<'a> = Handshake<&'a [u8], &'a [u8], PacketNumber, DecoderBufferMut<'a>>;
6666

6767
impl<'a> ProtectedHandshake<'a> {
68+
pub fn get_wire_bytes(&self) -> Vec<u8> {
69+
self.payload.buffer.encode_to_vec()
70+
}
71+
6872
#[inline]
6973
pub(crate) fn decode(
7074
_tag: Tag,

quic/s2n-quic-core/src/packet/short.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ impl<'a> ProtectedShort<'a> {
194194
.get_checked_range(&self.destination_connection_id)
195195
.into_less_safe_slice()
196196
}
197+
198+
pub fn get_wire_bytes(&self) -> Vec<u8> {
199+
self.payload.buffer.encode_to_vec()
200+
}
197201
}
198202

199203
impl<'a> EncryptedShort<'a> {

quic/s2n-quic-transport/src/connection/connection_container/tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ impl connection::Trait for TestConnection {
138138
_datagram: &mut <Self::Config as endpoint::Config>::DatagramEndpoint,
139139
_dc_endpoint: &mut <Self::Config as endpoint::Config>::DcEndpoint,
140140
_conn_limits_endpoint: &mut <Self::Config as endpoint::Config>::ConnectionLimits,
141+
_random_generator: &mut <Self::Config as endpoint::Config>::RandomGenerator,
142+
_packet_interceptor: &mut <Self::Config as endpoint::Config>::PacketInterceptor,
143+
_connection_id_format: &mut <Self::Config as endpoint::Config>::ConnectionIdFormat,
141144
) -> Result<(), connection::Error> {
142145
Ok(())
143146
}
@@ -153,6 +156,7 @@ impl connection::Trait for TestConnection {
153156
_datagram_endpoint: &mut <Self::Config as endpoint::Config>::DatagramEndpoint,
154157
_dc_endpoint: &mut <Self::Config as endpoint::Config>::DcEndpoint,
155158
_conn_limits_endpoint: &mut <Self::Config as endpoint::Config>::ConnectionLimits,
159+
_connection_id_format: &<Self::Config as endpoint::Config>::ConnectionIdFormat,
156160
) -> Result<(), ProcessingError> {
157161
Ok(())
158162
}
@@ -169,6 +173,7 @@ impl connection::Trait for TestConnection {
169173
_datagram_endpoint: &mut <Self::Config as endpoint::Config>::DatagramEndpoint,
170174
_dc_endpoint: &mut <Self::Config as endpoint::Config>::DcEndpoint,
171175
_conn_limits_endpoint: &mut <Self::Config as endpoint::Config>::ConnectionLimits,
176+
_connection_id_format: &<Self::Config as endpoint::Config>::ConnectionIdFormat,
172177
) -> Result<(), ProcessingError> {
173178
Ok(())
174179
}
@@ -185,6 +190,7 @@ impl connection::Trait for TestConnection {
185190
_datagram_endpoint: &mut <Self::Config as endpoint::Config>::DatagramEndpoint,
186191
_dc_endpoint: &mut <Self::Config as endpoint::Config>::DcEndpoint,
187192
_connection_limits_endpoint: &mut <Self::Config as endpoint::Config>::ConnectionLimits,
193+
_connection_id_format: &<Self::Config as endpoint::Config>::ConnectionIdFormat,
188194
) -> Result<(), ProcessingError> {
189195
Ok(())
190196
}

0 commit comments

Comments
 (0)