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 packet;
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_structures::token_bucket::TokenBucket;
52pub use device::address::{
53 AssignedAddrIpExt, IpAddressId, IpDeviceAddr, IpDeviceAddressIdContext, Ipv4DeviceAddr,
54 Ipv6DeviceAddr, WeakIpAddressId,
55};
56pub use device::link::{LinkAddress, LinkDevice, LinkUnicastAddress};
57pub use device::{
58 AnyDevice, Device, DeviceIdAnyCompatContext, DeviceIdContext, DeviceIdentifier, EitherDeviceId,
59 StrongDeviceIdentifier, WeakDeviceIdentifier,
60};
61pub use error::{
62 AddressResolutionFailed, ErrorAndSerializer, ExistsError, LocalAddressError, NotFoundError,
63 NotSupportedError, RemoteAddressError, SocketError, ZonedAddressError,
64};
65pub use event::EventContext;
66pub use frame::{
67 CoreTxMetadataContext, FrameDestination, NeverBuffer, ReceivableFrameMeta, RecvFrameContext,
68 RecvIpFrameMeta, SendFrameContext, SendFrameError, SendFrameErrorReason, SendableFrameMeta,
69 TxMetadata, TxMetadataBindingsTypes,
70};
71pub use inspect::{Inspectable, InspectableValue, Inspector, InspectorDeviceExt, InspectorExt};
72pub use ip::{
73 BroadcastIpExt, IcmpErrorCode, IcmpIpExt, Icmpv4ErrorCode, Icmpv6ErrorCode, IpExt,
74 IpTypesIpExt, Mark, MarkDomain, MarkStorage, Marks, Mms, WrapBroadcastMarker,
75};
76pub use map_deref::{MapDeref, MapDerefExt};
77pub use matchers::{
78 AddressMatcher, AddressMatcherEither, AddressMatcherType, BoundAddressMatcherEither,
79 BoundInterfaceMatcher, BoundPortMatcher, InterfaceMatcher, InterfaceProperties,
80 IpSocketMatcher, IpSocketProperties, IpSocketPropertiesMatcher, MarkInDomainMatcher,
81 MarkMatcher, MarkMatchers, Matcher, MatcherBindingsTypes, MaybeSocketTransportProperties,
82 PortMatcher, SocketCookieMatcher, SocketTransportProtocolMatcher, SubnetMatcher,
83 TcpSocketMatcher, TcpSocketProperties, TcpSocketState, TcpStateMatcher, UdpSocketMatcher,
84 UdpSocketProperties, UdpSocketState, UdpStateMatcher,
85};
86pub use num::PositiveIsize;
87pub use packet::{
88 ChecksumOffloadResult, ChecksumOffloadSpec, ChecksumRxOffloading, DynamicNetworkSerializer,
89 NetworkParsingContext, NetworkPartialSerializer, NetworkSerializationContext,
90 NetworkSerializer, ProtocolSpecificOffloadSpec,
91};
92pub use port_alloc::{EphemeralPort, PortAllocImpl, simple_randomized_port_alloc};
93pub use resource_references::{
94 DeferredResourceRemovalContext, ReferenceNotifiers, ReferenceNotifiersExt,
95 RemoveResourceResult, RemoveResourceResultWithContext,
96};
97pub use rng::RngContext;
98pub use settings::{BufferSizeSettings, SettingsContext};
99pub use tcp::base::{Control, EffectiveMss, FragmentedPayload, Mss, MssSizeLimiters};
100pub use tcp::segment::{
101 HandshakeOptions, Options, Payload, PayloadLen, ResetOptions, SackBlock, SackBlocks, Segment,
102 SegmentHeader, SegmentOptions, VerifiedTcpSegment,
103};
104pub use tcp::seqnum::{SeqNum, UnscaledWindowSize, WindowScale, WindowSize};
105pub use tcp::timestamp::{
106 Milliseconds, RxTimestampOption, Timestamp, TimestampOption, TxTimestampOption, Unitless,
107};
108pub use test_only::TestOnlyPartialEq;
109pub use time::local_timer_heap::LocalTimerHeap;
110pub use time::{
111 AtomicInstant, CoreTimerContext, HandleableTimer, Instant, InstantBindingsTypes,
112 InstantContext, IntoCoreTimerCtx, NestedIntoCoreTimerCtx, TimerBindingsTypes, TimerContext,
113 TimerHandler,
114};
115pub use uninstantiable::{Uninstantiable, UninstantiableWrapper};
116pub use work_queue::WorkQueueReport;
117
118pub mod ref_counted_hash_map {
120 pub use crate::data_structures::ref_counted_hash_map::{
121 InsertResult, RefCountedHashMap, RefCountedHashSet, RemoveResult,
122 };
123}
124
125pub mod rcu {
127 pub use crate::data_structures::rcu::{ReadGuard, SynchronizedWriterRcu, WriteGuard};
128}
129
130pub mod socket {
132 mod address;
133 mod base;
134 mod cookie;
135 pub(crate) mod sndbuf;
136
137 pub use address::{
138 AddrIsMappedError, AddrVecIter, ConnAddr, ConnInfoAddr, ConnIpAddr, DualStackConnIpAddr,
139 DualStackListenerIpAddr, DualStackLocalIp, DualStackRemoteIp, IpAddrVec, ListenerAddr,
140 ListenerIpAddr, SocketIpAddr, StrictlyZonedAddr,
141 };
142 pub use base::{
143 AddrEntry, AddrVec, Bound, BoundSocketMap, DualStackIpExt, DualStackTuple, EitherStack,
144 FoundSockets, IncompatibleError, InsertError, Inserter, Listener, ListenerAddrInfo,
145 MaybeDualStack, NotDualStackCapableError, RemoveResult, ReusePortOption,
146 SetDualStackEnabledError, SharingDomain, Shutdown, ShutdownType, SocketAddrType,
147 SocketDeviceUpdate, SocketDeviceUpdateNotAllowedError, SocketIpAddrExt, SocketIpExt,
148 SocketMapAddrSpec, SocketMapAddrStateSpec, SocketMapAddrStateUpdateSharingSpec,
149 SocketMapConflictPolicy, SocketMapStateSpec, SocketMapUpdateSharingPolicy,
150 SocketStateEntry, SocketZonedAddrExt, UpdateSharingError,
151 };
152 pub use cookie::SocketCookie;
153 pub use sndbuf::{
154 SendBufferFullError, SendBufferSpace, SendBufferTracking, SocketWritableListener,
155 };
156}
157
158pub mod socketmap {
161 pub use crate::data_structures::socketmap::{
162 Entry, IterShadows, OccupiedEntry, SocketMap, Tagged, VacantEntry,
163 };
164}
165
166pub mod sync {
168 pub use netstack3_sync::rc::{
173 DebugReferences, DynDebugReferences, MapNotifier as MapRcNotifier, Notifier as RcNotifier,
174 Primary as PrimaryRc, ResourceToken, ResourceTokenValue, Strong as StrongRc,
175 Weak as WeakRc,
176 };
177 pub use netstack3_sync::{LockGuard, Mutex, RwLock, RwLockReadGuard, RwLockWriteGuard};
178}
179
180#[cfg(any(test, feature = "testutils"))]
182pub mod testutil {
183 mod addr;
184 mod benchmarks;
185 mod fake_bindings;
186 mod fake_core;
187 mod fake_network;
188 mod misc;
189 mod monotonic_id;
190
191 pub use crate::device::address::testutil::FakeWeakAddressId;
192 pub use crate::device::link::testutil::{FakeLinkAddress, FakeLinkDevice, FakeLinkDeviceId};
193 pub use crate::device::testutil::{
194 FakeDeviceClass, FakeDeviceId, FakeReferencyDeviceId, FakeStrongDeviceId, FakeWeakDeviceId,
195 MultipleDevicesId, MultipleDevicesIdState,
196 };
197 pub use crate::event::testutil::FakeEventCtx;
198 pub use crate::frame::testutil::{FakeFrameCtx, FakeTxMetadata, WithFakeFrameContext};
199 pub use crate::matchers::testutil::FakeMatcherDeviceId;
200 pub use crate::rng::testutil::{FakeCryptoRng, new_rng, run_with_many_seeds};
201 pub use crate::settings::testutil::AlwaysDefaultsSettingsContext;
202 pub use crate::socket::sndbuf::testutil::FakeSocketWritableListener;
203 pub use crate::time::testutil::{
204 FakeAtomicInstant, FakeInstant, FakeInstantCtx, FakeTimerCtx, FakeTimerCtxExt, FakeTimerId,
205 InstantAndData, WithFakeTimerContext,
206 };
207 pub use addr::{TEST_ADDRS_V4, TEST_ADDRS_V6, TestAddrs, TestDualStackIpExt, TestIpExt};
208 pub use benchmarks::{Bencher, RealBencher, TestBencher};
209 pub use fake_bindings::FakeBindingsCtx;
210 pub use fake_core::FakeCoreCtx;
211 pub use fake_network::{
212 FakeNetwork, FakeNetworkLinks, FakeNetworkSpec, PendingFrame, PendingFrameData, StepResult,
213 };
214 pub use misc::{assert_empty, set_logger_for_test};
215 pub use monotonic_id::MonotonicIdentifier;
216}
217
218#[cfg(benchmark)]
220pub mod benchmarks {
221 pub fn add_benches(b: criterion::Benchmark) -> criterion::Benchmark {
223 crate::data_structures::token_bucket::benchmarks::add_benches(b)
224 }
225}