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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [bsd_tcpip/] [current/] [include/] [netinet6/] [in6.h] - Blame information for rev 856

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

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      include/netinet6/in6.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
/*      $KAME: in6.h,v 1.115 2002/01/02 06:43:13 jinmei Exp $   */
21
 
22
/*
23
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
24
 * All rights reserved.
25
 *
26
 * Redistribution and use in source and binary forms, with or without
27
 * modification, are permitted provided that the following conditions
28
 * are met:
29
 * 1. Redistributions of source code must retain the above copyright
30
 *    notice, this list of conditions and the following disclaimer.
31
 * 2. Redistributions in binary form must reproduce the above copyright
32
 *    notice, this list of conditions and the following disclaimer in the
33
 *    documentation and/or other materials provided with the distribution.
34
 * 3. Neither the name of the project nor the names of its contributors
35
 *    may be used to endorse or promote products derived from this software
36
 *    without specific prior written permission.
37
 *
38
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
39
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
41
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
42
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
44
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
45
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
46
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
47
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48
 * SUCH DAMAGE.
49
 */
50
 
51
/*
52
 * Copyright (c) 1982, 1986, 1990, 1993
53
 *      The Regents of the University of California.  All rights reserved.
54
 *
55
 * Redistribution and use in source and binary forms, with or without
56
 * modification, are permitted provided that the following conditions
57
 * are met:
58
 * 1. Redistributions of source code must retain the above copyright
59
 *    notice, this list of conditions and the following disclaimer.
60
 * 2. Redistributions in binary form must reproduce the above copyright
61
 *    notice, this list of conditions and the following disclaimer in the
62
 *    documentation and/or other materials provided with the distribution.
63
 * 3. All advertising materials mentioning features or use of this software
64
 *    must display the following acknowledgement:
65
 *      This product includes software developed by the University of
66
 *      California, Berkeley and its contributors.
67
 * 4. Neither the name of the University nor the names of its contributors
68
 *    may be used to endorse or promote products derived from this software
69
 *    without specific prior written permission.
70
 *
71
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
72
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
73
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
74
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
75
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
76
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
77
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
78
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
79
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
80
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
81
 * SUCH DAMAGE.
82
 *
83
 *      @(#)in.h        8.3 (Berkeley) 1/3/94
84
 */
85
 
86
#ifndef __KAME_NETINET_IN_H_INCLUDED_
87
#error "do not include netinet6/in6.h directly, include netinet/in.h.  see RFC2553"
88
#endif
89
 
90
#ifndef _NETINET6_IN6_H_
91
#define _NETINET6_IN6_H_
92
 
93
/*
94
 * Identification of the network protocol stack
95
 * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
96
 * has the table of implementation/integration differences.
97
 */
98
#define __KAME__
99
#define __KAME_VERSION          "SNAP 20020107"
100
 
101
/*
102
 * Local port number conventions:
103
 *
104
 * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
105
 * unless a kernel is compiled with IPNOPRIVPORTS defined.
106
 *
107
 * When a user does a bind(2) or connect(2) with a port number of zero,
108
 * a non-conflicting local port address is chosen.
109
 *
110
 * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
111
 * that is settable by sysctl(3); net.inet.ip.anonportmin and
112
 * net.inet.ip.anonportmax respectively.
113
 *
114
 * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
115
 * default assignment range.
116
 *
117
 * The value IP_PORTRANGE_DEFAULT causes the default behavior.
118
 *
119
 * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
120
 * and exists only for FreeBSD compatibility purposes.
121
 *
122
 * The value IP_PORTRANGE_LOW changes the range to the "low" are
123
 * that is (by convention) restricted to privileged processes.
124
 * This convention is based on "vouchsafe" principles only.
125
 * It is only secure if you trust the remote host to restrict these ports.
126
 * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
127
 */
128
 
129
#define IPV6PORT_RESERVED       1024
130
#define IPV6PORT_ANONMIN        49152
131
#define IPV6PORT_ANONMAX        65535
132
#define IPV6PORT_RESERVEDMIN    600
133
#define IPV6PORT_RESERVEDMAX    (IPV6PORT_RESERVED-1)
134
 
135
/*
136
 * IPv6 address
137
 */
138
struct in6_addr {
139
        union {
140
                u_int8_t   __u6_addr8[16];
141
                u_int16_t  __u6_addr16[8];
142
                u_int32_t  __u6_addr32[4];
143
        } __u6_addr;                    /* 128-bit IP6 address */
144
};
145
 
146
#define s6_addr   __u6_addr.__u6_addr8
147
#ifdef _KERNEL  /* XXX nonstandard */
148
#define s6_addr8  __u6_addr.__u6_addr8
149
#define s6_addr16 __u6_addr.__u6_addr16
150
#define s6_addr32 __u6_addr.__u6_addr32
151
#endif
152
 
153
#define INET6_ADDRSTRLEN        46
154
 
155
/*
156
 * Socket address for IPv6
157
 */
158
#ifndef _XOPEN_SOURCE
159
#define SIN6_LEN
160
#endif
161
struct sockaddr_in6 {
162
        u_int8_t        sin6_len;       /* length of this struct(sa_family_t)*/
163
        u_int8_t        sin6_family;    /* AF_INET6 (sa_family_t) */
164
        u_int16_t       sin6_port;      /* Transport layer port # (in_port_t)*/
165
        u_int32_t       sin6_flowinfo;  /* IP6 flow information */
166
        struct in6_addr sin6_addr;      /* IP6 address */
167
        u_int32_t       sin6_scope_id;  /* scope zone index */
168
};
169
 
170
/*
171
 * Local definition for masks
172
 */
173
#ifdef _KERNEL  /* XXX nonstandard */
174
#define IN6MASK0        {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
175
#define IN6MASK32       {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
176
                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
177
#define IN6MASK64       {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
178
                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
179
#define IN6MASK96       {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
180
                            0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
181
#define IN6MASK128      {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
182
                            0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
183
#endif
184
 
185
#ifdef _KERNEL
186
extern const struct sockaddr_in6 sa6_any;
187
 
188
extern const struct in6_addr in6mask0;
189
extern const struct in6_addr in6mask32;
190
extern const struct in6_addr in6mask64;
191
extern const struct in6_addr in6mask96;
192
extern const struct in6_addr in6mask128;
193
#endif /* _KERNEL */
194
 
195
/*
196
 * Macros started with IPV6_ADDR is KAME local
197
 */
198
#ifdef _KERNEL  /* XXX nonstandard */
199
#if BYTE_ORDER == BIG_ENDIAN
200
#define IPV6_ADDR_INT32_ONE     1
201
#define IPV6_ADDR_INT32_TWO     2
202
#define IPV6_ADDR_INT32_MNL     0xff010000
203
#define IPV6_ADDR_INT32_MLL     0xff020000
204
#define IPV6_ADDR_INT32_SMP     0x0000ffff
205
#define IPV6_ADDR_INT16_ULL     0xfe80
206
#define IPV6_ADDR_INT16_USL     0xfec0
207
#define IPV6_ADDR_INT16_MLL     0xff02
208
#elif BYTE_ORDER == LITTLE_ENDIAN
209
#define IPV6_ADDR_INT32_ONE     0x01000000
210
#define IPV6_ADDR_INT32_TWO     0x02000000
211
#define IPV6_ADDR_INT32_MNL     0x000001ff
212
#define IPV6_ADDR_INT32_MLL     0x000002ff
213
#define IPV6_ADDR_INT32_SMP     0xffff0000
214
#define IPV6_ADDR_INT16_ULL     0x80fe
215
#define IPV6_ADDR_INT16_USL     0xc0fe
216
#define IPV6_ADDR_INT16_MLL     0x02ff
217
#endif
218
#endif
219
 
220
/*
221
 * Definition of some useful macros to handle IP6 addresses
222
 */
223
#define IN6ADDR_ANY_INIT \
224
        {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
225
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
226
#define IN6ADDR_LOOPBACK_INIT \
227
        {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
228
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
229
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
230
        {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
231
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
232
#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \
233
        {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
234
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
235
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
236
        {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
237
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
238
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
239
        {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
240
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
241
 
242
extern const struct in6_addr in6addr_any;
243
extern const struct in6_addr in6addr_loopback;
244
extern const struct in6_addr in6addr_nodelocal_allnodes;
245
extern const struct in6_addr in6addr_linklocal_allnodes;
246
extern const struct in6_addr in6addr_linklocal_allrouters;
247
 
248
/*
249
 * Equality
250
 * NOTE: Some of kernel programming environment (for example, openbsd/sparc)
251
 * does not supply memcmp().  For userland memcmp() is preferred as it is
252
 * in ANSI standard.
253
 */
254
#ifdef _KERNEL
255
#define IN6_ARE_ADDR_EQUAL(a, b)                        \
256
    (bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
257
#else
258
#define IN6_ARE_ADDR_EQUAL(a, b)                        \
259
    (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)
260
#endif
261
 
262
#ifdef _KERNEL                  /* non standard */
263
/* see if two addresses are equal in a scope-conscious manner. */
264
#define SA6_ARE_ADDR_EQUAL(a, b) \
265
        (((a)->sin6_scope_id == 0 || (b)->sin6_scope_id == 0 || \
266
          ((a)->sin6_scope_id == (b)->sin6_scope_id)) && \
267
         (bcmp(&(a)->sin6_addr, &(b)->sin6_addr, sizeof(struct in6_addr)) == 0))
268
#endif
269
 
270
/*
271
 * Unspecified
272
 */
273
#define IN6_IS_ADDR_UNSPECIFIED(a)      \
274
        ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) &&   \
275
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) &&  \
276
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) &&  \
277
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
278
 
279
/*
280
 * Loopback
281
 */
282
#define IN6_IS_ADDR_LOOPBACK(a)         \
283
        ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) &&   \
284
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) &&  \
285
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) &&  \
286
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
287
 
288
/*
289
 * IPv4 compatible
290
 */
291
#define IN6_IS_ADDR_V4COMPAT(a)         \
292
        ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) &&   \
293
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) &&  \
294
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) &&  \
295
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \
296
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))
297
 
298
/*
299
 * Mapped
300
 */
301
#define IN6_IS_ADDR_V4MAPPED(a)               \
302
        ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) &&   \
303
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) &&  \
304
         (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
305
 
306
/*
307
 * KAME Scope Values
308
 */
309
 
310
#ifdef _KERNEL  /* XXX nonstandard */
311
#define IPV6_ADDR_SCOPE_NODELOCAL       0x01
312
#define IPV6_ADDR_SCOPE_INTFACELOCAL    0x01
313
#define IPV6_ADDR_SCOPE_LINKLOCAL       0x02
314
#define IPV6_ADDR_SCOPE_SITELOCAL       0x05
315
#define IPV6_ADDR_SCOPE_ORGLOCAL        0x08    /* just used in this file */
316
#define IPV6_ADDR_SCOPE_GLOBAL          0x0e
317
#else
318
#define __IPV6_ADDR_SCOPE_NODELOCAL     0x01
319
#define __IPV6_ADDR_SCOPE_INTFACELOCAL  0x01
320
#define __IPV6_ADDR_SCOPE_LINKLOCAL     0x02
321
#define __IPV6_ADDR_SCOPE_SITELOCAL     0x05
322
#define __IPV6_ADDR_SCOPE_ORGLOCAL      0x08    /* just used in this file */
323
#define __IPV6_ADDR_SCOPE_GLOBAL        0x0e
324
#endif
325
 
326
/*
327
 * Unicast Scope
328
 * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
329
 */
330
#define IN6_IS_ADDR_LINKLOCAL(a)        \
331
        (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
332
#define IN6_IS_ADDR_SITELOCAL(a)        \
333
        (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
334
 
335
/*
336
 * Multicast
337
 */
338
#define IN6_IS_ADDR_MULTICAST(a)        ((a)->s6_addr[0] == 0xff)
339
 
340
#ifdef _KERNEL  /* XXX nonstandard */
341
#define IPV6_ADDR_MC_SCOPE(a)           ((a)->s6_addr[1] & 0x0f)
342
#else
343
#define __IPV6_ADDR_MC_SCOPE(a)         ((a)->s6_addr[1] & 0x0f)
344
#endif
345
 
346
/*
347
 * Multicast Scope
348
 */
349
#ifdef _KERNEL  /* refers nonstandard items */
350
#define IN6_IS_ADDR_MC_NODELOCAL(a)     \
351
        (IN6_IS_ADDR_MULTICAST(a) &&    \
352
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
353
#define IN6_IS_ADDR_MC_INTFACELOCAL(a)  \
354
        (IN6_IS_ADDR_MULTICAST(a) &&    \
355
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
356
#define IN6_IS_ADDR_MC_LINKLOCAL(a)     \
357
        (IN6_IS_ADDR_MULTICAST(a) &&    \
358
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
359
#define IN6_IS_ADDR_MC_SITELOCAL(a)     \
360
        (IN6_IS_ADDR_MULTICAST(a) &&    \
361
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
362
#define IN6_IS_ADDR_MC_ORGLOCAL(a)      \
363
        (IN6_IS_ADDR_MULTICAST(a) &&    \
364
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
365
#define IN6_IS_ADDR_MC_GLOBAL(a)        \
366
        (IN6_IS_ADDR_MULTICAST(a) &&    \
367
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
368
#else
369
#define IN6_IS_ADDR_MC_NODELOCAL(a)     \
370
        (IN6_IS_ADDR_MULTICAST(a) &&    \
371
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
372
#define IN6_IS_ADDR_MC_LINKLOCAL(a)     \
373
        (IN6_IS_ADDR_MULTICAST(a) &&    \
374
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
375
#define IN6_IS_ADDR_MC_SITELOCAL(a)     \
376
        (IN6_IS_ADDR_MULTICAST(a) &&    \
377
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
378
#define IN6_IS_ADDR_MC_ORGLOCAL(a)      \
379
        (IN6_IS_ADDR_MULTICAST(a) &&    \
380
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
381
#define IN6_IS_ADDR_MC_GLOBAL(a)        \
382
        (IN6_IS_ADDR_MULTICAST(a) &&    \
383
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
384
#endif
385
 
386
#ifdef _KERNEL  /* nonstandard */
387
/*
388
 * KAME Scope
389
 */
390
#define IN6_IS_SCOPE_LINKLOCAL(a)       \
391
        ((IN6_IS_ADDR_LINKLOCAL(a)) ||  \
392
         (IN6_IS_ADDR_MC_LINKLOCAL(a)))
393
 
394
#if (defined(__FreeBSD__) && __FreeBSD__ >= 3)
395
#define IFA6_IS_DEPRECATED(a) \
396
        ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
397
         (u_int32_t)((time_second - (a)->ia6_updatetime)) > \
398
         (a)->ia6_lifetime.ia6t_pltime)
399
#define IFA6_IS_INVALID(a) \
400
        ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
401
         (u_int32_t)((time_second - (a)->ia6_updatetime)) > \
402
         (a)->ia6_lifetime.ia6t_vltime)
403
#else
404
#define IFA6_IS_DEPRECATED(a) \
405
        ((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \
406
         (u_int32_t)((time.tv_sec - (a)->ia6_updatetime)) > \
407
         (a)->ia6_lifetime.ia6t_pltime)
408
#define IFA6_IS_INVALID(a) \
409
        ((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \
410
         (u_int32_t)((time.tv_sec - (a)->ia6_updatetime)) > \
411
         (a)->ia6_lifetime.ia6t_vltime)
412
#endif
413
#endif /* _KERNEL */
414
 
415
/*
416
 * IP6 route structure
417
 */
418
#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
419
#ifndef _XOPEN_SOURCE
420
#ifndef NEW_STRUCT_ROUTE
421
struct route_in6 {
422
        struct  rtentry *ro_rt;
423
        struct  sockaddr_in6 ro_dst;
424
};
425
#endif /* !NEW_STRUCT_ROUTE */
426
#endif
427
#endif
428
 
429
/*
430
 * Options for use with [gs]etsockopt at the IPV6 level.
431
 * First word of comment is data type; bool is stored in int.
432
 */
433
/* no hdrincl */
434
#if 0 /* the followings are relic in IPv4 and hence are disabled */
435
#define IPV6_OPTIONS            1  /* buf/ip6_opts; set/get IP6 options */
436
#define IPV6_RECVOPTS           5  /* bool; receive all IP6 opts w/dgram */
437
#define IPV6_RECVRETOPTS        6  /* bool; receive IP6 opts for response */
438
#define IPV6_RECVDSTADDR        7  /* bool; receive IP6 dst addr w/dgram */
439
#define IPV6_RETOPTS            8  /* ip6_opts; set/get IP6 options */
440
#endif
441
#define IPV6_SOCKOPT_RESERVED1  3  /* reserved for future use */
442
#define IPV6_UNICAST_HOPS       4  /* int; IP6 hops */
443
#define IPV6_MULTICAST_IF       9  /* u_int; set/get IP6 multicast i/f */
444
#define IPV6_MULTICAST_HOPS     10 /* int; set/get IP6 multicast hops */
445
#define IPV6_MULTICAST_LOOP     11 /* u_int; set/get IP6 multicast loopback */
446
#define IPV6_JOIN_GROUP         12 /* ip6_mreq; join a group membership */
447
#define IPV6_LEAVE_GROUP        13 /* ip6_mreq; leave a group membership */
448
#define IPV6_PORTRANGE          14 /* int; range to choose for unspec port */
449
#define ICMP6_FILTER            18 /* icmp6_filter; icmp6 filter */
450
/* RFC2292 options */
451
#ifdef _KERNEL
452
#define IPV6_2292PKTINFO        19 /* bool; send/recv if, src/dst addr */
453
#define IPV6_2292HOPLIMIT       20 /* bool; hop limit */
454
#define IPV6_2292NEXTHOP        21 /* bool; next hop addr */
455
#define IPV6_2292HOPOPTS        22 /* bool; hop-by-hop option */
456
#define IPV6_2292DSTOPTS        23 /* bool; destinaion option */
457
#define IPV6_2292RTHDR          24 /* bool; routing header */
458
#define IPV6_2292PKTOPTIONS     25 /* buf/cmsghdr; set/get IPv6 options */
459
#endif
460
 
461
#define IPV6_CHECKSUM           26 /* int; checksum offset for raw socket */
462
#define IPV6_V6ONLY             27 /* bool; make AF_INET6 sockets v6 only */
463
#ifndef _KERNEL
464
#define IPV6_BINDV6ONLY         IPV6_V6ONLY
465
#endif
466
 
467
#if 1 /* IPSEC */
468
#define IPV6_IPSEC_POLICY       28 /* struct; get/set security policy */
469
#endif
470
#define IPV6_FAITH              29 /* bool; accept FAITH'ed connections */
471
 
472
#if 1 /* IPV6FIREWALL */
473
#define IPV6_FW_ADD             30 /* add a firewall rule to chain */
474
#define IPV6_FW_DEL             31 /* delete a firewall rule from chain */
475
#define IPV6_FW_FLUSH           32 /* flush firewall rule chain */
476
#define IPV6_FW_ZERO            33 /* clear single/all firewall counter(s) */
477
#define IPV6_FW_GET             34 /* get entire firewall rule chain */
478
#endif
479
 
480
/* new socket options introduced in RFC2292bis */
481
#define IPV6_RTHDRDSTOPTS       35 /* ip6_dest; send dst option before rthdr */
482
 
483
#define IPV6_RECVPKTINFO        36 /* bool; recv if, dst addr */
484
#define IPV6_RECVHOPLIMIT       37 /* bool; recv hop limit */
485
#define IPV6_RECVRTHDR          38 /* bool; recv routing header */
486
#define IPV6_RECVHOPOPTS        39 /* bool; recv hop-by-hop option */
487
#define IPV6_RECVDSTOPTS        40 /* bool; recv dst option after rthdr */
488
#ifdef _KERNEL
489
#define IPV6_RECVRTHDRDSTOPTS   41 /* bool; recv dst option before rthdr */
490
#endif
491
 
492
#define IPV6_USE_MIN_MTU        42 /* bool; send packets at the minimum MTU */
493
#define IPV6_RECVPATHMTU        43 /* bool; notify an according MTU */
494
 
495
#define IPV6_PATHMTU            44 /* mtuinfo; get the current path MTU (sopt),
496
                                      4 bytes int; MTU notification (cmsg) */
497
#define IPV6_REACHCONF          45 /* no data; ND reachability confirm
498
                                      (cmsg only) */
499
 
500
/* more new socket options introduced in RFC2292bis */
501
#define IPV6_PKTINFO            46 /* in6_pktinfo; send if, src addr */
502
#define IPV6_HOPLIMIT           47 /* int; send hop limit */
503
#define IPV6_NEXTHOP            48 /* sockaddr; next hop addr */
504
#define IPV6_HOPOPTS            49 /* ip6_hbh; send hop-by-hop option */
505
#define IPV6_DSTOPTS            50 /* ip6_dest; send dst option befor rthdr */
506
#define IPV6_RTHDR              51 /* ip6_rthdr; send routing header */
507
#if 0
508
#define IPV6_PKTOPTIONS         52 /* buf/cmsghdr; set/get IPv6 options */
509
                                   /* obsoleted by 2292bis */
510
#endif
511
 
512
#ifdef __OpenBSD__
513
#define IPV6_AUTH_LEVEL         53   /* int; authentication used */
514
#define IPV6_ESP_TRANS_LEVEL    54   /* int; transport encryption */
515
#define IPV6_ESP_NETWORK_LEVEL  55   /* int; full-packet encryption */
516
#define IPSEC6_OUTSA            56   /* set the outbound SA for a socket */
517
#endif
518
 
519
#define IPV6_RECVTCLASS         57 /* bool; recv traffic class values */
520
#ifdef _KERNEL
521
#define IPV6_OTCLASS            58 /* u_int8_t; send traffic class value */
522
#endif
523
#define IPV6_AUTOFLOWLABEL      59 /* bool; attach flowlabel automagically */
524
 
525
#ifdef __OpenBSD__
526
#define IPV6_IPCOMP_LEVEL       60   /* int; compression */
527
#endif
528
 
529
#define IPV6_TCLASS             61 /* int; send traffic class value */
530
#define IPV6_DONTFRAG           62 /* bool; disable IPv6 fragmentation */
531
 
532
/* to define items, should talk with KAME guys first, for *BSD compatibility */
533
 
534
#define IPV6_RTHDR_LOOSE     0 /* this hop need not be a neighbor. XXX old spec */
535
#define IPV6_RTHDR_STRICT    1 /* this hop must be a neighbor. XXX old spec */
536
#define IPV6_RTHDR_TYPE_0    0 /* IPv6 routing header type 0 */
537
 
538
/*
539
 * Defaults and limits for options
540
 */
541
#define IPV6_DEFAULT_MULTICAST_HOPS 1   /* normally limit m'casts to 1 hop */
542
#define IPV6_DEFAULT_MULTICAST_LOOP 1   /* normally hear sends if a member */
543
 
544
/*
545
 * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
546
 */
547
struct ipv6_mreq {
548
        struct in6_addr ipv6mr_multiaddr;
549
        unsigned int    ipv6mr_interface;
550
};
551
 
552
/*
553
 * IPV6_PKTINFO: Packet information(RFC2292 sec 5)
554
 */
555
struct in6_pktinfo {
556
        struct in6_addr ipi6_addr;      /* src/dst IPv6 address */
557
        unsigned int    ipi6_ifindex;   /* send/recv interface index */
558
};
559
 
560
/*
561
 * Control structure for IPV6_RECVPATHMTU socket option.
562
 * Note that this structure is not fully conformant to rfc2292bis-02.
563
 * However, since how to tell the destination of the path (or the path itself)
564
 * to the application is not determined, we use our original structure.
565
 */
566
struct ip6_mtuinfo {
567
        struct sockaddr_in6 ip6m_addr;  /* or sockaddr_storage? */
568
        u_int32_t ip6m_mtu;
569
};
570
 
571
/*
572
 * Argument for IPV6_PORTRANGE:
573
 * - which range to search when port is unspecified at bind() or connect()
574
 */
575
#define IPV6_PORTRANGE_DEFAULT  0        /* default range */
576
#define IPV6_PORTRANGE_HIGH     1       /* "high" - request firewall bypass */
577
#define IPV6_PORTRANGE_LOW      2       /* "low" - vouchsafe security */
578
 
579
#ifndef _XOPEN_SOURCE
580
/*
581
 * Definitions for inet6 sysctl operations.
582
 *
583
 * Third level is protocol number.
584
 * Fourth level is desired variable within that protocol.
585
 */
586
#define IPV6PROTO_MAXID (IPPROTO_PIM + 1)       /* don't list to IPV6PROTO_MAX */
587
 
588
#define CTL_IPV6PROTO_NAMES { \
589
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
590
        { 0, 0 }, \
591
        { "tcp6", CTLTYPE_NODE }, \
592
        { 0, 0 }, \
593
        { 0, 0 }, \
594
        { 0, 0 }, \
595
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
596
        { 0, 0 }, \
597
        { 0, 0 }, \
598
        { "udp6", CTLTYPE_NODE }, \
599
        { 0, 0 }, \
600
        { 0, 0 }, \
601
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
602
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
603
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
604
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
605
        { 0, 0 }, \
606
        { "ip6", CTLTYPE_NODE }, \
607
        { 0, 0 }, \
608
        { 0, 0 }, \
609
        { 0, 0 }, \
610
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
611
        { 0, 0 }, \
612
        { "ipsec6", CTLTYPE_NODE }, \
613
        { 0, 0 }, \
614
        { 0, 0 }, \
615
        { 0, 0 }, \
616
        { 0, 0 }, \
617
        { 0, 0 }, \
618
        { 0, 0 }, \
619
        { "icmp6", CTLTYPE_NODE }, \
620
        { 0, 0 }, \
621
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
622
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
623
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
624
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
625
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
626
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
627
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
628
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
629
        { 0, 0 }, \
630
        { 0, 0 }, \
631
        { 0, 0 }, \
632
        { "pim6", CTLTYPE_NODE }, \
633
}
634
 
635
/*
636
 * Names for IP sysctl objects
637
 */
638
#define IPV6CTL_FORWARDING      1       /* act as router */
639
#define IPV6CTL_SENDREDIRECTS   2       /* may send redirects when forwarding*/
640
#define IPV6CTL_DEFHLIM         3       /* default Hop-Limit */
641
#ifdef notyet
642
#define IPV6CTL_DEFMTU          4       /* default MTU */
643
#endif
644
#define IPV6CTL_FORWSRCRT       5       /* forward source-routed dgrams */
645
#define IPV6CTL_STATS           6       /* stats */
646
#define IPV6CTL_MRTSTATS        7       /* multicast forwarding stats */
647
#define IPV6CTL_MRTPROTO        8       /* multicast routing protocol */
648
#define IPV6CTL_MAXFRAGPACKETS  9       /* max packets reassembly queue */
649
#define IPV6CTL_SOURCECHECK     10      /* verify source route and intf */
650
#define IPV6CTL_SOURCECHECK_LOGINT 11   /* minimume logging interval */
651
#define IPV6CTL_ACCEPT_RTADV    12
652
#define IPV6CTL_KEEPFAITH       13
653
#define IPV6CTL_LOG_INTERVAL    14
654
#define IPV6CTL_HDRNESTLIMIT    15
655
#define IPV6CTL_DAD_COUNT       16
656
#define IPV6CTL_AUTO_FLOWLABEL  17
657
#define IPV6CTL_DEFMCASTHLIM    18
658
#define IPV6CTL_GIF_HLIM        19      /* default HLIM for gif encap packet */
659
#define IPV6CTL_KAME_VERSION    20
660
#define IPV6CTL_USE_DEPRECATED  21      /* use deprecated addr (RFC2462 5.5.4) */
661
#define IPV6CTL_RR_PRUNE        22      /* walk timer for router renumbering */
662
#if 0   /* obsolete */
663
#define IPV6CTL_MAPPED_ADDR     23
664
#endif
665
#define IPV6CTL_V6ONLY          24
666
#ifdef __FreeBSD__
667
#define IPV6CTL_RTEXPIRE        25      /* cloned route expiration time */
668
#define IPV6CTL_RTMINEXPIRE     26      /* min value for expiration time */
669
#define IPV6CTL_RTMAXCACHE      27      /* trigger level for dynamic expire */
670
#endif
671
#ifdef __NetBSD__
672
#define IPV6CTL_ANONPORTMIN     28      /* minimum ephemeral port */
673
#define IPV6CTL_ANONPORTMAX     29      /* maximum ephemeral port */
674
#define IPV6CTL_LOWPORTMIN      30      /* minimum reserved port */
675
#define IPV6CTL_LOWPORTMAX      31      /* maximum reserved port */
676
#endif
677
#define IPV6CTL_USETEMPADDR     32      /* use temporary addresses for
678
                                           privacy extension */
679
#define IPV6CTL_TEMPPLTIME      33      /* preferred lifetime for tmpaddrs */
680
#define IPV6CTL_TEMPVLTIME      34      /* valid lifetime for tmpaddrs */
681
#define IPV6CTL_AUTO_LINKLOCAL  35      /* automatic link-local addr assign */
682
#define IPV6CTL_RIP6STATS       36      /* raw_ip6 stats */
683
#define IPV6CTL_PREFER_TEMPADDR 37      /* prefer temporary addr as src */
684
#define IPV6CTL_ADDRCTLPOLICY   38      /* get/set address selection policy */
685
#define IPV6CTL_USE_DEFAULTZONE 39      /* use default scope zone */
686
 
687
/* New entries should be added here from current IPV6CTL_MAXID value. */
688
/* to define items, should talk with KAME guys first, for *BSD compatibility */
689
#define IPV6CTL_MAXID           40
690
 
691
#ifdef IPV6CTL_RTEXPIRE
692
#define __IPV6CTL_NAMES_RTEXPIRE        "rtexpire"
693
#define __IPV6CTL_TYPE_RTEXPIRE         CTLTYPE_INT
694
#define __IPV6CTL_VARS_RTEXPIRE         0        /* &rtq_reallyold */
695
#else
696
#define __IPV6CTL_NAMES_RTEXPIRE        0
697
#define __IPV6CTL_TYPE_RTEXPIRE         0
698
#define __IPV6CTL_VARS_RTEXPIRE         0
699
#endif
700
 
701
#ifdef IPV6CTL_RTMINEXPIRE
702
#define __IPV6CTL_NAMES_RTMINEXPIRE     "minexpire"
703
#define __IPV6CTL_TYPE_RTMINEXPIRE      CTLTYPE_INT
704
#define __IPV6CTL_VARS_RTMINEXPIRE      0        /* &rtq_minreallyold */
705
#else
706
#define __IPV6CTL_NAMES_RTMINEXPIRE     0
707
#define __IPV6CTL_TYPE_RTMINEXPIRE      0
708
#define __IPV6CTL_VARS_RTMINEXPIRE      0
709
#endif
710
 
711
#ifdef IPV6CTL_RTMAXCACHE
712
#define __IPV6CTL_NAMES_RTMAXCACHE      "maxcache"
713
#define __IPV6CTL_TYPE_RTMAXCACHE       CTLTYPE_INT
714
#define __IPV6CTL_VARS_RTMAXCACHE       0        /* &rtq_toomany */
715
#else
716
#define __IPV6CTL_NAMES_RTMAXCACHE      0
717
#define __IPV6CTL_TYPE_RTMAXCACHE       0
718
#define __IPV6CTL_VARS_RTMAXCACHE       0
719
#endif
720
 
721
#ifdef IPV6CTL_ANONPORTMIN
722
#define __IPV6CTL_NAMES_ANONPORTMIN     "anonportmin"
723
#define __IPV6CTL_TYPE_ANONPORTMIN      CTLTYPE_INT
724
#define __IPV6CTL_VARS_ANONPORTMIN      0
725
#else
726
#define __IPV6CTL_NAMES_ANONPORTMIN     0
727
#define __IPV6CTL_TYPE_ANONPORTMIN      0
728
#define __IPV6CTL_VARS_ANONPORTMIN      0
729
#endif
730
 
731
#ifdef IPV6CTL_ANONPORTMAX
732
#define __IPV6CTL_NAMES_ANONPORTMAX     "anonportmax"
733
#define __IPV6CTL_TYPE_ANONPORTMAX      CTLTYPE_INT
734
#define __IPV6CTL_VARS_ANONPORTMAX      0
735
#else
736
#define __IPV6CTL_NAMES_ANONPORTMAX     0
737
#define __IPV6CTL_TYPE_ANONPORTMAX      0
738
#define __IPV6CTL_VARS_ANONPORTMAX      0
739
#endif
740
 
741
#ifdef IPV6CTL_LOWPORTMIN
742
#define __IPV6CTL_NAMES_LOWPORTMIN      "lowportmin"
743
#define __IPV6CTL_TYPE_LOWPORTMIN       CTLTYPE_INT
744
#define __IPV6CTL_VARS_LOWPORTMIN       0
745
#else
746
#define __IPV6CTL_NAMES_LOWPORTMIN      0
747
#define __IPV6CTL_TYPE_LOWPORTMIN       0
748
#define __IPV6CTL_VARS_LOWPORTMIN       0
749
#endif
750
 
751
#ifdef IPV6CTL_LOWPORTMAX
752
#define __IPV6CTL_NAMES_LOWPORTMAX      "lowportmax"
753
#define __IPV6CTL_TYPE_LOWPORTMAX       CTLTYPE_INT
754
#define __IPV6CTL_VARS_LOWPORTMAX       0
755
#else
756
#define __IPV6CTL_NAMES_LOWPORTMAX      0
757
#define __IPV6CTL_TYPE_LOWPORTMAX       0
758
#define __IPV6CTL_VARS_LOWPORTMAX       0
759
#endif
760
 
761
 
762
#define IPV6CTL_NAMES { \
763
        { 0, 0 }, \
764
        { "forwarding", CTLTYPE_INT }, \
765
        { "redirect", CTLTYPE_INT }, \
766
        { "hlim", CTLTYPE_INT }, \
767
        { "mtu", CTLTYPE_INT }, \
768
        { "forwsrcrt", CTLTYPE_INT }, \
769
        { 0, 0 }, \
770
        { 0, 0 }, \
771
        { "mrtproto", CTLTYPE_INT }, \
772
        { "maxfragpackets", CTLTYPE_INT }, \
773
        { "sourcecheck", CTLTYPE_INT }, \
774
        { "sourcecheck_logint", CTLTYPE_INT }, \
775
        { "accept_rtadv", CTLTYPE_INT }, \
776
        { "keepfaith", CTLTYPE_INT }, \
777
        { "log_interval", CTLTYPE_INT }, \
778
        { "hdrnestlimit", CTLTYPE_INT }, \
779
        { "dad_count", CTLTYPE_INT }, \
780
        { "auto_flowlabel", CTLTYPE_INT }, \
781
        { "defmcasthlim", CTLTYPE_INT }, \
782
        { "gifhlim", CTLTYPE_INT }, \
783
        { "kame_version", CTLTYPE_STRING }, \
784
        { "use_deprecated", CTLTYPE_INT }, \
785
        { "rr_prune", CTLTYPE_INT }, \
786
        { 0, 0 }, \
787
        { "v6only", CTLTYPE_INT }, \
788
        { __IPV6CTL_NAMES_RTEXPIRE, __IPV6CTL_TYPE_RTEXPIRE }, \
789
        { __IPV6CTL_NAMES_RTMINEXPIRE, __IPV6CTL_TYPE_RTMINEXPIRE }, \
790
        { __IPV6CTL_NAMES_RTMAXCACHE, __IPV6CTL_TYPE_RTMAXCACHE }, \
791
        { __IPV6CTL_NAMES_ANONPORTMIN, __IPV6CTL_TYPE_ANONPORTMIN }, \
792
        { __IPV6CTL_NAMES_ANONPORTMAX, __IPV6CTL_TYPE_ANONPORTMAX }, \
793
        { __IPV6CTL_NAMES_LOWPORTMIN, __IPV6CTL_TYPE_LOWPORTMIN }, \
794
        { __IPV6CTL_NAMES_LOWPORTMAX, __IPV6CTL_TYPE_LOWPORTMAX }, \
795
        { "use_tempaddr", CTLTYPE_INT }, \
796
        { "temppltime", CTLTYPE_INT }, \
797
        { "tempvltime", CTLTYPE_INT }, \
798
        { "auto_linklocal", CTLTYPE_INT }, \
799
        { 0, 0 }, \
800
        { "prefer_tempaddr", CTLTYPE_INT }, \
801
        { 0, 0 }, \
802
        { "use_defaultzone", CTLTYPE_INT }, \
803
}
804
 
805
#ifdef __bsdi__
806
#define IPV6CTL_VARS { \
807
        0, \
808
        &ip6_forwarding, \
809
        &ip6_sendredirects, \
810
        &ip6_defhlim, \
811
        0, \
812
        &ip6_forward_srcrt, \
813
        0, \
814
        0, \
815
        0, \
816
        &ip6_maxfragpackets, \
817
        &ip6_sourcecheck, \
818
        &ip6_sourcecheck_interval, \
819
        &ip6_accept_rtadv, \
820
        &ip6_keepfaith, \
821
        &ip6_log_interval, \
822
        &ip6_hdrnestlimit, \
823
        &ip6_dad_count, \
824
        &ip6_auto_flowlabel, \
825
        &ip6_defmcasthlim, \
826
        &ip6_gif_hlim, \
827
        0, \
828
        &ip6_use_deprecated, \
829
        &ip6_rr_prune, \
830
        0, \
831
        &ip6_v6only, \
832
        __IPV6CTL_VARS_RTEXPIRE, \
833
        __IPV6CTL_VARS_RTMINEXPIRE, \
834
        __IPV6CTL_VARS_RTMAXCACHE, \
835
        __IPV6CTL_VARS_ANONPORTMIN, \
836
        __IPV6CTL_VARS_ANONPORTMAX, \
837
        __IPV6CTL_VARS_LOWPORTMIN, \
838
        __IPV6CTL_VARS_LOWPORTMAX, \
839
        &ip6_use_tempaddr, \
840
        &ip6_temp_preferred_lifetime, \
841
        &ip6_temp_valid_lifetime, \
842
        &ip6_auto_linklocal, \
843
        0, \
844
        &ip6_prefer_tempaddr, \
845
        0, \
846
        &ip6_use_defzone,\
847
}
848
#endif
849
#endif /* !_XOPEN_SOURCE */
850
 
851
/*
852
 * Redefinition of mbuf flags
853
 */
854
#define M_AUTHIPHDR     M_PROTO2
855
#define M_DECRYPTED     M_PROTO3
856
#define M_LOOP          M_PROTO4
857
#define M_AUTHIPDGM     M_PROTO5
858
 
859
#ifdef _KERNEL
860
struct cmsghdr;
861
struct mbuf;
862
struct ifnet;
863
 
864
int     in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));
865
int     in6_localaddr __P((struct in6_addr *));
866
int     in6_addrscope __P((struct in6_addr *));
867
struct  in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));
868
extern void in6_if_up __P((struct ifnet *));
869
struct sockaddr;
870
 
871
void    in6_sin6_2_sin __P((struct sockaddr_in *sin,
872
                            struct sockaddr_in6 *sin6));
873
void    in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin,
874
                                 struct sockaddr_in6 *sin6));
875
void    in6_sin6_2_sin_in_sock __P((struct sockaddr *nam));
876
void    in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam));
877
extern void addrsel_policy_init __P((void));
878
 
879
#define satosin6(sa)    ((struct sockaddr_in6 *)(sa))
880
#define sin6tosa(sin6)  ((struct sockaddr *)(sin6))
881
#define ifatoia6(ifa)   ((struct in6_ifaddr *)(ifa))
882
#endif /* _KERNEL */
883
 
884
__BEGIN_DECLS
885
struct cmsghdr;
886
 
887
extern int inet6_option_space __P((int));
888
extern int inet6_option_init __P((void *, struct cmsghdr **, int));
889
extern int inet6_option_append __P((struct cmsghdr *, const u_int8_t *,
890
        int, int));
891
extern u_int8_t *inet6_option_alloc __P((struct cmsghdr *, int, int, int));
892
extern int inet6_option_next __P((const struct cmsghdr *, u_int8_t **));
893
extern int inet6_option_find __P((const struct cmsghdr *, u_int8_t **, int));
894
 
895
extern size_t inet6_rthdr_space __P((int, int));
896
extern struct cmsghdr *inet6_rthdr_init __P((void *, int));
897
extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *,
898
                unsigned int));
899
extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int));
900
#if 0 /* not implemented yet */
901
extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *));
902
#endif
903
extern int inet6_rthdr_segments __P((const struct cmsghdr *));
904
extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int));
905
extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int));
906
 
907
extern int inet6_opt_init __P((void *, size_t));
908
extern int inet6_opt_append __P((void *, size_t, int, u_int8_t,
909
                                 size_t, u_int8_t, void **));
910
extern int inet6_opt_finish __P((void *, size_t, int));
911
extern int inet6_opt_set_val __P((void *, size_t, void *, int));
912
 
913
extern int inet6_opt_next __P((void *, size_t, int, u_int8_t *,
914
                               size_t *, void **));
915
extern int inet6_opt_find __P((void *, size_t, int, u_int8_t,
916
                          size_t *, void **));
917
extern int inet6_opt_get_val __P((void *, size_t, void *, int));
918
extern size_t inet6_rth_space __P((int, int));
919
extern void *inet6_rth_init __P((void *, int, int, int));
920
extern int inet6_rth_add __P((void *, const struct in6_addr *));
921
extern int inet6_rth_reverse __P((const void *, void *));
922
extern int inet6_rth_segments __P((const void *));
923
extern struct in6_addr *inet6_rth_getaddr __P((const void *, int));
924
 
925
/* the followings two are experimental.  should not merge them to *BSD. */
926
struct sockaddr;                /* XXX */
927
 
928
extern int addr2scopetype __P((struct sockaddr *));
929
extern int inet_zoneid __P((int, int, char *, u_int32_t *));
930
__END_DECLS
931
 
932
#endif /* !_NETINET6_IN6_H_ */

powered by: WebSVN 2.1.0

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