Import 2.1.42pre1
[davej-history.git] / include / linux / if.h
blob06e2d740ed2c998f534dae94e2aec1d42dba6405
1 /*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
6 * Global definitions for the INET interface module.
8 * Version: @(#)if.h 1.0.2 04/18/93
10 * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988
11 * Ross Biro, <bir7@leland.Stanford.Edu>
12 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
19 #ifndef _LINUX_IF_H
20 #define _LINUX_IF_H
22 #include <linux/types.h> /* for "__kernel_caddr_t" et al */
23 #include <linux/socket.h> /* for "struct sockaddr" et al */
25 /* Standard interface flags. */
26 #define IFF_UP 0x1 /* interface is up */
27 #define IFF_BROADCAST 0x2 /* broadcast address valid */
28 #define IFF_DEBUG 0x4 /* turn on debugging */
29 #define IFF_LOOPBACK 0x8 /* is a loopback net */
30 #define IFF_POINTOPOINT 0x10 /* interface is has p-p link */
31 #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
32 #define IFF_RUNNING 0x40 /* resources allocated */
33 #define IFF_NOARP 0x80 /* no ARP protocol */
34 #define IFF_PROMISC 0x100 /* receive all packets */
35 #define IFF_ALLMULTI 0x200 /* receive all multicast packets*/
37 #define IFF_MASTER 0x400 /* master of a load balancer */
38 #define IFF_SLAVE 0x800 /* slave of a load balancer */
40 #define IFF_MULTICAST 0x1000 /* Supports multicast */
43 * The ifaddr structure contains information about one address
44 * of an interface. They are maintained by the different address
45 * families, are allocated and attached when an address is set,
46 * and are linked together so all addresses for an interface can
47 * be located.
50 struct ifaddr
52 struct sockaddr ifa_addr; /* address of interface */
53 union {
54 struct sockaddr ifu_broadaddr;
55 struct sockaddr ifu_dstaddr;
56 } ifa_ifu;
57 struct iface *ifa_ifp; /* back-pointer to interface */
58 struct ifaddr *ifa_next; /* next address for interface */
61 #define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */
62 #define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */
65 * Device mapping structure. I'd just gone off and designed a
66 * beautiful scheme using only loadable modules with arguments
67 * for driver options and along come the PCMCIA people 8)
69 * Ah well. The get() side of this is good for WDSETUP, and it'll
70 * be handy for debugging things. The set side is fine for now and
71 * being very small might be worth keeping for clean configuration.
74 struct ifmap
76 unsigned long mem_start;
77 unsigned long mem_end;
78 unsigned short base_addr;
79 unsigned char irq;
80 unsigned char dma;
81 unsigned char port;
82 /* 3 bytes spare */
86 * Interface request structure used for socket
87 * ioctl's. All interface ioctl's must have parameter
88 * definitions which begin with ifr_name. The
89 * remainder may be interface specific.
92 struct ifreq
94 #define IFHWADDRLEN 6
95 #define IFNAMSIZ 16
96 union
98 char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
99 } ifr_ifrn;
101 union {
102 struct sockaddr ifru_addr;
103 struct sockaddr ifru_dstaddr;
104 struct sockaddr ifru_broadaddr;
105 struct sockaddr ifru_netmask;
106 struct sockaddr ifru_hwaddr;
107 short ifru_flags;
108 int ifru_ivalue;
109 int ifru_mtu;
110 struct ifmap ifru_map;
111 char ifru_slave[IFNAMSIZ]; /* Just fits the size */
112 __kernel_caddr_t ifru_data;
113 } ifr_ifru;
116 #define ifr_name ifr_ifrn.ifrn_name /* interface name */
117 #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
118 #define ifr_addr ifr_ifru.ifru_addr /* address */
119 #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */
120 #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
121 #define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
122 #define ifr_flags ifr_ifru.ifru_flags /* flags */
123 #define ifr_metric ifr_ifru.ifru_ivalue /* metric */
124 #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
125 #define ifr_map ifr_ifru.ifru_map /* device map */
126 #define ifr_slave ifr_ifru.ifru_slave /* slave device */
127 #define ifr_data ifr_ifru.ifru_data /* for use by interface */
128 #define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */
131 * Structure used in SIOCGIFCONF request.
132 * Used to retrieve interface configuration
133 * for machine (useful for programs which
134 * must know all networks accessible).
137 struct ifconf
139 int ifc_len; /* size of buffer */
140 union
142 __kernel_caddr_t ifcu_buf;
143 struct ifreq *ifcu_req;
144 } ifc_ifcu;
146 #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
147 #define ifc_req ifc_ifcu.ifcu_req /* array of structures */
149 #endif /* _LINUX_IF_H */