1#![no_std]
11#![warn(missing_docs, unreachable_patterns, clippy::useless_conversion, clippy::redundant_clone)]
12
13extern crate fakealloc as alloc;
14
15mod context;
16mod convert;
17mod counters;
18mod data_structures;
19mod device;
20mod error;
21mod event;
22mod frame;
23mod inspect;
24mod ip;
25mod matchers;
26mod num;
27mod port_alloc;
28mod resource_references;
29mod rng;
30mod tcp;
31mod test_only;
32mod time;
33mod uninstantiable;
34mod work_queue;
35
36pub use context::{BuildableCoreContext, ContextPair, ContextProvider, CtxPair};
37pub use convert::{BidirectionalConverter, OwnedOrRefsBidirectionalConverter};
38pub use counters::{Counter, CounterContext, CounterRepr, ResourceCounterContext};
39pub use data_structures::token_bucket::TokenBucket;
40pub use device::address::{
41 AssignedAddrIpExt, IpAddressId, IpDeviceAddr, IpDeviceAddressIdContext, Ipv4DeviceAddr,
42 Ipv6DeviceAddr, WeakIpAddressId,
43};
44pub use device::link::{LinkAddress, LinkDevice, LinkUnicastAddress};
45pub use device::{
46 AnyDevice, Device, DeviceIdAnyCompatContext, DeviceIdContext, DeviceIdentifier, DeviceWithName,
47 EitherDeviceId, StrongDeviceIdentifier, WeakDeviceIdentifier,
48};
49pub use error::{
50 AddressResolutionFailed, ErrorAndSerializer, ExistsError, LocalAddressError, NotFoundError,
51 NotSupportedError, RemoteAddressError, SocketError, ZonedAddressError,
52};
53pub use event::{CoreEventContext, EventContext};
54pub use frame::{
55 CoreTxMetadataContext, FrameDestination, ReceivableFrameMeta, RecvFrameContext,
56 RecvIpFrameMeta, SendFrameContext, SendFrameError, SendFrameErrorReason, SendableFrameMeta,
57 TxMetadataBindingsTypes,
58};
59pub use inspect::{Inspectable, InspectableValue, Inspector, InspectorDeviceExt, InspectorExt};
60pub use ip::{
61 BroadcastIpExt, IcmpErrorCode, IcmpIpExt, Icmpv4ErrorCode, Icmpv6ErrorCode, IpExt,
62 IpTypesIpExt, Mark, MarkDomain, MarkStorage, Marks, Mms, WrapBroadcastMarker,
63};
64pub use matchers::{DeviceNameMatcher, Matcher, SubnetMatcher};
65pub use num::PositiveIsize;
66pub use port_alloc::{simple_randomized_port_alloc, EphemeralPort, PortAllocImpl};
67pub use resource_references::{
68 DeferredResourceRemovalContext, ReferenceNotifiers, ReferenceNotifiersExt,
69 RemoveResourceResult, RemoveResourceResultWithContext,
70};
71pub use rng::RngContext;
72pub use tcp::base::{Control, FragmentedPayload, Mss};
73pub use tcp::segment::{
74 HandshakeOptions, Options, Payload, PayloadLen, SackBlock, SackBlocks, Segment, SegmentHeader,
75 SegmentOptions,
76};
77pub use tcp::seqnum::{SeqNum, UnscaledWindowSize, WindowScale, WindowSize};
78pub use test_only::{TestOnlyFrom, TestOnlyPartialEq};
79pub use time::local_timer_heap::LocalTimerHeap;
80pub use time::{
81 AtomicInstant, CoreTimerContext, HandleableTimer, Instant, InstantBindingsTypes,
82 InstantContext, IntoCoreTimerCtx, NestedIntoCoreTimerCtx, TimerBindingsTypes, TimerContext,
83 TimerHandler,
84};
85pub use uninstantiable::{Uninstantiable, UninstantiableWrapper};
86pub use work_queue::WorkQueueReport;
87
88pub mod ref_counted_hash_map {
90 pub use crate::data_structures::ref_counted_hash_map::{
91 InsertResult, RefCountedHashMap, RefCountedHashSet, RemoveResult,
92 };
93}
94
95pub mod socket {
97 mod address;
98 mod base;
99 pub(crate) mod sndbuf;
100
101 pub use address::{
102 AddrIsMappedError, AddrVecIter, ConnAddr, ConnInfoAddr, ConnIpAddr, DualStackConnIpAddr,
103 DualStackListenerIpAddr, DualStackLocalIp, DualStackRemoteIp, ListenerAddr, ListenerIpAddr,
104 SocketIpAddr, StrictlyZonedAddr,
105 };
106 pub use base::{
107 AddrEntry, AddrVec, Bound, BoundSocketMap, DualStackIpExt, DualStackTuple, EitherStack,
108 FoundSockets, IncompatibleError, InsertError, Inserter, Listener, ListenerAddrInfo,
109 MaybeDualStack, NotDualStackCapableError, RemoveResult, SetDualStackEnabledError, Shutdown,
110 ShutdownType, SocketAddrType, SocketDeviceUpdate, SocketDeviceUpdateNotAllowedError,
111 SocketIpAddrExt, SocketIpExt, SocketMapAddrSpec, SocketMapAddrStateSpec,
112 SocketMapAddrStateUpdateSharingSpec, SocketMapConflictPolicy, SocketMapStateSpec,
113 SocketMapUpdateSharingPolicy, SocketStateEntry, SocketZonedAddrExt, UpdateSharingError,
114 };
115 pub use sndbuf::{
116 SendBufferFullError, SendBufferSpace, SendBufferTracking, SocketWritableListener,
117 };
118}
119
120pub mod socketmap {
123 pub use crate::data_structures::socketmap::{
124 Entry, IterShadows, OccupiedEntry, SocketMap, Tagged, VacantEntry,
125 };
126}
127
128pub mod sync {
130 pub use netstack3_sync::rc::{
135 DebugReferences, DynDebugReferences, MapNotifier as MapRcNotifier, Notifier as RcNotifier,
136 Primary as PrimaryRc, Strong as StrongRc, Weak as WeakRc,
137 };
138 pub use netstack3_sync::{LockGuard, Mutex, RwLock, RwLockReadGuard, RwLockWriteGuard};
139}
140
141#[cfg(any(test, feature = "testutils"))]
143pub mod testutil {
144 mod addr;
145 mod benchmarks;
146 mod fake_bindings;
147 mod fake_core;
148 mod fake_network;
149 mod misc;
150 mod monotonic_id;
151
152 pub use crate::device::address::testutil::FakeWeakAddressId;
153 pub use crate::device::link::testutil::{FakeLinkAddress, FakeLinkDevice, FakeLinkDeviceId};
154 pub use crate::device::testutil::{
155 FakeDeviceId, FakeReferencyDeviceId, FakeStrongDeviceId, FakeWeakDeviceId,
156 MultipleDevicesId, MultipleDevicesIdState,
157 };
158 pub use crate::event::testutil::FakeEventCtx;
159 pub use crate::frame::testutil::{FakeFrameCtx, FakeTxMetadata, WithFakeFrameContext};
160 pub use crate::rng::testutil::{new_rng, run_with_many_seeds, FakeCryptoRng};
161 pub use crate::socket::sndbuf::testutil::FakeSocketWritableListener;
162 pub use crate::time::testutil::{
163 FakeAtomicInstant, FakeInstant, FakeInstantCtx, FakeTimerCtx, FakeTimerCtxExt, FakeTimerId,
164 InstantAndData, WithFakeTimerContext,
165 };
166 pub use addr::{TestAddrs, TestDualStackIpExt, TestIpExt, TEST_ADDRS_V4, TEST_ADDRS_V6};
167 pub use benchmarks::{Bencher, RealBencher, TestBencher};
168 pub use fake_bindings::FakeBindingsCtx;
169 pub use fake_core::FakeCoreCtx;
170 pub use fake_network::{
171 FakeNetwork, FakeNetworkLinks, FakeNetworkSpec, PendingFrame, PendingFrameData, StepResult,
172 };
173 pub use misc::{assert_empty, set_logger_for_test};
174 pub use monotonic_id::MonotonicIdentifier;
175}
176
177#[cfg(benchmark)]
179pub mod benchmarks {
180 pub fn add_benches(b: criterion::Benchmark) -> criterion::Benchmark {
182 crate::data_structures::token_bucket::benchmarks::add_benches(b)
183 }
184}