netstack3_datagram/
lib.rs

1// Copyright 2024 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5//! Netstack3 core Datagram sockets.
6//!
7//! This crate contains the shared base implementation between UDP and ICMP Echo
8//! sockets.
9
10#![no_std]
11#![warn(
12    missing_docs,
13    unreachable_patterns,
14    clippy::useless_conversion,
15    clippy::redundant_clone,
16    clippy::precedence
17)]
18
19extern crate alloc;
20
21#[path = "."]
22mod internal {
23    pub(super) mod datagram;
24    pub(super) mod diagnostics;
25    pub(super) mod settings;
26    pub(super) mod sndbuf;
27    pub(super) mod spec_context;
28    pub(super) mod uninstantiable;
29}
30
31pub use internal::datagram::{
32    BoundSocketState, BoundSocketStateType, BoundSockets, ConnInfo, ConnState, ConnectError,
33    DatagramApi, DatagramBindingsContext, DatagramBindingsTypes, DatagramBoundStateContext,
34    DatagramFlowId, DatagramIpSpecificSocketOptions, DatagramSocketMapSpec, DatagramSocketSet,
35    DatagramSocketSpec, DatagramStateContext, DualStackConnState, DualStackConverter,
36    DualStackDatagramBoundStateContext, DualStackIpExt, EitherIpSocket, ExpectedConnError,
37    ExpectedUnboundError, InUseError, IpExt, IpOptions, ListenerInfo, MulticastInterfaceSelector,
38    MulticastMembershipInterfaceSelector, NonDualStackConverter,
39    NonDualStackDatagramBoundStateContext, ReferenceState, SendError, SendToError,
40    SetMulticastMembershipError, SocketInfo, SocketState, StrongRc, WeakRc,
41    WrapOtherStackIpOptions, WrapOtherStackIpOptionsMut,
42};
43pub use internal::diagnostics::{DatagramSocketDiagnosticsSpec, SocketStateForMatching};
44pub use internal::settings::DatagramSettings;
45pub use internal::sndbuf::TxMetadata;
46pub use internal::spec_context::{
47    DatagramSpecBoundStateContext, DatagramSpecStateContext,
48    DualStackDatagramSpecBoundStateContext, NonDualStackDatagramSpecBoundStateContext,
49};
50
51/// Datagram socket test utilities.
52#[cfg(any(test, feature = "testutils"))]
53pub mod testutil {
54    pub use crate::internal::datagram::create_primary_id;
55    pub use crate::internal::datagram::testutil::setup_fake_ctx_with_dualstack_conn_addrs;
56}