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