blob: 4be0a1673ffbfe21ebecc68a7630bff7e42137dc [file] [log] [blame]
Stephen Barber219b1852017-06-15 23:20:16 -07001// Copyright TUNTAP, 2017 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#![allow(non_upper_case_globals)]
6#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8
9#[macro_use]
10extern crate sys_util;
11
David Tolnay633426a2019-04-12 12:18:35 -070012use sys_util::{ioctl_ior_nr, ioctl_iow_nr};
13
Stephen Barber219b1852017-06-15 23:20:16 -070014// generated with bindgen /usr/include/linux/if.h --no-unstable-rust
15// --constified-enum '*' --with-derive-default -- -D __UAPI_DEF_IF_IFNAMSIZ -D
16// __UAPI_DEF_IF_NET_DEVICE_FLAGS -D __UAPI_DEF_IF_IFREQ -D __UAPI_DEF_IF_IFMAP
17// Name is "iff" to avoid conflicting with "if" keyword.
18// Generated against Linux 4.11 to include fix "uapi: fix linux/if.h userspace
19// compilation errors".
20// Manual fixup of ifrn_name to be of type c_uchar instead of c_char.
David Tolnay5bbbf612018-12-01 17:49:30 -080021#[cfg_attr(feature = "cargo-clippy", allow(clippy))]
Stephen Barber219b1852017-06-15 23:20:16 -070022pub mod iff;
23// generated with bindgen /usr/include/linux/if_tun.h --no-unstable-rust
24// --constified-enum '*' --with-derive-default
25pub mod if_tun;
26// generated with bindgen /usr/include/linux/in.h --no-unstable-rust
27// --constified-enum '*' --with-derive-default
28// Name is "inn" to avoid conflicting with "in" keyword.
29pub mod inn;
30// generated with bindgen /usr/include/linux/sockios.h --no-unstable-rust
31// --constified-enum '*' --with-derive-default
32pub mod sockios;
David Tolnayfe3ef7d2019-03-08 15:57:49 -080033pub use crate::if_tun::*;
34pub use crate::iff::*;
35pub use crate::inn::*;
36pub use crate::sockios::*;
Stephen Barber219b1852017-06-15 23:20:16 -070037
38pub const TUNTAP: ::std::os::raw::c_uint = 84;
39
Stephen Barber308ff602018-02-13 22:47:07 -080040pub const ARPHRD_ETHER: sa_family_t = 1;
41
Stephen Barber219b1852017-06-15 23:20:16 -070042ioctl_iow_nr!(TUNSETNOCSUM, TUNTAP, 200, ::std::os::raw::c_int);
43ioctl_iow_nr!(TUNSETDEBUG, TUNTAP, 201, ::std::os::raw::c_int);
44ioctl_iow_nr!(TUNSETIFF, TUNTAP, 202, ::std::os::raw::c_int);
45ioctl_iow_nr!(TUNSETPERSIST, TUNTAP, 203, ::std::os::raw::c_int);
46ioctl_iow_nr!(TUNSETOWNER, TUNTAP, 204, ::std::os::raw::c_int);
47ioctl_iow_nr!(TUNSETLINK, TUNTAP, 205, ::std::os::raw::c_int);
48ioctl_iow_nr!(TUNSETGROUP, TUNTAP, 206, ::std::os::raw::c_int);
49ioctl_ior_nr!(TUNGETFEATURES, TUNTAP, 207, ::std::os::raw::c_uint);
50ioctl_iow_nr!(TUNSETOFFLOAD, TUNTAP, 208, ::std::os::raw::c_uint);
51ioctl_iow_nr!(TUNSETTXFILTER, TUNTAP, 209, ::std::os::raw::c_uint);
52ioctl_ior_nr!(TUNGETIFF, TUNTAP, 210, ::std::os::raw::c_uint);
53ioctl_ior_nr!(TUNGETSNDBUF, TUNTAP, 211, ::std::os::raw::c_int);
54ioctl_iow_nr!(TUNSETSNDBUF, TUNTAP, 212, ::std::os::raw::c_int);
55ioctl_iow_nr!(TUNATTACHFILTER, TUNTAP, 213, sock_fprog);
56ioctl_iow_nr!(TUNDETACHFILTER, TUNTAP, 214, sock_fprog);
57ioctl_ior_nr!(TUNGETVNETHDRSZ, TUNTAP, 215, ::std::os::raw::c_int);
58ioctl_iow_nr!(TUNSETVNETHDRSZ, TUNTAP, 216, ::std::os::raw::c_int);
59ioctl_iow_nr!(TUNSETQUEUE, TUNTAP, 217, ::std::os::raw::c_int);
60ioctl_iow_nr!(TUNSETIFINDEX, TUNTAP, 218, ::std::os::raw::c_uint);
61ioctl_ior_nr!(TUNGETFILTER, TUNTAP, 219, sock_fprog);
62ioctl_iow_nr!(TUNSETVNETLE, TUNTAP, 220, ::std::os::raw::c_int);
63ioctl_ior_nr!(TUNGETVNETLE, TUNTAP, 221, ::std::os::raw::c_int);
64ioctl_iow_nr!(TUNSETVNETBE, TUNTAP, 222, ::std::os::raw::c_int);
65ioctl_ior_nr!(TUNGETVNETBE, TUNTAP, 223, ::std::os::raw::c_int);