source: rubycfg_asp/trunk/asp_dcre/tinet/netinet/ip6.h@ 313

Last change on this file since 313 was 313, checked in by coas-nagasima, 7 years ago

ソースを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 11.3 KB
Line 
1/*
2 * TINET (TCP/IP Protocol Stack)
3 *
4 * Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering
5 * Tomakomai National College of Technology, JAPAN
6 *
7 * 上記著作権者
8は,以下の (1)~(4) の条件か,Free Software Foundation
9 * によってå…
10¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
11 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
12 * を改変したものを含む.以下同じ)を使用・複製・改変・再é…
13å¸ƒï¼ˆä»¥ä¸‹ï¼Œ
14 * 利用と呼ぶ)することを無償で許諾する.
15 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
16 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
17 * スコード中に含まれていること.
18 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
19 * 用できる形で再é…
20å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
21å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
22 * 者
23マニュアルなど)に,上記の著作権表示,この利用条件および下記
24 * の無保証規定を掲載すること.
25 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
26 * 用できない形で再é…
27å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®æ¡ä»¶ã‚’満たすこと.
28 * (a) 再é…
29å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
30マニュアルなど)に,上記の著
31 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
32 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
33 * 害からも,上記著作権者
34およびTOPPERSプロジェクトをå…
35è²¬ã™ã‚‹ã“と.
36 *
37 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
38お
39 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
40 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
41 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
42 *
43 * @(#) $Id: ip6.h 313 2017-07-23 04:50:32Z coas-nagasima $
44 */
45
46/* $FreeBSD: src/sys/netinet/ip6.h,v 1.2.2.2 2001/07/03 11:01:46 ume Exp $ */
47/* $KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $ */
48
49/*
50 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
51 * All rights reserved.
52 *
53 * Redistribution and use in source and binary forms, with or without
54 * modification, are permitted provided that the following conditions
55 * are met:
56 * 1. Redistributions of source code must retain the above copyright
57 * notice, this list of conditions and the following disclaimer.
58 * 2. Redistributions in binary form must reproduce the above copyright
59 * notice, this list of conditions and the following disclaimer in the
60 * documentation and/or other materials provided with the distribution.
61 * 3. Neither the name of the project nor the names of its contributors
62 * may be used to endorse or promote products derived from this software
63 * without specific prior written permission.
64 *
65 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
66 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
67 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
68 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
69 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
70 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
71 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
72 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
73 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
74 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
75 * SUCH DAMAGE.
76 */
77
78/*
79 * Copyright (c) 1982, 1986, 1993
80 * The Regents of the University of California. All rights reserved.
81 *
82 * Redistribution and use in source and binary forms, with or without
83 * modification, are permitted provided that the following conditions
84 * are met:
85 * 1. Redistributions of source code must retain the above copyright
86 * notice, this list of conditions and the following disclaimer.
87 * 2. Redistributions in binary form must reproduce the above copyright
88 * notice, this list of conditions and the following disclaimer in the
89 * documentation and/or other materials provided with the distribution.
90 * 3. All advertising materials mentioning features or use of this software
91 * must display the following acknowledgement:
92 * This product includes software developed by the University of
93 * California, Berkeley and its contributors.
94 * 4. Neither the name of the University nor the names of its contributors
95 * may be used to endorse or promote products derived from this software
96 * without specific prior written permission.
97 *
98 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
99 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
100 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
101 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
102 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
103 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
104 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
105 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
106 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
107 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
108 * SUCH DAMAGE.
109 *
110 * @(#)ip.h 8.1 (Berkeley) 6/10/93
111 */
112
113#ifndef _IP6_H_
114#define _IP6_H_
115
116/*
117 * IPv6 の定義、RFC2460 参ç…
118§
119 */
120
121#define IPV6_VERSION 6
122
123/*
124 * IPv6 ヘッダの定義
125 */
126
127typedef struct t_ip6_hdr {
128 uint32_t vcf; /* Version: 4 bit */
129 /* Traffic Class: 8 bit */
130 /* Flow Label: 20 bit */
131 uint16_t plen; /* Payload Length */
132 uint8_t next; /* Next Header */
133 uint8_t hlim; /* Hop Limit */
134 T_IN6_ADDR src; /* Source Address */
135 T_IN6_ADDR dst; /* Destination Address */
136 } T_IP6_HDR;
137
138#define IP6_HDR_SIZE (sizeof(T_IP6_HDR))
139
140/*
141 * IPv6 ヘッダ構造体メンバアクセスマクロ
142 */
143
144#define IP6_MAKE_VCF(v,cf) (((uint32_t)(v)<<28)|(cf))
145#define IP6_VCF_V(vcf) ((uint32_t)(vcf)>>28)
146#define IP6_VCF_C(vcf) (((uint32_t)(vcf)>>20)&ULONG_C(0xff))
147#define IP6_VCF_F(vcf) ((uint32_t)(vcf)&ULONG_C(0x000fffff))
148#define IP6_VCF_CF(vcf) ((uint32_t)(vcf)&ULONG_C(0x0fffffff))
149
150/*
151 * 拡張ヘッダ
152 */
153
154typedef struct t_ip6_ext_hdr {
155 uint8_t next; /* Next Header */
156 uint8_t len; /* 8 オクテット単位の長さ */
157 } T_IP6_EXT_HDR;
158
159/*
160 * 中継点 (Hop-by-Hop) オプションヘッダ
161 */
162
163typedef struct t_ip6_hbh_hdr {
164 uint8_t next; /* Next Header */
165 uint8_t len; /* 8 オクテット単位の長さ。ただし、
166 * このオプションヘッダå…
167¨ä½“のオクテット数を
168 * 8 で割った値の - 1 がå…
169¥ã‚‹ã€‚
170 */
171 } T_IP6_HBH_HDR;
172
173/*
174 * 終点 (Destination) オプションヘッダ
175 */
176
177typedef struct t_ip6_dest_hdr {
178 uint8_t next; /* Next Header */
179 uint8_t len; /* 8 オクテット単位の長さ。ただし、
180 * このオプションヘッダå…
181¨ä½“のオクテット数を
182 * 8 で割った値の - 1 がå…
183¥ã‚‹ã€‚
184 */
185 } T_IP6_DEST_HDR;
186
187/* 中継点 (Hop-by-Hop) オプション */
188
189#define IP6OPT_PAD1 UINT_C(0x00) /* 00 0 00000 */
190#define IP6OPT_PADN UINT_C(0x01) /* 00 0 00001 */
191#define IP6OPT_JUMBO UINT_C(0xc2) /* 11 0 00010 */
192#define IP6OPT_NSAP_ADDR UINT_C(0xc3) /* 11 0 00011 */
193#define IP6OPT_TUNNEL_LIMIT UINT_C(0x04) /* 00 0 00100 */
194#define IP6OPT_RTR_ALERT UINT_C(0x05) /* 00 0 00101 */
195
196#define IP6OPT_MINLEN 2 /* オプションの最短長 */
197
198/* 未知のオプションの処理の指定 */
199
200#define IP6OPT_TYPE_SKIP UINT_C(0x00) /* 無視する。 */
201#define IP6OPT_TYPE_DISCARD UINT_C(0x40) /* データグラムを破棄する。 */
202#define IP6OPT_TYPE_FORCEICMP UINT_C(0x80) /* 破棄して、ICMP を返送する。 */
203#define IP6OPT_TYPE_ICMP UINT_C(0xc0)
204 /* 破棄して、マルチキャストでなければ ICMP を返送する。 */
205
206#define IP6OPT_TYPE(o) ((o)&UINT_C(0xc0))
207
208/*
209 * 経路制御ヘッダ
210 */
211
212typedef struct t_ip6_rt_hdr {
213 uint8_t next; /* Next Header */
214 uint8_t len; /* 8 オクテット単位の長さ。ただし、
215 * このオプションヘッダå…
216¨ä½“のオクテット数を
217 * 8 で割った値の - 1 がå…
218¥ã‚‹ã€‚
219 */
220 uint8_t type; /* 経路制御タイプ */
221 uint8_t segleft; /* セグメントの残り */
222 } T_IP6_RT_HDR;
223
224/*
225 * タイプ 0 経路制御ヘッダ
226 */
227
228typedef struct t_ip6_rt0_hdr {
229 uint8_t next; /* Next Header */
230 uint8_t len; /* 8 オクテット単位の長さ。ただし、
231 * このオプションヘッダå…
232¨ä½“のオクテット数を
233 * 8 で割った値の - 1 がå…
234¥ã‚‹ã€‚
235 */
236 uint8_t type; /* 経路制御タイプ */
237 uint8_t segleft; /* セグメントの残り */
238 uint32_t reserved; /* 予約 */
239 } T_IP6_RT0_HDR;
240
241/*
242 * 断片ヘッダ
243 */
244
245typedef struct t_ip6_frag_hdr {
246 uint8_t next; /* Next Header */
247 uint8_t reserved;
248 uint16_t off_flag; /* オフセットとフラグ */
249 uint32_t ident; /* 分割識別子 */
250 } T_IP6_FRAG_HDR;
251
252/* 断片ヘッダのオフセットとフラグ */
253
254#ifdef _NET_CFG_BYTE_ORDER
255
256#if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN
257
258#define IP6F_OFF_MASK UINT_C(0xfff8) /* オフセットを取出すマスク */
259#define IP6F_RESERVED_MASK UINT_C(0x0006) /* 予約を取出すマスク */
260#define IP6F_MORE_FRAG UINT_C(0x0001) /* 中間フラグメント */
261
262#elif _NET_CFG_BYTE_ORDER == _NET_CFG_LITTLE_ENDIAN
263
264#define IP6F_OFF_MASK UINT_C(0xf8ff) /* オフセットを取出すマスク */
265#define IP6F_RESERVED_MASK UINT_C(0x0600) /* 予約を取出すマスク */
266#define IP6F_MORE_FRAG UINT_C(0x0100) /* 中間フラグメント */
267
268#endif /* #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN */
269
270#endif /* of #ifdef _NET_CFG_BYTE_ORDER */
271
272/*
273 * 制限値
274 */
275
276#define IPV6_MAXHLIM UINT_C(255) /* ホップリミットの最大値 */
277#define IPV6_DEFHLIM UINT_C(64) /* ホップリミットの規定値 */
278#define IPV6_FRAGTTL UINT_C(60) /* 分割されたデータグラムの生存時間(秒) */
279#define IPV6_MMTU UINT_C(1280) /* 最小 MTU。ペイロード (1024) + ヘッダ (256) */
280#define IPV6_MAXPACKET UINT_C(65535) /* ジャンボペイロードを除く最大パケットサイズ */
281
282/*
283 * IPv6 と IPv4 をコンパイル時に選択するためのマクロ
284 */
285
286/*
287 * ホップリミットの規定値は、ルータ通知により変更されることがある
288 */
289
290#if NUM_ND6_DEF_RTR_ENTRY > 0
291
292/* ルータ通知を受信する場合は、通知された値 */
293
294#define IP6_DEFTTL ip6_defhlim
295
296#else /* #if NUM_ND6_DEF_RTR_ENTRY > 0 */
297
298/* ルータ通知を受信しない場合の値は既定値 */
299
300#define IP6_DEFTTL IPV6_DEFHLIM
301
302#endif /* #if NUM_ND6_DEF_RTR_ENTRY > 0 */
303
304/* IPv4 と IPv6 をコンパイル時に選択するためのマクロ */
305
306#ifdef _IP6_CFG
307
308#define IP_HDR_SIZE IP6_HDR_SIZE
309#define T_IP_HDR T_IP6_HDR
310#define IP_DEFTTL IP6_DEFTTL
311
312#endif /* of #ifdef _IP6_CFG */
313
314#endif /* of #ifndef _IP6_H_ */
Note: See TracBrowser for help on using the repository browser.