Skip to main content

s2n_quic_dc/stream/
socket.rs

1// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4use super::TransportFeatures;
5
6pub mod application;
7#[cfg(any(test, feature = "testing"))]
8mod bach;
9pub mod fd;
10mod handle;
11mod send_only;
12#[cfg(feature = "tokio")]
13mod tokio;
14mod tracing;
15
16pub use self::tracing::Tracing;
17pub use crate::socket::*;
18pub use application::Application;
19pub use handle::{Ext, Flags, Socket};
20pub use send_only::SendOnly;
21
22pub type ArcApplication = std::sync::Arc<dyn Application>;
23
24#[derive(Clone, Copy, Debug, PartialEq, Eq)]
25#[non_exhaustive]
26pub enum Protocol {
27    Tcp,
28    Udp,
29    Other(&'static str),
30}
31
32impl Protocol {
33    s2n_quic_core::state::is!(is_tcp, Tcp);
34    s2n_quic_core::state::is!(is_udp, Udp);
35
36    #[inline]
37    pub fn is_other(&self) -> bool {
38        matches!(self, Self::Other(_))
39    }
40}