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

Subversion Repositories openrisc

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

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
//
7
//==========================================================================
8
// ####BSDALTCOPYRIGHTBEGIN####                                             
9
// -------------------------------------------                              
10
// Portions of this software may have been derived from OpenBSD             
11
// or other sources, and if so are covered by the appropriate copyright     
12
// and license included herein.                                             
13
// -------------------------------------------                              
14
// ####BSDALTCOPYRIGHTEND####                                               
15
//==========================================================================
16
//#####DESCRIPTIONBEGIN####
17
//
18
// Author(s):    gthomas
19
// Contributors: gthomas
20
// Date:         2000-01-10
21
// Purpose:      
22
// Description:  
23
//              
24
//
25
//####DESCRIPTIONEND####
26
//
27
//==========================================================================
28
 
29
 
30
/* $OpenBSD: in6.h,v 1.9 1999/12/10 08:53:17 angelos Exp $ */
31
/*
32
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
33
 * All rights reserved.
34
 *
35
 * Redistribution and use in source and binary forms, with or without
36
 * modification, are permitted provided that the following conditions
37
 * are met:
38
 * 1. Redistributions of source code must retain the above copyright
39
 *    notice, this list of conditions and the following disclaimer.
40
 * 2. Redistributions in binary form must reproduce the above copyright
41
 *    notice, this list of conditions and the following disclaimer in the
42
 *    documentation and/or other materials provided with the distribution.
43
 * 3. Neither the name of the project nor the names of its contributors
44
 *    may be used to endorse or promote products derived from this software
45
 *    without specific prior written permission.
46
 *
47
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
48
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
51
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
53
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
54
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
55
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
56
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
57
 * SUCH DAMAGE.
58
 */
59
 
60
/*
61
 * Copyright (c) 1982, 1986, 1990, 1993
62
 *      The Regents of the University of California.  All rights reserved.
63
 *
64
 * Redistribution and use in source and binary forms, with or without
65
 * modification, are permitted provided that the following conditions
66
 * are met:
67
 * 1. Redistributions of source code must retain the above copyright
68
 *    notice, this list of conditions and the following disclaimer.
69
 * 2. Redistributions in binary form must reproduce the above copyright
70
 *    notice, this list of conditions and the following disclaimer in the
71
 *    documentation and/or other materials provided with the distribution.
72
 * 3. All advertising materials mentioning features or use of this software
73
 *    must display the following acknowledgement:
74
 *      This product includes software developed by the University of
75
 *      California, Berkeley and its contributors.
76
 * 4. Neither the name of the University nor the names of its contributors
77
 *    may be used to endorse or promote products derived from this software
78
 *    without specific prior written permission.
79
 *
80
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
81
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
82
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
83
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
84
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
85
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
86
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
87
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
88
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
89
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
90
 * SUCH DAMAGE.
91
 *
92
 *      @(#)in.h        8.3 (Berkeley) 1/3/94
93
 */
94
 
95
#ifndef _NETINET6_IN6_H_
96
#define _NETINET6_IN6_H_
97
 
98
#if !defined(_XOPEN_SOURCE)
99
#include <sys/queue.h>
100
#endif
101
 
102
/*
103
 * Identification of the network protocol stack
104
 */
105
#define __KAME__
106
#define __KAME_VERSION          "19991208/OpenBSD-current"
107
 
108
/*
109
 * Local port number conventions:
110
 *
111
 * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
112
 * unless a kernel is compiled with IPNOPRIVPORTS defined.
113
 *
114
 * When a user does a bind(2) or connect(2) with a port number of zero,
115
 * a non-conflicting local port address is chosen.
116
 *
117
 * The default range is IPPORT_ANONMIX to IPPORT_ANONMAX, although
118
 * that is settable by sysctl(3); net.inet.ip.anonportmin and
119
 * net.inet.ip.anonportmax respectively.
120
 *
121
 * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
122
 * default assignment range.
123
 *
124
 * The value IP_PORTRANGE_DEFAULT causes the default behavior.
125
 *
126
 * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
127
 * and exists only for FreeBSD compatibility purposes.
128
 *
129
 * The value IP_PORTRANGE_LOW changes the range to the "low" are
130
 * that is (by convention) restricted to privileged processes.
131
 * This convention is based on "vouchsafe" principles only.
132
 * It is only secure if you trust the remote host to restrict these ports.
133
 * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
134
 */
135
 
136
#define IPV6PORT_RESERVED       1024
137
#define IPV6PORT_ANONMIN        49152
138
#define IPV6PORT_ANONMAX        65535
139
#define IPV6PORT_RESERVEDMIN    600
140
#define IPV6PORT_RESERVEDMAX    (IPV6PORT_RESERVED-1)
141
 
142
/*
143
 * IPv6 address
144
 */
145
struct in6_addr {
146
        union {
147
                u_int8_t   __u6_addr8[16];
148
                u_int16_t  __u6_addr16[8];
149
                u_int32_t  __u6_addr32[4];
150
        } __u6_addr;                    /* 128-bit IP6 address */
151
};
152
 
153
#define s6_addr   __u6_addr.__u6_addr8
154
#ifdef _KERNEL  /*XXX nonstandard*/
155
#define s6_addr8  __u6_addr.__u6_addr8
156
#define s6_addr16 __u6_addr.__u6_addr16
157
#define s6_addr32 __u6_addr.__u6_addr32
158
#endif
159
 
160
#define INET6_ADDRSTRLEN        46
161
 
162
/*
163
 * Socket address for IPv6
164
 */
165
#if !defined(_XOPEN_SOURCE)
166
#define SIN6_LEN
167
#endif
168
struct sockaddr_in6 {
169
        u_char          sin6_len;       /* length of this struct(sa_family_t)*/
170
        u_char          sin6_family;    /* AF_INET6 (sa_family_t) */
171
        u_int16_t       sin6_port;      /* Transport layer port # (in_port_t)*/
172
        u_int32_t       sin6_flowinfo;  /* IP6 flow information */
173
        struct in6_addr sin6_addr;      /* IP6 address */
174
        u_int32_t       sin6_scope_id;  /* intface scope id */
175
};
176
 
177
/*
178
 * Local definition for masks
179
 */
180
#ifdef _KERNEL  /*XXX nonstandard*/
181
#define IN6MASK0        {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
182
#define IN6MASK32       {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
183
                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
184
#define IN6MASK64       {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
185
                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
186
#define IN6MASK96       {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
187
                            0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
188
#define IN6MASK128      {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
189
                            0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
190
#endif
191
 
192
#ifdef _KERNEL
193
extern const struct in6_addr in6mask0;
194
extern const struct in6_addr in6mask32;
195
extern const struct in6_addr in6mask64;
196
extern const struct in6_addr in6mask96;
197
extern const struct in6_addr in6mask128;
198
#endif /* _KERNEL */
199
 
200
/*
201
 * Macros started with IPV6_ADDR is KAME local
202
 */
203
#ifdef _KERNEL  /*XXX nonstandard*/
204
#if BYTE_ORDER == BIG_ENDIAN
205
#define IPV6_ADDR_INT32_ONE     1
206
#define IPV6_ADDR_INT32_TWO     2
207
#define IPV6_ADDR_INT32_MNL     0xff010000
208
#define IPV6_ADDR_INT32_MLL     0xff020000
209
#define IPV6_ADDR_INT32_SMP     0x0000ffff
210
#define IPV6_ADDR_INT16_ULL     0xfe80
211
#define IPV6_ADDR_INT16_USL     0xfec0
212
#define IPV6_ADDR_INT16_MLL     0xff02
213
#elif BYTE_ORDER == LITTLE_ENDIAN
214
#define IPV6_ADDR_INT32_ONE     0x01000000
215
#define IPV6_ADDR_INT32_TWO     0x02000000
216
#define IPV6_ADDR_INT32_MNL     0x000001ff
217
#define IPV6_ADDR_INT32_MLL     0x000002ff
218
#define IPV6_ADDR_INT32_SMP     0xffff0000
219
#define IPV6_ADDR_INT16_ULL     0x80fe
220
#define IPV6_ADDR_INT16_USL     0xc0fe
221
#define IPV6_ADDR_INT16_MLL     0x02ff
222
#endif
223
#endif
224
 
225
/*
226
 * Definition of some useful macros to handle IP6 addresses
227
 */
228
#define IN6ADDR_ANY_INIT \
229
        {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
230
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
231
#define IN6ADDR_LOOPBACK_INIT \
232
        {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
233
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
234
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
235
        {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
236
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
237
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
238
        {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
239
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
240
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
241
        {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
242
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
243
 
244
extern const struct in6_addr in6addr_any;
245
extern const struct in6_addr in6addr_loopback;
246
extern const struct in6_addr in6addr_nodelocal_allnodes;
247
extern const struct in6_addr in6addr_linklocal_allnodes;
248
extern const struct in6_addr in6addr_linklocal_allrouters;
249
 
250
/*
251
 * Equality
252
 * NOTE: Some of kernel programming environment (for example, openbsd/sparc)
253
 * does not supply memcmp().  For userland memcmp() is preferred as it is
254
 * in ANSI standard.
255
 */
256
#ifdef _KERNEL
257
#define IN6_ARE_ADDR_EQUAL(a, b)                        \
258
        (bcmp((a), (b), sizeof(struct in6_addr)) == 0)
259
#else
260
#define IN6_ARE_ADDR_EQUAL(a, b)                        \
261
        (memcmp((a), (b), sizeof(struct in6_addr)) == 0)
262
#endif
263
 
264
/*
265
 * Unspecified
266
 */
267
#define IN6_IS_ADDR_UNSPECIFIED(a)      \
268
        ((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) &&       \
269
         (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) &&      \
270
         (*(u_int32_t *)(&(a)->s6_addr[8]) == 0) &&      \
271
         (*(u_int32_t *)(&(a)->s6_addr[12]) == 0))
272
 
273
/*
274
 * Loopback
275
 */
276
#define IN6_IS_ADDR_LOOPBACK(a)         \
277
        ((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) &&       \
278
         (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) &&      \
279
         (*(u_int32_t *)(&(a)->s6_addr[8]) == 0) &&      \
280
         (*(u_int32_t *)(&(a)->s6_addr[12]) == ntohl(1)))
281
 
282
/*
283
 * IPv4 compatible
284
 */
285
#define IN6_IS_ADDR_V4COMPAT(a)         \
286
        ((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) &&       \
287
         (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) &&      \
288
         (*(u_int32_t *)(&(a)->s6_addr[8]) == 0) &&      \
289
         (*(u_int32_t *)(&(a)->s6_addr[12]) != 0) &&     \
290
         (*(u_int32_t *)(&(a)->s6_addr[12]) != ntohl(1)))
291
 
292
/*
293
 * Mapped
294
 */
295
#define IN6_IS_ADDR_V4MAPPED(a)               \
296
        ((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) &&       \
297
         (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) &&      \
298
         (*(u_int32_t *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
299
 
300
/*
301
 * KAME Scope Values
302
 */
303
 
304
#ifdef _KERNEL  /*XXX nonstandard*/
305
#define IPV6_ADDR_SCOPE_NODELOCAL       0x01
306
#define IPV6_ADDR_SCOPE_LINKLOCAL       0x02
307
#define IPV6_ADDR_SCOPE_SITELOCAL       0x05
308
#define IPV6_ADDR_SCOPE_ORGLOCAL        0x08    /* just used in this file */
309
#define IPV6_ADDR_SCOPE_GLOBAL          0x0e
310
#else
311
#define __IPV6_ADDR_SCOPE_NODELOCAL     0x01
312
#define __IPV6_ADDR_SCOPE_LINKLOCAL     0x02
313
#define __IPV6_ADDR_SCOPE_SITELOCAL     0x05
314
#define __IPV6_ADDR_SCOPE_ORGLOCAL      0x08    /* just used in this file */
315
#define __IPV6_ADDR_SCOPE_GLOBAL        0x0e
316
#endif
317
 
318
/*
319
 * Unicast Scope
320
 * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
321
 */
322
#define IN6_IS_ADDR_LINKLOCAL(a)        \
323
        (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
324
#define IN6_IS_ADDR_SITELOCAL(a)        \
325
        (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
326
 
327
/*
328
 * Multicast
329
 */
330
#define IN6_IS_ADDR_MULTICAST(a)        ((a)->s6_addr[0] == 0xff)
331
 
332
#ifdef _KERNEL  /*XXX nonstandard*/
333
#define IPV6_ADDR_MC_SCOPE(a)           ((a)->s6_addr[1] & 0x0f)
334
#else
335
#define __IPV6_ADDR_MC_SCOPE(a)         ((a)->s6_addr[1] & 0x0f)
336
#endif
337
 
338
/*
339
 * Multicast Scope
340
 */
341
#ifdef _KERNEL  /*refers nonstandard items */
342
#define IN6_IS_ADDR_MC_NODELOCAL(a)     \
343
        (IN6_IS_ADDR_MULTICAST(a) &&    \
344
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
345
#define IN6_IS_ADDR_MC_LINKLOCAL(a)     \
346
        (IN6_IS_ADDR_MULTICAST(a) &&    \
347
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
348
#define IN6_IS_ADDR_MC_SITELOCAL(a)     \
349
        (IN6_IS_ADDR_MULTICAST(a) &&    \
350
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
351
#define IN6_IS_ADDR_MC_ORGLOCAL(a)      \
352
        (IN6_IS_ADDR_MULTICAST(a) &&    \
353
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
354
#define IN6_IS_ADDR_MC_GLOBAL(a)        \
355
        (IN6_IS_ADDR_MULTICAST(a) &&    \
356
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
357
#else
358
#define IN6_IS_ADDR_MC_NODELOCAL(a)     \
359
        (IN6_IS_ADDR_MULTICAST(a) &&    \
360
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
361
#define IN6_IS_ADDR_MC_LINKLOCAL(a)     \
362
        (IN6_IS_ADDR_MULTICAST(a) &&    \
363
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
364
#define IN6_IS_ADDR_MC_SITELOCAL(a)     \
365
        (IN6_IS_ADDR_MULTICAST(a) &&    \
366
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
367
#define IN6_IS_ADDR_MC_ORGLOCAL(a)      \
368
        (IN6_IS_ADDR_MULTICAST(a) &&    \
369
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
370
#define IN6_IS_ADDR_MC_GLOBAL(a)        \
371
        (IN6_IS_ADDR_MULTICAST(a) &&    \
372
         (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
373
#endif
374
 
375
/*
376
 * Wildcard Socket
377
 */
378
#if 0   /*pre-RFC2553*/
379
#define IN6_IS_ADDR_ANY(a)      IN6_IS_ADDR_UNSPECIFIED(a)
380
#endif
381
 
382
/*
383
 * KAME Scope
384
 */
385
#ifdef _KERNEL  /*nonstandard*/
386
#define IN6_IS_SCOPE_LINKLOCAL(a)       \
387
        ((IN6_IS_ADDR_LINKLOCAL(a)) ||  \
388
         (IN6_IS_ADDR_MC_LINKLOCAL(a)))
389
#endif
390
 
391
/*
392
 * IP6 route structure
393
 */
394
#if !defined(_XOPEN_SOURCE)
395
struct route_in6 {
396
        struct  rtentry *ro_rt;
397
        struct  sockaddr_in6 ro_dst;
398
};
399
#endif
400
 
401
/*
402
 * Options for use with [gs]etsockopt at the IPV6 level.
403
 * First word of comment is data type; bool is stored in int.
404
 */
405
#define IPV6_OPTIONS            1  /* buf/ip6_opts; set/get IP6 options */
406
/* no hdrincl */
407
#define IPV6_SOCKOPT_RESERVED1  3  /* reserved for future use */
408
#define IPV6_UNICAST_HOPS       4  /* int; IP6 hops */
409
#define IPV6_RECVOPTS           5  /* bool; receive all IP6 opts w/dgram */
410
#define IPV6_RECVRETOPTS        6  /* bool; receive IP6 opts for response */
411
#define IPV6_RECVDSTADDR        7  /* bool; receive IP6 dst addr w/dgram */
412
#define IPV6_RETOPTS            8  /* ip6_opts; set/get IP6 options */
413
#define IPV6_MULTICAST_IF       9  /* u_char; set/get IP6 multicast i/f  */
414
#define IPV6_MULTICAST_HOPS     10 /* u_char; set/get IP6 multicast hops */
415
#define IPV6_MULTICAST_LOOP     11 /* u_char; set/get IP6 multicast loopback */
416
#define IPV6_JOIN_GROUP         12 /* ip6_mreq; join a group membership */
417
#define IPV6_LEAVE_GROUP        13 /* ip6_mreq; leave a group membership */
418
#define IPV6_PORTRANGE          14 /* int; range to choose for unspec port */
419
#define ICMP6_FILTER            18 /* icmp6_filter; icmp6 filter */
420
#define IPV6_PKTINFO            19 /* bool; send/rcv if, src/dst addr */
421
#define IPV6_HOPLIMIT           20 /* bool; hop limit */
422
#define IPV6_NEXTHOP            21 /* bool; next hop addr */
423
#define IPV6_HOPOPTS            22 /* bool; hop-by-hop option */
424
#define IPV6_DSTOPTS            23 /* bool; destination option */
425
#define IPV6_RTHDR              24 /* bool; routing header */
426
#define IPV6_PKTOPTIONS         25 /* buf/cmsghdr; set/get IPv6 options */
427
#define IPV6_CHECKSUM           26 /* int; checksum offset for raw socket */
428
#define IPV6_BINDV6ONLY         27 /* bool; only bind INET6 at null bind */
429
 
430
#if 1 /*IPSEC*/
431
#define IPV6_IPSEC_POLICY       28 /* struct; get/set security policy */
432
#endif
433
#define IPV6_FAITH              29 /* bool; accept FAITH'ed connections */
434
 
435
#if 1 /*IPV6FIREWALL*/
436
#define IPV6_FW_ADD             30 /* add a firewall rule to chain */
437
#define IPV6_FW_DEL             31 /* delete a firewall rule from chain */
438
#define IPV6_FW_FLUSH           32 /* flush firewall rule chain */
439
#define IPV6_FW_ZERO            33 /* clear single/all firewall counter(s) */
440
#define IPV6_FW_GET             34 /* get entire firewall rule chain */
441
#endif
442
 
443
#define IPV6_RTHDR_LOOSE     0 /* this hop need not be a neighbor. XXX old spec */
444
#define IPV6_RTHDR_STRICT    1 /* this hop must be a neighbor. XXX old spec */
445
#define IPV6_RTHDR_TYPE_0    0 /* IPv6 routing header type 0 */
446
 
447
/*
448
 * Defaults and limits for options
449
 */
450
#define IPV6_DEFAULT_MULTICAST_HOPS 1   /* normally limit m'casts to 1 hop  */
451
#define IPV6_DEFAULT_MULTICAST_LOOP 1   /* normally hear sends if a member  */
452
 
453
/*
454
 * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
455
 */
456
struct ipv6_mreq {
457
        struct in6_addr ipv6mr_multiaddr;
458
        u_int           ipv6mr_interface;
459
};
460
 
461
/*
462
 * IPV6_PKTINFO: Packet information(RFC2292 sec 5)
463
 */
464
struct in6_pktinfo {
465
        struct in6_addr ipi6_addr;      /* src/dst IPv6 address */
466
        u_int ipi6_ifindex;             /* send/recv interface index */
467
};
468
 
469
/*
470
 * Argument for IPV6_PORTRANGE:
471
 * - which range to search when port is unspecified at bind() or connect()
472
 */
473
#define IPV6_PORTRANGE_DEFAULT  0        /* default range */
474
#define IPV6_PORTRANGE_HIGH     1       /* "high" - request firewall bypass */
475
#define IPV6_PORTRANGE_LOW      2       /* "low" - vouchsafe security */
476
 
477
#if !defined(_XOPEN_SOURCE)
478
/*
479
 * Definitions for inet6 sysctl operations.
480
 *
481
 * Third level is protocol number.
482
 * Fourth level is desired variable within that protocol.
483
 */
484
#define IPV6PROTO_MAXID (IPPROTO_PIM + 1)       /* don't list to IPV6PROTO_MAX */
485
 
486
#define CTL_IPV6PROTO_NAMES { \
487
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
488
        { 0, 0 }, \
489
        { "tcp6", CTLTYPE_NODE }, \
490
        { 0, 0 }, \
491
        { 0, 0 }, \
492
        { 0, 0 }, \
493
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
494
        { 0, 0 }, \
495
        { 0, 0 }, \
496
        { "udp6", CTLTYPE_NODE }, \
497
        { 0, 0 }, \
498
        { 0, 0 }, \
499
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
500
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
501
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
502
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
503
        { 0, 0 }, \
504
        { "ip6", CTLTYPE_NODE }, \
505
        { 0, 0 }, \
506
        { 0, 0 }, \
507
        { 0, 0 }, \
508
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
509
        { 0, 0 }, \
510
        { "ipsec6", CTLTYPE_NODE }, \
511
        { 0, 0 }, \
512
        { 0, 0 }, \
513
        { 0, 0 }, \
514
        { 0, 0 }, \
515
        { 0, 0 }, \
516
        { 0, 0 }, \
517
        { "icmp6", CTLTYPE_NODE }, \
518
        { 0, 0 }, \
519
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
520
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
521
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
522
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
523
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
524
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
525
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
526
        { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
527
        { 0, 0 }, \
528
        { 0, 0 }, \
529
        { 0, 0 }, \
530
        { "pim6", CTLTYPE_NODE }, \
531
}
532
 
533
/*
534
 * Names for IP sysctl objects
535
 */
536
#define IPV6CTL_FORWARDING      1       /* act as router */
537
#define IPV6CTL_SENDREDIRECTS   2       /* may send redirects when forwarding*/
538
#define IPV6CTL_DEFHLIM         3       /* default Hop-Limit */
539
#ifdef notyet
540
#define IPV6CTL_DEFMTU          4       /* default MTU */
541
#endif
542
#define IPV6CTL_FORWSRCRT       5       /* forward source-routed dgrams */
543
#define IPV6CTL_STATS           6       /* stats */
544
#define IPV6CTL_MRTSTATS        7       /* multicast forwarding stats */
545
#define IPV6CTL_MRTPROTO        8       /* multicast routing protocol */
546
#define IPV6CTL_MAXFRAGPACKETS  9       /* max packets reassembly queue */
547
#define IPV6CTL_SOURCECHECK     10      /* verify source route and intf */
548
#define IPV6CTL_SOURCECHECK_LOGINT 11   /* minimume logging interval */
549
#define IPV6CTL_ACCEPT_RTADV    12
550
#define IPV6CTL_KEEPFAITH       13
551
#define IPV6CTL_LOG_INTERVAL    14
552
#define IPV6CTL_HDRNESTLIMIT    15
553
#define IPV6CTL_DAD_COUNT       16
554
#define IPV6CTL_AUTO_FLOWLABEL  17
555
#define IPV6CTL_DEFMCASTHLIM    18
556
#define IPV6CTL_GIF_HLIM        19      /* default HLIM for gif encap packet */
557
#define IPV6CTL_KAME_VERSION    20
558
#define IPV6CTL_USE_DEPRECATED  21      /* use deprecated addr (RFC2462 5.5.4) */
559
#define IPV6CTL_RR_PRUNE        22      /* walk timer for router renumbering */
560
#ifdef MAPPED_ADDR_ENABLED
561
#define IPV6CTL_MAPPED_ADDR     23
562
#endif /* MAPPED_ADDR_ENABLED */
563
/* New entries should be added here from current IPV6CTL_MAXID value. */
564
#define IPV6CTL_MAXID           24
565
 
566
#ifdef MAPPED_ADDR_ENABLED
567
#define IPV6CTL_NAMES_MAPPED_ADDR       "mapped_addr"
568
#define IPV6CTL_TYPE_MAPPED_ADDR        CTLTYPE_INT
569
#define IPV6CTL_VARS_MAPPED_ADDR        &ip6_mapped_addr_on
570
#else  /* MAPPED_ADDR_ENABLED */
571
#define IPV6CTL_NAMES_MAPPED_ADDR       0
572
#define IPV6CTL_TYPE_MAPPED_ADDR        0
573
#define IPV6CTL_VARS_MAPPED_ADDR        0
574
#endif /* MAPPED_ADDR_ENABLED */
575
 
576
#define IPV6CTL_NAMES { \
577
        { 0, 0 }, \
578
        { "forwarding", CTLTYPE_INT }, \
579
        { "redirect", CTLTYPE_INT }, \
580
        { "hlim", CTLTYPE_INT }, \
581
        { "mtu", CTLTYPE_INT }, \
582
        { "forwsrcrt", CTLTYPE_INT }, \
583
        { 0, 0 }, \
584
        { 0, 0 }, \
585
        { "mrtproto", CTLTYPE_INT }, \
586
        { "maxfragpackets", CTLTYPE_INT }, \
587
        { "sourcecheck", CTLTYPE_INT }, \
588
        { "sourcecheck_logint", CTLTYPE_INT }, \
589
        { "accept_rtadv", CTLTYPE_INT }, \
590
        { "keepfaith", CTLTYPE_INT }, \
591
        { "log_interval", CTLTYPE_INT }, \
592
        { "hdrnestlimit", CTLTYPE_INT }, \
593
        { "dad_count", CTLTYPE_INT }, \
594
        { "auto_flowlabel", CTLTYPE_INT }, \
595
        { "defmcasthlim", CTLTYPE_INT }, \
596
        { "gifhlim", CTLTYPE_INT }, \
597
        { "kame_version", CTLTYPE_STRING }, \
598
        { "use_deprecated", CTLTYPE_INT }, \
599
        { "rr_prune", CTLTYPE_INT }, \
600
        { IPV6CTL_NAMES_MAPPED_ADDR, IPV6CTL_TYPE_MAPPED_ADDR }, \
601
}
602
 
603
#define IPV6CTL_VARS { \
604
        0, \
605
        &ip6_forwarding, \
606
        &ip6_sendredirects, \
607
        &ip6_defhlim, \
608
        0, \
609
        &ip6_forward_srcrt, \
610
        0, \
611
        0, \
612
        0, \
613
        &ip6_maxfragpackets, \
614
        &ip6_sourcecheck, \
615
        &ip6_sourcecheck_interval, \
616
        &ip6_accept_rtadv, \
617
        &ip6_keepfaith, \
618
        &ip6_log_interval, \
619
        &ip6_hdrnestlimit, \
620
        &ip6_dad_count, \
621
        &ip6_auto_flowlabel, \
622
        &ip6_defmcasthlim, \
623
        &ip6_gif_hlim, \
624
        0, \
625
        &ip6_use_deprecated, \
626
        &ip6_rr_prune, \
627
        IPV6CTL_VARS_MAPPED_ADDR, \
628
}
629
#endif /* !_XOPEN_SOURCE */
630
 
631
#ifdef _KERNEL
632
struct cmsghdr;
633
struct mbuf;
634
struct ifnet;
635
 
636
int     in6_canforward __P((struct in6_addr *, struct in6_addr *));
637
int     in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));
638
int     in6_localaddr __P((struct in6_addr *));
639
int     in6_addrscope __P((struct in6_addr *));
640
struct  in6_ifaddr *in6_ifawithscope __P((struct ifnet *, struct in6_addr *));
641
struct  in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));
642
extern void in6_if_up __P((struct ifnet *));
643
#ifdef MAPPED_ADDR_ENABLED
644
struct sockaddr;
645
 
646
void    in6_sin6_2_sin __P((struct sockaddr_in *sin,
647
                            struct sockaddr_in6 *sin6));
648
void    in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin,
649
                                 struct sockaddr_in6 *sin6));
650
void    in6_sin6_2_sin_in_sock __P((struct sockaddr *nam));
651
void    in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam));
652
#endif /* MAPPED_ADDR_ENABLED */
653
 
654
#define satosin6(sa)    ((struct sockaddr_in6 *)(sa))
655
#define sin6tosa(sin6)  ((struct sockaddr *)(sin6))
656
#define ifatoia6(ifa)   ((struct in6_ifaddr *)(ifa))
657
#endif /* _KERNEL */
658
 
659
__BEGIN_DECLS
660
struct cmsghdr;
661
 
662
extern int inet6_option_space(int);
663
extern int inet6_option_init(void *, struct cmsghdr **, int);
664
extern int inet6_option_append(struct cmsghdr *, const u_int8_t *, int, int);
665
extern u_int8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
666
extern int inet6_option_next(const struct cmsghdr *, u_int8_t **);
667
extern int inet6_option_find(const struct cmsghdr *, u_int8_t **, int);
668
 
669
extern size_t inet6_rthdr_space __P((int, int));
670
extern struct cmsghdr *inet6_rthdr_init __P((void *, int));
671
extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *,
672
                unsigned int));
673
extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int));
674
#if 0 /* not implemented yet */
675
extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *));
676
#endif
677
extern int inet6_rthdr_segments __P((const struct cmsghdr *));
678
extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int));
679
extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int));
680
__END_DECLS
681
 
682
#endif /* !_NETINET6_IN6_H_ */

powered by: WebSVN 2.1.0

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