source: azure_iot_hub/trunk/asp3_dcre/tinet/netapp/dhcp6_cli.h@ 388

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

Azure IoT Hub Device C SDK を使ったサンプルの追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 9.5 KB
Line 
1/*
2 * Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (c) 1995-2003 by Internet Software Consortium
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 *
17 * Internet Systems Consortium, Inc.
18 * 950 Charter Street
19 * Redwood City, CA 94063
20 * <info@isc.org>
21 * https://www.isc.org/
22 *
23 * This code is based on the original client state machine that was
24 * written by Elliot Poger. The code has been extensively hacked on
25 * by Ted Lemon since then, so any mistakes you find are probably his
26 * fault and not Elliot's.
27 */
28/*
29 * WIDE Project DHCP Implementation
30 * Copyright (c) 1995-1997 Akihiro Tominaga
31 * Copyright (c) 1995-1997 WIDE Project
32 * All rights reserved.
33 *
34 * Permission to use, copy, modify and distribute this software and its
35 * documentation is hereby granted, provided the following conditions
36 * are satisfied,
37 *
38 * 1. Both the copyright notice and this permission notice appear in
39 * all copies of the software, derivative works or modified versions,
40 * and any portions thereof, and that both notices appear in
41 * supporting documentation.
42 * 2. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
44 * This product includes software developed by WIDE Project and
45 * its contributors.
46 * 3. Neither the name of WIDE Project nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE
51 * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
52 * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE
53 * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED.
54 *
55 * Feedback of the results generated from any improvements or
56 * extensions made to this software would be much appreciated.
57 * Any such feedback should be sent to:
58 *
59 * Akihiro Tominaga
60 * WIDE Project
61 * Keio University, Endo 5322, Kanagawa, Japan
62 * (E-mail: dhcp-dist@wide.ad.jp)
63 *
64 * WIDE project has the rights to redistribute these changes.
65 */
66/*
67 * TINET (TCP/IP Protocol Stack)
68 *
69 * Copyright (C) 2011 by Dep. of Computer Science and Engineering
70 * Tomakomai National College of Technology, JAPAN
71 *
72 * 上記著作権者
73は,以下の (1)~(4) の条件か,Free Software Foundation
74 * によってå…
75¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
76 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
77 * を改変したものを含む.以下同じ)を使用・複製・改変・再é…
78å¸ƒï¼ˆä»¥ä¸‹ï¼Œ
79 * 利用と呼ぶ)することを無償で許諾する.
80 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
81 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
82 * スコード中に含まれていること.
83 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
84 * 用できる形で再é…
85å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
86å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
87 * 者
88マニュアルなど)に,上記の著作権表示,この利用条件および下記
89 * の無保証規定を掲載すること.
90 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
91 * 用できない形で再é…
92å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこ
93 * と.
94 * (a) 再é…
95å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
96マニュアルなど)に,上記の著
97 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
98 * (b) 再é…
99å¸ƒã®å½¢æ…
100‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
101 * 報告すること.
102 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
103 * 害からも,上記著作権者
104およびTOPPERSプロジェクトをå…
105è²¬ã™ã‚‹ã“と.
106 *
107 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
108お
109 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
110 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
111 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
112 *
113 * @(#) $Id: dhcp6_cli.h 388 2019-05-22 11:25:18Z coas-nagasima $
114 */
115
116#ifndef DHCP6_CLI_H
117#define DHCP6_CLI_H
118
119#ifdef DHCP6_CLI_CFG
120
121#include <netinet/in.h>
122#include <netapp/dhcp6.h>
123
124/*
125 * DHCP クライアントのスタックサイズ
126 */
127
128#define DHCP6_CLI_STACK_SIZE 1024 /* DHCP クライアントタスクのスタックサイズ */
129
130/*
131 * DHCP クライアントの優å…
132ˆåº¦
133 */
134
135#define DHCP6_CLI_MAIN_PRIORITY 5 /* DHCP クライアントタスクの優å…
136ˆåº¦ */
137
138/*
139 * コンパイル時コンフィギュレーション
140 */
141
142/*
143 * DHCPv6 動作モード
144 *
145 * #define DHCP6_CLI_CFG_MODE で指定する。
146 * 指定されていなければ、ステートレスに設定する。
147 *
148 */
149
150#define DHCP6_CLI_CFG_STATELESS 0 /* ステートレスに設定する。 */
151#define DHCP6_CLI_CFG_STATEFULL 1 /* ステートフルに設定する。 */
152#define DHCP6_CLI_CFG_RA 2 /* RA の M/O ビットにより設定する。 */
153#define DHCP6_CLI_CFG_MODE_DEFAULT DHCP6_CLI_CFG_STATELESS
154
155/* IA の設定 */
156#define DHCP6_CLI_CFG_IA_NA 1
157//#define DHCP6_CLI_CFG_IA_TA 1
158//#define DHCP6_CLI_CFG_IA_PD 1
159
160/* Rapid-commit の指定 */
161//#define DHCP6_CLI_CFG_RAPID_COMMIT 1
162
163/* 推奨度の定義 */
164#define DHCP6_CLI_CFG_PREFER_IA 50 /* IA_NA/TA/PD 当たりの推奨度 */
165#define DHCP6_CLI_CFG_PREFER_IAADDR 100 /* アドレス当たりの推奨度 */
166
167/* DHCPv6 クライアントメッセージの受信リストサイズ(2以上指定すること) */
168#define NUM_DHCP6_CLI_MSG_LIST 3
169
170/*
171 * DHCPv6 クライアントメッセージ構造体数【変更禁止】
172 * +1 は送信用
173 */
174#define NUM_MPF_DHCP6_CLI_MSG (NUM_DHCP6_CLI_MSG_LIST+1)
175
176/* DHCP 必
177須オプションリスト */
178
179#ifndef DHCP6_CLI_CFG_REQUIRED_OLIST
180
181#if defined(USE_RESOLVER)
182
183#define DHCP6_CLI_CFG_REQUIRED_OLIST { \
184 DHCP6_OPT_NAME_SERVERS, \
185 }
186
187#else /* of #if defined(USE_RESOLVER) */
188
189#endif /* of #if defined(USE_RESOLVER) */
190
191#endif /* of #ifndef DHCP6_CLI_CFG_REQUIRED_OLIST */
192
193/* DHCP 要求オプションリスト */
194
195#ifndef DHCP6_CLI_CFG_REQUEST_OLIST
196
197#if defined(USE_RESOLVER)
198
199#define DHCP6_CLI_CFG_REQUEST_OLIST { \
200 DHCP6_OPT_DOMAIN_SEARCH, \
201 }
202
203#else /* of #if defined(USE_RESOLVER) */
204
205#endif /* of #if defined(USE_RESOLVER) */
206
207#endif /* of #ifndef DHCP6_CLI_CFG_REQUEST_OLIST */
208
209/*
210 * タイムアウト定数
211 * RFC3315 に規定されたタイミング定数は dhcp6.h 参ç…
212§
213 */
214
215/* 標準メッセージの再送信タイムアウト */
216#define TMO_DHCP6C_NORMAL ULONG_C(60*1000)
217
218/* 標準要求リース時間 */
219#define TMO_DHCP6C_REQ_LEASE ULONG_C(7200*1000)
220
221/* メッセージ構造体獲得タイムアウト */
222#define TMO_DHCP6C_MPF_GET ULONG_C(1000)
223
224/* メッセージ受信タイムアウト */
225#define TMO_DHCP6C_RCV_DAT ULONG_C(1000)
226
227/*
228 * DHCPv6 クライアントメッセージ構造体
229 */
230
231typedef struct dhcp6_cli_msg {
232 /* 4バイト境界にアラインする。*/
233 T_DHCP6_MSG msg; /* DHCPv6 メッセージ構造体 */
234 struct dhcp6_cli_msg *next; /* リストの次のメッセージ構造体 */
235 SYSTIM rcv_time; /* 受信した時間 */
236 T_IPV6EP srv; /* サーバのIPv6アドレス/ポート番号 */
237 uint16_t len; /* msg の有効長 */
238 uint16_t prefer; /* msg の推奨度 */
239 uint16_t status; /* STATUS CODE オプションの status */
240 } T_DHCP6_CLI_MSG;
241
242/* prefer のフラグ */
243
244#define DHCP6_ClI_MSG_PREFER_ADDR UINT_C(0x8000) /* アドレス情
245報あり */
246#define DHCP6_ClI_MSG_PREFER_REQUIRED UINT_C(0x4000) /* 必
247須オプションあり */
248#define DHCP6_ClI_MSG_PREFER_REQUEST UINT_C(0x2000) /* 要求オプションあり */
249#define DHCP6_ClI_MSG_PREFER_OPTION UINT_C(0x1000) /* PREFER オプションあり */
250#define DHCP6_ClI_MSG_PREFER_FLAG_MASK UINT_C(0xf000)
251#define DHCP6_ClI_MSG_PREFER_VALUE_MASK (~(DHCP6_ClI_MSG_PREFER_FLAG_MASK))
252
253/*
254 * STATUS CODE オプションが無い時の値
255 */
256
257#define DHCP6_CLI_STAT_UNDEFINED (-1)
258
259/*
260 * コールバック関数
261 */
262
263extern ER callback_nblk_dhcp6_cli (ID cepid, FN fncd, void *p_parblk);
264
265/*
266 * タスク
267 */
268
269extern void dhcp6_cli_task(intptr_t exinf);
270
271/*
272 * 関数
273 */
274
275extern ER dhcp6c_rel_info (void);
276extern ER dhcp6c_renew_info (void);
277extern ER dhcp6c_get_info (T_IN6_ADDR *addr, uint32_t *expire, uint32_t *renew,
278 uint32_t *rebind, uint32_t *deprefer, SYSTIM *bind_start);
279
280#endif /* of #ifdef DHCP6_CLI_CFG */
281
282#endif /* of #ifndef DHCP6_CLI_H */
Note: See TracBrowser for help on using the repository browser.