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(missing_docs, unreachable_patterns, clippy::useless_conversion, clippy::redundant_clone)]
12
13extern crate fakealloc as alloc;
14
15#[path = "."]
16mod internal {
17    pub(super) mod datagram;
18    pub(super) mod sndbuf;
19    pub(super) mod spec_context;
20    pub(super) mod uninstantiable;
21}
22
23pub use internal::datagram::{
24    BoundSocketState, BoundSocketStateType, BoundSockets, ConnInfo, ConnState, ConnectError,
25    DatagramApi, DatagramBindingsContext, DatagramBindingsTypes, DatagramBoundStateContext,
26    DatagramFlowId, DatagramIpSpecificSocketOptions, DatagramSocketMapSpec, DatagramSocketSet,
27    DatagramSocketSpec, DatagramStateContext, DualStackConnState, DualStackConverter,
28    DualStackDatagramBoundStateContext, DualStackIpExt, EitherIpSocket, ExpectedConnError,
29    ExpectedUnboundError, InUseError, IpExt, IpOptions, ListenerInfo, MulticastInterfaceSelector,
30    MulticastMembershipInterfaceSelector, NonDualStackConverter,
31    NonDualStackDatagramBoundStateContext, ReferenceState, SendError, SendToError,
32    SetMulticastMembershipError, SocketInfo, SocketState, StrongRc, WeakRc,
33    WrapOtherStackIpOptions, WrapOtherStackIpOptionsMut,
34};
35pub use internal::sndbuf::TxMetadata;
36pub use internal::spec_context::{
37    DatagramSpecBoundStateContext, DatagramSpecStateContext,
38    DualStackDatagramSpecBoundStateContext, NonDualStackDatagramSpecBoundStateContext,
39};
40
41/// Datagram socket test utilities.
42#[cfg(any(test, feature = "testutils"))]
43pub mod testutil {
44    pub use crate::internal::datagram::create_primary_id;
45    pub use crate::internal::datagram::testutil::setup_fake_ctx_with_dualstack_conn_addrs;
46}