netstack3_core/
lock_ordering.rs1pub(crate) use lock_order::Unlocked;
106
107use core::convert::Infallible as Never;
108use core::marker::PhantomData;
109
110use lock_order::impl_lock_after;
111use lock_order::relation::LockAfter;
112use net_types::ip::{Ipv4, Ipv6};
113
114pub enum UnlockedState {}
121
122pub struct IcmpAllSocketsSet<I>(PhantomData<I>, Never);
123pub struct IcmpSocketState<I>(PhantomData<I>, Never);
124pub struct IcmpBoundMap<I>(PhantomData<I>, Never);
125
126pub struct IcmpTokenBucket<I>(PhantomData<I>, Never);
127
128pub struct TcpAllSocketsSet<I>(PhantomData<I>, Never);
129pub struct TcpSocketState<I>(PhantomData<I>, Never);
130pub struct TcpDemux<I>(PhantomData<I>, Never);
131pub struct UdpAllSocketsSet<I>(PhantomData<I>, Never);
132pub struct UdpSocketState<I>(PhantomData<I>, Never);
133pub struct UdpBoundMap<I>(PhantomData<I>, Never);
134
135pub struct IpDeviceConfiguration<I>(PhantomData<I>, Never);
136pub struct IpDeviceGmp<I>(PhantomData<I>, Never);
137pub struct IpDeviceAddresses<I>(PhantomData<I>, Never);
138pub struct IpDeviceFlags<I>(PhantomData<I>, Never);
139pub struct IpDeviceDefaultHopLimit<I>(PhantomData<I>, Never);
140
141pub enum Ipv4DeviceAddressState {}
142
143pub enum Ipv6DeviceRouterSolicitations {}
144pub enum Ipv6DeviceRouteDiscovery {}
145pub enum Ipv6DeviceLearnedParams {}
146pub enum Ipv6DeviceSlaac {}
147pub enum Ipv6DeviceAddressDad {}
148pub enum Ipv6DeviceAddressState {}
149pub struct NudConfig<I>(PhantomData<I>, Never);
150
151pub struct IpState<I>(PhantomData<I>, Never);
154pub struct IpStatePmtuCache<I>(PhantomData<I>, Never);
155pub struct IpStateFragmentCache<I>(PhantomData<I>, Never);
156pub struct IpStateRulesTable<I>(PhantomData<I>, Never);
157pub struct IpStateRoutingTables<I>(PhantomData<I>, Never);
158pub struct IpStateRoutingTable<I>(PhantomData<I>, Never);
159pub struct RawIpSocketState<I>(PhantomData<I>, Never);
161pub struct AllRawIpSockets<I>(PhantomData<I>, Never);
163
164pub struct IpMulticastForwardingState<I>(PhantomData<I>, Never);
166pub struct IpMulticastRouteTable<I>(PhantomData<I>, Never);
168pub struct IpMulticastForwardingPendingPackets<I>(PhantomData<I>, Never);
170
171pub enum DeviceLayerState {}
172pub enum AllDeviceSockets {}
173pub enum AnyDeviceSockets {}
174pub enum DeviceSocketState {}
175pub enum DeviceSockets {}
176pub struct EthernetDeviceIpState<I>(PhantomData<I>, Never);
177pub enum EthernetDeviceDynamicState {}
178pub enum PureIpDeviceDynamicState {}
179
180pub enum EthernetIpv4Arp {}
181pub enum EthernetIpv6Nud {}
182pub enum EthernetTxQueue {}
183pub enum EthernetTxDequeue {}
184pub enum EthernetRxDequeue {}
192
193pub enum LoopbackRxQueue {}
194pub enum LoopbackRxDequeue {}
195pub enum LoopbackTxQueue {}
196pub enum LoopbackTxDequeue {}
197
198pub enum PureIpDeviceTxQueue {}
199pub enum PureIpDeviceTxDequeue {}
200pub enum PureIpDeviceRxDequeue {}
204
205pub struct FilterState<I>(PhantomData<I>, Never);
206
207impl LockAfter<Unlocked> for LoopbackTxDequeue {}
208impl_lock_after!(LoopbackTxDequeue => EthernetTxDequeue);
209impl_lock_after!(EthernetTxDequeue => PureIpDeviceTxDequeue);
210impl_lock_after!(PureIpDeviceTxDequeue => LoopbackRxDequeue);
211impl_lock_after!(LoopbackRxDequeue => EthernetRxDequeue);
212impl_lock_after!(EthernetRxDequeue => PureIpDeviceRxDequeue);
213impl_lock_after!(PureIpDeviceRxDequeue => IcmpAllSocketsSet<Ipv4>);
214impl_lock_after!(IcmpAllSocketsSet<Ipv4> => IcmpAllSocketsSet<Ipv6>);
215impl_lock_after!(IcmpAllSocketsSet<Ipv6> => IcmpSocketState<Ipv4>);
216impl_lock_after!(IcmpSocketState<Ipv4> => IcmpBoundMap<Ipv4>);
217impl_lock_after!(IcmpBoundMap<Ipv4> => IcmpTokenBucket<Ipv4>);
218impl_lock_after!(IcmpTokenBucket<Ipv4> => IcmpSocketState<Ipv6>);
219impl_lock_after!(IcmpSocketState<Ipv6> => IcmpBoundMap<Ipv6>);
220impl_lock_after!(IcmpBoundMap<Ipv6> => IcmpTokenBucket<Ipv6>);
221impl_lock_after!(IcmpTokenBucket<Ipv6> => AllRawIpSockets<Ipv4>);
222impl_lock_after!(AllRawIpSockets<Ipv4> => AllRawIpSockets<Ipv6>);
223impl_lock_after!(AllRawIpSockets<Ipv6> => RawIpSocketState<Ipv4>);
224impl_lock_after!(RawIpSocketState<Ipv4> => RawIpSocketState<Ipv6>);
225impl_lock_after!(RawIpSocketState<Ipv6> => TcpAllSocketsSet<Ipv4>);
226
227impl_lock_after!(TcpAllSocketsSet<Ipv4> => TcpAllSocketsSet<Ipv6>);
232impl_lock_after!(TcpAllSocketsSet<Ipv6> => TcpSocketState<Ipv4>);
233impl_lock_after!(TcpSocketState<Ipv4> => TcpSocketState<Ipv6>);
234impl_lock_after!(TcpSocketState<Ipv6> => TcpDemux<Ipv4>);
235impl_lock_after!(TcpDemux<Ipv4> => TcpDemux<Ipv6>);
236impl_lock_after!(TcpDemux<Ipv6> => UdpAllSocketsSet<Ipv4>);
237impl_lock_after!(UdpAllSocketsSet<Ipv4> => UdpAllSocketsSet<Ipv6>);
238impl_lock_after!(UdpAllSocketsSet<Ipv6> => UdpSocketState<Ipv4>);
239impl_lock_after!(UdpSocketState<Ipv4> => UdpSocketState<Ipv6>);
240impl_lock_after!(UdpSocketState<Ipv6> => UdpBoundMap<Ipv4>);
241impl_lock_after!(UdpBoundMap<Ipv4> => UdpBoundMap<Ipv6>);
242impl_lock_after!(UdpBoundMap<Ipv6> => IpMulticastForwardingState<Ipv4>);
243impl_lock_after!(IpMulticastForwardingState<Ipv4> => IpMulticastRouteTable<Ipv4>);
244impl_lock_after!(IpMulticastRouteTable<Ipv4> => IpMulticastForwardingPendingPackets<Ipv4>);
245impl_lock_after!(IpMulticastForwardingPendingPackets<Ipv4> => IpMulticastForwardingState<Ipv6>);
246impl_lock_after!(IpMulticastForwardingState<Ipv6> => IpMulticastRouteTable<Ipv6>);
247impl_lock_after!(IpMulticastRouteTable<Ipv6> => IpMulticastForwardingPendingPackets<Ipv6>);
248impl_lock_after!(IpMulticastForwardingPendingPackets<Ipv6> => IpStateRulesTable<Ipv4>);
249impl_lock_after!(IpStateRulesTable<Ipv4> => IpStateRulesTable<Ipv6>);
250impl_lock_after!(IpStateRulesTable<Ipv6> => IpStateRoutingTables<Ipv4>);
251impl_lock_after!(IpStateRoutingTables<Ipv4> => IpStateRoutingTables<Ipv6>);
252impl_lock_after!(IpStateRoutingTables<Ipv6> => IpStateRoutingTable<Ipv4>);
253impl_lock_after!(IpStateRoutingTable<Ipv4> => IpStateRoutingTable<Ipv6>);
254impl_lock_after!(IpStateRoutingTable<Ipv6> => IpDeviceConfiguration<Ipv4>);
255impl_lock_after!(IpDeviceConfiguration<Ipv4> => IpDeviceConfiguration<Ipv6>);
256impl_lock_after!(IpDeviceConfiguration<Ipv6> => DeviceLayerState);
257impl_lock_after!(DeviceLayerState => Ipv6DeviceRouteDiscovery);
258impl_lock_after!(Ipv6DeviceRouteDiscovery => Ipv6DeviceSlaac);
259impl_lock_after!(Ipv6DeviceSlaac => Ipv6DeviceAddressDad);
260impl_lock_after!(Ipv6DeviceAddressDad => IpDeviceGmp<Ipv4>);
261
262impl_lock_after!(IpDeviceGmp<Ipv4> => IpDeviceGmp<Ipv6>);
263impl_lock_after!(IpDeviceGmp<Ipv6> => FilterState<Ipv4>);
264
265impl_lock_after!(FilterState<Ipv4> => FilterState<Ipv6>);
266impl_lock_after!(FilterState<Ipv6> => IpState<Ipv4>);
267impl_lock_after!(IpState<Ipv4> => IpState<Ipv6>);
268
269impl_lock_after!(IpState<Ipv4> => IpStatePmtuCache<Ipv4>);
270impl_lock_after!(IpState<Ipv6> => IpStatePmtuCache<Ipv6>);
271impl_lock_after!(IpState<Ipv4> => IpStateFragmentCache<Ipv4>);
272impl_lock_after!(IpState<Ipv6> => IpStateFragmentCache<Ipv6>);
273
274impl_lock_after!(IpState<Ipv6> => LoopbackTxQueue);
275impl_lock_after!(LoopbackTxQueue => LoopbackRxQueue);
276impl_lock_after!(LoopbackTxQueue => EthernetIpv4Arp);
277impl_lock_after!(EthernetIpv4Arp => EthernetIpv6Nud);
278impl_lock_after!(EthernetIpv6Nud => AllDeviceSockets);
279
280impl_lock_after!(AllDeviceSockets => AnyDeviceSockets);
281impl_lock_after!(AnyDeviceSockets => EthernetDeviceIpState<Ipv4>);
282impl_lock_after!(EthernetDeviceIpState<Ipv4> => IpDeviceAddresses<Ipv4>);
283impl_lock_after!(IpDeviceAddresses<Ipv4> => IpDeviceAddresses<Ipv6>);
284impl_lock_after!(IpDeviceAddresses<Ipv6> => IpDeviceFlags<Ipv4>);
285impl_lock_after!(IpDeviceFlags<Ipv4> => IpDeviceFlags<Ipv6>);
286impl_lock_after!(IpDeviceFlags<Ipv6> => Ipv4DeviceAddressState);
287impl_lock_after!(Ipv4DeviceAddressState => Ipv6DeviceAddressState);
288impl_lock_after!(Ipv6DeviceAddressState => IpDeviceDefaultHopLimit<Ipv4>);
289impl_lock_after!(IpDeviceDefaultHopLimit<Ipv4> => EthernetDeviceIpState<Ipv6>);
290impl_lock_after!(EthernetDeviceIpState<Ipv6> => IpDeviceDefaultHopLimit<Ipv6>);
291impl_lock_after!(IpDeviceDefaultHopLimit<Ipv6> => Ipv6DeviceRouterSolicitations);
292impl_lock_after!(Ipv6DeviceRouterSolicitations => Ipv6DeviceLearnedParams);
293impl_lock_after!(Ipv6DeviceLearnedParams => NudConfig<Ipv4>);
294impl_lock_after!(NudConfig<Ipv4> => NudConfig<Ipv6>);
295impl_lock_after!(NudConfig<Ipv6> => EthernetDeviceDynamicState);
296impl_lock_after!(EthernetDeviceDynamicState => EthernetTxQueue);
297impl_lock_after!(EthernetTxQueue => PureIpDeviceDynamicState);
298impl_lock_after!(PureIpDeviceDynamicState => PureIpDeviceTxQueue);
299
300impl_lock_after!(AnyDeviceSockets => DeviceSockets);
301impl_lock_after!(DeviceSockets => DeviceSocketState);