1use libc::{c_uchar, c_uint, c_ulong, c_ushort};
2
3pub const IFNAMSIZ: usize = 16;
4pub const IFALIASZ: usize = 256;
5pub const ALTIFNAMSIZ: usize = 128;
6
7#[repr(C)]
8#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
9pub enum NetDeviceFlags {
10 Up = 1 << 0, Broadcast = 1 << 1, Debug = 1 << 2, Loopback = 1 << 3, Pointopoint = 1 << 4, Notrailers = 1 << 5, Running = 1 << 6, Noarp = 1 << 7, Promisc = 1 << 8, Allmulti = 1 << 9, Master = 1 << 10, Slave = 1 << 11, Multicast = 1 << 12, Portsel = 1 << 13, Automedia = 1 << 14, Dynamic = 1 << 15, LowerUp = 1 << 16, Dormant = 1 << 17, Echo = 1 << 18, }
31pub const IFF_UP: c_uint = NetDeviceFlags::Up as c_uint;
32pub const IFF_BROADCAST: c_uint = NetDeviceFlags::Broadcast as c_uint;
33pub const IFF_DEBUG: c_uint = NetDeviceFlags::Debug as c_uint;
34pub const IFF_LOOPBACK: c_uint = NetDeviceFlags::Loopback as c_uint;
35pub const IFF_POINTOPOINT: c_uint = NetDeviceFlags::Pointopoint as c_uint;
36pub const IFF_NOTRAILERS: c_uint = NetDeviceFlags::Notrailers as c_uint;
37pub const IFF_RUNNING: c_uint = NetDeviceFlags::Running as c_uint;
38pub const IFF_NOARP: c_uint = NetDeviceFlags::Noarp as c_uint;
39pub const IFF_PROMISC: c_uint = NetDeviceFlags::Promisc as c_uint;
40pub const IFF_ALLMULTI: c_uint = NetDeviceFlags::Allmulti as c_uint;
41pub const IFF_MASTER: c_uint = NetDeviceFlags::Master as c_uint;
42pub const IFF_SLAVE: c_uint = NetDeviceFlags::Slave as c_uint;
43pub const IFF_MULTICAST: c_uint = NetDeviceFlags::Multicast as c_uint;
44pub const IFF_PORTSEL: c_uint = NetDeviceFlags::Portsel as c_uint;
45pub const IFF_AUTOMEDIA: c_uint = NetDeviceFlags::Automedia as c_uint;
46pub const IFF_DYNAMIC: c_uint = NetDeviceFlags::Dynamic as c_uint;
47pub const IFF_LOWER_UP: c_uint = NetDeviceFlags::LowerUp as c_uint;
48pub const IFF_DORMANT: c_uint = NetDeviceFlags::Dormant as c_uint;
49pub const IFF_ECHO: c_uint = NetDeviceFlags::Echo as c_uint;
50pub const IFF_VOLATILE: c_uint = IFF_LOOPBACK
51 | IFF_POINTOPOINT
52 | IFF_BROADCAST
53 | IFF_ECHO
54 | IFF_MASTER
55 | IFF_SLAVE
56 | IFF_RUNNING
57 | IFF_LOWER_UP
58 | IFF_DORMANT;
59
60pub const IF_GET_IFACE: c_uint = 0x0001; pub const IF_GET_PROTO: c_uint = 0x0002;
62
63pub const IF_IFACE_V35: c_uint = 0x1000; pub const IF_IFACE_V24: c_uint = 0x1001; pub const IF_IFACE_X21: c_uint = 0x1002; pub const IF_IFACE_T1: c_uint = 0x1003; pub const IF_IFACE_E1: c_uint = 0x1004; pub const IF_IFACE_SYNC_SERIAL: c_uint = 0x1005; pub const IF_IFACE_X21D: c_uint = 0x1006; pub const IF_PROTO_HDLC: c_uint = 0x2000; pub const IF_PROTO_PPP: c_uint = 0x2001; pub const IF_PROTO_CISCO: c_uint = 0x2002; pub const IF_PROTO_FR: c_uint = 0x2003; pub const IF_PROTO_FR_ADD_PVC: c_uint = 0x2004; pub const IF_PROTO_FR_DEL_PVC: c_uint = 0x2005; pub const IF_PROTO_X25: c_uint = 0x2006; pub const IF_PROTO_HDLC_ETH: c_uint = 0x2007; pub const IF_PROTO_FR_ADD_ETH_PVC: c_uint = 0x2008; pub const IF_PROTO_FR_DEL_ETH_PVC: c_uint = 0x2009; pub const IF_PROTO_FR_PVC: c_uint = 0x200A; pub const IF_PROTO_FR_ETH_PVC: c_uint = 0x200B;
85pub const IF_PROTO_RAW: c_uint = 0x200C; #[repr(u8)]
88#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
89pub enum IfOper {
90 Unknown,
92 Notpresent,
93 Down,
94 Lowerlayerdown,
95 Testing,
96 Dormant,
97 Up,
98}
99pub const IF_OPER_UNKNOWN: u8 = IfOper::Unknown as u8;
100pub const IF_OPER_NOTPRESENT: u8 = IfOper::Notpresent as u8;
101pub const IF_OPER_DOWN: u8 = IfOper::Down as u8;
102pub const IF_OPER_LOWERLAYERDOWN: u8 = IfOper::Lowerlayerdown as u8;
103pub const IF_OPER_TESTING: u8 = IfOper::Testing as u8;
104pub const IF_OPER_DORMANT: u8 = IfOper::Dormant as u8;
105pub const IF_OPER_UP: u8 = IfOper::Up as u8;
106
107#[repr(u8)]
109#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
110pub enum IfLinkMode {
111 Default = 0,
113 Dormant, Testing, }
116pub const IF_LINK_MODE_DEFAULT: u8 = IfLinkMode::Default as u8;
117pub const IF_LINK_MODE_DORMANT: u8 = IfLinkMode::Dormant as u8;
118pub const IF_LINK_MODE_TESTING: u8 = IfLinkMode::Testing as u8;
119
120#[repr(C)]
131#[derive(Debug, Clone, Copy)]
132pub struct Ifmap {
133 mem_start: c_ulong,
134 mem_end: c_ulong,
135 base_addr: c_ushort,
136 irq: c_uchar,
137 dma: c_uchar,
138 port: c_uchar, }
140
141