xref: /aosp_15_r20/external/crosvm/net_sys/src/lib.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 // Copyright TUNTAP, 2017 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 //! Linux networking API bindings.
6 
7 #![cfg(any(target_os = "android", target_os = "linux"))]
8 #![allow(non_upper_case_globals)]
9 #![allow(non_camel_case_types)]
10 #![allow(non_snake_case)]
11 
12 use base::ioctl_ior_nr;
13 use base::ioctl_iow_nr;
14 
15 pub mod if_tun;
16 pub mod iff; // Named "iff" to avoid conflicting with "if" keyword.
17 pub mod sockios;
18 pub use crate::if_tun::sock_fprog;
19 pub use crate::if_tun::IFF_MULTI_QUEUE;
20 pub use crate::if_tun::IFF_NO_PI;
21 pub use crate::if_tun::IFF_TAP;
22 pub use crate::if_tun::IFF_VNET_HDR;
23 pub use crate::if_tun::TUN_F_CSUM;
24 pub use crate::if_tun::TUN_F_TSO4;
25 pub use crate::if_tun::TUN_F_TSO6;
26 pub use crate::if_tun::TUN_F_TSO_ECN;
27 pub use crate::if_tun::TUN_F_UFO;
28 pub use crate::iff::ifreq;
29 pub use crate::iff::net_device_flags;
30 
31 pub const TUNTAP: ::std::os::raw::c_uint = 84;
32 
33 ioctl_iow_nr!(TUNSETNOCSUM, TUNTAP, 200, ::std::os::raw::c_int);
34 ioctl_iow_nr!(TUNSETDEBUG, TUNTAP, 201, ::std::os::raw::c_int);
35 ioctl_iow_nr!(TUNSETIFF, TUNTAP, 202, ::std::os::raw::c_int);
36 ioctl_iow_nr!(TUNSETPERSIST, TUNTAP, 203, ::std::os::raw::c_int);
37 ioctl_iow_nr!(TUNSETOWNER, TUNTAP, 204, ::std::os::raw::c_int);
38 ioctl_iow_nr!(TUNSETLINK, TUNTAP, 205, ::std::os::raw::c_int);
39 ioctl_iow_nr!(TUNSETGROUP, TUNTAP, 206, ::std::os::raw::c_int);
40 ioctl_ior_nr!(TUNGETFEATURES, TUNTAP, 207, ::std::os::raw::c_uint);
41 ioctl_iow_nr!(TUNSETOFFLOAD, TUNTAP, 208, ::std::os::raw::c_uint);
42 ioctl_iow_nr!(TUNSETTXFILTER, TUNTAP, 209, ::std::os::raw::c_uint);
43 ioctl_ior_nr!(TUNGETIFF, TUNTAP, 210, ::std::os::raw::c_uint);
44 ioctl_ior_nr!(TUNGETSNDBUF, TUNTAP, 211, ::std::os::raw::c_int);
45 ioctl_iow_nr!(TUNSETSNDBUF, TUNTAP, 212, ::std::os::raw::c_int);
46 ioctl_iow_nr!(TUNATTACHFILTER, TUNTAP, 213, sock_fprog);
47 ioctl_iow_nr!(TUNDETACHFILTER, TUNTAP, 214, sock_fprog);
48 ioctl_ior_nr!(TUNGETVNETHDRSZ, TUNTAP, 215, ::std::os::raw::c_int);
49 ioctl_iow_nr!(TUNSETVNETHDRSZ, TUNTAP, 216, ::std::os::raw::c_int);
50 ioctl_iow_nr!(TUNSETQUEUE, TUNTAP, 217, ::std::os::raw::c_int);
51 ioctl_iow_nr!(TUNSETIFINDEX, TUNTAP, 218, ::std::os::raw::c_uint);
52 ioctl_ior_nr!(TUNGETFILTER, TUNTAP, 219, sock_fprog);
53 ioctl_iow_nr!(TUNSETVNETLE, TUNTAP, 220, ::std::os::raw::c_int);
54 ioctl_ior_nr!(TUNGETVNETLE, TUNTAP, 221, ::std::os::raw::c_int);
55 ioctl_iow_nr!(TUNSETVNETBE, TUNTAP, 222, ::std::os::raw::c_int);
56 ioctl_ior_nr!(TUNGETVNETBE, TUNTAP, 223, ::std::os::raw::c_int);
57