• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * DO NOT EDIT THIS FILE. It was generated from linux/if.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  * INET         An implementation of the TCP/IP protocol suite for the LINUX
11  *              operating system.  INET is implemented using the  BSD Socket
12  *              interface as the means of communication with the user level.
13  *
14  *              Global definitions for the INET interface module.
15  *
16  * Version:     @(#)if.h        1.0.2   04/18/93
17  *
18  * Authors:     Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988
19  *              Ross Biro
20  *              Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
21  *
22  *              This program is free software; you can redistribute it and/or
23  *              modify it under the terms of the GNU General Public License
24  *              as published by the Free Software Foundation; either version
25  *              2 of the License, or (at your option) any later version.
26  */
27 
28 #include <Python.h>
29 #include <sys/ioctl.h>
30 #include <netinet/in.h>
31 #include <linux/if.h>
32 
_init_linux_if_h(PyObject * m)33 void _init_linux_if_h(PyObject *m) {
34   PyModule_AddIntMacro(m, IFNAMSIZ);
35   PyModule_AddIntMacro(m, IFALIASZ);
36 
37   /**
38    * enum net_device_flags - &struct net_device flags
39    *
40    * These are the &struct net_device flags, they can be set by drivers, the
41    * kernel and some can be triggered by userspace. Userspace can query and
42    * set these flags using userspace utilities but there is also a sysfs
43    * entry available for all dev flags which can be queried and set. These flags
44    * are shared for all types of net_devices. The sysfs entries are available
45    * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs
46    * are annotated below, note that only a few flags can be toggled and some
47    * other flags are always always preserved from the original net_device flags
48    * even if you try to set them via sysfs. Flags which are always preserved
49    * are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__
50    * are annotated below as such.
51    *
52    * You should have a pretty good reason to be extending these flags.
53    *
54    * @IFF_UP: interface is up. Can be toggled through sysfs.
55    * @IFF_BROADCAST: broadcast address valid. Volatile.
56    * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs.
57    * @IFF_LOOPBACK: is a loopback net. Volatile.
58    * @IFF_POINTOPOINT: interface is has p-p link. Volatile.
59    * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs.
60    *      Volatile.
61    * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile.
62    * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile.
63    * @IFF_PROMISC: receive all packets. Can be toggled through sysfs.
64    * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through
65    *      sysfs.
66    * @IFF_MASTER: master of a load balancer. Volatile.
67    * @IFF_SLAVE: slave of a load balancer. Volatile.
68    * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs.
69    * @IFF_PORTSEL: can set media type. Can be toggled through sysfs.
70    * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs.
71    * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled
72    *      through sysfs.
73    * @IFF_LOWER_UP: driver signals L1 up. Volatile.
74    * @IFF_DORMANT: driver signals dormant. Volatile.
75    * @IFF_ECHO: echo sent packets. Volatile.
76    */
77   /* enum net_device_flags */
78   PyModule_AddIntMacro(m, IFF_UP);
79   PyModule_AddIntMacro(m, IFF_BROADCAST);
80   PyModule_AddIntMacro(m, IFF_DEBUG);
81   PyModule_AddIntMacro(m, IFF_LOOPBACK);
82   PyModule_AddIntMacro(m, IFF_POINTOPOINT);
83   PyModule_AddIntMacro(m, IFF_NOTRAILERS);
84   PyModule_AddIntMacro(m, IFF_RUNNING);
85   PyModule_AddIntMacro(m, IFF_NOARP);
86   PyModule_AddIntMacro(m, IFF_PROMISC);
87   PyModule_AddIntMacro(m, IFF_ALLMULTI);
88   PyModule_AddIntMacro(m, IFF_MASTER);
89   PyModule_AddIntMacro(m, IFF_SLAVE);
90   PyModule_AddIntMacro(m, IFF_MULTICAST);
91   PyModule_AddIntMacro(m, IFF_PORTSEL);
92   PyModule_AddIntMacro(m, IFF_AUTOMEDIA);
93   PyModule_AddIntMacro(m, IFF_DYNAMIC);
94   PyModule_AddIntMacro(m, IFF_LOWER_UP);
95   PyModule_AddIntMacro(m, IFF_DORMANT);
96   PyModule_AddIntMacro(m, IFF_ECHO);
97 
98   PyModule_AddIntMacro(m, IFF_UP);
99   PyModule_AddIntMacro(m, IFF_BROADCAST);
100   PyModule_AddIntMacro(m, IFF_DEBUG);
101   PyModule_AddIntMacro(m, IFF_LOOPBACK);
102   PyModule_AddIntMacro(m, IFF_POINTOPOINT);
103   PyModule_AddIntMacro(m, IFF_NOTRAILERS);
104   PyModule_AddIntMacro(m, IFF_RUNNING);
105   PyModule_AddIntMacro(m, IFF_NOARP);
106   PyModule_AddIntMacro(m, IFF_PROMISC);
107   PyModule_AddIntMacro(m, IFF_ALLMULTI);
108   PyModule_AddIntMacro(m, IFF_MASTER);
109   PyModule_AddIntMacro(m, IFF_SLAVE);
110   PyModule_AddIntMacro(m, IFF_MULTICAST);
111   PyModule_AddIntMacro(m, IFF_PORTSEL);
112   PyModule_AddIntMacro(m, IFF_AUTOMEDIA);
113   PyModule_AddIntMacro(m, IFF_DYNAMIC);
114   PyModule_AddIntMacro(m, IFF_LOWER_UP);
115   PyModule_AddIntMacro(m, IFF_DORMANT);
116   PyModule_AddIntMacro(m, IFF_ECHO);
117 
118   PyModule_AddIntMacro(m, IFF_VOLATILE);
119 
120   PyModule_AddIntMacro(m, IF_GET_IFACE);
121   PyModule_AddIntMacro(m, IF_GET_PROTO);
122 
123   /* For definitions see hdlc.h */
124   PyModule_AddIntMacro(m, IF_IFACE_V35);
125   PyModule_AddIntMacro(m, IF_IFACE_V24);
126   PyModule_AddIntMacro(m, IF_IFACE_X21);
127   PyModule_AddIntMacro(m, IF_IFACE_T1);
128   PyModule_AddIntMacro(m, IF_IFACE_E1);
129   PyModule_AddIntMacro(m, IF_IFACE_SYNC_SERIAL);
130   PyModule_AddIntMacro(m, IF_IFACE_X21D);
131 
132   /* For definitions see hdlc.h */
133   PyModule_AddIntMacro(m, IF_PROTO_HDLC);
134   PyModule_AddIntMacro(m, IF_PROTO_PPP);
135   PyModule_AddIntMacro(m, IF_PROTO_CISCO);
136   PyModule_AddIntMacro(m, IF_PROTO_FR);
137   PyModule_AddIntMacro(m, IF_PROTO_FR_ADD_PVC);
138   PyModule_AddIntMacro(m, IF_PROTO_FR_DEL_PVC);
139   PyModule_AddIntMacro(m, IF_PROTO_X25);
140   PyModule_AddIntMacro(m, IF_PROTO_HDLC_ETH);
141   PyModule_AddIntMacro(m, IF_PROTO_FR_ADD_ETH_PVC);
142   PyModule_AddIntMacro(m, IF_PROTO_FR_DEL_ETH_PVC);
143   PyModule_AddIntMacro(m, IF_PROTO_FR_PVC);
144   PyModule_AddIntMacro(m, IF_PROTO_FR_ETH_PVC);
145   PyModule_AddIntMacro(m, IF_PROTO_RAW);
146 
147   /* RFC 2863 operational status */
148   PyModule_AddIntMacro(m, IF_OPER_UNKNOWN);
149   PyModule_AddIntMacro(m, IF_OPER_NOTPRESENT);
150   PyModule_AddIntMacro(m, IF_OPER_DOWN);
151   PyModule_AddIntMacro(m, IF_OPER_LOWERLAYERDOWN);
152   PyModule_AddIntMacro(m, IF_OPER_TESTING);
153   PyModule_AddIntMacro(m, IF_OPER_DORMANT);
154   PyModule_AddIntMacro(m, IF_OPER_UP);
155 
156   /* link modes */
157   PyModule_AddIntMacro(m, IF_LINK_MODE_DEFAULT);
158   PyModule_AddIntMacro(m, IF_LINK_MODE_DORMANT);
159 }
160