1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/net/if_var.h
|
4 |
|
|
//
|
5 |
|
|
//==========================================================================
|
6 |
|
|
// ####BSDCOPYRIGHTBEGIN####
|
7 |
|
|
// -------------------------------------------
|
8 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
9 |
|
|
//
|
10 |
|
|
// Portions of this software may have been derived from FreeBSD
|
11 |
|
|
// or other sources, and if so are covered by the appropriate copyright
|
12 |
|
|
// and license included herein.
|
13 |
|
|
//
|
14 |
|
|
// Portions created by the Free Software Foundation are
|
15 |
|
|
// Copyright (C) 2002 Free Software Foundation, Inc.
|
16 |
|
|
// -------------------------------------------
|
17 |
|
|
// ####BSDCOPYRIGHTEND####
|
18 |
|
|
//==========================================================================
|
19 |
|
|
|
20 |
|
|
/*
|
21 |
|
|
* Copyright (c) 1982, 1986, 1989, 1993
|
22 |
|
|
* The Regents of the University of California. All rights reserved.
|
23 |
|
|
*
|
24 |
|
|
* Redistribution and use in source and binary forms, with or without
|
25 |
|
|
* modification, are permitted provided that the following conditions
|
26 |
|
|
* are met:
|
27 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
28 |
|
|
* notice, this list of conditions and the following disclaimer.
|
29 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
30 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
31 |
|
|
* documentation and/or other materials provided with the distribution.
|
32 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
33 |
|
|
* must display the following acknowledgement:
|
34 |
|
|
* This product includes software developed by the University of
|
35 |
|
|
* California, Berkeley and its contributors.
|
36 |
|
|
* 4. Neither the name of the University nor the names of its contributors
|
37 |
|
|
* may be used to endorse or promote products derived from this software
|
38 |
|
|
* without specific prior written permission.
|
39 |
|
|
*
|
40 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
41 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
42 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
43 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
44 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
45 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
46 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
48 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
49 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
50 |
|
|
* SUCH DAMAGE.
|
51 |
|
|
*
|
52 |
|
|
* From: @(#)if.h 8.1 (Berkeley) 6/10/93
|
53 |
|
|
* $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $
|
54 |
|
|
*/
|
55 |
|
|
|
56 |
|
|
#ifndef _NET_IF_VAR_H_
|
57 |
|
|
#define _NET_IF_VAR_H_
|
58 |
|
|
|
59 |
|
|
/*
|
60 |
|
|
* Structures defining a network interface, providing a packet
|
61 |
|
|
* transport mechanism (ala level 0 of the PUP protocols).
|
62 |
|
|
*
|
63 |
|
|
* Each interface accepts output datagrams of a specified maximum
|
64 |
|
|
* length, and provides higher level routines with input datagrams
|
65 |
|
|
* received from its medium.
|
66 |
|
|
*
|
67 |
|
|
* Output occurs when the routine if_output is called, with three parameters:
|
68 |
|
|
* (*ifp->if_output)(ifp, m, dst, rt)
|
69 |
|
|
* Here m is the mbuf chain to be sent and dst is the destination address.
|
70 |
|
|
* The output routine encapsulates the supplied datagram if necessary,
|
71 |
|
|
* and then transmits it on its medium.
|
72 |
|
|
*
|
73 |
|
|
* On input, each interface unwraps the data received by it, and either
|
74 |
|
|
* places it on the input queue of a internetwork datagram routine
|
75 |
|
|
* and posts the associated software interrupt, or passes the datagram to a raw
|
76 |
|
|
* packet input routine.
|
77 |
|
|
*
|
78 |
|
|
* Routines exist for locating interfaces by their addresses
|
79 |
|
|
* or for locating a interface on a certain network, as well as more general
|
80 |
|
|
* routing and gateway routines maintaining information used to locate
|
81 |
|
|
* interfaces. These routines live in the files if.c and route.c
|
82 |
|
|
*/
|
83 |
|
|
|
84 |
|
|
#ifdef __STDC__
|
85 |
|
|
/*
|
86 |
|
|
* Forward structure declarations for function prototypes [sic].
|
87 |
|
|
*/
|
88 |
|
|
struct mbuf;
|
89 |
|
|
struct proc;
|
90 |
|
|
struct rtentry;
|
91 |
|
|
struct socket;
|
92 |
|
|
struct ether_header;
|
93 |
|
|
#endif
|
94 |
|
|
|
95 |
|
|
#include <sys/queue.h> /* get TAILQ macros */
|
96 |
|
|
|
97 |
|
|
TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */
|
98 |
|
|
TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */
|
99 |
|
|
TAILQ_HEAD(ifprefixhead, ifprefix);
|
100 |
|
|
LIST_HEAD(ifmultihead, ifmultiaddr);
|
101 |
|
|
|
102 |
|
|
/*
|
103 |
|
|
* Structure defining a queue for a network interface.
|
104 |
|
|
*/
|
105 |
|
|
struct ifqueue {
|
106 |
|
|
struct mbuf *ifq_head;
|
107 |
|
|
struct mbuf *ifq_tail;
|
108 |
|
|
int ifq_len;
|
109 |
|
|
int ifq_maxlen;
|
110 |
|
|
int ifq_drops;
|
111 |
|
|
};
|
112 |
|
|
|
113 |
|
|
/*
|
114 |
|
|
* Structure defining a network interface.
|
115 |
|
|
*
|
116 |
|
|
* (Would like to call this struct ``if'', but C isn't PL/1.)
|
117 |
|
|
*/
|
118 |
|
|
struct ifnet {
|
119 |
|
|
void *if_softc; /* pointer to driver state */
|
120 |
|
|
char *if_name; /* name, e.g. ``en'' or ``lo'' */
|
121 |
|
|
TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */
|
122 |
|
|
struct ifaddrhead if_addrhead; /* linked list of addresses per if */
|
123 |
|
|
char if_xname[IFNAMSIZ]; /* external name (name + unit) */
|
124 |
|
|
int if_pcount; /* number of promiscuous listeners */
|
125 |
|
|
struct bpf_if *if_bpf; /* packet filter structure */
|
126 |
|
|
u_short if_index; /* numeric abbreviation for this if */
|
127 |
|
|
short if_unit; /* sub-unit for lower level driver */
|
128 |
|
|
short if_timer; /* time 'til if_watchdog called */
|
129 |
|
|
short if_flags; /* up/down, broadcast, etc. */
|
130 |
|
|
int if_ipending; /* interrupts pending */
|
131 |
|
|
void *if_linkmib; /* link-type-specific MIB data */
|
132 |
|
|
size_t if_linkmiblen; /* length of above data */
|
133 |
|
|
struct if_data if_data;
|
134 |
|
|
struct ifmultihead if_multiaddrs; /* multicast addresses configured */
|
135 |
|
|
int if_amcount; /* number of all-multicast requests */
|
136 |
|
|
/* procedure handles */
|
137 |
|
|
int (*if_output) /* output routine (enqueue) */
|
138 |
|
|
__P((struct ifnet *, struct mbuf *, struct sockaddr *,
|
139 |
|
|
struct rtentry *));
|
140 |
|
|
void (*if_start) /* initiate output routine */
|
141 |
|
|
__P((struct ifnet *));
|
142 |
|
|
int (*if_done) /* output complete routine */
|
143 |
|
|
__P((struct ifnet *)); /* (XXX not used; fake prototype) */
|
144 |
|
|
int (*if_ioctl) /* ioctl routine */
|
145 |
|
|
__P((struct ifnet *, u_long, caddr_t));
|
146 |
|
|
void (*if_watchdog) /* timer routine */
|
147 |
|
|
__P((struct ifnet *));
|
148 |
|
|
int (*if_poll_recv) /* polled receive routine */
|
149 |
|
|
__P((struct ifnet *, int *));
|
150 |
|
|
int (*if_poll_xmit) /* polled transmit routine */
|
151 |
|
|
__P((struct ifnet *, int *));
|
152 |
|
|
void (*if_poll_intren) /* polled interrupt reenable routine */
|
153 |
|
|
__P((struct ifnet *));
|
154 |
|
|
void (*if_poll_slowinput) /* input routine for slow devices */
|
155 |
|
|
__P((struct ifnet *, struct mbuf *));
|
156 |
|
|
void (*if_init) /* Init routine */
|
157 |
|
|
__P((void *));
|
158 |
|
|
int (*if_resolvemulti) /* validate/resolve multicast */
|
159 |
|
|
__P((struct ifnet *, struct sockaddr **, struct sockaddr *));
|
160 |
|
|
struct ifqueue if_snd; /* output queue */
|
161 |
|
|
struct ifqueue *if_poll_slowq; /* input queue for slow devices */
|
162 |
|
|
struct ifprefixhead if_prefixhead; /* list of prefixes per if */
|
163 |
|
|
};
|
164 |
|
|
typedef void if_init_f_t __P((void *));
|
165 |
|
|
|
166 |
|
|
#define if_mtu if_data.ifi_mtu
|
167 |
|
|
#define if_type if_data.ifi_type
|
168 |
|
|
#define if_physical if_data.ifi_physical
|
169 |
|
|
#define if_addrlen if_data.ifi_addrlen
|
170 |
|
|
#define if_hdrlen if_data.ifi_hdrlen
|
171 |
|
|
#define if_metric if_data.ifi_metric
|
172 |
|
|
#define if_baudrate if_data.ifi_baudrate
|
173 |
|
|
#define if_hwassist if_data.ifi_hwassist
|
174 |
|
|
#define if_ipackets if_data.ifi_ipackets
|
175 |
|
|
#define if_ierrors if_data.ifi_ierrors
|
176 |
|
|
#define if_opackets if_data.ifi_opackets
|
177 |
|
|
#define if_oerrors if_data.ifi_oerrors
|
178 |
|
|
#define if_collisions if_data.ifi_collisions
|
179 |
|
|
#define if_ibytes if_data.ifi_ibytes
|
180 |
|
|
#define if_obytes if_data.ifi_obytes
|
181 |
|
|
#define if_imcasts if_data.ifi_imcasts
|
182 |
|
|
#define if_omcasts if_data.ifi_omcasts
|
183 |
|
|
#define if_iqdrops if_data.ifi_iqdrops
|
184 |
|
|
#define if_noproto if_data.ifi_noproto
|
185 |
|
|
#define if_lastchange if_data.ifi_lastchange
|
186 |
|
|
#define if_recvquota if_data.ifi_recvquota
|
187 |
|
|
#define if_xmitquota if_data.ifi_xmitquota
|
188 |
|
|
#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0)
|
189 |
|
|
|
190 |
|
|
/* for compatibility with other BSDs */
|
191 |
|
|
#define if_addrlist if_addrhead
|
192 |
|
|
#define if_list if_link
|
193 |
|
|
|
194 |
|
|
static __inline__ char *
|
195 |
|
|
if_name(struct ifnet *ifp)
|
196 |
|
|
{
|
197 |
|
|
return ifp->if_xname;
|
198 |
|
|
}
|
199 |
|
|
|
200 |
|
|
/*
|
201 |
|
|
* Bit values in if_ipending
|
202 |
|
|
*/
|
203 |
|
|
#define IFI_RECV 1 /* I want to receive */
|
204 |
|
|
#define IFI_XMIT 2 /* I want to transmit */
|
205 |
|
|
|
206 |
|
|
/*
|
207 |
|
|
* Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq)
|
208 |
|
|
* are queues of messages stored on ifqueue structures
|
209 |
|
|
* (defined above). Entries are added to and deleted from these structures
|
210 |
|
|
* by these macros, which should be called with ipl raised to splimp().
|
211 |
|
|
*/
|
212 |
|
|
#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen)
|
213 |
|
|
#define IF_DROP(ifq) ((ifq)->ifq_drops++)
|
214 |
|
|
#define IF_ENQUEUE(ifq, m) { \
|
215 |
|
|
(m)->m_nextpkt = 0; \
|
216 |
|
|
if ((ifq)->ifq_tail == 0) \
|
217 |
|
|
(ifq)->ifq_head = m; \
|
218 |
|
|
else \
|
219 |
|
|
(ifq)->ifq_tail->m_nextpkt = m; \
|
220 |
|
|
(ifq)->ifq_tail = m; \
|
221 |
|
|
(ifq)->ifq_len++; \
|
222 |
|
|
}
|
223 |
|
|
#define IF_PREPEND(ifq, m) { \
|
224 |
|
|
(m)->m_nextpkt = (ifq)->ifq_head; \
|
225 |
|
|
if ((ifq)->ifq_tail == 0) \
|
226 |
|
|
(ifq)->ifq_tail = (m); \
|
227 |
|
|
(ifq)->ifq_head = (m); \
|
228 |
|
|
(ifq)->ifq_len++; \
|
229 |
|
|
}
|
230 |
|
|
#define IF_DEQUEUE(ifq, m) { \
|
231 |
|
|
(m) = (ifq)->ifq_head; \
|
232 |
|
|
if (m) { \
|
233 |
|
|
if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \
|
234 |
|
|
(ifq)->ifq_tail = 0; \
|
235 |
|
|
(m)->m_nextpkt = 0; \
|
236 |
|
|
(ifq)->ifq_len--; \
|
237 |
|
|
} \
|
238 |
|
|
}
|
239 |
|
|
#define IF_POLL(ifq, m) ((m) = (ifq)->ifq_head)
|
240 |
|
|
#define IF_PURGE(ifq) \
|
241 |
|
|
while (1) { \
|
242 |
|
|
struct mbuf *m0; \
|
243 |
|
|
IF_DEQUEUE((ifq), m0); \
|
244 |
|
|
if (m0 == NULL) \
|
245 |
|
|
break; \
|
246 |
|
|
else \
|
247 |
|
|
m_freem(m0); \
|
248 |
|
|
}
|
249 |
|
|
#define IF_IS_EMPTY(ifq) ((ifq)->ifq_len == 0)
|
250 |
|
|
|
251 |
|
|
#ifdef _KERNEL
|
252 |
|
|
#define IF_ENQ_DROP(ifq, m) if_enq_drop(ifq, m)
|
253 |
|
|
|
254 |
|
|
#if defined(__GNUC__) && defined(MT_HEADER)
|
255 |
|
|
static __inline int
|
256 |
|
|
if_queue_drop(struct ifqueue *ifq, struct mbuf *m)
|
257 |
|
|
{
|
258 |
|
|
IF_DROP(ifq);
|
259 |
|
|
return 0;
|
260 |
|
|
}
|
261 |
|
|
|
262 |
|
|
static __inline int
|
263 |
|
|
if_enq_drop(struct ifqueue *ifq, struct mbuf *m)
|
264 |
|
|
{
|
265 |
|
|
if (IF_QFULL(ifq) &&
|
266 |
|
|
!if_queue_drop(ifq, m))
|
267 |
|
|
return 0;
|
268 |
|
|
IF_ENQUEUE(ifq, m);
|
269 |
|
|
return 1;
|
270 |
|
|
}
|
271 |
|
|
#else
|
272 |
|
|
|
273 |
|
|
#ifdef MT_HEADER
|
274 |
|
|
int if_enq_drop __P((struct ifqueue *, struct mbuf *));
|
275 |
|
|
#endif
|
276 |
|
|
|
277 |
|
|
#endif
|
278 |
|
|
|
279 |
|
|
/*
|
280 |
|
|
* 72 was chosen below because it is the size of a TCP/IP
|
281 |
|
|
* header (40) + the minimum mss (32).
|
282 |
|
|
*/
|
283 |
|
|
#define IF_MINMTU 72
|
284 |
|
|
#define IF_MAXMTU 65535
|
285 |
|
|
|
286 |
|
|
#endif /* _KERNEL */
|
287 |
|
|
|
288 |
|
|
#ifdef _KERNEL
|
289 |
|
|
#define IFQ_ENQUEUE(ifq, m, err) \
|
290 |
|
|
do { \
|
291 |
|
|
if (IF_QFULL((ifq))) { \
|
292 |
|
|
m_freem((m)); \
|
293 |
|
|
(err) = ENOBUFS; \
|
294 |
|
|
} else { \
|
295 |
|
|
IF_ENQUEUE((ifq), (m)); \
|
296 |
|
|
(err) = 0; \
|
297 |
|
|
} \
|
298 |
|
|
if ((err)) \
|
299 |
|
|
(ifq)->ifq_drops++; \
|
300 |
|
|
} while (0)
|
301 |
|
|
|
302 |
|
|
#define IFQ_DEQUEUE(ifq, m) IF_DEQUEUE((ifq), (m))
|
303 |
|
|
|
304 |
|
|
#define IFQ_POLL(ifq, m) IF_POLL((ifq), (m))
|
305 |
|
|
|
306 |
|
|
#define IFQ_PURGE(ifq) \
|
307 |
|
|
while (1) { \
|
308 |
|
|
struct mbuf *m0; \
|
309 |
|
|
IF_DEQUEUE((ifq), m0); \
|
310 |
|
|
if (m0 == NULL) \
|
311 |
|
|
break; \
|
312 |
|
|
else \
|
313 |
|
|
m_freem(m0); \
|
314 |
|
|
}
|
315 |
|
|
|
316 |
|
|
#define IFQ_SET_READY(ifq) ((void)0)
|
317 |
|
|
#define IFQ_CLASSIFY(ifq, m, af, pa) ((void)0)
|
318 |
|
|
|
319 |
|
|
#define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0)
|
320 |
|
|
#define IFQ_INC_LEN(ifq) ((ifq)->ifq_len++)
|
321 |
|
|
#define IFQ_DEC_LEN(ifq) (--(ifq)->ifq_len)
|
322 |
|
|
#define IFQ_INC_DROPS(ifq) ((ifq)->ifq_drops++)
|
323 |
|
|
#define IFQ_SET_MAXLEN(ifq, len) ((ifq)->ifq_maxlen = (len))
|
324 |
|
|
|
325 |
|
|
#endif /* _KERNEL */
|
326 |
|
|
|
327 |
|
|
/*
|
328 |
|
|
* The ifaddr structure contains information about one address
|
329 |
|
|
* of an interface. They are maintained by the different address families,
|
330 |
|
|
* are allocated and attached when an address is set, and are linked
|
331 |
|
|
* together so all addresses for an interface can be located.
|
332 |
|
|
*/
|
333 |
|
|
struct ifaddr {
|
334 |
|
|
struct sockaddr *ifa_addr; /* address of interface */
|
335 |
|
|
struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */
|
336 |
|
|
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
|
337 |
|
|
struct sockaddr *ifa_netmask; /* used to determine subnet */
|
338 |
|
|
struct if_data if_data; /* not all members are meaningful */
|
339 |
|
|
struct ifnet *ifa_ifp; /* back-pointer to interface */
|
340 |
|
|
TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */
|
341 |
|
|
void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */
|
342 |
|
|
__P((int, struct rtentry *, struct sockaddr *));
|
343 |
|
|
u_short ifa_flags; /* mostly rt_flags for cloning */
|
344 |
|
|
u_int ifa_refcnt; /* references to this structure */
|
345 |
|
|
int ifa_metric; /* cost of going out this interface */
|
346 |
|
|
#ifdef notdef
|
347 |
|
|
struct rtentry *ifa_rt; /* XXXX for ROUTETOIF ????? */
|
348 |
|
|
#endif
|
349 |
|
|
int (*ifa_claim_addr) /* check if an addr goes to this if */
|
350 |
|
|
__P((struct ifaddr *, struct sockaddr *));
|
351 |
|
|
|
352 |
|
|
};
|
353 |
|
|
#define IFA_ROUTE RTF_UP /* route installed */
|
354 |
|
|
#define IFAREF(ifa) do { ++(ifa)->ifa_refcnt; } while (0)
|
355 |
|
|
|
356 |
|
|
/* for compatibility with other BSDs */
|
357 |
|
|
#define ifa_list ifa_link
|
358 |
|
|
|
359 |
|
|
/*
|
360 |
|
|
* The prefix structure contains information about one prefix
|
361 |
|
|
* of an interface. They are maintained by the different address families,
|
362 |
|
|
* are allocated and attached when an prefix or an address is set,
|
363 |
|
|
* and are linked together so all prefixes for an interface can be located.
|
364 |
|
|
*/
|
365 |
|
|
struct ifprefix {
|
366 |
|
|
struct sockaddr *ifpr_prefix; /* prefix of interface */
|
367 |
|
|
struct ifnet *ifpr_ifp; /* back-pointer to interface */
|
368 |
|
|
TAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */
|
369 |
|
|
u_char ifpr_plen; /* prefix length in bits */
|
370 |
|
|
u_char ifpr_type; /* protocol dependent prefix type */
|
371 |
|
|
};
|
372 |
|
|
|
373 |
|
|
/*
|
374 |
|
|
* Multicast address structure. This is analogous to the ifaddr
|
375 |
|
|
* structure except that it keeps track of multicast addresses.
|
376 |
|
|
* Also, the reference count here is a count of requests for this
|
377 |
|
|
* address, not a count of pointers to this structure.
|
378 |
|
|
*/
|
379 |
|
|
struct ifmultiaddr {
|
380 |
|
|
LIST_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */
|
381 |
|
|
struct sockaddr *ifma_addr; /* address this membership is for */
|
382 |
|
|
struct sockaddr *ifma_lladdr; /* link-layer translation, if any */
|
383 |
|
|
struct ifnet *ifma_ifp; /* back-pointer to interface */
|
384 |
|
|
u_int ifma_refcount; /* reference count */
|
385 |
|
|
void *ifma_protospec; /* protocol-specific state, if any */
|
386 |
|
|
};
|
387 |
|
|
|
388 |
|
|
#ifdef _KERNEL
|
389 |
|
|
#define IFAFREE(ifa) \
|
390 |
|
|
do { \
|
391 |
|
|
if ((ifa)->ifa_refcnt <= 0) \
|
392 |
|
|
ifafree(ifa); \
|
393 |
|
|
else \
|
394 |
|
|
(ifa)->ifa_refcnt--; \
|
395 |
|
|
} while (0)
|
396 |
|
|
|
397 |
|
|
extern struct ifnethead ifnet;
|
398 |
|
|
extern struct ifnet **ifindex2ifnet;
|
399 |
|
|
extern int ifqmaxlen;
|
400 |
|
|
extern struct ifnet loif[];
|
401 |
|
|
extern int if_index;
|
402 |
|
|
extern struct ifaddr **ifnet_addrs;
|
403 |
|
|
|
404 |
|
|
void ether_ifattach __P((struct ifnet *, int));
|
405 |
|
|
void ether_ifdetach __P((struct ifnet *, int));
|
406 |
|
|
void ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *));
|
407 |
|
|
void ether_demux __P((struct ifnet *, struct ether_header *, struct mbuf *));
|
408 |
|
|
int ether_output __P((struct ifnet *,
|
409 |
|
|
struct mbuf *, struct sockaddr *, struct rtentry *));
|
410 |
|
|
int ether_output_frame __P((struct ifnet *, struct mbuf *));
|
411 |
|
|
int ether_ioctl __P((struct ifnet *, int, caddr_t));
|
412 |
|
|
|
413 |
|
|
int if_addmulti __P((struct ifnet *, struct sockaddr *,
|
414 |
|
|
struct ifmultiaddr **));
|
415 |
|
|
int if_allmulti __P((struct ifnet *, int));
|
416 |
|
|
void if_attach __P((struct ifnet *));
|
417 |
|
|
int if_delmulti __P((struct ifnet *, struct sockaddr *));
|
418 |
|
|
void if_detach __P((struct ifnet *));
|
419 |
|
|
void if_down __P((struct ifnet *));
|
420 |
|
|
void if_route __P((struct ifnet *, int flag, int fam));
|
421 |
|
|
int if_setlladdr __P((struct ifnet *, const u_char *, int));
|
422 |
|
|
void if_unroute __P((struct ifnet *, int flag, int fam));
|
423 |
|
|
void if_up __P((struct ifnet *));
|
424 |
|
|
/*void ifinit __P((void));*/ /* declared in systm.h for main() */
|
425 |
|
|
int ifioctl __P((struct socket *, u_long, caddr_t, struct proc *));
|
426 |
|
|
int ifpromisc __P((struct ifnet *, int));
|
427 |
|
|
struct ifnet *ifunit __P((const char *));
|
428 |
|
|
struct ifnet *if_withname __P((struct sockaddr *));
|
429 |
|
|
|
430 |
|
|
int if_poll_recv_slow __P((struct ifnet *ifp, int *quotap));
|
431 |
|
|
void if_poll_xmit_slow __P((struct ifnet *ifp, int *quotap));
|
432 |
|
|
void if_poll_throttle __P((void));
|
433 |
|
|
void if_poll_unthrottle __P((void *));
|
434 |
|
|
void if_poll_init __P((void));
|
435 |
|
|
void if_poll __P((void));
|
436 |
|
|
|
437 |
|
|
struct ifaddr *ifa_ifwithaddr __P((struct sockaddr *));
|
438 |
|
|
struct ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *));
|
439 |
|
|
struct ifaddr *ifa_ifwithnet __P((struct sockaddr *));
|
440 |
|
|
struct ifaddr *ifa_ifwithroute __P((int, struct sockaddr *,
|
441 |
|
|
struct sockaddr *));
|
442 |
|
|
struct ifaddr *ifaof_ifpforaddr __P((struct sockaddr *, struct ifnet *));
|
443 |
|
|
void ifafree __P((struct ifaddr *));
|
444 |
|
|
|
445 |
|
|
struct ifmultiaddr *ifmaof_ifpforaddr __P((struct sockaddr *,
|
446 |
|
|
struct ifnet *));
|
447 |
|
|
int if_simloop __P((struct ifnet *ifp, struct mbuf *m, int af, int hlen));
|
448 |
|
|
|
449 |
|
|
void if_clone_attach __P((struct if_clone *));
|
450 |
|
|
void if_clone_detach __P((struct if_clone *));
|
451 |
|
|
|
452 |
|
|
int if_clone_create __P((char *, int));
|
453 |
|
|
int if_clone_destroy __P((const char *));
|
454 |
|
|
|
455 |
|
|
#endif /* _KERNEL */
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
#endif /* !_NET_IF_VAR_H_ */
|