source: azure_iot_hub/trunk/asp3_dcre/tinet/netapp/dhcp6_cli_var.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_var.h 388 2019-05-22 11:25:18Z coas-nagasima $
114 */
115
116#ifndef DHCP6_CLI_VAR_H
117#define DHCP6_CLI_VAR_H
118
119#ifdef DHCP6_CLI_CFG
120
121/*
122 * DHCP クライアントコンテキスト構造体
123 */
124
125/* TIMER の定義 */
126
127#define DHCP6C_TIMER_SND_SOL 0
128#define DHCP6C_TIMER_SND_REQ 1
129#define DHCP6C_TIMER_SND_REL 2
130#define DHCP6C_TIMER_RCV_ADV 3
131#define DHCP6C_TIMER_RCV_REPLY 4
132#define DHCP6C_TIMER_RENEW 5
133#define DHCP6C_TIMER_REBIND 6
134#define DHCP6C_TIMER_EXPIRE 7
135#define DHCP6C_TIMER_DEPREF 8
136#define DHCP6C_TIMER_SND_REF 9
137#define DHCP6C_TIMER_SND_IREQ 10
138#define NUM_DHCP6C_TIMERS 11
139
140#define DHCP6C_TIMER_HZ 1
141
142/* 定数の定義 */
143
144#define MAX_DUID_LEN (ETHER_ADDR_LEN+8)
145
146typedef struct dhcp6_cli_context {
147 T_DHCP6_CLI_MSG *rcv_lst; /* 受信メッセージ構造体リスト */
148 T_DHCP6_CLI_MSG *val_lst; /* 検証メッセージ構造体リスト */
149 T_DHCP6_CLI_MSG *prf_lst; /* 推奨メッセージ構造体リスト */
150 T_DHCP6_CLI_MSG *snd_msg; /* 送信メッセージ構造体 */
151 T_DHCP6_CLI_MSG *adv_msg; /* 通知されたリース・メッセージ構造体 */
152 T_DHCP6_CLI_MSG *act_msg; /* 有効なリース・メッセージ構造体 */
153 T_IF_SOFTC *sc; /* IF のソフトウェア情
154å ± */
155 T_IPV6EP dst; /* 送信å…
156ˆã®IPアドレス/ポート番号 */
157 SYSTIM RT; /* 再送信間隔 */
158 SYSTIM IRT; /* 初期再送信間隔 */
159 SYSTIM MRT; /* 最大再送信間隔 */
160 SYSTIM MRD; /* 最大再送信継続時間 */
161 SYSTIM next_MRD; /* 次の最大再送信継続時間 */
162 SYSTIM timers[NUM_DHCP6C_TIMERS];
163 /* タイマーé…
164åˆ— */
165 ER_UINT error; /* エラー・データ長 */
166 ID cepid; /* CEP ID */
167 uint32_t xid; /* トランザクション ID */
168 uint16_t flags; /* 各種フラグ */
169 uint16_t max_prefer; /* 受信メッセージの最大推奨度 */
170 uint8_t duid[MAX_DUID_LEN];
171 /* client DHCP Unique ID */
172 uint8_t duid_len; /* client DUID 長 */
173 uint8_t fsm; /* 現在の状æ…
174‹ */
175 uint8_t MRC; /* 最大再送信回数 */
176 uint8_t txcount; /* 再送信回数 */
177 uint8_t refresh_type; /* REFRESH のメッセージタイプ */
178 } T_DHCP6_CLI_CONTEXT;
179
180/* fsm(状æ…
181‹é·ç§»ï¼‰ã®å®šç¾© */
182
183#define DHCP6_FSM_INIT 1
184#define DHCP6_FSM_SELECT 2
185#define DHCP6_FSM_BOUND 4
186#define DHCP6_FSM_RENEW 5
187#define DHCP6_FSM_REBIND 6
188#define DHCP6_FSM_REQ_INFO 9 /* DHCPv6 の RFC3315 には無い。*/
189#define DHCP6_FSM_INFORMED 10 /* DHCPv6 の RFC3315 には無い。*/
190#define DHCP6_FSM_REL_INFO 11 /* DHCPv6 の RFC3315 には無い。*/
191#define DHCP6_FSM_SLEEP 12 /* DHCPv6 の RFC3315 には無い。*/
192
193/* flag の定義 */
194
195#define DHCP6C_FLAG_TMOUT_SND_SOL (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_SOL)
196#define DHCP6C_FLAG_TMOUT_SND_REQ (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_REQ)
197#define DHCP6C_FLAG_TMOUT_SND_REL (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_REL)
198#define DHCP6C_FLAG_TMOUT_RCV_ADV (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_RCV_ADV)
199#define DHCP6C_FLAG_TMOUT_RCV_REPLY (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_RCV_REPLY)
200#define DHCP6C_FLAG_TMOUT_RENEW (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_RENEW)
201#define DHCP6C_FLAG_TMOUT_REBIND (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_REBIND)
202#define DHCP6C_FLAG_TMOUT_EXPIRE (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_EXPIRE)
203#define DHCP6C_FLAG_TMOUT_DEPREF (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_DEPREF)
204#define DHCP6C_FLAG_TMOUT_SND_REF (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_REF)
205#define DHCP6C_FLAG_TMOUT_SND_IREQ (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_IREQ)
206#define DHCP6C_FLAG_TMOUT_TIMER UINT_C(0x0010)
207#define DHCP6C_FLAG_TMOUT_TIMER_MASK UINT_C(0x000f)
208#define DHCP6C_FLAG_TMOUT_MASK UINT_C(0x001f)
209
210#define DHCP6C_FLAG_RCV_MSG UINT_C(0x0200)
211#define DHCP6C_FLAG_RENEW UINT_C(0x0400)
212
213/* IAADDR 構造体の FLAG の定義(len に多重化する)*/
214
215#define DHCP6C_IAA_FLAG_EXPIRED UINT_C(0x8000)
216#define DHCP6C_IAA_FLAG_DEPREFERD UINT_C(0x4000)
217#define DHCP6C_IAA_FLAG_MASK UINT_C(0xc000)
218
219/*
220 * 関数シミュレーションマクロ
221 */
222
223/* 時間比較 */
224
225#define TIMEC_GT(a,b) ((int32_t)((a)-(b))>0)
226#define TIMEC_GE(a,b) ((int32_t)((a)-(b))>=0)
227
228/* 時間定数の変換 */
229
230#define SYSTIM2TIMER(t) (((t)<SYSTIM_HZ/DHCP6C_TIMER_HZ)?(DHCP6C_TIMER_HZ):((t)*DHCP6C_TIMER_HZ)/SYSTIM_HZ)
231#define SYSTIM2SEC(t) (((t)<SYSTIM_HZ)?1:((t)/SYSTIM_HZ))
232#define SEC2TIMER(t) ((t)*DHCP6C_TIMER_HZ)
233#define SEC2SYSTIM(t) ((t)*SYSTIM_HZ)
234
235#endif /* of #ifdef DHCP6_CLI_CFG */
236
237#endif /* of #ifndef DHCP6_CLI_VAR_H */
Note: See TracBrowser for help on using the repository browser.