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