source: azure_iot_hub/trunk/asp3_dcre/tinet/netinet/icmp6.h@ 389

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

ビルドが通るよう更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 19.8 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 * 上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
8 * によって公表されている GNU General Public License の Version 2 に記
9 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
10 * を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
11 * 利用と呼ぶ)することを無償で許諾する.
12 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
13 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
14 * スコード中に含まれていること.
15 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
16 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
17 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
18 * の無保証規定を掲載すること.
19 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
20 * 用できない形で再配布する場合には,次の条件を満たすこと.
21 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
22 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
23 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
24 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
25 *
26 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
27 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
28 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
29 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
30 *
31 * @(#) $Id$
32 */
33
34/* $FreeBSD: src/sys/netinet/icmp6.h,v 1.2.2.3 2001/07/06 05:36:35 sumikawa Exp $ */
35/* $KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $ */
36
37/*
38 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
39 * All rights reserved.
40 *
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
43 * are met:
44 * 1. Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * 2. Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in the
48 * documentation and/or other materials provided with the distribution.
49 * 3. Neither the name of the project nor the names of its contributors
50 * may be used to endorse or promote products derived from this software
51 * without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
54 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
56 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
57 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
58 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
59 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
60 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE.
64 */
65
66/*
67 * Copyright (c) 1982, 1986, 1993
68 * The Regents of the University of California. All rights reserved.
69 *
70 * Redistribution and use in source and binary forms, with or without
71 * modification, are permitted provided that the following conditions
72 * are met:
73 * 1. Redistributions of source code must retain the above copyright
74 * notice, this list of conditions and the following disclaimer.
75 * 2. Redistributions in binary form must reproduce the above copyright
76 * notice, this list of conditions and the following disclaimer in the
77 * documentation and/or other materials provided with the distribution.
78 * 3. All advertising materials mentioning features or use of this software
79 * must display the following acknowledgement:
80 * This product includes software developed by the University of
81 * California, Berkeley and its contributors.
82 * 4. Neither the name of the University nor the names of its contributors
83 * may be used to endorse or promote products derived from this software
84 * without specific prior written permission.
85 *
86 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
87 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
88 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
89 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
90 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
91 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
92 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
93 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
94 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
95 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
96 * SUCH DAMAGE.
97 *
98 * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
99 */
100
101#ifndef _IP_ICMP6_H_
102#define _IP_ICMP6_H_
103
104/*
105 * ICMPv6 ヘッダ
106 */
107
108typedef struct t_icmp6_hdr {
109 uint8_t type; /* メッセージの型 */
110 uint8_t code; /* サブ型 */
111 uint16_t sum; /* チェックサム */
112 union {
113 uint32_t data32;
114 uint16_t data16[2];
115 uint8_t data8[4];
116 } data;
117 } __attribute__((packed, aligned(2))) T_ICMP6_HDR;
118
119#define icmp6_data32 data.data32
120#define icmp6_data16 data.data16
121#define icmp6_data8 data.data8
122#define icmp6_pptr data.data32 /* パラメータ異常 */
123#define icmp6_mtu data.data32 /* パラメータ異常 */
124#define icmp6_id data.data16[0] /* エコー要求と応答 */
125#define icmp6_seq data.data16[1] /* エコー要求と応答 */
126
127#define ICMP6_HDR_SIZE (sizeof(T_ICMP6_HDR))
128#define IF_IP6_ICMP6_HDR_OFFSET (IF_IP6_HDR_SIZE)
129
130#define GET_ICMP6_HDR(nbuf,ihoff) ((T_ICMP6_HDR*)((uint8_t*)((nbuf)->buf) + ihoff))
131#define GET_ICMP6_SDU(nbuf,ihoff) ((uint8_t*)((nbuf)->buf) + ihoff + ICMP6_HDR_SIZE)
132
133#define GET_IP6_ICMP6_HDR_SIZE(nbuf) (GET_IP6_HDR_SIZE(nbuf) + ICMP6_HDR_SIZE)
134#define GET_IF_IP6_ICMP6_HDR_SIZE(nbuf) (IF_HDR_SIZE + GET_IP6_ICMP6_HDR_SIZE(nbuf))
135
136/*
137 * ICMP6 タイプ
138 */
139
140#define ICMP6_DST_UNREACH UINT_C(1) /* 宛先到達不可能 */
141#define ICMP6_PACKET_TOO_BIG UINT_C(2) /* パケットが大きすぎる。 */
142#define ICMP6_TIME_EXCEEDED UINT_C(3) /* TTL を超過した。 */
143#define ICMP6_PARAM_PROB UINT_C(4) /* IPv6 ヘッダが不正。 */
144
145#define ICMP6_ECHO_REQUEST UINT_C(128) /* エコー要求 */
146#define ICMP6_ECHO_REPLY UINT_C(129) /* エコー応答 */
147
148#define ICMP6_MEMBERSHIP_QUERY UINT_C(130) /* グループメンバ照会 */
149#define ICMP6_MEMBERSHIP_REPORT UINT_C(131) /* グループメンバ報告 */
150#define ICMP6_MEMBERSHIP_REDUCTION UINT_C(132) /* グループメンバ終了 */
151
152#define MLD_LISTENER_QUERY UINT_C(130) /* マルチキャスト受信者照会 */
153#define MLD_LISTENER_REPORT UINT_C(131) /* マルチキャスト受信者報告 */
154#define MLD_LISTENER_DONE UINT_C(132) /* マルチキャスト受信者終了 */
155
156#define ND_ROUTER_SOLICIT UINT_C(133) /* ルータ要請 */
157#define ND_ROUTER_ADVERT UINT_C(134) /* ルータ通知 */
158#define ND_NEIGHBOR_SOLICIT UINT_C(135) /* 近隣要請 */
159#define ND_NEIGHBOR_ADVERT UINT_C(136) /* 近隣通知 */
160#define ND_REDIRECT UINT_C(137) /* 向け直し */
161
162#define ICMP6_ROUTER_RENUMBERING UINT_C(138) /* ルータ番号再設定 */
163
164#define ICMP6_WRU_REQUEST UINT_C(139) /* 要求ノード探索 */
165#define ICMP6_WRU_REPLY UINT_C(140) /* 応答ノード探索 */
166
167#define ICMP6_FQDN_QUERY UINT_C(139) /* FQDN 照会 */
168#define ICMP6_FQDN_REPLY UINT_C(140) /* FQDN 応答 */
169
170#define ICMP6_NI_QUERY UINT_C(139) /* ノード情報照会 */
171#define ICMP6_NI_REPLY UINT_C(140) /* ノード情報応答 */
172
173#define ICMP6_MAX_TYPE UINT_C(203) /* ICMP6 タイプの最大値 */
174
175/*
176 * ICMP6 コード
177 */
178
179/* 宛先到達不可能 */
180
181#define ICMP6_DST_UNREACH_NOROUTE UINT_C(0) /* 到達ルートなし。 */
182#define ICMP6_DST_UNREACH_ADMIN UINT_C(1) /* 管理者により無効化中。 */
183#define ICMP6_DST_UNREACH_NOTEIGHBOR UINT_C(2) /* 近隣者ではなくなった。 */
184#define ICMP6_DST_UNREACH_BEYOND_SCOPE UINT_C(2) /* スコープを超えている。 */
185#define ICMP6_DST_UNREACH_ADDR UINT_C(3) /* 宛先アドレスに到達不可能。 */
186#define ICMP6_DST_UNREACH_NOPORT UINT_C(4) /* 宛先ポートに到達不可能。 */
187
188/* TTL 超過 */
189
190#define ICMP6_TIME_EXCEED_TRANSIT UINT_C(0) /* 転送時に TTL==0 になった。 */
191#define ICMP6_TIME_EXCEED_REASSEMBLY UINT_C(1) /* IP 再構成でタイムアウトした。*/
192
193/* ヘッダ不正 */
194
195#define ICMP6_PARAMPROB_HEADER UINT_C(0) /* ヘッダに不正があった。 */
196#define ICMP6_PARAMPROB_NEXT_HEADER UINT_C(1) /* 次ヘッダが認識できない。 */
197#define ICMP6_PARAMPROB_OPTION UINT_C(2) /* オプションが認識できない。 */
198
199/* 内部使用 */
200#define ND_REDIRECT_ONLINK UINT_C(0) /* オンリンクへの向け直し */
201#define ND_REDIRECT_ROUTER UINT_C(1) /* ルータへの向け直し */
202
203/*
204 * 制限値
205 */
206
207 /* ICMPv6 の最大ペイロード長 */
208#define ICMPV6_PAYLOAD_MAXLEN (IPV6_MMTU - (IP6_HDR_SIZE + ICMP6_HDR_SIZE))
209
210/*
211 * 近隣要請
212 */
213
214typedef struct t_neighbor_solicit_hdr {
215 T_ICMP6_HDR hdr;
216 T_IN6_ADDR target;
217 /* この後にオプションが続く */
218 } T_NEIGHBOR_SOLICIT_HDR;
219
220#define NEIGHBOR_SOLICIT_HDR_SIZE (sizeof(T_NEIGHBOR_SOLICIT_HDR))
221#define IF_IP6_NEIGHBOR_SOLICIT_HDR_OFFSET \
222 (IF_IP6_HDR_SIZE)
223
224#define GET_NEIGHBOR_SOLICIT_HDR(nbuf,nhoff) \
225 ((T_NEIGHBOR_SOLICIT_HDR*)((uint8_t*)((nbuf)->buf) + nhoff))
226#define GET_NEIGHBOR_SOLICIT_SDU(nbuf,nhoff) \
227 ((uint8_t*)((nbuf)->buf) + nhoff + NEIGHBOR_SOLICIT_HDR_SIZE)
228
229#define GET_IP6_NEIGHBOR_SOLICIT_HDR_SIZE(nbuf) \
230 (GET_IP6_HDR_SIZE(nbuf) + NEIGHBOR_SOLICIT_HDR_SIZE)
231#define GET_IF_IP6_NEIGHBOR_SOLICIT_HDR_SIZE(nbuf) \
232 (GET_IP6_NEIGHBOR_SOLICIT_HDR_SIZE(nbuf) + IF_HDR_SIZE)
233
234/*
235 * 近隣通知
236 */
237
238typedef struct t_neighbor_advert_hdr {
239 T_ICMP6_HDR hdr;
240 T_IN6_ADDR target;
241 /* この後にオプションが続く */
242 } __attribute__((packed, aligned(2))) T_NEIGHBOR_ADVERT_HDR;
243
244/* ICMP6 ヘッダのデータ部の定義 */
245
246#define nd_na_flags_reserved hdr.data.data32
247
248#define NEIGHBOR_ADVERT_HDR_SIZE (sizeof(T_NEIGHBOR_ADVERT_HDR))
249#define IP6_NEIGHBOR_ADVERT_HDR_SIZE (IP6_HDR_SIZE + NEIGHBOR_ADVERT_HDR_SIZE)
250#define IF_IP6_NEIGHBOR_ADVERT_HDR_SIZE \
251 (IF_IP6_HDR_SIZE + NEIGHBOR_ADVERT_HDR_SIZE)
252#define IF_IP6_NEIGHBOR_ADVERT_HDR_OFFSET \
253 (IF_IP6_HDR_SIZE)
254
255#define GET_NEIGHBOR_ADVERT_HDR(nbuf,nhoff) \
256 ((T_NEIGHBOR_ADVERT_HDR*)((uint8_t*)((nbuf)->buf) + nhoff))
257#define GET_NEIGHBOR_ADVERT_SDU(nbuf,nhoff) \
258 ((uint8_t*)((nbuf)->buf) + nhoff + NEIGHBOR_ADVERT_HDR_SIZE)
259
260#define GET_IP6_NEIGHBOR_ADVERT_HDR_SIZE(nbuf) \
261 (GET_IP6_HDR_SIZE(nbuf) + NEIGHBOR_ADVERT_HDR_SIZE)
262#define GET_IF_IP6_NEIGHBOR_ADVERT_HDR_SIZE(nbuf) \
263 (GET_IP6_NEIGHBOR_ADVERT_HDR_SIZE(nbuf) + IF_HDR_SIZE)
264
265/*
266 * 近隣通知フラグ、nd_na_flags_reserved (hdr.data32) に設定する。
267 */
268
269#if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN
270
271#define ND_NA_FLG_OVERRIDE ULONG_C(0x20000000) /* 近隣キャッシュ上書き */
272#define ND_NA_FLG_SOLICITED ULONG_C(0x40000000) /* 近隣要請への応答 */
273#define ND_NA_FLG_ROUTER ULONG_C(0x80000000) /* ルータ通知 */
274
275#elif _NET_CFG_BYTE_ORDER == _NET_CFG_LITTLE_ENDIAN
276
277#define ND_NA_FLG_OVERRIDE ULONG_C(0x00000020) /* 近隣キャッシュ上書き */
278#define ND_NA_FLG_SOLICITED ULONG_C(0x00000040) /* 近隣要請への応答 */
279#define ND_NA_FLG_ROUTER ULONG_C(0x00000080) /* ルータ通知 */
280
281#endif /* #if _NET_CFG_BYTE_ORDER == _NET_CFG_BIG_ENDIAN */
282
283/*
284 * ルータ通知
285 *
286 * RFC4291: IP Version 6 Addressing Architecture
287 * RFC4941: Privacy Extensions for Stateless Address Autoconfiguration in IPv6
288 * RFC6106: IPv6 Router Advertisement Options for DNS Configuration
289 */
290
291typedef struct t_router_advert_hdr {
292 T_ICMP6_HDR hdr;
293 uint32_t reachable; /* [us] 到達可能時間 */
294 uint32_t retransmit; /* [us] 近隣要請送信間隔 */
295 /* この後にオプションが続く */
296 } __attribute__((packed, aligned(2))) T_ROUTER_ADVERT_HDR;
297
298/* ICMP6 ヘッダのデータ部の定義 */
299
300#define nd_ra_current_hoplimit hdr.data.data8[0]
301#define nd_ra_flags hdr.data.data8[1]
302#define nd_ra_router_lifetime hdr.data.data16[1] /* [s] ルータ有効時間 */
303
304#define ROUTER_ADVERT_HDR_SIZE (sizeof(T_ROUTER_ADVERT_HDR))
305#define IP6_ROUTER_ADVERT_HDR_SIZE (IP6_HDR_SIZE + ROUTER_ADVERT_HDR_SIZE)
306#define IF_IP6_ROUTER_ADVERT_HDR_SIZE (IF_IP6_HDR_SIZE + ROUTER_ADVERT_HDR_SIZE)
307#define IF_IP6_ROUTER_ADVERT_HDR_OFFSET (IF_IP6_HDR_SIZE)
308
309#define GET_ROUTER_ADVERT_HDR(nbuf,nhoff) \
310 ((T_ROUTER_ADVERT_HDR*)((uint8_t*)((nbuf)->buf) + nhoff))
311#define GET_ROUTER_ADVERT_SDU(nbuf,nhoff) \
312 ((uint8_t*)((nbuf)->buf) + nhoff + ROUTER_ADVERT_HDR_SIZE)
313
314#define GET_IP6_ROUTER_ADVERT_HDR_SIZE(nbuf) \
315 (GET_IP6_HDR_SIZE(nbuf) + ROUTER_ADVERT_HDR_SIZE)
316#define GET_IF_IP6_ROUTER_ADVERT_HDR_SIZE(nbuf) \
317 (GET_IP6_ROUTER_ADVERT_HDR_SIZE(nbuf) + IF_HDR_SIZE)
318
319/*
320 * ルータ通知ヘッダのフラグ
321 */
322
323#define ND_RA_FLAG_MANAGED UINT_C(0x80)
324#define ND_RA_FLAG_OTHER UINT_C(0x40)
325#define ND_RA_FLAG_HA UINT_C(0x20)
326
327/*
328 * M: RA以外の方法で自動的にアドレスを設定することを許可する。
329 * O: RA以外の方法で自動的にアドレス以外の情報を設定することをを許可する。
330 *
331 * M O
332 * ON ON アドレスとそれ以外の情報をDHCPv6で設定する(statefull)
333 * ON OFF アドレスはDHCPv6で設定するが、それ以外は手動で設定する。
334 * OFF ON アドレスは RA で設定するが、それ以外の情報をDHCPv6で設定する(stateless)
335 * OFF OFF DHCPv6 は使用しない。
336 */
337
338/*
339 * ルータ要請
340 */
341
342typedef struct t_router_solicit_hdr {
343 T_ICMP6_HDR hdr;
344 } __attribute__((packed, aligned(2))) T_ROUTER_SOLICIT_HDR;
345
346/* ICMP6 ヘッダのデータ部の定義 */
347
348#define nd_rs_reserved hdr.data.data32
349
350#define ROUTER_SOLICIT_HDR_SIZE (sizeof(T_ROUTER_SOLICIT_HDR))
351#define IP6_ROUTER_SOLICIT_HDR_SIZE (IP6_HDR_SIZE + ROUTER_SOLICIT_HDR_SIZE)
352#define IF_IP6_ROUTER_SOLICIT_HDR_SIZE (IF_IP6_HDR_SIZE + ROUTER_SOLICIT_HDR_SIZE)
353#define IF_IP6_ROUTER_SOLICIT_HDR_OFFSET \
354 (IF_IP6_HDR_SIZE)
355
356#define GET_ROUTER_SOLICIT_HDR(nbuf,nhoff) \
357 ((T_ROUTER_SOLICIT_HDR*)((uint8_t*)((nbuf)->buf) + nhoff))
358#define GET_ROUTER_SOLICIT_SDU(nbuf,nhoff) \
359 ((uint8_t*)((nbuf)->buf) + nhoff + ROUTER_SOLICIT_HDR_SIZE)
360
361#define GET_IP6_ROUTER_SOLICIT_HDR_SIZE(nbuf) \
362 (GET_IP6_HDR_SIZE(nbuf) + ROUTER_SOLICIT_HDR_SIZE)
363#define GET_IF_IP6_ROUTER_SOLICIT_HDR_SIZE(nbuf) \
364 (GET_IP6_ROUTER_SOLICIT_HDR_SIZE(nbuf) + IF_HDR_SIZE)
365
366/*
367 * 近隣探索オプション
368 */
369
370/* 近隣探索ヘッダ */
371
372typedef struct t_neighbor_hdr {
373 T_ICMP6_HDR hdr;
374 T_IN6_ADDR target;
375 } __attribute__((packed, aligned(2))) T_NEIGHBOR_HDR;
376
377/* 近隣探索オプションヘッダ */
378
379typedef struct t_nd_opt_hdr {
380 uint8_t type; /* オプションタイプ */
381 uint8_t len; /* オプション長、単位は 8 バイト */
382 } __attribute__((packed, aligned(2))) T_ND_OPT_HDR;
383
384#define ND_OPT_HDR_SIZE (sizeof(T_ND_OPT_HDR))
385
386#define ND_OPT_SOURCE_LINKADDR UINT_C(1) /* 送信先ネットワークインタフェースのアドレス */
387#define ND_OPT_TARGET_LINKADDR UINT_C(2) /* 対象ネットワークインタフェースのアドレス */
388#define ND_OPT_PREFIX_INFORMATION UINT_C(3) /* プレフィックス情報 */
389#define ND_OPT_REDIRECTED_HEADER UINT_C(4) /* リダイレクト・ヘッダ */
390#define ND_OPT_MTU UINT_C(5) /* MTU */
391
392#define ND_OPT_PREFIX_INFO_COUNT UINT_C(6) /* プレフィックス情報の個数 */
393#define ND_OPT_OFF_ARRAY_SIZE UINT_C(7) /* ND オプションのオフセットを記録する配列サイズ*/
394
395#define ND_OPT_OFF_ARRAY_IX(t) ((t)-1) /* オフセット配列のインデックス */
396
397/* プレフィックスオプション */
398
399typedef struct t_nd_opt_prefix_info {
400 uint8_t type; /* 近隣探索オプションタイプ = 3 */
401 uint8_t len; /* オプション長 = 8×4=32 */
402 uint8_t prefix_len; /* プレフィックス長 */
403 uint8_t flags; /* フラグ */
404 uint32_t valid; /* [s] 有効時間 */
405 uint32_t preferred; /* [s] 推奨有効時間 */
406 uint32_t reserved;
407 T_IN6_ADDR prefix; /* プレフィックス */
408 } __attribute__((packed, aligned(2))) T_ND_OPT_PREFIX_INFO;
409
410#define ND_OPT_PI_FLAG_ONLINK UINT_C(0x80) /* オンリンクプレフィックス */
411#define ND_OPT_PI_FLAG_AUTO UINT_C(0x40) /* ステートレス・アドレス自動設定*/
412
413/* MTU オプションヘッダ */
414
415typedef struct t_nd_opt_mtu_hdr {
416 uint8_t type; /* オプションタイプ */
417 uint8_t len; /* オプション長、単位は 8 バイト*/
418 uint16_t reserved;
419 uint32_t mtu; /* MTU */
420 } __attribute__((packed, aligned(2))) T_ND_OPT_MTU_HDR;
421
422/*
423 * 向け直し
424 */
425
426typedef struct t_nd_redirect_hdr {
427 T_ICMP6_HDR hdr;
428 T_IN6_ADDR target; /* ルータのアドレス */
429 T_IN6_ADDR dst; /* 向け直しの終点アドレス */
430 /* この後にオプションが続く */
431 } __attribute__((packed, aligned(2))) T_ND_REDIRECT_HDR;
432
433#define ND_REDIRECT_HDR_SIZE (sizeof(T_ND_REDIRECT_HDR))
434
435#ifdef SUPPORT_MIB
436
437/*
438 * SNMP の 管理情報ベース (MIB)
439 */
440
441typedef struct t_icmp6_ifstat {
442 uint32_t ipv6IfIcmpInMsgs;
443 uint32_t ipv6IfIcmpInErrors;
444 uint32_t ipv6IfIcmpInDestUnreachs;
445/* uint32_t ipv6IfIcmpInAdminProhibs;*/
446 uint32_t ipv6IfIcmpInTimeExcds;
447 uint32_t ipv6IfIcmpInParmProblems;
448 uint32_t ipv6IfIcmpInPktTooBigs;
449 uint32_t ipv6IfIcmpInEchos;
450 uint32_t ipv6IfIcmpInEchoReplies;
451/* uint32_t ipv6IfIcmpInRouterSolicits;*/
452 uint32_t ipv6IfIcmpInRouterAdvertisements;
453 uint32_t ipv6IfIcmpInNeighborSolicits;
454 uint32_t ipv6IfIcmpInNeighborAdvertisements;
455 uint32_t ipv6IfIcmpInRedirects;
456/* uint32_t ipv6IfIcmpInGroupMembQueries;*/
457/* uint32_t ipv6IfIcmpInGroupMembResponses;*/
458/* uint32_t ipv6IfIcmpInGroupMembReductions;*/
459 uint32_t ipv6IfIcmpOutMsgs;
460 uint32_t ipv6IfIcmpOutErrors;
461 uint32_t ipv6IfIcmpOutDestUnreachs;
462/* uint32_t ipv6IfIcmpOutAdminProhibs;*/
463/* uint32_t ipv6IfIcmpOutTimeExcds;*/
464 uint32_t ipv6IfIcmpOutParmProblems;
465 uint32_t ipv6IfIcmpOutPktTooBigs;
466 uint32_t ipv6IfIcmpOutEchos;
467 uint32_t ipv6IfIcmpOutEchoReplies;
468 uint32_t ipv6IfIcmpOutRouterSolicits;
469/* uint32_t ipv6IfIcmpOutRouterAdvertisements;*/
470 uint32_t ipv6IfIcmpOutNeighborSolicits;
471 uint32_t ipv6IfIcmpOutNeighborAdvertisements;
472/* uint32_t ipv6IfIcmpOutRedirects;*/
473/* uint32_t ipv6IfIcmpOutGroupMembQueries;*/
474/* uint32_t ipv6IfIcmpOutGroupMembResponses;*/
475/* uint32_t ipv6IfIcmpOutGroupMembReductions;*/
476} T_ICMP6_IFSTAT;
477
478extern T_ICMP6_IFSTAT icmp6_ifstat;
479
480#endif /* of #ifdef SUPPORT_MIB */
481
482/*
483 * 関数
484 */
485
486extern uint_t icmp6_input (T_NET_BUF **inputp, uint_t *offp, uint_t *nextp);
487extern void icmp6_error (T_NET_BUF *input, uint8_t type, uint8_t code, uint32_t param);
488
489#ifdef ICMP_CFG_CALLBACK_ECHO_REPLY
490
491extern void icmp6_echo_reply (T_NET_BUF *input, uint_t ihoff);
492
493#endif /* of #ifdef ICMP_CFG_CALLBACK_ECHO_REPLY */
494
495#endif /* of #ifndef _IP_ICMP6_H_ */
Note: See TracBrowser for help on using the repository browser.