1#![no_std]
8#![recursion_limit = "256"]
11#![allow(stable_features)]
14#![warn(
15 missing_docs,
16 unreachable_patterns,
17 clippy::useless_conversion,
18 clippy::redundant_clone,
19 clippy::precedence
20)]
21extern crate alloc;
22
23mod api;
24mod context;
25mod counters;
26mod lock_ordering;
27mod marker;
28mod state;
29mod time;
30mod transport;
31
32#[cfg(any(test, feature = "testutils"))]
33pub mod testutil;
34
35pub mod data_structures {
37 pub mod rcu {
39 pub use netstack3_base::rcu::{ReadGuard, SynchronizedWriterRcu, WriteGuard};
40 }
41}
42pub mod device {
44 #[path = "."]
45 pub(crate) mod integration {
46 mod base;
47 mod blackhole;
48 mod ethernet;
49 mod loopback;
50 mod pure_ip;
51 mod socket;
52
53 pub(crate) use base::{
54 device_state, device_state_and_core_ctx, get_mtu, ip_device_state,
55 ip_device_state_and_core_ctx,
56 };
57 }
58
59 pub use netstack3_base::{
61 BoundInterfaceMatcher, InterfaceMatcher, InterfaceProperties, StrongDeviceIdentifier,
62 };
63 pub use netstack3_device::blackhole::{BlackholeDevice, BlackholeDeviceId};
64 pub use netstack3_device::ethernet::{
65 EthernetCreationProperties, EthernetDeviceEvent, EthernetDeviceId, EthernetLinkDevice,
66 EthernetWeakDeviceId, MaxEthernetFrameSize, RecvEthernetFrameMeta,
67 };
68 pub use netstack3_device::loopback::{
69 LoopbackCreationProperties, LoopbackDevice, LoopbackDeviceId, LoopbackWeakDeviceId,
70 };
71 pub use netstack3_device::pure_ip::{
72 PureIpDevice, PureIpDeviceCreationProperties, PureIpDeviceId,
73 PureIpDeviceReceiveFrameMetadata, PureIpHeaderParams, PureIpWeakDeviceId,
74 };
75 pub use netstack3_device::queue::{
76 BatchSize, ReceiveQueueBindingsContext, TransmitQueueBindingsContext,
77 TransmitQueueConfiguration, TxBufferAllocator,
78 };
79 pub use netstack3_device::{
80 ArpConfiguration, ArpConfigurationUpdate, DeviceBufferBindingsTypes, DeviceClassMatcher,
81 DeviceConfiguration, DeviceConfigurationUpdate, DeviceConfigurationUpdateError,
82 DeviceCounters, DeviceId, DeviceIdAndNameMatcher, DeviceLayerEventDispatcher,
83 DeviceLayerStateTypes, DeviceProvider, DeviceSendFrameError, NdpConfiguration,
84 NdpConfigurationUpdate, WeakDeviceId,
85 };
86}
87
88pub mod device_socket {
90 pub use netstack3_base::{FrameDestination, SendFrameErrorReason};
91 pub use netstack3_device::socket::{
92 DeviceSocketBindingsContext, DeviceSocketMetadata, DeviceSocketTypes, EthernetFrame,
93 EthernetHeaderParams, Frame, IpFrame, Protocol, ReceiveFrameError, ReceivedFrame,
94 SentFrame, SocketId, SocketInfo, TargetDevice, WeakDeviceSocketId,
95 };
96}
97
98pub mod error {
100 pub use netstack3_base::{
101 AddressResolutionFailed, ExistsError, LocalAddressError, NotFoundError, NotSupportedError,
102 RemoteAddressError, SocketError, ZonedAddressError,
103 };
104}
105
106pub mod filter {
108 mod integration;
109
110 pub use netstack3_filter::{
111 Action, BindingsPacketMatcher, EitherIpProto, FilterApi, FilterBindingsContext,
112 FilterBindingsTypes, FilterIpExt, FilterIpPacket, FilterPacketMetadata, Hook, Interfaces,
113 IpPacket, IpRoutines, MarkAction, NatRoutines, PacketMatcher, ProofOfEgressCheck,
114 RejectType, Routine, Routines, Rule, SocketEgressFilterResult, SocketInfo,
115 SocketIngressFilterResult, SocketOpsFilter, SocketOpsFilterBindingContext,
116 TransparentProxy, TransportProtocolMatcher, Tuple, UninstalledRoutine, ValidationError,
117 };
118}
119
120pub mod inspect {
122 pub use netstack3_base::{
123 Inspectable, InspectableValue, Inspector, InspectorDeviceExt, InspectorExt,
124 };
125}
126
127pub mod icmp {
129 pub use netstack3_icmp_echo::{
130 IcmpEchoBindingsContext, IcmpEchoBindingsTypes, IcmpEchoSettings, IcmpSocketId,
131 ReceiveIcmpEchoError,
132 };
133}
134
135pub mod ip {
137 #[path = "."]
138 pub(crate) mod integration {
139 mod base;
140 mod device;
141 mod multicast_forwarding;
142 mod raw;
143
144 pub(crate) use device::CoreCtxWithIpDeviceConfiguration;
145 }
146
147 pub use netstack3_base::{
149 AddressMatcher, AddressMatcherEither, AddressMatcherType, BoundAddressMatcherEither,
150 BoundPortMatcher, Mark, MarkDomain, MarkInDomainMatcher, MarkMatcher, MarkMatchers, Marks,
151 PortMatcher, SubnetMatcher, WrapBroadcastMarker,
152 };
153 pub use netstack3_ip::device::{
154 AddIpAddrSubnetError, AddrSubnetAndManualConfigEither, AddressRemovedReason,
155 CommonAddressConfig, CommonAddressProperties, IidGenerationConfiguration, IidSecret,
156 IpAddressState, IpDeviceConfiguration, IpDeviceConfigurationAndFlags,
157 IpDeviceConfigurationUpdate, IpDeviceEvent, IpDeviceIpExt, Ipv4AddrConfig,
158 Ipv4DeviceConfiguration, Ipv4DeviceConfigurationUpdate, Ipv6AddrManualConfig,
159 Ipv6DeviceConfiguration, Ipv6DeviceConfigurationUpdate, Lifetime,
160 PendingIpDeviceConfigurationUpdate, PreferredLifetime, RouteDiscoveryConfiguration,
161 RouteDiscoveryConfigurationUpdate, SetIpAddressPropertiesError, SlaacConfiguration,
162 SlaacConfigurationUpdate, StableSlaacAddressConfiguration,
163 TemporarySlaacAddressConfiguration, UpdateIpConfigurationError,
164 };
165 pub use netstack3_ip::gmp::{IgmpConfigMode, MldConfigMode};
166 pub use netstack3_ip::multicast_forwarding::{
167 ForwardMulticastRouteError, MulticastForwardingDisabledError, MulticastForwardingEvent,
168 MulticastRoute, MulticastRouteKey, MulticastRouteStats, MulticastRouteTarget,
169 };
170 pub use netstack3_ip::raw::{
171 RawIpSocketIcmpFilter, RawIpSocketIcmpFilterError, RawIpSocketId, RawIpSocketProtocol,
172 RawIpSocketSendToError, RawIpSocketsBindingsContext, RawIpSocketsBindingsTypes,
173 ReceivePacketError, WeakRawIpSocketId,
174 };
175 pub use netstack3_ip::socket::{
176 IpSockCreateAndSendError, IpSockCreationError, IpSockSendError,
177 };
178 pub use netstack3_ip::{
179 IpLayerEvent, IpRoutingBindingsTypes, MarksBindingsContext, ResolveRouteError,
180 RouterAdvertisementEvent, SocketMetadata,
181 };
182}
183
184pub mod neighbor {
186 pub use netstack3_ip::nud::{
188 Event, EventDynamicState, EventKind, EventState, LinkResolutionContext,
189 LinkResolutionNotifier, LinkResolutionResult, MAX_ENTRIES, NeighborRemovalError,
190 NudUserConfig, NudUserConfigUpdate, StaticNeighborInsertionError,
191 TriggerNeighborProbeError,
192 };
193}
194
195pub mod routes {
197 pub use netstack3_base::{Marks, WrapBroadcastMarker};
199 pub use netstack3_ip::{
200 AddRouteError, AddableEntry, AddableEntryEither, AddableMetric, Entry, EntryEither,
201 Generation, Metric, NextHop, RawMetric, ResolvedRoute, RoutableIpAddr, RoutePreference,
202 RouteResolveOptions, RoutingTableCookie, RoutingTableId, Rule, RuleAction, RuleMatcher,
203 TrafficOriginMatcher,
204 };
205}
206
207pub mod socket {
209 pub use netstack3_datagram::{
210 ConnInfo, ConnectError, ExpectedConnError, ExpectedUnboundError, ListenerInfo,
211 MulticastInterfaceSelector, MulticastMembershipInterfaceSelector,
212 PendingDatagramSocketError, SendError, SendToError, SetMulticastMembershipError,
213 SocketInfo,
214 };
215
216 pub use netstack3_base::socket::{
217 AddrIsMappedError, NotDualStackCapableError, ReusePortOption, SetDualStackEnabledError,
218 SharingDomain, ShutdownType, SocketCookie, SocketWritableListener, StrictlyZonedAddr,
219 };
220
221 pub use netstack3_base::{
222 IpSocketMatcher, SocketCookieMatcher, SocketTransportProtocolMatcher, TcpSocketMatcher,
223 TcpStateMatcher, UdpSocketMatcher, UdpStateMatcher,
224 };
225}
226
227pub mod sync {
229 use netstack3_sync as _;
234
235 pub use netstack3_base::sync::{
236 DebugReferences, DynDebugReferences, LockGuard, MapRcNotifier, Mutex, PrimaryRc,
237 RcNotifier, ResourceToken, ResourceTokenValue, RwLock, RwLockReadGuard, RwLockWriteGuard,
238 StrongRc, WeakRc,
239 };
240 pub use netstack3_base::{RemoveResourceResult, RemoveResourceResultWithContext};
241}
242
243pub mod tcp {
245 pub use netstack3_base::{FragmentedPayload, Payload, PayloadLen, TcpSocketState};
246 pub use netstack3_tcp::{
247 AcceptError, BindError, BoundInfo, Buffer, BufferLimits, BufferSizes,
248 CongestionControlState, ConnectError, ConnectionError, ConnectionInfo,
249 DEFAULT_FIN_WAIT2_TIMEOUT, IntoBuffers, ListenError, ListenerNotifier, NoConnection,
250 OriginalDestinationError, ReceiveBuffer, SendBuffer, SetDeviceError, SetReuseAddrError,
251 SocketAddr, SocketInfo, SocketOptions, TcpBindingsTypes, TcpSettings,
252 TcpSocketDestructionContext, TcpSocketDiagnosticTuple, TcpSocketDiagnostics, TcpSocketId,
253 TcpSocketInfo, UnboundInfo,
254 };
255}
256
257pub mod trace {
259 pub use netstack3_trace::*;
261}
262
263pub mod types {
265 pub use netstack3_base::{BufferSizeSettings, Counter, PositiveIsize, WorkQueueReport};
266}
267
268pub mod udp {
270 pub use netstack3_udp::{
271 ReceiveUdpError, SendError, SendToError, UdpBindingsTypes, UdpPacketMeta,
272 UdpReceiveBindingsContext, UdpRemotePort, UdpSettings, UdpSocketDiagnosticTuple,
273 UdpSocketDiagnostics, UdpSocketId,
274 };
275}
276
277pub use api::CoreApi;
278pub use context::{CoreCtx, UnlockedCoreCtx};
279pub use inspect::Inspector;
280pub use marker::{BindingsContext, BindingsTypes, CoreContext, IpBindingsContext, IpExt};
281pub use netstack3_base::{
282 ChecksumOffloadResult, ChecksumOffloadSpec, ChecksumRxOffloading, CtxPair,
283 DeferredResourceRemovalContext, EventContext, InstantBindingsTypes, InstantContext,
284 MapDerefExt, MatcherBindingsTypes, NetworkParsingContext, NetworkSerializationContext,
285 ProtocolSpecificOffloadSpec, ReferenceNotifiers, RngContext, SettingsContext,
286 SocketDiagnosticsSeed, TimerBindingsTypes, TimerContext, TxMetadata, TxMetadataBindingsTypes,
287};
288pub use netstack3_datagram::PendingDatagramSocketError;
289pub use state::{StackState, StackStateBuilder};
290pub use time::{AtomicInstant, Instant, TimerId};
291pub use transport::CoreTxMetadata;
292
293pub use netstack3_device::for_any_device_id;
295pub use netstack3_macros::context_ip_bounds;
296
297