Chameleon

Chameleon Svn Source Tree

Root/branches/mozodojo/i386/include/netinet/ip6.h

1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*$KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $*/
29
30/*
31 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
32 * All rights reserved.
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. Neither the name of the project nor the names of its contributors
43 * may be used to endorse or promote products derived from this software
44 * without specific prior written permission.
45 *
46 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
47 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
50 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE.
57 */
58
59/*
60 * Copyright (c) 1982, 1986, 1993
61 *The Regents of the University of California. All rights reserved.
62 *
63 * Redistribution and use in source and binary forms, with or without
64 * modification, are permitted provided that the following conditions
65 * are met:
66 * 1. Redistributions of source code must retain the above copyright
67 * notice, this list of conditions and the following disclaimer.
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in the
70 * documentation and/or other materials provided with the distribution.
71 * 3. All advertising materials mentioning features or use of this software
72 * must display the following acknowledgement:
73 *This product includes software developed by the University of
74 *California, Berkeley and its contributors.
75 * 4. Neither the name of the University nor the names of its contributors
76 * may be used to endorse or promote products derived from this software
77 * without specific prior written permission.
78 *
79 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
80 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
81 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
82 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
83 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
84 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
85 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
86 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
87 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
88 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
89 * SUCH DAMAGE.
90 *
91 *@(#)ip.h8.1 (Berkeley) 6/10/93
92 */
93
94#ifndef _NETINET_IP6_H_
95#define _NETINET_IP6_H_
96#include <sys/appleapiopts.h>
97
98/*
99 * Definition for internet protocol version 6.
100 * RFC 2460
101 */
102
103struct ip6_hdr {
104union {
105struct ip6_hdrctl {
106u_int32_t ip6_un1_flow;/* 20 bits of flow-ID */
107u_int16_t ip6_un1_plen;/* payload length */
108u_int8_t ip6_un1_nxt;/* next header */
109u_int8_t ip6_un1_hlim;/* hop limit */
110} ip6_un1;
111u_int8_t ip6_un2_vfc;/* 4 bits version, top 4 bits class */
112} ip6_ctlun;
113struct in6_addr ip6_src;/* source address */
114struct in6_addr ip6_dst;/* destination address */
115} __attribute__((__packed__));
116
117#define ip6_vfcip6_ctlun.ip6_un2_vfc
118#define ip6_flowip6_ctlun.ip6_un1.ip6_un1_flow
119#define ip6_plenip6_ctlun.ip6_un1.ip6_un1_plen
120#define ip6_nxtip6_ctlun.ip6_un1.ip6_un1_nxt
121#define ip6_hlimip6_ctlun.ip6_un1.ip6_un1_hlim
122#define ip6_hopsip6_ctlun.ip6_un1.ip6_un1_hlim
123
124#define IPV6_VERSION0x60
125#define IPV6_VERSION_MASK0xf0
126
127#if BYTE_ORDER == BIG_ENDIAN
128#define IPV6_FLOWINFO_MASK0x0fffffff/* flow info (28 bits) */
129#define IPV6_FLOWLABEL_MASK0x000fffff/* flow label (20 bits) */
130#else
131#if BYTE_ORDER == LITTLE_ENDIAN
132#define IPV6_FLOWINFO_MASK0xffffff0f/* flow info (28 bits) */
133#define IPV6_FLOWLABEL_MASK0xffff0f00/* flow label (20 bits) */
134#endif /* LITTLE_ENDIAN */
135#endif
136#if 1
137/* ECN bits proposed by Sally Floyd */
138#define IP6TOS_CE0x01/* congestion experienced */
139#define IP6TOS_ECT0x02/* ECN-capable transport */
140#endif
141
142/*
143 * Extension Headers
144 */
145
146structip6_ext {
147u_int8_t ip6e_nxt;
148u_int8_t ip6e_len;
149} __attribute__((__packed__));
150
151/* Hop-by-Hop options header */
152/* XXX should we pad it to force alignment on an 8-byte boundary? */
153struct ip6_hbh {
154u_int8_t ip6h_nxt;/* next header */
155u_int8_t ip6h_len;/* length in units of 8 octets */
156/* followed by options */
157} __attribute__((__packed__));
158
159/* Destination options header */
160/* XXX should we pad it to force alignment on an 8-byte boundary? */
161struct ip6_dest {
162u_int8_t ip6d_nxt;/* next header */
163u_int8_t ip6d_len;/* length in units of 8 octets */
164/* followed by options */
165} __attribute__((__packed__));
166
167/* Option types and related macros */
168#define IP6OPT_PAD10x00/* 00 0 00000 */
169#define IP6OPT_PADN0x01/* 00 0 00001 */
170#define IP6OPT_JUMBO0xC2/* 11 0 00010 = 194 */
171#define IP6OPT_NSAP_ADDR0xC3/* 11 0 00011 */
172#define IP6OPT_TUNNEL_LIMIT0x04/* 00 0 00100 */
173#define IP6OPT_RTALERT0x05/* 00 0 00101 (KAME definition) */
174
175#define IP6OPT_RTALERT_LEN4
176#define IP6OPT_RTALERT_MLD0/* Datagram contains an MLD message */
177#define IP6OPT_RTALERT_RSVP1/* Datagram contains an RSVP message */
178#define IP6OPT_RTALERT_ACTNET2 /* contains an Active Networks msg */
179#define IP6OPT_MINLEN2
180
181#define IP6OPT_BINDING_UPDATE0xc6/* 11 0 00110 */
182#define IP6OPT_BINDING_ACK0x07/* 00 0 00111 */
183#define IP6OPT_BINDING_REQ0x08/* 00 0 01000 */
184#define IP6OPT_HOME_ADDRESS0xc9/* 11 0 01001 */
185#define IP6OPT_EID0x8a/* 10 0 01010 */
186
187#define IP6OPT_TYPE(o)((o) & 0xC0)
188#define IP6OPT_TYPE_SKIP0x00
189#define IP6OPT_TYPE_DISCARD0x40
190#define IP6OPT_TYPE_FORCEICMP0x80
191#define IP6OPT_TYPE_ICMP0xC0
192
193#define IP6OPT_MUTABLE0x20
194
195#define IP6OPT_JUMBO_LEN6
196
197/* Routing header */
198struct ip6_rthdr {
199u_int8_t ip6r_nxt;/* next header */
200u_int8_t ip6r_len;/* length in units of 8 octets */
201u_int8_t ip6r_type;/* routing type */
202u_int8_t ip6r_segleft;/* segments left */
203/* followed by routing type specific data */
204} __attribute__((__packed__));
205
206/* Type 0 Routing header */
207struct ip6_rthdr0 {
208u_int8_t ip6r0_nxt;/* next header */
209u_int8_t ip6r0_len;/* length in units of 8 octets */
210u_int8_t ip6r0_type;/* always zero */
211u_int8_t ip6r0_segleft;/* segments left */
212u_int8_t ip6r0_reserved;/* reserved field */
213u_int8_t ip6r0_slmap[3];/* strict/loose bit map */
214struct in6_addr ip6r0_addr[1];/* up to 23 addresses */
215} __attribute__((__packed__));
216
217/* Fragment header */
218struct ip6_frag {
219u_int8_t ip6f_nxt;/* next header */
220u_int8_t ip6f_reserved;/* reserved field */
221u_int16_t ip6f_offlg;/* offset, reserved, and flag */
222u_int32_t ip6f_ident;/* identification */
223} __attribute__((__packed__));
224
225#if BYTE_ORDER == BIG_ENDIAN
226#define IP6F_OFF_MASK0xfff8/* mask out offset from _offlg */
227#define IP6F_RESERVED_MASK0x0006/* reserved bits in ip6f_offlg */
228#define IP6F_MORE_FRAG0x0001/* more-fragments flag */
229#else /* BYTE_ORDER == LITTLE_ENDIAN */
230#define IP6F_OFF_MASK0xf8ff/* mask out offset from _offlg */
231#define IP6F_RESERVED_MASK0x0600/* reserved bits in ip6f_offlg */
232#define IP6F_MORE_FRAG0x0100/* more-fragments flag */
233#endif /* BYTE_ORDER == LITTLE_ENDIAN */
234
235/*
236 * Internet implementation parameters.
237 */
238#define IPV6_MAXHLIM255/* maximun hoplimit */
239#define IPV6_DEFHLIM64/* default hlim */
240#define IPV6_FRAGTTL120/* ttl for fragment packets, in slowtimo tick */
241#define IPV6_HLIMDEC1/* subtracted when forwaeding */
242
243#define IPV6_MMTU1280/* minimal MTU and reassembly. 1024 + 256 */
244#define IPV6_MAXPACKET65535/* ip6 max packet size without Jumbo payload*/
245
246#endif /* !_NETINET_IP6_H_ */
247

Archive Download this file

Revision: 1232