source: EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dhcp6.h@ 331

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

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 9.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 * 上記著作権者
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 * と.
29 * (a) 再é…
30å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
31マニュアルなど)に,上記の著
32 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
33 * (b) 再é…
34å¸ƒã®å½¢æ…
35‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
36 * 報告すること.
37 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
38 * 害からも,上記著作権者
39およびTOPPERSプロジェクトをå…
40è²¬ã™ã‚‹ã“と.
41 *
42 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
43お
44 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
45 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
46 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
47 *
48 * @(#) $Id$
49 */
50
51#ifndef DHCP6_H
52#define DHCP6_H
53
54/*
55 * DHCPv6 に関する定義
56 *
57 * RFC3315
58 */
59
60/*
61 * DHCPv6 メッセージの定数の定義
62 */
63
64#define DHCP6_XID_LEN 3
65#define DHCP6_OPTION_LEN (512-(1+DHCP6_XID_LEN))
66
67/*
68 * DHCPv6 メッセージ
69 */
70
71typedef struct dhcp6_msg_hdr {
72 uint8_t type; /* message type */
73 uint8_t xid[DHCP6_XID_LEN]; /* transaction ID */
74 } T_DHCP6_MSG_HDR;
75
76typedef struct dhcp6_msg {
77 T_DHCP6_MSG_HDR hdr;
78 uint8_t options[DHCP6_OPTION_LEN]; /* options */
79 } T_DHCP6_MSG;
80
81/* message type の定義 */
82
83#define DHCP6_SOLICIT UINT_C(1)
84#define DHCP6_ADVERTISE UINT_C(2)
85#define DHCP6_REQUEST UINT_C(3)
86#define DHCP6_CONFIRM UINT_C(4)
87#define DHCP6_RENEW UINT_C(5)
88#define DHCP6_REBIND UINT_C(6)
89#define DHCP6_REPLY UINT_C(7)
90#define DHCP6_RELEASE UINT_C(8)
91#define DHCP6_DECLINE UINT_C(9)
92#define DHCP6_RECONFIGURE UINT_C(10)
93#define DHCP6_INFO_REQ UINT_C(11)
94#define DHCP6_RELAY_FORW UINT_C(12)
95#define DHCP6_RELAY_REPL UINT_C(13)
96
97/*
98 * DHCPv6 オプション
99 */
100
101#define DHCP6_OPT_CLIENTID UINT_C(1)
102#define DHCP6_OPT_SERVERID UINT_C(2)
103#define DHCP6_OPT_IA_NA UINT_C(3)
104#define DHCP6_OPT_IA_TA UINT_C(4)
105#define DHCP6_OPT_IAADDR UINT_C(5)
106#define DHCP6_OPT_ORO UINT_C(6)
107#define DHCP6_OPT_PREFERENCE UINT_C(7)
108#define DHCP6_OPT_UNICAST UINT_C(12)
109#define DHCP6_OPT_STATUS_CODE UINT_C(13)
110#define DHCP6_OPT_RAPID_COMMIT UINT_C(14)
111#define DHCP6_OPT_NAME_SERVERS UINT_C(23)
112#define DHCP6_OPT_DOMAIN_SEARCH UINT_C(24)
113#define DHCP6_OPT_IA_PD UINT_C(25)
114
115/* hardware address type の定義 */
116
117#define DHCP6_HWA_TYPE_ETHER UINT_C(1)
118#define DHCP6_HWA_TYPE_IEEE802 UINT_C(6)
119
120/* STATUS CODE の定義 */
121
122#define DHCP6_STAT_SUCCESS UINT_C(0)
123#define DHCP6_STAT_UNSPECIFID UINT_C(1)
124#define DHCP6_STAT_NO_AVAIL UINT_C(2)
125#define DHCP6_STAT_NO_BINDING UINT_C(3)
126#define DHCP6_STAT_NO_ONLINK UINT_C(4)
127#define DHCP6_STAT_USE_MCAST UINT_C(5)
128
129/* 時間定数[s]の定義 */
130
131#define DHCP6_MAX_TIME UINT_C(0xffffffff)
132
133/*
134 * オプションのヘッダ部の定義
135 */
136
137/* オプションのå…
138±é€šéƒ¨ */
139
140typedef struct dhcp6_option {
141 uint16_t code; /* option code */
142 uint16_t len; /* option length */
143 } T_DHCP6_OPTION;
144
145/* オプションのå…
146±é€šéƒ¨ */
147
148/* CLIENTID オプション */
149
150typedef struct dhcp6_opt_clientid {
151 uint16_t code; /* option code */
152 uint16_t len; /* option length */
153 } T_DHCP6_OPT_CLIENTID;
154
155/* SERVERID オプション */
156
157typedef struct dhcp6_opt_serverid {
158 uint16_t code; /* option code */
159 uint16_t len; /* option length */
160 } T_DHCP6_OPT_SERVERID;
161
162/* IA_NA/IA_PD オプション */
163
164typedef struct dhcp6_opt_ia_na_pd {
165 uint16_t code; /* option code */
166 uint16_t len; /* option length */
167 uint32_t iaid; /* IA ID */
168 uint32_t renew; /* renew timeout (T1) */
169 uint32_t rebind; /* rebind timeout (T2) */
170 } T_DHCP6_OPT_IA_NA_PD;
171
172/* IA_TA オプション */
173
174typedef struct dhcp6_opt_ia_ta {
175 uint16_t code; /* option code */
176 uint16_t len; /* option length */
177 uint32_t iaid; /* IA ID */
178 } T_DHCP6_OPT_IA_TA;
179
180/* IAADDR オプション */
181
182#ifdef T_IN6_ADDR_DEFINED
183
184typedef struct dhcp6_opt_iaaddr {
185 uint16_t code; /* option code */
186 uint16_t len; /* option length */
187 T_IN6_ADDR addr; /* IPv6 address */
188 uint32_t prefer; /* preferred lifetime */
189 uint32_t valid; /* valid lifetime */
190 } T_DHCP6_OPT_IAADDR;
191
192#endif /* of #ifdef T_IN6_ADDR_DEFINED */
193
194/* ORO オプション */
195
196typedef struct dhcp6_opt_oro {
197 uint16_t code; /* option code */
198 uint16_t len; /* option length */
199 } T_DHCP6_OPT_ORO;
200
201/* PREFERENCE オプション */
202
203typedef struct dhcp6_opt_preference {
204 uint16_t code; /* option code */
205 uint16_t len; /* option length */
206 uint8_t prefer; /* preference value */
207 } T_DHCP6_OPT_PREFERENCE;
208
209/* UNICAST オプション */
210
211#ifdef T_IN6_ADDR_DEFINED
212
213typedef struct dhcp6_opt_unicast {
214 uint16_t code; /* option code */
215 uint16_t len; /* option length */
216 T_IN6_ADDR addr; /* IPv6 address for server*/
217 } T_DHCP6_OPT_UNICAST;
218
219#endif /* of #ifdef T_IN6_ADDR_DEFINED */
220
221/* STATUS CODE オプション */
222
223typedef struct dhcp6_opt_status_code {
224 uint16_t code; /* option code */
225 uint16_t len; /* option length */
226 uint16_t status; /* status code */
227 } T_DHCP6_OPT_STATUS_CODE;
228
229/* NAME SERVERS オプション */
230
231typedef struct dhcp6_opt_name_servers {
232 uint16_t code; /* option code */
233 uint16_t len; /* option length */
234 T_IN6_ADDR addrs[1]; /* IPv6 address */
235 } T_DHCP6_OPT_NAME_SERVERS;
236
237/* DOMAIN SEARCH オプション */
238
239typedef struct dhcp6_opt_domain_search {
240 uint16_t code; /* option code */
241 uint16_t len; /* option length */
242 uint8_t name[1]; /* domain search */
243 } T_DHCP6_OPT_DOMAIN_SEARCH;
244
245/*
246 * DHCPv6 タイミング定数【RFC3315 5.5 参ç…
247§ã€‘
248 * その他のタイミング定数は dhcp6_cli.h 参ç…
249§
250 */
251
252#ifdef SYSTIM_HZ
253
254#define TMO_SOL_MAX_DELAY (1*SYSTIM_HZ) /* 1[s] */
255#define TMO_SOL_TIMEOUT (1*SYSTIM_HZ) /* 1[s] */
256#define TMO_SOL_MAX_RT (120*SYSTIM_HZ) /* 120[s] */
257#define TMO_REQ_TIMEOUT (1*SYSTIM_HZ) /* 1[s] */
258#define TMO_REQ_MAX_RT (30*SYSTIM_HZ) /* 30[s] */
259#define TMO_REQ_MAX_RC 10 /* 再送信回数 */
260#define TMO_CNF_MAX_DELAY (1*SYSTIM_HZ) /* 1[s] */
261#define TMO_CNF_TIMEOUT (1*SYSTIM_HZ) /* 1[s] */
262#define TMO_CNF_MAX_RT (4*SYSTIM_HZ) /* 4[s] */
263#define TMO_CNF_MAX_RD (10*SYSTIM_HZ) /* 10[s] */
264#define TMO_REN_TIMEOUT (10*SYSTIM_HZ) /* 10[s] */
265#define TMO_REN_MAX_RT (600*SYSTIM_HZ) /* 600[s] */
266#define TMO_REB_TIMEOUT (10*SYSTIM_HZ) /* 10[s] */
267#define TMO_REB_MAX_RT (600*SYSTIM_HZ) /* 600[s] */
268#define TMO_INF_MAX_DELAY (1*SYSTIM_HZ) /* 1[s] */
269#define TMO_INF_TIMEOUT (1*SYSTIM_HZ) /* 1[s] */
270#define TMO_INF_MAX_RT (120*SYSTIM_HZ) /* 120[s] */
271#define TMO_REL_TIMEOUT (1*SYSTIM_HZ) /* 1[s] */
272#define TMO_REL_MAX_RC 5 /* 再送信回数 */
273#define TMO_DEC_TIMEOUT (1*SYSTIM_HZ) /* 1[s] */
274#define TMO_DEC_MAX_RC 5 /* 再送信回数 */
275#define TMO_REC_TIMEOUT (2*SYSTIM_HZ) /* 2[s] */
276#define TMO_REC_MAX_RC 8 /* 再送信回数 */
277
278#endif /* of #ifdef SYSTIM_HZ */
279
280/*
281 * DUID -- DHCP Unique ID
282 */
283
284/* DUID_LLT 構造体 */
285
286typedef struct dhcp6_duid_llt_hdr {
287 uint16_t code; /* DUID code */
288 uint16_t type; /* hardware type */
289 uint32_t time; /* time */
290 } T_DHCP6_DUID_LLT_HDR;
291
292/* DUID_LL 構造体 */
293
294typedef struct dhcp6_duid_ll_hdr {
295 uint16_t code; /* DUID code */
296 uint16_t type; /* hardware type */
297 } T_DHCP6_DUID_LL_HDR;
298
299/* DUID タイプ【RFC3315 9参ç…
300§ã€‘*/
301
302#define DUID_LLT 1
303#define DUID_EN 2
304#define DUID_LL 3
305
306/*
307 * DUID 時間の調整
308 * DUID 時間の開始は 2001/1/1
309 */
310
311#define DUID_TIME_EPOCH 0
312
313/* リレー転送の最大ホップ数 */
314
315#define HOP_COUNT_LIMIT 32
316
317/*
318 * IPv6 アドレス
319 */
320
321#define IPV6_ADDR_ALL_DHCP_RELAY_SERVERS_INIT \
322 {{{ UINT_C(0xff), UINT_C(0x02), UINT_C(0x00), UINT_C(0x00), \
323 UINT_C(0x00), UINT_C(0x00), UINT_C(0x00), UINT_C(0x00), \
324 UINT_C(0x00), UINT_C(0x00), UINT_C(0x00), UINT_C(0x00), \
325 UINT_C(0x00), UINT_C(0x01), UINT_C(0x00), UINT_C(0x02) }}}
326
327#define IPV6_ADDR_ALL_DHCP_SERVERS_INIT \
328 {{{ UINT_C(0xff), UINT_C(0x05), UINT_C(0x00), UINT_C(0x00), \
329 UINT_C(0x00), UINT_C(0x00), UINT_C(0x00), UINT_C(0x00), \
330 UINT_C(0x00), UINT_C(0x00), UINT_C(0x00), UINT_C(0x00), \
331 UINT_C(0x00), UINT_C(0x01), UINT_C(0x00), UINT_C(0x03) }}}
332
333/*
334 * UDP ポート番号
335 */
336
337#ifndef DHCP6_SRV_CFG_PORTNO
338#define DHCP6_SRV_CFG_PORTNO 547 /* server */
339#endif
340
341#ifndef DHCP6_CLI_CFG_PORTNO
342#define DHCP6_CLI_CFG_PORTNO 546 /* client */
343#endif
344
345#endif /* of #ifndef DHCP6_H */
Note: See TracBrowser for help on using the repository browser.