1
/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
2
This file is part of the GNU C Library.
4
The GNU C Library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Lesser General Public
6
License as published by the Free Software Foundation; either
7
version 2.1 of the License, or (at your option) any later version.
9
The GNU C Library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Lesser General Public License for more details.
14
You should have received a copy of the GNU Lesser General Public
15
License along with the GNU C Library; if not, write to the Free
16
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24
#include <sys/types.h>
25
#include <sys/socket.h>
27
/* Standard interface flags. */
30
IFF_UP = 0x1, /* Interface is up. */
32
IFF_BROADCAST = 0x2, /* Broadcast address valid. */
33
#define IFF_BROADCAST IFF_BROADCAST
34
IFF_DEBUG = 0x4, /* Turn on debugging. */
35
#define IFF_DEBUG IFF_DEBUG
36
IFF_LOOPBACK = 0x8, /* Is a loopback net. */
37
#define IFF_LOOPBACK IFF_LOOPBACK
38
IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link. */
39
#define IFF_POINTOPOINT IFF_POINTOPOINT
40
IFF_NOTRAILERS = 0x20, /* Avoid use of trailers. */
41
#define IFF_NOTRAILERS IFF_NOTRAILERS
42
IFF_RUNNING = 0x40, /* Resources allocated. */
43
#define IFF_RUNNING IFF_RUNNING
44
IFF_NOARP = 0x80, /* No address resolution protocol. */
45
#define IFF_NOARP IFF_NOARP
46
IFF_PROMISC = 0x100, /* Receive all packets. */
47
#define IFF_PROMISC IFF_PROMISC
50
IFF_ALLMULTI = 0x200, /* Receive all multicast packets. */
51
#define IFF_ALLMULTI IFF_ALLMULTI
53
IFF_OACTIVE = 0x400, /* Transmission in progress. */
54
#define IFF_OACTIVE IFF_OACTIVE
55
IFF_SIMPLEX = 0x800, /* Cannot hear own transmissions. */
56
#define IFF_SIMPLEX IFF_SIMPLEX
57
IFF_DO_HW_LOOPBACK = 0x10000, /* Force loopback through hardware. */
58
#define IFF_DO_HW_LOOPBACK IFF_DO_HW_LOOPBACK
59
IFF_ALLCAST = 0x20000, /* Global broadcast. */
60
#define IFF_ALLCAST IFF_ALLCAST
61
IFF_BRIDGE = 0x40000, /* Receive all bridge packets. */
62
#define IFF_BRIDGE IFF_BRIDGE
63
IFF_NOECHO = IFF_SIMPLEX, /* Reeives echo packets. */
64
#define IFF_NOECHO IFF_NOECHO
67
/* The ifaddr structure contains information about one address of an
68
interface. They are maintained by the different address families,
69
are allocated and attached when an address is set, and are linked
70
together so all addresses for an interface can be located. */
74
struct sockaddr ifa_addr; /* Address of interface. */
77
struct sockaddr ifu_broadaddr;
78
struct sockaddr ifu_dstaddr;
80
struct sockaddr *ifa_netmask; /* Used to determine subnet. */
81
struct iface *ifa_ifp; /* Back-pointer to interface. */
82
struct ifaddr *ifa_next; /* Next address for interface. */
83
void (*ifa_rtrequest) (void);
84
struct rtentry *ifa_rt;
85
unsigned short int ifa_flags;
89
#define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */
90
#define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of link */
92
/* Interface request structure used for socket ioctl's. All interface
93
ioctl's must have parameter definitions which begin with ifr_name.
94
The remainder may be interface specific. */
102
char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */
107
struct sockaddr ifru_addr;
108
struct sockaddr ifru_dstaddr;
109
struct sockaddr ifru_broadaddr;
110
struct sockaddr ifru_netmask;
111
struct sockaddr ifru_hwaddr;
112
short int ifru_flags;
114
unsigned int ifru_mtu;
115
char ifru_slave[IFNAMSIZ]; /* Just fits the size */
117
unsigned short int ifru_site6;
121
/* Old AIX 3.1 version. */
124
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
127
struct sockaddr ifru_addr;
128
struct sockaddr ifru_dstaddr;
129
struct sockaddr ifru_broadaddr;
133
unsigned int ifru_mtu;
135
unsigned char reserved[8];
139
#define ifr_name ifr_ifrn.ifrn_name /* interface name */
140
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
141
#define ifr_addr ifr_ifru.ifru_addr /* address */
142
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */
143
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
144
#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */
145
#define ifr_flags ifr_ifru.ifru_flags /* flags */
146
#define ifr_metric ifr_ifru.ifru_ivalue /* metric */
147
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
148
#define ifr_slave ifr_ifru.ifru_slave /* slave device */
149
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
150
#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */
151
#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */
152
#define ifr_baudrate ifr_ifru.ifru_ivalue /* link bandwidth */
153
#define ifr_qlen ifr_ifru.ifru_ivalue /* queue length */
154
#define ifr_site6 ifr_ifru.ifru_site6 /* IPv6 site index */
157
/* Structure used in SIOCGIFCONF request. Used to retrieve interface
158
configuration for machine (useful for programs which must know all
159
networks accessible). */
163
int ifc_len; /* Size of buffer. */
167
struct ifreq *ifcu_req;
170
#define ifc_buf ifc_ifcu.ifcu_buf /* Buffer address. */
171
#define ifc_req ifc_ifcu.ifcu_req /* Array of structures. */
175
/* Convert an interface name to an index, and vice versa. */
177
extern unsigned int if_nametoindex (__const char *__ifname) __THROW;
178
extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW;
180
/* Return a list of all interfaces and their indices. */
184
unsigned int if_index; /* 1, 2, ... */
185
char *if_name; /* null terminated name: "eth0", ... */
188
extern struct if_nameindex *if_nameindex (void) __THROW;
190
/* Free the data returned from if_nameindex. */
192
extern void if_freenameindex (struct if_nameindex *__ptr) __THROW;
196
#endif /* net/if.h */