xref: /cloud-hypervisor/net_gen/src/lib.rs (revision dce82a34d06b200be8f336788d7421608a74e95d)
153f52954SSebastien Boeuf // Copyright TUNTAP, 2017 The Chromium OS Authors. All rights reserved.
253f52954SSebastien Boeuf // Use of this source code is governed by a BSD-style license that can be
353f52954SSebastien Boeuf // found in the THIRD-PARTY file.
45e9886bbSRuslan Mstoi //
55e9886bbSRuslan Mstoi // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
653f52954SSebastien Boeuf 
753f52954SSebastien Boeuf #![allow(non_upper_case_globals)]
853f52954SSebastien Boeuf #![allow(non_camel_case_types)]
953f52954SSebastien Boeuf #![allow(non_snake_case)]
1053f52954SSebastien Boeuf 
1153f52954SSebastien Boeuf #[macro_use]
1253f52954SSebastien Boeuf extern crate vmm_sys_util;
1353f52954SSebastien Boeuf 
1453f52954SSebastien Boeuf // generated with bindgen /usr/include/linux/if.h --no-unstable-rust
1553f52954SSebastien Boeuf // --constified-enum '*' --with-derive-default -- -D __UAPI_DEF_IF_IFNAMSIZ -D
1653f52954SSebastien Boeuf // __UAPI_DEF_IF_NET_DEVICE_FLAGS -D __UAPI_DEF_IF_IFREQ -D __UAPI_DEF_IF_IFMAP
1753f52954SSebastien Boeuf // Name is "iff" to avoid conflicting with "if" keyword.
1853f52954SSebastien Boeuf // Generated against Linux 4.11 to include fix "uapi: fix linux/if.h userspace
1953f52954SSebastien Boeuf // compilation errors".
2053f52954SSebastien Boeuf // Manual fixup of ifrn_name to be of type c_uchar instead of c_char.
2153f52954SSebastien Boeuf pub mod iff;
2253f52954SSebastien Boeuf // generated with bindgen /usr/include/linux/if_tun.h --no-unstable-rust
2353f52954SSebastien Boeuf // --constified-enum '*' --with-derive-default
2453f52954SSebastien Boeuf pub mod if_tun;
2553f52954SSebastien Boeuf // generated with bindgen /usr/include/linux/in.h --no-unstable-rust
2653f52954SSebastien Boeuf // --constified-enum '*' --with-derive-default
2753f52954SSebastien Boeuf // Name is "inn" to avoid conflicting with "in" keyword.
2853f52954SSebastien Boeuf pub mod inn;
29*dce82a34SGregory Anders // generated with bindgen /usr/include/linux/ipv6.h --no-layout-tests --constified-enum '*'
30*dce82a34SGregory Anders // --allowlist-type 'sockaddr_in6|in6_ifreq'
31*dce82a34SGregory Anders pub mod ipv6;
3253f52954SSebastien Boeuf // generated with bindgen /usr/include/linux/sockios.h --no-unstable-rust
3353f52954SSebastien Boeuf // --constified-enum '*' --with-derive-default
3453f52954SSebastien Boeuf pub mod sockios;
35990362e3SRob Bradford pub use if_tun::{
36990362e3SRob Bradford     sock_fprog, IFF_MULTI_QUEUE, IFF_NO_PI, IFF_TAP, IFF_VNET_HDR, TUN_F_CSUM, TUN_F_TSO4,
37990362e3SRob Bradford     TUN_F_TSO6, TUN_F_TSO_ECN, TUN_F_UFO,
38990362e3SRob Bradford };
39990362e3SRob Bradford pub use iff::{ifreq, net_device_flags_IFF_UP, setsockopt, sockaddr, AF_INET};
40990362e3SRob Bradford pub use inn::sockaddr_in;
41*dce82a34SGregory Anders pub use ipv6::{in6_ifreq, sockaddr_in6};
4253f52954SSebastien Boeuf 
4353f52954SSebastien Boeuf pub const TUNTAP: ::std::os::raw::c_uint = 84;
4453f52954SSebastien Boeuf 
4553f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETNOCSUM, TUNTAP, 200, ::std::os::raw::c_int);
4653f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETDEBUG, TUNTAP, 201, ::std::os::raw::c_int);
4753f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETIFF, TUNTAP, 202, ::std::os::raw::c_int);
4853f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETPERSIST, TUNTAP, 203, ::std::os::raw::c_int);
4953f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETOWNER, TUNTAP, 204, ::std::os::raw::c_int);
5053f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETLINK, TUNTAP, 205, ::std::os::raw::c_int);
5153f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETGROUP, TUNTAP, 206, ::std::os::raw::c_int);
5253f52954SSebastien Boeuf ioctl_ior_nr!(TUNGETFEATURES, TUNTAP, 207, ::std::os::raw::c_uint);
5353f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETOFFLOAD, TUNTAP, 208, ::std::os::raw::c_uint);
5453f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETTXFILTER, TUNTAP, 209, ::std::os::raw::c_uint);
5553f52954SSebastien Boeuf ioctl_ior_nr!(TUNGETIFF, TUNTAP, 210, ::std::os::raw::c_uint);
5653f52954SSebastien Boeuf ioctl_ior_nr!(TUNGETSNDBUF, TUNTAP, 211, ::std::os::raw::c_int);
5753f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETSNDBUF, TUNTAP, 212, ::std::os::raw::c_int);
5853f52954SSebastien Boeuf ioctl_iow_nr!(TUNATTACHFILTER, TUNTAP, 213, sock_fprog);
5953f52954SSebastien Boeuf ioctl_iow_nr!(TUNDETACHFILTER, TUNTAP, 214, sock_fprog);
6053f52954SSebastien Boeuf ioctl_ior_nr!(TUNGETVNETHDRSZ, TUNTAP, 215, ::std::os::raw::c_int);
6153f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETVNETHDRSZ, TUNTAP, 216, ::std::os::raw::c_int);
6253f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETQUEUE, TUNTAP, 217, ::std::os::raw::c_int);
6353f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETIFINDEX, TUNTAP, 218, ::std::os::raw::c_uint);
6453f52954SSebastien Boeuf ioctl_ior_nr!(TUNGETFILTER, TUNTAP, 219, sock_fprog);
6553f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETVNETLE, TUNTAP, 220, ::std::os::raw::c_int);
6653f52954SSebastien Boeuf ioctl_ior_nr!(TUNGETVNETLE, TUNTAP, 221, ::std::os::raw::c_int);
6753f52954SSebastien Boeuf ioctl_iow_nr!(TUNSETVNETBE, TUNTAP, 222, ::std::os::raw::c_int);
6853f52954SSebastien Boeuf ioctl_ior_nr!(TUNGETVNETBE, TUNTAP, 223, ::std::os::raw::c_int);
69