interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / libc / src / new / netbsd / net / if_.rs

101 lines · 3245 bytes Raw Blame History
1//! Header: `net/if.h`
2//!
3//! <https://github.com/NetBSD/src/tree/trunk/sys/timex.h>
4
5use crate::prelude::*;
6use crate::IFNAMSIZ;
7
8s! {
9 pub struct if_data {
10 pub ifi_type: c_uchar,
11 pub ifi_addrlen: c_uchar,
12 pub ifi_hdrlen: c_uchar,
13 pub ifi_link_state: c_int,
14 pub ifi_mtu: u64,
15 pub ifi_metric: u64,
16 pub ifi_baudrate: u64,
17 pub ifi_ipackets: u64,
18 pub ifi_ierrors: u64,
19 pub ifi_opackets: u64,
20 pub ifi_oerrors: u64,
21 pub ifi_collisions: u64,
22 pub ifi_ibytes: u64,
23 pub ifi_obytes: u64,
24 pub ifi_imcasts: u64,
25 pub ifi_omcasts: u64,
26 pub ifi_iqdrops: u64,
27 pub ifi_noproto: u64,
28 pub ifi_lastchange: crate::timespec,
29 }
30}
31
32pub const LINK_STATE_UNKNOWN: c_int = 0; // link invalid/unknown
33pub const LINK_STATE_DOWN: c_int = 1; // link is down
34pub const LINK_STATE_UP: c_int = 2; // link is up
35
36pub const IFF_UP: c_int = 0x0001; // interface is up
37pub const IFF_BROADCAST: c_int = 0x0002; // broadcast address valid
38pub const IFF_DEBUG: c_int = 0x0004; // turn on debugging
39pub const IFF_LOOPBACK: c_int = 0x0008; // is a loopback net
40pub const IFF_POINTOPOINT: c_int = 0x0010; // interface is point-to-point link
41pub const IFF_RUNNING: c_int = 0x0040; // resources allocated
42pub const IFF_NOARP: c_int = 0x0080; // no address resolution protocol
43pub const IFF_PROMISC: c_int = 0x0100; // receive all packets
44pub const IFF_ALLMULTI: c_int = 0x0200; // receive all multicast packets
45pub const IFF_OACTIVE: c_int = 0x0400; // transmission in progress
46pub const IFF_SIMPLEX: c_int = 0x0800; // can't hear own transmissions
47pub const IFF_LINK0: c_int = 0x1000; // per link layer defined bit
48pub const IFF_LINK1: c_int = 0x2000; // per link layer defined bit
49pub const IFF_LINK2: c_int = 0x4000; // per link layer defined bit
50pub const IFF_MULTICAST: c_int = 0x8000; // supports multicast
51
52s! {
53 #[repr(C, align(8))]
54 pub struct if_msghdr {
55 pub ifm_msglen: c_ushort,
56 pub ifm_version: c_uchar,
57 pub ifm_type: c_uchar,
58 pub ifm_addrs: c_int,
59 pub ifm_flags: c_int,
60 pub ifm_index: c_ushort,
61 pub ifm_data: if_data,
62 }
63}
64
65s_no_extra_traits! {
66 pub struct ifreq {
67 pub ifr_name: [c_char; IFNAMSIZ],
68 pub ifr_ifru: __c_anonymous_ifr_ifru,
69 }
70
71 pub union __c_anonymous_ifr_ifru {
72 pub ifru_addr: crate::sockaddr,
73 pub ifru_dstaddr: crate::sockaddr,
74 pub ifru_broadaddr: crate::sockaddr,
75 pub space: crate::sockaddr_storage,
76 pub ifru_flags: c_short,
77 pub ifru_addrflags: c_int,
78 pub ifru_metrics: c_int,
79 pub ifru_mtu: c_int,
80 pub ifru_dlt: c_int,
81 pub ifru_value: c_uint,
82 pub ifru_data: *mut c_void,
83 // buf and buflen are deprecated but they contribute to union size
84 ifru_b: __c_anonymous_ifr_ifru_ifru_b,
85 }
86
87 struct __c_anonymous_ifr_ifru_ifru_b {
88 b_buflen: u32,
89 b_buf: *mut c_void,
90 }
91
92 pub struct ifconf {
93 pub ifc_len: c_int,
94 pub ifc_ifcu: __c_anonymous_ifc_ifcu,
95 }
96
97 pub union __c_anonymous_ifc_ifcu {
98 pub ifcu_buf: *mut c_void,
99 pub ifcu_req: *mut ifreq,
100 }
101}