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