netstack3_device/
blackhole.rs1use core::convert::Infallible as Never;
8
9use netstack3_base::Device;
10
11use crate::internal::base::{BlackholeDeviceCounters, DeviceReceiveFrameSpec};
12use crate::internal::id::{BasePrimaryDeviceId, BaseWeakDeviceId};
13use crate::{BaseDeviceId, DeviceStateSpec};
14
15pub type BlackholeWeakDeviceId<BT> = BaseWeakDeviceId<BlackholeDevice, BT>;
22
23pub type BlackholeDeviceId<BT> = BaseDeviceId<BlackholeDevice, BT>;
29
30pub type BlackholePrimaryDeviceId<BT> = BasePrimaryDeviceId<BlackholeDevice, BT>;
32
33pub struct BlackholeDeviceState {}
35
36#[derive(Copy, Clone)]
38pub enum BlackholeDevice {}
39
40impl Device for BlackholeDevice {}
41
42impl DeviceStateSpec for BlackholeDevice {
43 type State<BT: crate::DeviceLayerTypes> = BlackholeDeviceState;
44
45 type External<BT: crate::DeviceLayerTypes> = BT::BlackholeDeviceState;
46
47 type CreationProperties = ();
48
49 type Counters = BlackholeDeviceCounters;
50
51 type TimerId<D: netstack3_base::WeakDeviceIdentifier> = Never;
52
53 fn new_device_state<
54 CC: netstack3_base::CoreTimerContext<Self::TimerId<CC::WeakDeviceId>, BC>
55 + netstack3_base::DeviceIdContext<Self>,
56 BC: crate::DeviceLayerTypes + netstack3_base::TimerContext,
57 >(
58 _bindings_ctx: &mut BC,
59 _self_id: CC::WeakDeviceId,
60 _properties: Self::CreationProperties,
61 ) -> Self::State<BC> {
62 BlackholeDeviceState {}
63 }
64
65 const IS_LOOPBACK: bool = false;
66
67 const DEBUG_TYPE: &'static str = "Blackhole";
68}
69
70impl DeviceReceiveFrameSpec for BlackholeDevice {
71 type FrameMetadata<D> = Never;
74}