Skip to main content

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 spec_context;
26    pub(super) mod tx_metadata;
27    pub(super) mod uninstantiable;
28}
29
30pub use internal::datagram::{
31    BoundDatagramSocketMap, BoundSocketState, BoundSocketStateType, ConnInfo, ConnState,
32    ConnectError, DatagramApi, DatagramBindingsContext, DatagramBindingsTypes,
33    DatagramBoundStateContext, DatagramFlowId, DatagramIpSpecificSocketOptions,
34    DatagramSocketMapSpec, DatagramSocketSet, DatagramSocketSpec, DatagramStateContext,
35    DualStackBaseIpExt, DualStackConnState, DualStackConverter, DualStackDatagramBoundStateContext,
36    DualStackIpExt, EitherIpSocket, ExpectedConnError, ExpectedUnboundError, InUseError, IpExt,
37    IpOptions, ListenerInfo, MulticastInterfaceSelector, MulticastMembershipInterfaceSelector,
38    NonDualStackConverter, NonDualStackDatagramBoundStateContext, PendingDatagramSocketError,
39    ReferenceState, SendError, SendToError, SetMulticastMembershipError, SocketInfo, SocketState,
40    SocketStateInner, StrongRc, WeakRc, WrapOtherStackIpOptions, WrapOtherStackIpOptionsMut,
41};
42pub use internal::diagnostics::{DatagramSocketDiagnosticsSpec, SocketStateForMatching};
43pub use internal::spec_context::{
44    DatagramSpecBoundStateContext, DatagramSpecStateContext,
45    DualStackDatagramSpecBoundStateContext, NonDualStackDatagramSpecBoundStateContext,
46};
47pub use internal::tx_metadata::TxMetadata;
48
49/// Datagram socket test utilities.
50#[cfg(any(test, feature = "testutils"))]
51pub mod testutil {
52    pub use crate::internal::datagram::create_primary_id;
53    pub use crate::internal::datagram::testutil::setup_fake_ctx_with_dualstack_conn_addrs;
54}