williamr@2
|
1 |
/*-
|
williamr@2
|
2 |
* Copyright (c) 1982, 1986, 1989, 1993
|
williamr@2
|
3 |
* The Regents of the University of California. All rights reserved.
|
williamr@2
|
4 |
*
|
williamr@2
|
5 |
* Redistribution and use in source and binary forms, with or without
|
williamr@2
|
6 |
* modification, are permitted provided that the following conditions
|
williamr@2
|
7 |
* are met:
|
williamr@2
|
8 |
* 1. Redistributions of source code must retain the above copyright
|
williamr@2
|
9 |
* notice, this list of conditions and the following disclaimer.
|
williamr@2
|
10 |
* 2. Redistributions in binary form must reproduce the above copyright
|
williamr@2
|
11 |
* notice, this list of conditions and the following disclaimer in the
|
williamr@2
|
12 |
* documentation and/or other materials provided with the distribution.
|
williamr@2
|
13 |
* 4. Neither the name of the University nor the names of its contributors
|
williamr@2
|
14 |
* may be used to endorse or promote products derived from this software
|
williamr@2
|
15 |
* without specific prior written permission.
|
williamr@2
|
16 |
*
|
williamr@2
|
17 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
williamr@2
|
18 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
williamr@2
|
19 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
williamr@2
|
20 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
williamr@2
|
21 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
williamr@2
|
22 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
williamr@2
|
23 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
williamr@2
|
24 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
williamr@2
|
25 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
williamr@2
|
26 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
williamr@2
|
27 |
* SUCH DAMAGE.
|
williamr@2
|
28 |
*
|
williamr@4
|
29 |
* Portions Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
|
williamr@2
|
30 |
* @(#)if.h 8.1 (Berkeley) 6/10/93
|
williamr@2
|
31 |
* $FreeBSD: src/sys/net/if.h,v 1.96.2.3 2005/10/07 14:00:05 glebius Exp $
|
williamr@2
|
32 |
*/
|
williamr@2
|
33 |
|
williamr@2
|
34 |
#ifndef _NET_IF_H_
|
williamr@2
|
35 |
#define _NET_IF_H_
|
williamr@2
|
36 |
|
williamr@2
|
37 |
#ifdef __SYMBIAN32__
|
williamr@2
|
38 |
#ifdef __cplusplus
|
williamr@2
|
39 |
extern "C" {
|
williamr@2
|
40 |
#endif
|
williamr@2
|
41 |
#endif
|
williamr@2
|
42 |
|
williamr@2
|
43 |
#include <sys/cdefs.h>
|
williamr@2
|
44 |
|
williamr@2
|
45 |
#ifdef _KERNEL
|
williamr@2
|
46 |
#include <sys/queue.h>
|
williamr@2
|
47 |
#endif
|
williamr@2
|
48 |
|
williamr@2
|
49 |
#if __BSD_VISIBLE
|
williamr@2
|
50 |
/*
|
williamr@2
|
51 |
* <net/if.h> does not depend on <sys/time.h> on most other systems. This
|
williamr@2
|
52 |
* helps userland compatibility. (struct timeval ifi_lastchange)
|
williamr@2
|
53 |
*/
|
williamr@2
|
54 |
#ifndef _KERNEL
|
williamr@2
|
55 |
#include <sys/time.h>
|
williamr@2
|
56 |
#endif
|
williamr@2
|
57 |
|
williamr@2
|
58 |
struct ifnet;
|
williamr@2
|
59 |
#endif
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/*
|
williamr@2
|
62 |
* Length of interface external name, including terminating '\0'.
|
williamr@2
|
63 |
* Note: this is the same size as a generic device's external name.
|
williamr@2
|
64 |
*/
|
williamr@2
|
65 |
#ifdef __SYMBIAN32__
|
williamr@2
|
66 |
// KCommsDbSvrMaxColumnNameLength = 50
|
williamr@2
|
67 |
#define IF_NAMESIZE 50
|
williamr@2
|
68 |
#else
|
williamr@2
|
69 |
#define IF_NAMESIZE 16
|
williamr@2
|
70 |
#endif
|
williamr@2
|
71 |
#if __BSD_VISIBLE
|
williamr@2
|
72 |
#define IFNAMSIZ IF_NAMESIZE
|
williamr@2
|
73 |
#define IF_MAXUNIT 0x7fff /* historical value */
|
williamr@2
|
74 |
#endif
|
williamr@2
|
75 |
#if __BSD_VISIBLE
|
williamr@2
|
76 |
|
williamr@2
|
77 |
/*
|
williamr@2
|
78 |
* Structure used to query names of interface cloners.
|
williamr@2
|
79 |
*/
|
williamr@2
|
80 |
|
williamr@2
|
81 |
struct if_clonereq {
|
williamr@2
|
82 |
int ifcr_total; /* total cloners (out) */
|
williamr@2
|
83 |
int ifcr_count; /* room for this many in user buffer */
|
williamr@2
|
84 |
char *ifcr_buffer; /* buffer for cloner names */
|
williamr@2
|
85 |
};
|
williamr@2
|
86 |
|
williamr@2
|
87 |
/*
|
williamr@2
|
88 |
* Structure describing information about an interface
|
williamr@2
|
89 |
* which may be of interest to management entities.
|
williamr@2
|
90 |
*/
|
williamr@2
|
91 |
struct if_data {
|
williamr@2
|
92 |
/* generic interface information */
|
williamr@2
|
93 |
u_char ifi_type; /* ethernet, tokenring, etc */
|
williamr@2
|
94 |
u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
|
williamr@2
|
95 |
u_char ifi_addrlen; /* media address length */
|
williamr@2
|
96 |
u_char ifi_hdrlen; /* media header length */
|
williamr@2
|
97 |
u_char ifi_link_state; /* current link state */
|
williamr@2
|
98 |
u_char ifi_recvquota; /* polling quota for receive intrs */
|
williamr@2
|
99 |
u_char ifi_xmitquota; /* polling quota for xmit intrs */
|
williamr@2
|
100 |
u_char ifi_datalen; /* length of this data struct */
|
williamr@2
|
101 |
u_long ifi_mtu; /* maximum transmission unit */
|
williamr@2
|
102 |
u_long ifi_metric; /* routing metric (external only) */
|
williamr@2
|
103 |
u_long ifi_baudrate; /* linespeed */
|
williamr@2
|
104 |
/* volatile statistics */
|
williamr@2
|
105 |
u_long ifi_ipackets; /* packets received on interface */
|
williamr@2
|
106 |
u_long ifi_ierrors; /* input errors on interface */
|
williamr@2
|
107 |
u_long ifi_opackets; /* packets sent on interface */
|
williamr@2
|
108 |
u_long ifi_oerrors; /* output errors on interface */
|
williamr@2
|
109 |
u_long ifi_collisions; /* collisions on csma interfaces */
|
williamr@2
|
110 |
u_long ifi_ibytes; /* total number of octets received */
|
williamr@2
|
111 |
u_long ifi_obytes; /* total number of octets sent */
|
williamr@2
|
112 |
u_long ifi_imcasts; /* packets received via multicast */
|
williamr@2
|
113 |
u_long ifi_omcasts; /* packets sent via multicast */
|
williamr@2
|
114 |
u_long ifi_iqdrops; /* dropped on input, this interface */
|
williamr@2
|
115 |
u_long ifi_noproto; /* destined for unsupported protocol */
|
williamr@2
|
116 |
u_long ifi_hwassist; /* HW offload capabilities */
|
williamr@2
|
117 |
time_t ifi_epoch; /* uptime at attach or stat reset */
|
williamr@2
|
118 |
#ifdef __alpha__
|
williamr@2
|
119 |
u_int ifi_timepad; /* time_t is int, not long on alpha */
|
williamr@2
|
120 |
#endif
|
williamr@2
|
121 |
struct timeval ifi_lastchange; /* time of last administrative change */
|
williamr@2
|
122 |
};
|
williamr@2
|
123 |
|
williamr@2
|
124 |
/*-
|
williamr@2
|
125 |
* Interface flags are of two types: network stack owned flags, and driver
|
williamr@2
|
126 |
* owned flags. Historically, these values were stored in the same ifnet
|
williamr@2
|
127 |
* flags field, but with the advent of fine-grained locking, they have been
|
williamr@2
|
128 |
* broken out such that the network stack is responsible for synchronizing
|
williamr@2
|
129 |
* the stack-owned fields, and the device driver the device-owned fields.
|
williamr@2
|
130 |
* Both halves can perform lockless reads of the other half's field, subject
|
williamr@2
|
131 |
* to accepting the involved races.
|
williamr@2
|
132 |
*
|
williamr@2
|
133 |
* Both sets of flags come from the same number space, and should not be
|
williamr@2
|
134 |
* permitted to conflict, as they are exposed to user space via a single
|
williamr@2
|
135 |
* field.
|
williamr@2
|
136 |
*
|
williamr@2
|
137 |
* The following symbols identify read and write requirements for fields:
|
williamr@2
|
138 |
*
|
williamr@2
|
139 |
* (i) if_flags field set by device driver before attach, read-only there
|
williamr@2
|
140 |
* after.
|
williamr@2
|
141 |
* (n) if_flags field written only by the network stack, read by either the
|
williamr@2
|
142 |
* stack or driver.
|
williamr@2
|
143 |
* (d) if_drv_flags field written only by the device driver, read by either
|
williamr@2
|
144 |
* the stack or driver.
|
williamr@2
|
145 |
*/
|
williamr@2
|
146 |
#define IFF_UP 0x1 /* (n) interface is up */
|
williamr@2
|
147 |
#define IFF_BROADCAST 0x2 /* (i) broadcast address valid */
|
williamr@2
|
148 |
#define IFF_DEBUG 0x4 /* (n) turn on debugging */
|
williamr@2
|
149 |
#define IFF_LOOPBACK 0x8 /* (i) is a loopback net */
|
williamr@2
|
150 |
#define IFF_POINTOPOINT 0x10 /* (i) is a point-to-point link */
|
williamr@2
|
151 |
#define IFF_SMART 0x20 /* (i) interface manages own routes */
|
williamr@2
|
152 |
#define IFF_DRV_RUNNING 0x40 /* (d) resources allocated */
|
williamr@2
|
153 |
#define IFF_NOARP 0x80 /* (n) no address resolution protocol */
|
williamr@2
|
154 |
#define IFF_PROMISC 0x100 /* (n) receive all packets */
|
williamr@2
|
155 |
#define IFF_ALLMULTI 0x200 /* (n) receive all multicast packets */
|
williamr@2
|
156 |
#define IFF_DRV_OACTIVE 0x400 /* (d) tx hardware queue is full */
|
williamr@2
|
157 |
#define IFF_SIMPLEX 0x800 /* (i) can't hear own transmissions */
|
williamr@2
|
158 |
#define IFF_LINK0 0x1000 /* per link layer defined bit */
|
williamr@2
|
159 |
#define IFF_LINK1 0x2000 /* per link layer defined bit */
|
williamr@2
|
160 |
#define IFF_LINK2 0x4000 /* per link layer defined bit */
|
williamr@2
|
161 |
#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */
|
williamr@2
|
162 |
#define IFF_MULTICAST 0x8000 /* (i) supports multicast */
|
williamr@2
|
163 |
/* 0x10000 */
|
williamr@2
|
164 |
#define IFF_PPROMISC 0x20000 /* (n) user-requested promisc mode */
|
williamr@2
|
165 |
#define IFF_MONITOR 0x40000 /* (n) user-requested monitor mode */
|
williamr@2
|
166 |
#define IFF_STATICARP 0x80000 /* (n) static ARP */
|
williamr@2
|
167 |
#define IFF_NEEDSGIANT 0x100000 /* (i) hold Giant over if_start calls */
|
williamr@2
|
168 |
|
williamr@2
|
169 |
/*
|
williamr@2
|
170 |
* Old names for driver flags so that user space tools can continue to use
|
williamr@2
|
171 |
* the old (portable) names.
|
williamr@2
|
172 |
*/
|
williamr@2
|
173 |
#ifndef _KERNEL
|
williamr@2
|
174 |
#define IFF_RUNNING IFF_DRV_RUNNING
|
williamr@2
|
175 |
#define IFF_OACTIVE IFF_DRV_OACTIVE
|
williamr@2
|
176 |
#endif
|
williamr@2
|
177 |
|
williamr@2
|
178 |
/* flags set internally only: */
|
williamr@2
|
179 |
#define IFF_CANTCHANGE \
|
williamr@2
|
180 |
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_DRV_RUNNING|IFF_DRV_OACTIVE|\
|
williamr@2
|
181 |
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_PROMISC)
|
williamr@2
|
182 |
|
williamr@2
|
183 |
/*
|
williamr@2
|
184 |
* Values for if_link_state.
|
williamr@2
|
185 |
*/
|
williamr@2
|
186 |
#define LINK_STATE_UNKNOWN 0 /* link invalid/unknown */
|
williamr@2
|
187 |
#define LINK_STATE_DOWN 1 /* link is down */
|
williamr@2
|
188 |
#define LINK_STATE_UP 2 /* link is up */
|
williamr@2
|
189 |
|
williamr@2
|
190 |
/*
|
williamr@2
|
191 |
* Some convenience macros used for setting ifi_baudrate.
|
williamr@2
|
192 |
* XXX 1000 vs. 1024? --thorpej@netbsd.org
|
williamr@2
|
193 |
*/
|
williamr@2
|
194 |
#define IF_Kbps(x) ((x) * 1000) /* kilobits/sec. */
|
williamr@2
|
195 |
#define IF_Mbps(x) (IF_Kbps((x) * 1000)) /* megabits/sec. */
|
williamr@2
|
196 |
#define IF_Gbps(x) (IF_Mbps((x) * 1000)) /* gigabits/sec. */
|
williamr@2
|
197 |
|
williamr@2
|
198 |
/* Capabilities that interfaces can advertise. */
|
williamr@2
|
199 |
#define IFCAP_RXCSUM 0x0001 /* can offload checksum on RX */
|
williamr@2
|
200 |
#define IFCAP_TXCSUM 0x0002 /* can offload checksum on TX */
|
williamr@2
|
201 |
#define IFCAP_NETCONS 0x0004 /* can be a network console */
|
williamr@2
|
202 |
#define IFCAP_VLAN_MTU 0x0008 /* VLAN-compatible MTU */
|
williamr@2
|
203 |
#define IFCAP_VLAN_HWTAGGING 0x0010 /* hardware VLAN tag support */
|
williamr@2
|
204 |
#define IFCAP_JUMBO_MTU 0x0020 /* 9000 byte MTU supported */
|
williamr@2
|
205 |
#define IFCAP_POLLING 0x0040 /* driver supports polling */
|
williamr@2
|
206 |
|
williamr@2
|
207 |
#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
|
williamr@2
|
208 |
|
williamr@2
|
209 |
#define IFQ_MAXLEN 50
|
williamr@2
|
210 |
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
|
williamr@2
|
211 |
|
williamr@2
|
212 |
/*
|
williamr@2
|
213 |
* Message format for use in obtaining information about interfaces
|
williamr@2
|
214 |
* from getkerninfo and the routing socket
|
williamr@2
|
215 |
*/
|
williamr@2
|
216 |
struct if_msghdr {
|
williamr@2
|
217 |
u_short ifm_msglen; /* to skip over non-understood messages */
|
williamr@2
|
218 |
u_char ifm_version; /* future binary compatibility */
|
williamr@2
|
219 |
u_char ifm_type; /* message type */
|
williamr@2
|
220 |
int ifm_addrs; /* like rtm_addrs */
|
williamr@2
|
221 |
int ifm_flags; /* value of if_flags */
|
williamr@2
|
222 |
u_short ifm_index; /* index for associated ifp */
|
williamr@2
|
223 |
struct if_data ifm_data;/* statistics and other data about if */
|
williamr@2
|
224 |
};
|
williamr@2
|
225 |
|
williamr@2
|
226 |
/*
|
williamr@2
|
227 |
* Message format for use in obtaining information about interface addresses
|
williamr@2
|
228 |
* from getkerninfo and the routing socket
|
williamr@2
|
229 |
*/
|
williamr@2
|
230 |
struct ifa_msghdr {
|
williamr@2
|
231 |
u_short ifam_msglen; /* to skip over non-understood messages */
|
williamr@2
|
232 |
u_char ifam_version; /* future binary compatibility */
|
williamr@2
|
233 |
u_char ifam_type; /* message type */
|
williamr@2
|
234 |
int ifam_addrs; /* like rtm_addrs */
|
williamr@2
|
235 |
int ifam_flags; /* value of ifa_flags */
|
williamr@2
|
236 |
u_short ifam_index; /* index for associated ifp */
|
williamr@2
|
237 |
int ifam_metric; /* value of ifa_metric */
|
williamr@2
|
238 |
};
|
williamr@2
|
239 |
|
williamr@2
|
240 |
/*
|
williamr@2
|
241 |
* Message format for use in obtaining information about multicast addresses
|
williamr@2
|
242 |
* from the routing socket
|
williamr@2
|
243 |
*/
|
williamr@2
|
244 |
struct ifma_msghdr {
|
williamr@2
|
245 |
u_short ifmam_msglen; /* to skip over non-understood messages */
|
williamr@2
|
246 |
u_char ifmam_version; /* future binary compatibility */
|
williamr@2
|
247 |
u_char ifmam_type; /* message type */
|
williamr@2
|
248 |
int ifmam_addrs; /* like rtm_addrs */
|
williamr@2
|
249 |
int ifmam_flags; /* value of ifa_flags */
|
williamr@2
|
250 |
u_short ifmam_index; /* index for associated ifp */
|
williamr@2
|
251 |
};
|
williamr@2
|
252 |
|
williamr@2
|
253 |
/*
|
williamr@2
|
254 |
* Message format announcing the arrival or departure of a network interface.
|
williamr@2
|
255 |
*/
|
williamr@2
|
256 |
struct if_announcemsghdr {
|
williamr@2
|
257 |
u_short ifan_msglen; /* to skip over non-understood messages */
|
williamr@2
|
258 |
u_char ifan_version; /* future binary compatibility */
|
williamr@2
|
259 |
u_char ifan_type; /* message type */
|
williamr@2
|
260 |
u_short ifan_index; /* index for associated ifp */
|
williamr@2
|
261 |
char ifan_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
williamr@2
|
262 |
u_short ifan_what; /* what type of announcement */
|
williamr@2
|
263 |
};
|
williamr@2
|
264 |
|
williamr@2
|
265 |
#define IFAN_ARRIVAL 0 /* interface arrival */
|
williamr@2
|
266 |
#define IFAN_DEPARTURE 1 /* interface departure */
|
williamr@2
|
267 |
|
williamr@2
|
268 |
/*
|
williamr@2
|
269 |
* Interface request structure used for socket
|
williamr@2
|
270 |
* ioctl's. All interface ioctl's must have parameter
|
williamr@2
|
271 |
* definitions which begin with ifr_name. The
|
williamr@2
|
272 |
* remainder may be interface specific.
|
williamr@2
|
273 |
*/
|
williamr@2
|
274 |
struct ifreq {
|
williamr@2
|
275 |
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
williamr@2
|
276 |
union {
|
williamr@2
|
277 |
struct sockaddr ifru_addr;
|
williamr@2
|
278 |
struct sockaddr ifru_dstaddr;
|
williamr@2
|
279 |
struct sockaddr ifru_broadaddr;
|
williamr@2
|
280 |
struct sockaddr ifru_hwaddr;
|
williamr@2
|
281 |
short ifru_flags[2];
|
williamr@2
|
282 |
short ifru_index;
|
williamr@2
|
283 |
int ifru_metric;
|
williamr@2
|
284 |
int ifru_mtu;
|
williamr@2
|
285 |
int ifru_phys;
|
williamr@2
|
286 |
int ifru_media;
|
williamr@2
|
287 |
caddr_t ifru_data;
|
williamr@2
|
288 |
int ifru_cap[2];
|
williamr@2
|
289 |
unsigned int snap_id;
|
williamr@2
|
290 |
} ifr_ifru;
|
williamr@2
|
291 |
#ifdef __SYMBIAN32__
|
williamr@2
|
292 |
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
|
williamr@2
|
293 |
#endif
|
williamr@2
|
294 |
#define ifr_addr ifr_ifru.ifru_addr /* address */
|
williamr@2
|
295 |
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
|
williamr@2
|
296 |
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
|
williamr@2
|
297 |
#define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */
|
williamr@2
|
298 |
#define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */
|
williamr@2
|
299 |
#define ifr_metric ifr_ifru.ifru_metric /* metric */
|
williamr@2
|
300 |
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
|
williamr@2
|
301 |
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
|
williamr@2
|
302 |
#define ifr_media ifr_ifru.ifru_media /* physical media */
|
williamr@2
|
303 |
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
|
williamr@2
|
304 |
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
|
williamr@2
|
305 |
#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
|
williamr@2
|
306 |
#define ifr_index ifr_ifru.ifru_index /* interface index */
|
williamr@2
|
307 |
};
|
williamr@2
|
308 |
|
williamr@2
|
309 |
#define _SIZEOF_ADDR_IFREQ(ifr) \
|
williamr@2
|
310 |
((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \
|
williamr@2
|
311 |
(sizeof(struct ifreq) - sizeof(struct sockaddr) + \
|
williamr@2
|
312 |
(ifr).ifr_addr.sa_len) : sizeof(struct ifreq))
|
williamr@2
|
313 |
|
williamr@2
|
314 |
struct ifaliasreq {
|
williamr@2
|
315 |
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
williamr@2
|
316 |
struct sockaddr ifra_addr;
|
williamr@2
|
317 |
struct sockaddr ifra_broadaddr;
|
williamr@2
|
318 |
struct sockaddr ifra_mask;
|
williamr@2
|
319 |
};
|
williamr@2
|
320 |
|
williamr@2
|
321 |
struct ifmediareq {
|
williamr@2
|
322 |
char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
williamr@2
|
323 |
int ifm_current; /* current media options */
|
williamr@2
|
324 |
int ifm_mask; /* don't care mask */
|
williamr@2
|
325 |
int ifm_status; /* media status */
|
williamr@2
|
326 |
int ifm_active; /* active options */
|
williamr@2
|
327 |
int ifm_count; /* # entries in ifm_ulist array */
|
williamr@2
|
328 |
int *ifm_ulist; /* media words */
|
williamr@2
|
329 |
};
|
williamr@2
|
330 |
|
williamr@2
|
331 |
struct ifdrv {
|
williamr@2
|
332 |
char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
williamr@2
|
333 |
unsigned long ifd_cmd;
|
williamr@2
|
334 |
size_t ifd_len;
|
williamr@2
|
335 |
void *ifd_data;
|
williamr@2
|
336 |
};
|
williamr@2
|
337 |
|
williamr@2
|
338 |
/*
|
williamr@2
|
339 |
* Structure used to retrieve aux status data from interfaces.
|
williamr@2
|
340 |
* Kernel suppliers to this interface should respect the formatting
|
williamr@2
|
341 |
* needed by ifconfig(8): each line starts with a TAB and ends with
|
williamr@2
|
342 |
* a newline. The canonical example to copy and paste is in if_tun.c.
|
williamr@2
|
343 |
*/
|
williamr@2
|
344 |
|
williamr@2
|
345 |
#define IFSTATMAX 800 /* 10 lines of text */
|
williamr@2
|
346 |
struct ifstat {
|
williamr@2
|
347 |
char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
williamr@2
|
348 |
char ascii[IFSTATMAX + 1];
|
williamr@2
|
349 |
};
|
williamr@2
|
350 |
|
williamr@2
|
351 |
/*
|
williamr@2
|
352 |
* Structure used in SIOCGIFCONF request.
|
williamr@2
|
353 |
* Used to retrieve interface configuration
|
williamr@2
|
354 |
* for machine (useful for programs which
|
williamr@2
|
355 |
* must know all networks accessible).
|
williamr@2
|
356 |
*/
|
williamr@2
|
357 |
struct ifconf {
|
williamr@2
|
358 |
int ifc_len; /* size of associated buffer */
|
williamr@2
|
359 |
union {
|
williamr@2
|
360 |
caddr_t ifcu_buf;
|
williamr@2
|
361 |
struct ifreq *ifcu_req;
|
williamr@2
|
362 |
} ifc_ifcu;
|
williamr@2
|
363 |
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
|
williamr@2
|
364 |
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
|
williamr@2
|
365 |
};
|
williamr@2
|
366 |
|
williamr@2
|
367 |
|
williamr@2
|
368 |
/*
|
williamr@2
|
369 |
* Structure for SIOC[AGD]LIFADDR
|
williamr@2
|
370 |
*/
|
williamr@2
|
371 |
struct if_laddrreq {
|
williamr@2
|
372 |
char iflr_name[IFNAMSIZ];
|
williamr@2
|
373 |
u_int flags;
|
williamr@2
|
374 |
#define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */
|
williamr@2
|
375 |
u_int prefixlen; /* in/out */
|
williamr@2
|
376 |
struct sockaddr_storage addr; /* in/out */
|
williamr@2
|
377 |
struct sockaddr_storage dstaddr; /* out */
|
williamr@2
|
378 |
};
|
williamr@2
|
379 |
|
williamr@2
|
380 |
#endif /* __BSD_VISIBLE */
|
williamr@2
|
381 |
|
williamr@2
|
382 |
#ifndef _KERNEL
|
williamr@2
|
383 |
struct if_nameindex {
|
williamr@2
|
384 |
unsigned int if_index; /* 1, 2, ... */
|
williamr@2
|
385 |
char *if_name; /* null terminated name: "le0", ... */
|
williamr@2
|
386 |
};
|
williamr@2
|
387 |
|
williamr@2
|
388 |
__BEGIN_DECLS
|
williamr@2
|
389 |
IMPORT_C void if_freenameindex(struct if_nameindex *);
|
williamr@2
|
390 |
IMPORT_C char *if_indextoname(unsigned int, char *);
|
williamr@2
|
391 |
IMPORT_C struct if_nameindex *if_nameindex(void);
|
williamr@2
|
392 |
IMPORT_C unsigned int if_nametoindex(const char *);
|
williamr@2
|
393 |
__END_DECLS
|
williamr@2
|
394 |
#endif
|
williamr@2
|
395 |
|
williamr@2
|
396 |
#ifdef _KERNEL
|
williamr@2
|
397 |
struct thread;
|
williamr@2
|
398 |
|
williamr@2
|
399 |
/* XXX - this should go away soon. */
|
williamr@4
|
400 |
#include <stdapis/net/if_var.h>
|
williamr@2
|
401 |
#endif
|
williamr@2
|
402 |
|
williamr@2
|
403 |
/*
|
williamr@2
|
404 |
* Symbian specific APIs
|
williamr@2
|
405 |
*/
|
williamr@2
|
406 |
#ifdef __SYMBIAN32__
|
williamr@2
|
407 |
IMPORT_C int setdefaultif( const struct ifreq* );
|
williamr@2
|
408 |
#endif
|
williamr@2
|
409 |
|
williamr@2
|
410 |
#ifdef __SYMBIAN32__
|
williamr@2
|
411 |
#ifdef __cplusplus
|
williamr@2
|
412 |
}
|
williamr@2
|
413 |
#endif
|
williamr@2
|
414 |
#endif
|
williamr@2
|
415 |
|
williamr@2
|
416 |
#endif /* !_NET_IF_H_ */
|