OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [bsd_tcpip/] [v2_0/] [include/] [netinet6/] [in6_var.h] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/netinet6/in6_var.h
4
//
5
//==========================================================================
6
//####BSDCOPYRIGHTBEGIN####
7
//
8
// -------------------------------------------
9
//
10
// Portions of this software may have been derived from OpenBSD, 
11
// FreeBSD or other sources, and are covered by the appropriate
12
// copyright disclaimers included herein.
13
//
14
// Portions created by Red Hat are
15
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
16
//
17
// -------------------------------------------
18
//
19
//####BSDCOPYRIGHTEND####
20
//==========================================================================
21
 
22
/*      $KAME: in6_var.h,v 1.74 2001/12/24 10:39:30 jinmei Exp $        */
23
 
24
/*
25
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
26
 * All rights reserved.
27
 *
28
 * Redistribution and use in source and binary forms, with or without
29
 * modification, are permitted provided that the following conditions
30
 * are met:
31
 * 1. Redistributions of source code must retain the above copyright
32
 *    notice, this list of conditions and the following disclaimer.
33
 * 2. Redistributions in binary form must reproduce the above copyright
34
 *    notice, this list of conditions and the following disclaimer in the
35
 *    documentation and/or other materials provided with the distribution.
36
 * 3. Neither the name of the project 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 PROJECT 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 PROJECT 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
 
53
/*
54
 * Copyright (c) 1985, 1986, 1993
55
 *      The Regents of the University of California.  All rights reserved.
56
 *
57
 * Redistribution and use in source and binary forms, with or without
58
 * modification, are permitted provided that the following conditions
59
 * are met:
60
 * 1. Redistributions of source code must retain the above copyright
61
 *    notice, this list of conditions and the following disclaimer.
62
 * 2. Redistributions in binary form must reproduce the above copyright
63
 *    notice, this list of conditions and the following disclaimer in the
64
 *    documentation and/or other materials provided with the distribution.
65
 * 3. All advertising materials mentioning features or use of this software
66
 *    must display the following acknowledgement:
67
 *      This product includes software developed by the University of
68
 *      California, Berkeley and its contributors.
69
 * 4. Neither the name of the University nor the names of its contributors
70
 *    may be used to endorse or promote products derived from this software
71
 *    without specific prior written permission.
72
 *
73
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
74
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
75
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
76
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
77
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
78
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
79
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
80
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
81
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
82
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
83
 * SUCH DAMAGE.
84
 *
85
 *      @(#)in_var.h    8.1 (Berkeley) 6/10/93
86
 */
87
 
88
#ifndef _NETINET6_IN6_VAR_H_
89
#define _NETINET6_IN6_VAR_H_
90
 
91
/*
92
 * Interface address, Internet version.  One of these structures
93
 * is allocated for each interface with an Internet address.
94
 * The ifaddr structure contains the protocol-independent part
95
 * of the structure and is assumed to be first.
96
 */
97
 
98
/*
99
 * pltime/vltime are just for future reference (required to implements 2
100
 * hour rule for hosts).  they should never be modified by nd6_timeout or
101
 * anywhere else.
102
 *      userland -> kernel: accept pltime/vltime
103
 *      kernel -> userland: throw up everything
104
 *      in kernel: modify preferred/expire only
105
 */
106
struct in6_addrlifetime {
107
        time_t ia6t_expire;     /* valid lifetime expiration time */
108
        time_t ia6t_preferred;  /* preferred lifetime expiration time */
109
        u_int32_t ia6t_vltime;  /* valid lifetime */
110
        u_int32_t ia6t_pltime;  /* prefix lifetime */
111
};
112
 
113
#ifdef MEASURE_PERFORMANCE
114
/*
115
 * Structure for hashing "local" IPv6 addresses for lookup in IPv6 input.
116
 */
117
struct in6hash {
118
        struct  in6hash *in6h_next;
119
        struct  in6_addr in6h_addr;
120
        struct  in6_ifaddr *in6h_ifa;
121
        int     in6h_flags;
122
        int     in6h_hit;       /* number of hits for this entry */
123
        int     in6h_miss;      /* number of failures for this entry */
124
};
125
#endif
126
 
127
struct  in6_ifaddr {
128
        struct  ifaddr ia_ifa;          /* protocol-independent info */
129
#define ia_ifp          ia_ifa.ifa_ifp
130
#define ia_flags        ia_ifa.ifa_flags
131
        struct  sockaddr_in6 ia_addr;   /* interface address */
132
        struct  sockaddr_in6 ia_net;    /* network number of interface */
133
        struct  sockaddr_in6 ia_dstaddr; /* space for destination addr */
134
        struct  sockaddr_in6 ia_prefixmask; /* prefix mask */
135
        u_int32_t ia_plen;              /* prefix length */
136
        struct  in6_ifaddr *ia_next;    /* next in6 list of IP6 addresses */
137
#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
138
        LIST_HEAD(in6_multihead, in6_multi) ia6_multiaddrs;
139
                                        /* list of multicast addresses */
140
#endif
141
        int     ia6_flags;
142
 
143
        struct in6_addrlifetime ia6_lifetime;
144
        time_t  ia6_createtime; /* the creation time of this address, which is
145
                                 * currently used for temporary addresses only.
146
                                 */
147
        time_t  ia6_updatetime;
148
 
149
        /* back pointer to the ND prefix (for autoconfigured addresses only) */
150
        struct nd_prefix *ia6_ndpr;
151
 
152
#ifdef MEASURE_PERFORMANCE
153
        struct in6hash ia6_hash;        /* hash for ia_addr */
154
#endif
155
 
156
        /* multicast addresses joined from the kernel */
157
        LIST_HEAD(, in6_multi_mship) ia6_memberships;
158
};
159
 
160
/* control structure to manage address selection policy */
161
struct in6_addrpolicy {
162
        struct sockaddr_in6 addr; /* prefix address */
163
        struct sockaddr_in6 addrmask; /* prefix mask */
164
        int preced;             /* precedence */
165
        int label;              /* matching label */
166
        u_quad_t use;           /* statistics */
167
};
168
 
169
/*
170
 * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).
171
 */
172
struct in6_ifstat {
173
        u_quad_t ifs6_in_receive;       /* # of total input datagram */
174
        u_quad_t ifs6_in_hdrerr;        /* # of datagrams with invalid hdr */
175
        u_quad_t ifs6_in_toobig;        /* # of datagrams exceeded MTU */
176
        u_quad_t ifs6_in_noroute;       /* # of datagrams with no route */
177
        u_quad_t ifs6_in_addrerr;       /* # of datagrams with invalid dst */
178
        u_quad_t ifs6_in_protounknown;  /* # of datagrams with unknown proto */
179
                                        /* NOTE: increment on final dst if */
180
        u_quad_t ifs6_in_truncated;     /* # of truncated datagrams */
181
        u_quad_t ifs6_in_discard;       /* # of discarded datagrams */
182
                                        /* NOTE: fragment timeout is not here */
183
        u_quad_t ifs6_in_deliver;       /* # of datagrams delivered to ULP */
184
                                        /* NOTE: increment on final dst if */
185
        u_quad_t ifs6_out_forward;      /* # of datagrams forwarded */
186
                                        /* NOTE: increment on outgoing if */
187
        u_quad_t ifs6_out_request;      /* # of outgoing datagrams from ULP */
188
                                        /* NOTE: does not include forwrads */
189
        u_quad_t ifs6_out_discard;      /* # of discarded datagrams */
190
        u_quad_t ifs6_out_fragok;       /* # of datagrams fragmented */
191
        u_quad_t ifs6_out_fragfail;     /* # of datagrams failed on fragment */
192
        u_quad_t ifs6_out_fragcreat;    /* # of fragment datagrams */
193
                                        /* NOTE: this is # after fragment */
194
        u_quad_t ifs6_reass_reqd;       /* # of incoming fragmented packets */
195
                                        /* NOTE: increment on final dst if */
196
        u_quad_t ifs6_reass_ok;         /* # of reassembled packets */
197
                                        /* NOTE: this is # after reass */
198
                                        /* NOTE: increment on final dst if */
199
        u_quad_t ifs6_reass_fail;       /* # of reass failures */
200
                                        /* NOTE: may not be packet count */
201
                                        /* NOTE: increment on final dst if */
202
        u_quad_t ifs6_in_mcast;         /* # of inbound multicast datagrams */
203
        u_quad_t ifs6_out_mcast;        /* # of outbound multicast datagrams */
204
};
205
 
206
/*
207
 * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry.
208
 * XXX: I'm not sure if this file is the right place for this structure...
209
 */
210
struct icmp6_ifstat {
211
        /*
212
         * Input statistics
213
         */
214
        /* ipv6IfIcmpInMsgs, total # of input messages */
215
        u_quad_t ifs6_in_msg;
216
        /* ipv6IfIcmpInErrors, # of input error messages */
217
        u_quad_t ifs6_in_error;
218
        /* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */
219
        u_quad_t ifs6_in_dstunreach;
220
        /* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */
221
        u_quad_t ifs6_in_adminprohib;
222
        /* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */
223
        u_quad_t ifs6_in_timeexceed;
224
        /* ipv6IfIcmpInParmProblems, # of input parameter problem errors */
225
        u_quad_t ifs6_in_paramprob;
226
        /* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */
227
        u_quad_t ifs6_in_pkttoobig;
228
        /* ipv6IfIcmpInEchos, # of input echo requests */
229
        u_quad_t ifs6_in_echo;
230
        /* ipv6IfIcmpInEchoReplies, # of input echo replies */
231
        u_quad_t ifs6_in_echoreply;
232
        /* ipv6IfIcmpInRouterSolicits, # of input router solicitations */
233
        u_quad_t ifs6_in_routersolicit;
234
        /* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */
235
        u_quad_t ifs6_in_routeradvert;
236
        /* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */
237
        u_quad_t ifs6_in_neighborsolicit;
238
        /* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */
239
        u_quad_t ifs6_in_neighboradvert;
240
        /* ipv6IfIcmpInRedirects, # of input redirects */
241
        u_quad_t ifs6_in_redirect;
242
        /* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */
243
        u_quad_t ifs6_in_mldquery;
244
        /* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */
245
        u_quad_t ifs6_in_mldreport;
246
        /* ipv6IfIcmpInGroupMembReductions, # of input MLD done */
247
        u_quad_t ifs6_in_mlddone;
248
 
249
        /*
250
         * Output statistics. We should solve unresolved routing problem...
251
         */
252
        /* ipv6IfIcmpOutMsgs, total # of output messages */
253
        u_quad_t ifs6_out_msg;
254
        /* ipv6IfIcmpOutErrors, # of output error messages */
255
        u_quad_t ifs6_out_error;
256
        /* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */
257
        u_quad_t ifs6_out_dstunreach;
258
        /* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */
259
        u_quad_t ifs6_out_adminprohib;
260
        /* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */
261
        u_quad_t ifs6_out_timeexceed;
262
        /* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */
263
        u_quad_t ifs6_out_paramprob;
264
        /* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */
265
        u_quad_t ifs6_out_pkttoobig;
266
        /* ipv6IfIcmpOutEchos, # of output echo requests */
267
        u_quad_t ifs6_out_echo;
268
        /* ipv6IfIcmpOutEchoReplies, # of output echo replies */
269
        u_quad_t ifs6_out_echoreply;
270
        /* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */
271
        u_quad_t ifs6_out_routersolicit;
272
        /* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */
273
        u_quad_t ifs6_out_routeradvert;
274
        /* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */
275
        u_quad_t ifs6_out_neighborsolicit;
276
        /* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */
277
        u_quad_t ifs6_out_neighboradvert;
278
        /* ipv6IfIcmpOutRedirects, # of output redirects */
279
        u_quad_t ifs6_out_redirect;
280
        /* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */
281
        u_quad_t ifs6_out_mldquery;
282
        /* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */
283
        u_quad_t ifs6_out_mldreport;
284
        /* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */
285
        u_quad_t ifs6_out_mlddone;
286
};
287
 
288
struct  in6_ifreq {
289
        char    ifr_name[IFNAMSIZ];
290
        union {
291
                struct  sockaddr_in6 ifru_addr;
292
                struct  sockaddr_in6 ifru_dstaddr;
293
                short   ifru_flags;
294
                int     ifru_flags6;
295
                int     ifru_metric;
296
                caddr_t ifru_data;
297
                struct in6_addrlifetime ifru_lifetime;
298
                struct in6_ifstat ifru_stat;
299
                struct icmp6_ifstat ifru_icmp6stat;
300
                u_int32_t ifru_scope_id[16];
301
        } ifr_ifru;
302
};
303
 
304
struct  in6_aliasreq {
305
        char    ifra_name[IFNAMSIZ];
306
        struct  sockaddr_in6 ifra_addr;
307
        struct  sockaddr_in6 ifra_dstaddr;
308
        struct  sockaddr_in6 ifra_prefixmask;
309
        int     ifra_flags;
310
        struct in6_addrlifetime ifra_lifetime;
311
};
312
 
313
/* prefix type macro */
314
#define IN6_PREFIX_ND   1
315
#define IN6_PREFIX_RR   2
316
 
317
/*
318
 * prefix related flags passed between kernel(NDP related part) and
319
 * user land command(ifconfig) and daemon(rtadvd).
320
 */
321
struct in6_prflags {
322
        struct prf_ra {
323
                u_char onlink : 1;
324
                u_char autonomous : 1;
325
                u_char router : 1;
326
                u_char reserved : 5;
327
        } prf_ra;
328
        u_char prf_reserved1;
329
        u_short prf_reserved2;
330
        /* want to put this on 4byte offset */
331
        struct prf_rr {
332
                u_char decrvalid : 1;
333
                u_char decrprefd : 1;
334
                u_char reserved : 6;
335
        } prf_rr;
336
        u_char prf_reserved3;
337
        u_short prf_reserved4;
338
};
339
 
340
struct  in6_prefixreq {
341
        char    ipr_name[IFNAMSIZ];
342
        u_char  ipr_origin;
343
        u_char  ipr_plen;
344
        u_int32_t ipr_vltime;
345
        u_int32_t ipr_pltime;
346
        struct in6_prflags ipr_flags;
347
        struct  sockaddr_in6 ipr_prefix;
348
};
349
 
350
#define PR_ORIG_RA      0
351
#define PR_ORIG_RR      1
352
#define PR_ORIG_STATIC  2
353
#define PR_ORIG_KERNEL  3
354
 
355
#define ipr_raf_onlink          ipr_flags.prf_ra.onlink
356
#define ipr_raf_auto            ipr_flags.prf_ra.autonomous
357
 
358
#define ipr_statef_onlink       ipr_flags.prf_state.onlink
359
 
360
#define ipr_rrf_decrvalid       ipr_flags.prf_rr.decrvalid
361
#define ipr_rrf_decrprefd       ipr_flags.prf_rr.decrprefd
362
 
363
struct  in6_rrenumreq {
364
        char    irr_name[IFNAMSIZ];
365
        u_char  irr_origin;
366
        u_char  irr_m_len;      /* match len for matchprefix */
367
        u_char  irr_m_minlen;   /* minlen for matching prefix */
368
        u_char  irr_m_maxlen;   /* maxlen for matching prefix */
369
        u_char  irr_u_uselen;   /* uselen for adding prefix */
370
        u_char  irr_u_keeplen;  /* keeplen from matching prefix */
371
        struct irr_raflagmask {
372
                u_char onlink : 1;
373
                u_char autonomous : 1;
374
                u_char reserved : 6;
375
        } irr_raflagmask;
376
        u_int32_t irr_vltime;
377
        u_int32_t irr_pltime;
378
        struct in6_prflags irr_flags;
379
        struct  sockaddr_in6 irr_matchprefix;
380
        struct  sockaddr_in6 irr_useprefix;
381
};
382
 
383
#define irr_raf_mask_onlink     irr_raflagmask.onlink
384
#define irr_raf_mask_auto       irr_raflagmask.autonomous
385
#define irr_raf_mask_reserved   irr_raflagmask.reserved
386
 
387
#define irr_raf_onlink          irr_flags.prf_ra.onlink
388
#define irr_raf_auto            irr_flags.prf_ra.autonomous
389
 
390
#define irr_statef_onlink       irr_flags.prf_state.onlink
391
 
392
#define irr_rrf                 irr_flags.prf_rr
393
#define irr_rrf_decrvalid       irr_flags.prf_rr.decrvalid
394
#define irr_rrf_decrprefd       irr_flags.prf_rr.decrprefd
395
 
396
/*
397
 * Given a pointer to an in6_ifaddr (ifaddr),
398
 * return a pointer to the addr as a sockaddr_in6
399
 */
400
#define IA6_IN6(ia)     (&((ia)->ia_addr.sin6_addr))
401
#define IA6_DSTIN6(ia)  (&((ia)->ia_dstaddr.sin6_addr))
402
#define IA6_MASKIN6(ia) (&((ia)->ia_prefixmask.sin6_addr))
403
#define IA6_SIN6(ia)    (&((ia)->ia_addr))
404
#define IA6_DSTSIN6(ia) (&((ia)->ia_dstaddr))
405
#define IFA_IN6(x)      (&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr)
406
#define IFA_DSTIN6(x)   (&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr)
407
 
408
#ifdef _KERNEL
409
#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m)      (       \
410
        (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \
411
        (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \
412
        (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \
413
        (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 )
414
#endif
415
 
416
#define SIOCSIFADDR_IN6          _IOW('i', 12, struct in6_ifreq)
417
#define SIOCGIFADDR_IN6         _IOWR('i', 33, struct in6_ifreq)
418
 
419
#ifdef _KERNEL
420
/*
421
 * SIOCSxxx ioctls should be unused (see comments in in6.c), but
422
 * we do not shift numbers for binary compatibility.
423
 */
424
#define SIOCSIFDSTADDR_IN6       _IOW('i', 14, struct in6_ifreq)
425
#define SIOCSIFNETMASK_IN6       _IOW('i', 22, struct in6_ifreq)
426
#endif
427
 
428
#define SIOCGIFDSTADDR_IN6      _IOWR('i', 34, struct in6_ifreq)
429
#define SIOCGIFNETMASK_IN6      _IOWR('i', 37, struct in6_ifreq)
430
 
431
#define SIOCDIFADDR_IN6          _IOW('i', 25, struct in6_ifreq)
432
#define SIOCAIFADDR_IN6          _IOW('i', 26, struct in6_aliasreq)
433
 
434
#define SIOCSIFPHYADDR_IN6       _IOW('i', 70, struct in6_aliasreq)
435
#define SIOCGIFPSRCADDR_IN6     _IOWR('i', 71, struct in6_ifreq)
436
#define SIOCGIFPDSTADDR_IN6     _IOWR('i', 72, struct in6_ifreq)
437
 
438
#define SIOCGIFAFLAG_IN6        _IOWR('i', 73, struct in6_ifreq)
439
 
440
#define SIOCGDRLST_IN6          _IOWR('i', 74, struct in6_drlist)
441
#define SIOCGPRLST_IN6          _IOWR('i', 75, struct in6_oprlist)
442
#ifdef _KERNEL
443
#define OSIOCGIFINFO_IN6        _IOWR('i', 76, struct in6_ondireq)
444
#endif
445
#define SIOCGIFINFO_IN6         _IOWR('i', 108, struct in6_ndireq)
446
#define SIOCSNDFLUSH_IN6        _IOWR('i', 77, struct in6_ifreq)
447
#define SIOCGNBRINFO_IN6        _IOWR('i', 78, struct in6_nbrinfo)
448
#define SIOCSPFXFLUSH_IN6       _IOWR('i', 79, struct in6_ifreq)
449
#define SIOCSRTRFLUSH_IN6       _IOWR('i', 80, struct in6_ifreq)
450
 
451
#define SIOCGIFALIFETIME_IN6    _IOWR('i', 81, struct in6_ifreq)
452
#define SIOCSIFALIFETIME_IN6    _IOWR('i', 82, struct in6_ifreq)
453
#define SIOCGIFSTAT_IN6         _IOWR('i', 83, struct in6_ifreq)
454
#define SIOCGIFSTAT_ICMP6       _IOWR('i', 84, struct in6_ifreq)
455
 
456
#define SIOCSDEFIFACE_IN6       _IOWR('i', 85, struct in6_ndifreq)
457
#define SIOCGDEFIFACE_IN6       _IOWR('i', 86, struct in6_ndifreq)
458
 
459
#define SIOCSIFINFO_FLAGS       _IOWR('i', 87, struct in6_ndireq) /* XXX */
460
 
461
#define SIOCSSCOPE6             _IOW('i', 88, struct in6_ifreq)
462
#define SIOCGSCOPE6             _IOWR('i', 89, struct in6_ifreq)
463
#define SIOCGSCOPE6DEF          _IOWR('i', 90, struct in6_ifreq)
464
 
465
#define SIOCSIFPREFIX_IN6       _IOW('i', 100, struct in6_prefixreq) /* set */
466
#define SIOCGIFPREFIX_IN6       _IOWR('i', 101, struct in6_prefixreq) /* get */
467
#define SIOCDIFPREFIX_IN6       _IOW('i', 102, struct in6_prefixreq) /* del */
468
#define SIOCAIFPREFIX_IN6       _IOW('i', 103, struct in6_rrenumreq) /* add */
469
#define SIOCCIFPREFIX_IN6       _IOW('i', 104, \
470
                                     struct in6_rrenumreq) /* change */
471
#define SIOCSGIFPREFIX_IN6      _IOW('i', 105, \
472
                                     struct in6_rrenumreq) /* set global */
473
 
474
#define SIOCGETSGCNT_IN6        _IOWR('u', 106, \
475
                                      struct sioc_sg_req6) /* get s,g pkt cnt */
476
#define SIOCGETMIFCNT_IN6       _IOWR('u', 107, \
477
                                      struct sioc_mif_req6) /* get pkt cnt per if */
478
 
479
#define SIOCAADDRCTL_POLICY     _IOW('u', 108, struct in6_addrpolicy)
480
#define SIOCDADDRCTL_POLICY     _IOW('u', 109, struct in6_addrpolicy)
481
 
482
#define IN6_IFF_ANYCAST         0x01    /* anycast address */
483
#define IN6_IFF_TENTATIVE       0x02    /* tentative address */
484
#define IN6_IFF_DUPLICATED      0x04    /* DAD detected duplicate */
485
#define IN6_IFF_DETACHED        0x08    /* may be detached from the link */
486
#define IN6_IFF_DEPRECATED      0x10    /* deprecated address */
487
#define IN6_IFF_NODAD           0x20    /* don't perform DAD on this address
488
                                         * (used only at first SIOC* call)
489
                                         */
490
#define IN6_IFF_AUTOCONF        0x40    /* autoconfigurable address. */
491
#define IN6_IFF_TEMPORARY       0x80    /* temporary (anonymous) address. */
492
#define IN6_IFF_HOME            0x100   /* MIP6 home address. */
493
 
494
/* do not input/output */
495
#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)
496
 
497
#ifdef _KERNEL
498
#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b))
499
#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b))
500
#endif
501
 
502
#ifdef _KERNEL
503
extern struct in6_ifaddr *in6_ifaddr;
504
 
505
extern struct in6_ifstat **in6_ifstat;
506
extern size_t in6_ifstatmax;
507
extern struct icmp6stat icmp6stat;
508
extern struct icmp6_ifstat **icmp6_ifstat;
509
extern size_t icmp6_ifstatmax;
510
#define in6_ifstat_inc(ifp, tag) \
511
do {                                                            \
512
        if ((ifp) && (ifp)->if_index <= if_index                \
513
         && (ifp)->if_index < in6_ifstatmax                     \
514
         && in6_ifstat && in6_ifstat[(ifp)->if_index]) {        \
515
                in6_ifstat[(ifp)->if_index]->tag++;             \
516
        }                                                       \
517
} while (0)
518
 
519
extern struct ifqueue ip6intrq;         /* IP6 packet input queue */
520
extern struct in6_addr zeroin6_addr;
521
extern int inet6ctlerrmap[];
522
extern unsigned long in6_maxmtu;
523
 
524
/*
525
 * Macro for finding the internet address structure (in6_ifaddr) corresponding
526
 * to a given interface (ifnet structure).
527
 */
528
#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
529
 
530
#define IFP_TO_IA6(ifp, ia)                             \
531
/* struct ifnet *ifp; */                                \
532
/* struct in6_ifaddr *ia; */                            \
533
do {                                                                    \
534
        struct ifaddr *ifa;                                             \
535
        for (ifa = (ifp)->if_addrlist; ifa; ifa = ifa->ifa_next) {      \
536
                if (!ifa->ifa_addr)                                     \
537
                        continue;                                       \
538
                if (ifa->ifa_addr->sa_family == AF_INET6)               \
539
                        break;                                          \
540
        }                                                               \
541
        (ia) = (struct in6_ifaddr *)ifa;                                \
542
} while (0)
543
 
544
#else
545
 
546
#define IFP_TO_IA6(ifp, ia)                             \
547
/* struct ifnet *ifp; */                                \
548
/* struct in6_ifaddr *ia; */                            \
549
do {                                                                    \
550
        struct ifaddr *ifa;                                             \
551
        for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) {   \
552
                if (!ifa->ifa_addr)                                     \
553
                        continue;                                       \
554
                if (ifa->ifa_addr->sa_family == AF_INET6)               \
555
                        break;                                          \
556
        }                                                               \
557
        (ia) = (struct in6_ifaddr *)ifa;                                \
558
} while (0)
559
#endif
560
 
561
#endif /* _KERNEL */
562
 
563
/*
564
 * Multi-cast membership entry.  One for each group/ifp that a PCB
565
 * belongs to.
566
 */
567
struct in6_multi_mship {
568
        struct  in6_multi *i6mm_maddr;  /* Multicast address pointer */
569
        LIST_ENTRY(in6_multi_mship) i6mm_chain;  /* multicast options chain */
570
};
571
 
572
struct  in6_multi {
573
        LIST_ENTRY(in6_multi) in6m_entry; /* list glue */
574
        struct  in6_addr in6m_addr;     /* IP6 multicast address */
575
        struct  ifnet *in6m_ifp;        /* back pointer to ifnet */
576
#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
577
        struct  in6_ifaddr *in6m_ia;    /* back pointer to in6_ifaddr */
578
#else
579
        struct  ifmultiaddr *in6m_ifma; /* back pointer to ifmultiaddr */
580
#endif
581
        u_int   in6m_refcount;          /* # membership claims by sockets */
582
        u_int   in6m_state;             /* state of the membership */
583
        u_int   in6m_timer;             /* MLD6 listener report timer */
584
};
585
 
586
#ifdef _KERNEL
587
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
588
extern LIST_HEAD(in6_multihead, in6_multi) in6_multihead;
589
#endif
590
 
591
/*
592
 * Structure used by macros below to remember position when stepping through
593
 * all of the in6_multi records.
594
 */
595
struct  in6_multistep {
596
        struct  in6_ifaddr *i_ia;
597
        struct  in6_multi *i_in6m;
598
};
599
 
600
/*
601
 * Macros for looking up the in6_multi record for a given IP6 multicast
602
 * address on a given interface. If no matching record is found, "in6m"
603
 * returns NLL.
604
 */
605
 
606
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
607
 
608
#define IN6_LOOKUP_MULTI(addr, ifp, in6m)                       \
609
/* struct in6_addr addr; */                                     \
610
/* struct ifnet *ifp; */                                        \
611
/* struct in6_multi *in6m; */                                   \
612
do { \
613
        struct ifmultiaddr *ifma; \
614
        for (ifma = (ifp)->if_multiaddrs.lh_first; ifma; \
615
             ifma = ifma->ifma_link.le_next) { \
616
                if (ifma->ifma_addr->sa_family == AF_INET6 \
617
                    && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \
618
                                          &(addr))) \
619
                        break; \
620
        } \
621
        (in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \
622
} while(0)
623
 
624
/*
625
 * Macro to step through all of the in6_multi records, one at a time.
626
 * The current position is remembered in "step", which the caller must
627
 * provide.  IN6_FIRST_MULTI(), below, must be called to initialize "step"
628
 * and get the first record.  Both macros return a NULL "in6m" when there
629
 * are no remaining records.
630
 */
631
#define IN6_NEXT_MULTI(step, in6m)                                      \
632
/* struct in6_multistep step; */                                        \
633
/* struct in6_multi *in6m; */                                           \
634
do { \
635
        if (((in6m) = (step).i_in6m) != NULL) \
636
                (step).i_in6m = (step).i_in6m->in6m_entry.le_next; \
637
} while(0)
638
 
639
#define IN6_FIRST_MULTI(step, in6m)             \
640
/* struct in6_multistep step; */                \
641
/* struct in6_multi *in6m */                    \
642
do { \
643
        (step).i_in6m = in6_multihead.lh_first; \
644
                IN6_NEXT_MULTI((step), (in6m)); \
645
} while(0)
646
 
647
#else /* not FreeBSD3 */
648
 
649
#define IN6_LOOKUP_MULTI(addr, ifp, in6m)                       \
650
/* struct in6_addr addr; */                                     \
651
/* struct ifnet *ifp; */                                        \
652
/* struct in6_multi *in6m; */                                   \
653
do {                                                            \
654
        struct in6_ifaddr *ia;                                  \
655
                                                                \
656
        IFP_TO_IA6((ifp), ia);                                  \
657
        if (ia == NULL)                                         \
658
                (in6m) = NULL;                                  \
659
        else                                                    \
660
                for ((in6m) = ia->ia6_multiaddrs.lh_first;      \
661
                     (in6m) != NULL &&                          \
662
                     !IN6_ARE_ADDR_EQUAL(&(in6m)->in6m_addr, &(addr));  \
663
                     (in6m) = in6m->in6m_entry.le_next)         \
664
                        continue;                               \
665
} while (0)
666
 
667
/*
668
 * Macro to step through all of the in6_multi records, one at a time.
669
 * The current position is remembered in "step", which the caller must
670
 * provide.  IN6_FIRST_MULTI(), below, must be called to initialize "step"
671
 * and get the first record.  Both macros return a NULL "in6m" when there
672
 * are no remaining records.
673
 */
674
#define IN6_NEXT_MULTI(step, in6m)                                      \
675
/* struct in6_multistep step; */                                        \
676
/* struct in6_multi *in6m; */                                           \
677
do {                                                                    \
678
        if (((in6m) = (step).i_in6m) != NULL)                           \
679
                (step).i_in6m = (in6m)->in6m_entry.le_next;             \
680
        else                                                            \
681
                while ((step).i_ia != NULL) {                           \
682
                        (in6m) = (step).i_ia->ia6_multiaddrs.lh_first;  \
683
                        (step).i_ia = (step).i_ia->ia_next;             \
684
                        if ((in6m) != NULL) {                           \
685
                                (step).i_in6m = (in6m)->in6m_entry.le_next; \
686
                                break;                                  \
687
                        }                                               \
688
                }                                                       \
689
} while (0)
690
 
691
#define IN6_FIRST_MULTI(step, in6m)             \
692
/* struct in6_multistep step; */                \
693
/* struct in6_multi *in6m */                    \
694
do {                                            \
695
        (step).i_ia = in6_ifaddr;               \
696
        (step).i_in6m = NULL;                   \
697
        IN6_NEXT_MULTI((step), (in6m));         \
698
} while (0)
699
 
700
#endif /* not FreeBSD3 */
701
 
702
struct  in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *,
703
                                     int *));
704
void    in6_delmulti __P((struct in6_multi *));
705
struct in6_multi_mship *in6_joingroup __P((struct ifnet *, struct in6_addr *,
706
        int *));
707
int in6_leavegroup __P((struct in6_multi_mship *));
708
extern int in6_ifindex2scopeid __P((int));
709
extern int in6_mask2len __P((struct in6_addr *, u_char *));
710
#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3)
711
int     in6_control __P((struct socket *,
712
                         u_long, caddr_t, struct ifnet *, struct proc *));
713
#else
714
int     in6_control __P((struct socket *, u_long, caddr_t, struct ifnet *));
715
#endif
716
int     in6_update_ifa __P((struct ifnet *, struct in6_aliasreq *,
717
                            struct in6_ifaddr *));
718
void    in6_purgeaddr __P((struct ifaddr *));
719
int     in6if_do_dad __P((struct ifnet *));
720
void    in6_purgeif __P((struct ifnet *));
721
void    in6_savemkludge __P((struct in6_ifaddr *));
722
void    in6_setmaxmtu   __P((void));
723
void    in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *));
724
void    in6_createmkludge __P((struct ifnet *));
725
void    in6_purgemkludge __P((struct ifnet *));
726
struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int));
727
struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *,
728
                                             struct in6_addr *));
729
char    *ip6_sprintf __P((const struct in6_addr *));
730
int64_t in6_addr2zoneid __P((struct ifnet *, struct in6_addr *));
731
int     in6_matchlen __P((struct in6_addr *, struct in6_addr *));
732
int     in6_are_prefix_equal __P((struct in6_addr *p1, struct in6_addr *p2,
733
                                  int len));
734
void    in6_prefixlen2mask __P((struct in6_addr *maskp, int len));
735
void    in6_prefix_remove_ifid __P((int iilen, struct in6_ifaddr *ia));
736
void    in6_purgeprefix __P((struct ifnet *));
737
 
738
int     in6_is_addr_deprecated __P((struct sockaddr_in6 *));
739
int in6_embedscope __P((struct in6_addr *, const struct sockaddr_in6 *));
740
int in6_recoverscope __P((struct sockaddr_in6 *, const struct in6_addr *,
741
        struct ifnet *));
742
void in6_clearscope __P((struct in6_addr *));
743
int in6_src_ioctl __P((u_long, caddr_t));
744
 
745
#ifdef MEASURE_PERFORMANCE
746
void in6h_hashinit __P((void));
747
void in6h_addifa __P((struct in6_ifaddr *));
748
struct in6hash *in6h_lookup __P((const struct in6_addr *, struct ifnet *));
749
void in6h_rebuild __P((int));
750
#endif
751
#endif /* _KERNEL */
752
 
753
#endif /* _NETINET6_IN6_VAR_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.