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, EitherDeviceId,
58 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::{
77 BoundInterfaceMatcher, InterfaceMatcher, InterfaceProperties, Matcher, MatcherBindingsTypes,
78 SubnetMatcher,
79};
80pub use num::PositiveIsize;
81pub use port_alloc::{EphemeralPort, PortAllocImpl, simple_randomized_port_alloc};
82pub use resource_references::{
83 DeferredResourceRemovalContext, ReferenceNotifiers, ReferenceNotifiersExt,
84 RemoveResourceResult, RemoveResourceResultWithContext,
85};
86pub use rng::RngContext;
87pub use settings::{BufferSizeSettings, SettingsContext};
88pub use tcp::base::{Control, EffectiveMss, FragmentedPayload, Mss};
89pub use tcp::segment::{
90 HandshakeOptions, Options, Payload, PayloadLen, ResetOptions, SackBlock, SackBlocks, Segment,
91 SegmentHeader, SegmentOptions, VerifiedTcpSegment,
92};
93pub use tcp::seqnum::{SeqNum, UnscaledWindowSize, WindowScale, WindowSize};
94pub use tcp::timestamp::{
95 Milliseconds, RxTimestampOption, Timestamp, TimestampOption, TxTimestampOption, Unitless,
96};
97pub use test_only::TestOnlyPartialEq;
98pub use time::local_timer_heap::LocalTimerHeap;
99pub use time::{
100 AtomicInstant, CoreTimerContext, HandleableTimer, Instant, InstantBindingsTypes,
101 InstantContext, IntoCoreTimerCtx, NestedIntoCoreTimerCtx, TimerBindingsTypes, TimerContext,
102 TimerHandler,
103};
104pub use uninstantiable::{Uninstantiable, UninstantiableWrapper};
105pub use work_queue::WorkQueueReport;
106
107pub mod ref_counted_hash_map {
109 pub use crate::data_structures::ref_counted_hash_map::{
110 InsertResult, RefCountedHashMap, RefCountedHashSet, RemoveResult,
111 };
112}
113
114pub mod rcu {
116 pub use crate::data_structures::rcu::{ReadGuard, SynchronizedWriterRcu, WriteGuard};
117}
118
119pub mod socket {
121 mod address;
122 mod base;
123 mod cookie;
124 pub(crate) mod sndbuf;
125
126 pub use address::{
127 AddrIsMappedError, AddrVecIter, ConnAddr, ConnInfoAddr, ConnIpAddr, DualStackConnIpAddr,
128 DualStackListenerIpAddr, DualStackLocalIp, DualStackRemoteIp, ListenerAddr, ListenerIpAddr,
129 SocketIpAddr, StrictlyZonedAddr,
130 };
131 pub use base::{
132 AddrEntry, AddrVec, Bound, BoundSocketMap, DualStackIpExt, DualStackTuple, EitherStack,
133 FoundSockets, IncompatibleError, InsertError, Inserter, Listener, ListenerAddrInfo,
134 MaybeDualStack, NotDualStackCapableError, RemoveResult, SetDualStackEnabledError, Shutdown,
135 ShutdownType, SocketAddrType, SocketDeviceUpdate, SocketDeviceUpdateNotAllowedError,
136 SocketIpAddrExt, SocketIpExt, SocketMapAddrSpec, SocketMapAddrStateSpec,
137 SocketMapAddrStateUpdateSharingSpec, SocketMapConflictPolicy, SocketMapStateSpec,
138 SocketMapUpdateSharingPolicy, SocketStateEntry, SocketZonedAddrExt, UpdateSharingError,
139 };
140 pub use cookie::SocketCookie;
141 pub use sndbuf::{
142 SendBufferFullError, SendBufferSpace, SendBufferTracking, SocketWritableListener,
143 };
144}
145
146pub mod socketmap {
149 pub use crate::data_structures::socketmap::{
150 Entry, IterShadows, OccupiedEntry, SocketMap, Tagged, VacantEntry,
151 };
152}
153
154pub mod sync {
156 pub use netstack3_sync::rc::{
161 DebugReferences, DynDebugReferences, MapNotifier as MapRcNotifier, Notifier as RcNotifier,
162 Primary as PrimaryRc, ResourceToken, ResourceTokenValue, Strong as StrongRc,
163 Weak as WeakRc,
164 };
165 pub use netstack3_sync::{LockGuard, Mutex, RwLock, RwLockReadGuard, RwLockWriteGuard};
166}
167
168#[cfg(any(test, feature = "testutils"))]
170pub mod testutil {
171 mod addr;
172 mod benchmarks;
173 mod fake_bindings;
174 mod fake_core;
175 mod fake_network;
176 mod misc;
177 mod monotonic_id;
178
179 pub use crate::device::address::testutil::FakeWeakAddressId;
180 pub use crate::device::link::testutil::{FakeLinkAddress, FakeLinkDevice, FakeLinkDeviceId};
181 pub use crate::device::testutil::{
182 FakeDeviceClass, FakeDeviceId, FakeReferencyDeviceId, FakeStrongDeviceId, FakeWeakDeviceId,
183 MultipleDevicesId, MultipleDevicesIdState,
184 };
185 pub use crate::event::testutil::FakeEventCtx;
186 pub use crate::frame::testutil::{FakeFrameCtx, FakeTxMetadata, WithFakeFrameContext};
187 pub use crate::matchers::testutil::FakeMatcherDeviceId;
188 pub use crate::rng::testutil::{FakeCryptoRng, new_rng, run_with_many_seeds};
189 pub use crate::settings::testutil::AlwaysDefaultsSettingsContext;
190 pub use crate::socket::sndbuf::testutil::FakeSocketWritableListener;
191 pub use crate::time::testutil::{
192 FakeAtomicInstant, FakeInstant, FakeInstantCtx, FakeTimerCtx, FakeTimerCtxExt, FakeTimerId,
193 InstantAndData, WithFakeTimerContext,
194 };
195 pub use addr::{TEST_ADDRS_V4, TEST_ADDRS_V6, TestAddrs, TestDualStackIpExt, TestIpExt};
196 pub use benchmarks::{Bencher, RealBencher, TestBencher};
197 pub use fake_bindings::FakeBindingsCtx;
198 pub use fake_core::FakeCoreCtx;
199 pub use fake_network::{
200 FakeNetwork, FakeNetworkLinks, FakeNetworkSpec, PendingFrame, PendingFrameData, StepResult,
201 };
202 pub use misc::{assert_empty, set_logger_for_test};
203 pub use monotonic_id::MonotonicIdentifier;
204}
205
206#[cfg(benchmark)]
208pub mod benchmarks {
209 pub fn add_benches(b: criterion::Benchmark) -> criterion::Benchmark {
211 crate::data_structures::token_bucket::benchmarks::add_benches(b)
212 }
213}