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