s2n_quic_core/dc/
disabled.rs

1// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::{
5    crypto::tls::TlsSession,
6    dc::{ConnectionInfo, DatagramInfo, Endpoint, Path},
7    stateless_reset, transport,
8};
9use alloc::vec::Vec;
10
11#[derive(Debug, Default)]
12pub struct Disabled(());
13
14impl Endpoint for Disabled {
15    const ENABLED: bool = false;
16
17    type Path = ();
18
19    fn new_path(&mut self, _connection_info: &ConnectionInfo) -> Option<Self::Path> {
20        None
21    }
22
23    fn on_possible_secret_control_packet(
24        &mut self,
25        _datagram_info: &DatagramInfo,
26        _payload: &mut [u8],
27    ) -> bool {
28        unreachable!()
29    }
30
31    fn mtu_probing_complete_support(&self) -> bool {
32        false
33    }
34}
35
36// The Disabled Endpoint returns `None`, so this is not used
37impl Path for () {
38    fn on_path_secrets_ready(
39        &mut self,
40        _session: &impl TlsSession,
41    ) -> Result<Vec<stateless_reset::Token>, transport::Error> {
42        unimplemented!()
43    }
44
45    fn on_peer_stateless_reset_tokens<'a>(
46        &mut self,
47        _stateless_reset_tokens: impl Iterator<Item = &'a stateless_reset::Token>,
48    ) {
49        unimplemented!()
50    }
51
52    fn on_dc_handshake_complete(&mut self) {
53        unimplemented!()
54    }
55
56    fn on_mtu_updated(&mut self, _mtu: u16) {
57        unimplemented!()
58    }
59}