1 /*
2 * DO NOT EDIT THIS FILE. It was generated from linux/if_tun.h.
3 *
4 * Copyright (c) 2013 The Chromium Authors. All rights reserved.
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9 /*
10 * Universal TUN/TAP device driver.
11 * Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 */
23
24 #include <Python.h>
25 #include <sys/ioctl.h>
26 #include <netinet/in.h>
27 #include <net/if.h>
28 #include <linux/if_tun.h>
29
_init_linux_if_tun_h(PyObject * m)30 void _init_linux_if_tun_h(PyObject *m) {
31 /* Read queue size */
32 PyModule_AddIntMacro(m, TUN_READQ_SIZE);
33 /* TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead. */
34 PyModule_AddIntMacro(m, TUN_TUN_DEV);
35 PyModule_AddIntMacro(m, TUN_TAP_DEV);
36 PyModule_AddIntMacro(m, TUN_TYPE_MASK);
37
38 /* Ioctl defines */
39 PyModule_AddIntMacro(m, TUNSETNOCSUM);
40 PyModule_AddIntMacro(m, TUNSETDEBUG);
41 PyModule_AddIntMacro(m, TUNSETIFF);
42 PyModule_AddIntMacro(m, TUNSETPERSIST);
43 PyModule_AddIntMacro(m, TUNSETOWNER);
44 PyModule_AddIntMacro(m, TUNSETLINK);
45 PyModule_AddIntMacro(m, TUNSETGROUP);
46 PyModule_AddIntMacro(m, TUNGETFEATURES);
47 PyModule_AddIntMacro(m, TUNSETOFFLOAD);
48 PyModule_AddIntMacro(m, TUNSETTXFILTER);
49 PyModule_AddIntMacro(m, TUNGETIFF);
50 PyModule_AddIntMacro(m, TUNGETSNDBUF);
51 PyModule_AddIntMacro(m, TUNSETSNDBUF);
52 PyModule_AddIntMacro(m, TUNATTACHFILTER);
53 PyModule_AddIntMacro(m, TUNDETACHFILTER);
54 PyModule_AddIntMacro(m, TUNGETVNETHDRSZ);
55 PyModule_AddIntMacro(m, TUNSETVNETHDRSZ);
56 PyModule_AddIntMacro(m, TUNSETQUEUE);
57 PyModule_AddIntMacro(m, TUNSETIFINDEX);
58 PyModule_AddIntMacro(m, TUNGETFILTER);
59 PyModule_AddIntMacro(m, TUNSETVNETLE);
60 PyModule_AddIntMacro(m, TUNGETVNETLE);
61
62 /* TUNSETIFF ifr flags */
63 PyModule_AddIntMacro(m, IFF_TUN);
64 PyModule_AddIntMacro(m, IFF_TAP);
65 PyModule_AddIntMacro(m, IFF_NO_PI);
66 /* This flag has no real effect */
67 PyModule_AddIntMacro(m, IFF_ONE_QUEUE);
68 PyModule_AddIntMacro(m, IFF_VNET_HDR);
69 PyModule_AddIntMacro(m, IFF_TUN_EXCL);
70 PyModule_AddIntMacro(m, IFF_MULTI_QUEUE);
71 PyModule_AddIntMacro(m, IFF_ATTACH_QUEUE);
72 PyModule_AddIntMacro(m, IFF_DETACH_QUEUE);
73 /* read-only flag */
74 PyModule_AddIntMacro(m, IFF_PERSIST);
75 PyModule_AddIntMacro(m, IFF_NOFILTER);
76
77 /* Socket options */
78 PyModule_AddIntMacro(m, TUN_TX_TIMESTAMP);
79
80 /* Features for GSO (TUNSETOFFLOAD). */
81 PyModule_AddIntMacro(m, TUN_F_CSUM);
82 PyModule_AddIntMacro(m, TUN_F_TSO4);
83 PyModule_AddIntMacro(m, TUN_F_TSO6);
84 PyModule_AddIntMacro(m, TUN_F_TSO_ECN);
85 PyModule_AddIntMacro(m, TUN_F_UFO);
86
87 /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
88 PyModule_AddIntMacro(m, TUN_PKT_STRIP);
89 }
90