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.
5 *
6 *		Global definitions for the INET interface module.
7 *
8 * Version:	@(#)if.h	1.0.2	04/18/93
9 *
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>
13 *
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.
18 */
19#ifndef _LINUX_IF_H
20#define _LINUX_IF_H
21
22#include <linux/types.h>		/* for "__kernel_caddr_t" et al	*/
23#include <linux/socket.h>		/* for "struct sockaddr" et al	*/
24
25/* Standard interface flags (netdevice->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*/
36
37#define IFF_MASTER	0x400		/* master of a load balancer 	*/
38#define IFF_SLAVE	0x800		/* slave of a load balancer	*/
39
40#define IFF_MULTICAST	0x1000		/* Supports multicast		*/
41
42#define IFF_VOLATILE	(IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_MASTER|IFF_SLAVE|IFF_RUNNING)
43
44#define IFF_PORTSEL	0x2000          /* can set media type		*/
45#define IFF_AUTOMEDIA	0x4000		/* auto media select active	*/
46#define IFF_DYNAMIC	0x8000		/* dialup device with changing addresses*/
47
48/* Private (from user) interface flags (netdevice->priv_flags). */
49#define IFF_802_1Q_VLAN 0x1             /* 802.1Q VLAN device.          */
50
51/*
52 *	Device mapping structure. I'd just gone off and designed a
53 *	beautiful scheme using only loadable modules with arguments
54 *	for driver options and along come the PCMCIA people 8)
55 *
56 *	Ah well. The get() side of this is good for WDSETUP, and it'll
57 *	be handy for debugging things. The set side is fine for now and
58 *	being very small might be worth keeping for clean configuration.
59 */
60
61struct ifmap
62{
63	unsigned long mem_start;
64	unsigned long mem_end;
65	unsigned short base_addr;
66	unsigned char irq;
67	unsigned char dma;
68	unsigned char port;
69	/* 3 bytes spare */
70};
71
72/*
73 * Interface request structure used for socket
74 * ioctl's.  All interface ioctl's must have parameter
75 * definitions which begin with ifr_name.  The
76 * remainder may be interface specific.
77 */
78
79struct ifreq
80{
81#define IFHWADDRLEN	6
82#define	IFNAMSIZ	16
83	union
84	{
85		char	ifrn_name[IFNAMSIZ];		/* if name, e.g. "en0" */
86	} ifr_ifrn;
87
88	union {
89		struct	sockaddr ifru_addr;
90		struct	sockaddr ifru_dstaddr;
91		struct	sockaddr ifru_broadaddr;
92		struct	sockaddr ifru_netmask;
93		struct  sockaddr ifru_hwaddr;
94		short	ifru_flags;
95		int	ifru_ivalue;
96		int	ifru_mtu;
97		struct  ifmap ifru_map;
98		char	ifru_slave[IFNAMSIZ];	/* Just fits the size */
99		char	ifru_newname[IFNAMSIZ];
100		char *	ifru_data;
101	} ifr_ifru;
102};
103
104#define ifr_name	ifr_ifrn.ifrn_name	/* interface name 	*/
105#define ifr_hwaddr	ifr_ifru.ifru_hwaddr	/* MAC address 		*/
106#define	ifr_addr	ifr_ifru.ifru_addr	/* address		*/
107#define	ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-p lnk	*/
108#define	ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address	*/
109#define	ifr_netmask	ifr_ifru.ifru_netmask	/* interface net mask	*/
110#define	ifr_flags	ifr_ifru.ifru_flags	/* flags		*/
111#define	ifr_metric	ifr_ifru.ifru_ivalue	/* metric		*/
112#define	ifr_mtu		ifr_ifru.ifru_mtu	/* mtu			*/
113#define ifr_map		ifr_ifru.ifru_map	/* device map		*/
114#define ifr_slave	ifr_ifru.ifru_slave	/* slave device		*/
115#define	ifr_data	ifr_ifru.ifru_data	/* for use by interface	*/
116#define ifr_ifindex	ifr_ifru.ifru_ivalue	/* interface index	*/
117#define ifr_bandwidth	ifr_ifru.ifru_ivalue    /* link bandwidth	*/
118#define ifr_qlen	ifr_ifru.ifru_ivalue	/* Queue length 	*/
119#define ifr_newname	ifr_ifru.ifru_newname	/* New name		*/
120
121/*
122 * Structure used in SIOCGIFCONF request.
123 * Used to retrieve interface configuration
124 * for machine (useful for programs which
125 * must know all networks accessible).
126 */
127
128struct ifconf
129{
130	int	ifc_len;			/* size of buffer	*/
131	union
132	{
133		char *			ifcu_buf;
134		struct	ifreq 		*ifcu_req;
135	} ifc_ifcu;
136};
137#define	ifc_buf	ifc_ifcu.ifcu_buf		/* buffer address	*/
138#define	ifc_req	ifc_ifcu.ifcu_req		/* array of structures	*/
139
140
141#endif /* _LINUX_IF_H */
142