1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _LINUX_IF_H 8 #define _LINUX_IF_H 9 #include <linux/libc-compat.h> 10 #include <linux/types.h> 11 #include <linux/socket.h> 12 #include <linux/compiler.h> 13 #include <sys/socket.h> 14 #if __UAPI_DEF_IF_IFNAMSIZ 15 #define IFNAMSIZ 16 16 #endif 17 #define IFALIASZ 256 18 #define ALTIFNAMSIZ 128 19 #include <linux/hdlc/ioctl.h> 20 #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 21 enum net_device_flags { 22 #if __UAPI_DEF_IF_NET_DEVICE_FLAGS 23 IFF_UP = 1 << 0, 24 IFF_BROADCAST = 1 << 1, 25 IFF_DEBUG = 1 << 2, 26 IFF_LOOPBACK = 1 << 3, 27 IFF_POINTOPOINT = 1 << 4, 28 IFF_NOTRAILERS = 1 << 5, 29 IFF_RUNNING = 1 << 6, 30 IFF_NOARP = 1 << 7, 31 IFF_PROMISC = 1 << 8, 32 IFF_ALLMULTI = 1 << 9, 33 IFF_MASTER = 1 << 10, 34 IFF_SLAVE = 1 << 11, 35 IFF_MULTICAST = 1 << 12, 36 IFF_PORTSEL = 1 << 13, 37 IFF_AUTOMEDIA = 1 << 14, 38 IFF_DYNAMIC = 1 << 15, 39 #endif 40 #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 41 IFF_LOWER_UP = 1 << 16, 42 IFF_DORMANT = 1 << 17, 43 IFF_ECHO = 1 << 18, 44 #endif 45 }; 46 #endif 47 #if __UAPI_DEF_IF_NET_DEVICE_FLAGS 48 #define IFF_UP IFF_UP 49 #define IFF_BROADCAST IFF_BROADCAST 50 #define IFF_DEBUG IFF_DEBUG 51 #define IFF_LOOPBACK IFF_LOOPBACK 52 #define IFF_POINTOPOINT IFF_POINTOPOINT 53 #define IFF_NOTRAILERS IFF_NOTRAILERS 54 #define IFF_RUNNING IFF_RUNNING 55 #define IFF_NOARP IFF_NOARP 56 #define IFF_PROMISC IFF_PROMISC 57 #define IFF_ALLMULTI IFF_ALLMULTI 58 #define IFF_MASTER IFF_MASTER 59 #define IFF_SLAVE IFF_SLAVE 60 #define IFF_MULTICAST IFF_MULTICAST 61 #define IFF_PORTSEL IFF_PORTSEL 62 #define IFF_AUTOMEDIA IFF_AUTOMEDIA 63 #define IFF_DYNAMIC IFF_DYNAMIC 64 #endif 65 #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 66 #define IFF_LOWER_UP IFF_LOWER_UP 67 #define IFF_DORMANT IFF_DORMANT 68 #define IFF_ECHO IFF_ECHO 69 #endif 70 #define IFF_VOLATILE (IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST | IFF_ECHO | IFF_MASTER | IFF_SLAVE | IFF_RUNNING | IFF_LOWER_UP | IFF_DORMANT) 71 #define IF_GET_IFACE 0x0001 72 #define IF_GET_PROTO 0x0002 73 #define IF_IFACE_V35 0x1000 74 #define IF_IFACE_V24 0x1001 75 #define IF_IFACE_X21 0x1002 76 #define IF_IFACE_T1 0x1003 77 #define IF_IFACE_E1 0x1004 78 #define IF_IFACE_SYNC_SERIAL 0x1005 79 #define IF_IFACE_X21D 0x1006 80 #define IF_PROTO_HDLC 0x2000 81 #define IF_PROTO_PPP 0x2001 82 #define IF_PROTO_CISCO 0x2002 83 #define IF_PROTO_FR 0x2003 84 #define IF_PROTO_FR_ADD_PVC 0x2004 85 #define IF_PROTO_FR_DEL_PVC 0x2005 86 #define IF_PROTO_X25 0x2006 87 #define IF_PROTO_HDLC_ETH 0x2007 88 #define IF_PROTO_FR_ADD_ETH_PVC 0x2008 89 #define IF_PROTO_FR_DEL_ETH_PVC 0x2009 90 #define IF_PROTO_FR_PVC 0x200A 91 #define IF_PROTO_FR_ETH_PVC 0x200B 92 #define IF_PROTO_RAW 0x200C 93 enum { 94 IF_OPER_UNKNOWN, 95 IF_OPER_NOTPRESENT, 96 IF_OPER_DOWN, 97 IF_OPER_LOWERLAYERDOWN, 98 IF_OPER_TESTING, 99 IF_OPER_DORMANT, 100 IF_OPER_UP, 101 }; 102 enum { 103 IF_LINK_MODE_DEFAULT, 104 IF_LINK_MODE_DORMANT, 105 IF_LINK_MODE_TESTING, 106 }; 107 #if __UAPI_DEF_IF_IFMAP 108 struct ifmap { 109 unsigned long mem_start; 110 unsigned long mem_end; 111 unsigned short base_addr; 112 unsigned char irq; 113 unsigned char dma; 114 unsigned char port; 115 }; 116 #endif 117 struct if_settings { 118 unsigned int type; 119 unsigned int size; 120 union { 121 raw_hdlc_proto * raw_hdlc; 122 cisco_proto * cisco; 123 fr_proto * fr; 124 fr_proto_pvc * fr_pvc; 125 fr_proto_pvc_info * fr_pvc_info; 126 x25_hdlc_proto * x25; 127 sync_serial_settings * sync; 128 te1_settings * te1; 129 } ifs_ifsu; 130 }; 131 #if __UAPI_DEF_IF_IFREQ 132 struct ifreq { 133 #define IFHWADDRLEN 6 134 union { 135 char ifrn_name[IFNAMSIZ]; 136 } ifr_ifrn; 137 union { 138 struct sockaddr ifru_addr; 139 struct sockaddr ifru_dstaddr; 140 struct sockaddr ifru_broadaddr; 141 struct sockaddr ifru_netmask; 142 struct sockaddr ifru_hwaddr; 143 short ifru_flags; 144 int ifru_ivalue; 145 int ifru_mtu; 146 struct ifmap ifru_map; 147 char ifru_slave[IFNAMSIZ]; 148 char ifru_newname[IFNAMSIZ]; 149 void * ifru_data; 150 struct if_settings ifru_settings; 151 } ifr_ifru; 152 }; 153 #endif 154 #define ifr_name ifr_ifrn.ifrn_name 155 #define ifr_hwaddr ifr_ifru.ifru_hwaddr 156 #define ifr_addr ifr_ifru.ifru_addr 157 #define ifr_dstaddr ifr_ifru.ifru_dstaddr 158 #define ifr_broadaddr ifr_ifru.ifru_broadaddr 159 #define ifr_netmask ifr_ifru.ifru_netmask 160 #define ifr_flags ifr_ifru.ifru_flags 161 #define ifr_metric ifr_ifru.ifru_ivalue 162 #define ifr_mtu ifr_ifru.ifru_mtu 163 #define ifr_map ifr_ifru.ifru_map 164 #define ifr_slave ifr_ifru.ifru_slave 165 #define ifr_data ifr_ifru.ifru_data 166 #define ifr_ifindex ifr_ifru.ifru_ivalue 167 #define ifr_bandwidth ifr_ifru.ifru_ivalue 168 #define ifr_qlen ifr_ifru.ifru_ivalue 169 #define ifr_newname ifr_ifru.ifru_newname 170 #define ifr_settings ifr_ifru.ifru_settings 171 #if __UAPI_DEF_IF_IFCONF 172 struct ifconf { 173 int ifc_len; 174 union { 175 char * ifcu_buf; 176 struct ifreq * ifcu_req; 177 } ifc_ifcu; 178 }; 179 #endif 180 #define ifc_buf ifc_ifcu.ifcu_buf 181 #define ifc_req ifc_ifcu.ifcu_req 182 #endif 183