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