source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dhcp6_cli_var.h@ 352

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

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
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 * 上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
73 * によって公表されている GNU General Public License の Version 2 に記
74 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
75 * を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
76 * 利用と呼ぶ)することを無償で許諾する.
77 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
78 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
79 * スコード中に含まれていること.
80 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
81 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
82 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
83 * の無保証規定を掲載すること.
84 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
85 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
86 * と.
87 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
88 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
89 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
90 * 報告すること.
91 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
92 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
93 *
94 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
95 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
96 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
97 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
98 *
99 * @(#) $Id$
100 */
101
102#ifndef DHCP6_CLI_VAR_H
103#define DHCP6_CLI_VAR_H
104
105#ifdef DHCP6_CLI_CFG
106
107/*
108 * DHCP クライアントコンテキスト構造体
109 */
110
111/* TIMER の定義 */
112
113#define DHCP6C_TIMER_SND_SOL 0
114#define DHCP6C_TIMER_SND_REQ 1
115#define DHCP6C_TIMER_SND_REL 2
116#define DHCP6C_TIMER_RCV_ADV 3
117#define DHCP6C_TIMER_RCV_REPLY 4
118#define DHCP6C_TIMER_RENEW 5
119#define DHCP6C_TIMER_REBIND 6
120#define DHCP6C_TIMER_EXPIRE 7
121#define DHCP6C_TIMER_DEPREF 8
122#define DHCP6C_TIMER_SND_REF 9
123#define DHCP6C_TIMER_SND_IREQ 10
124#define NUM_DHCP6C_TIMERS 11
125
126#define DHCP6C_TIMER_HZ 1
127
128/* 定数の定義 */
129
130#define MAX_DUID_LEN (ETHER_ADDR_LEN+8)
131
132typedef struct dhcp6_cli_context {
133 T_DHCP6_CLI_MSG *rcv_lst; /* 受信メッセージ構造体リスト */
134 T_DHCP6_CLI_MSG *val_lst; /* 検証メッセージ構造体リスト */
135 T_DHCP6_CLI_MSG *prf_lst; /* 推奨メッセージ構造体リスト */
136 T_DHCP6_CLI_MSG *snd_msg; /* 送信メッセージ構造体 */
137 T_DHCP6_CLI_MSG *adv_msg; /* 通知されたリース・メッセージ構造体 */
138 T_DHCP6_CLI_MSG *act_msg; /* 有効なリース・メッセージ構造体 */
139 T_IF_SOFTC *sc; /* IF のソフトウェア情報 */
140 T_IPV6EP dst; /* 送信先のIPアドレス/ポート番号 */
141 SYSTIM RT; /* 再送信間隔 */
142 SYSTIM IRT; /* 初期再送信間隔 */
143 SYSTIM MRT; /* 最大再送信間隔 */
144 SYSTIM MRD; /* 最大再送信継続時間 */
145 SYSTIM next_MRD; /* 次の最大再送信継続時間 */
146 SYSTIM timers[NUM_DHCP6C_TIMERS];
147 /* タイマー配列 */
148 ER_UINT error; /* エラー・データ長 */
149 ID cepid; /* CEP ID */
150 uint32_t xid; /* トランザクション ID */
151 uint16_t flags; /* 各種フラグ */
152 uint16_t max_prefer; /* 受信メッセージの最大推奨度 */
153 uint8_t duid[MAX_DUID_LEN];
154 /* client DHCP Unique ID */
155 uint8_t duid_len; /* client DUID 長 */
156 uint8_t fsm; /* 現在の状態 */
157 uint8_t MRC; /* 最大再送信回数 */
158 uint8_t txcount; /* 再送信回数 */
159 uint8_t refresh_type; /* REFRESH のメッセージタイプ */
160 } T_DHCP6_CLI_CONTEXT;
161
162/* fsm(状態遷移)の定義 */
163
164#define DHCP6_FSM_INIT 1
165#define DHCP6_FSM_SELECT 2
166#define DHCP6_FSM_BOUND 4
167#define DHCP6_FSM_RENEW 5
168#define DHCP6_FSM_REBIND 6
169#define DHCP6_FSM_REQ_INFO 9 /* DHCPv6 の RFC3315 には無い。*/
170#define DHCP6_FSM_INFORMED 10 /* DHCPv6 の RFC3315 には無い。*/
171#define DHCP6_FSM_REL_INFO 11 /* DHCPv6 の RFC3315 には無い。*/
172#define DHCP6_FSM_SLEEP 12 /* DHCPv6 の RFC3315 には無い。*/
173
174/* flag の定義 */
175
176#define DHCP6C_FLAG_TMOUT_SND_SOL (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_SOL)
177#define DHCP6C_FLAG_TMOUT_SND_REQ (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_REQ)
178#define DHCP6C_FLAG_TMOUT_SND_REL (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_REL)
179#define DHCP6C_FLAG_TMOUT_RCV_ADV (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_RCV_ADV)
180#define DHCP6C_FLAG_TMOUT_RCV_REPLY (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_RCV_REPLY)
181#define DHCP6C_FLAG_TMOUT_RENEW (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_RENEW)
182#define DHCP6C_FLAG_TMOUT_REBIND (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_REBIND)
183#define DHCP6C_FLAG_TMOUT_EXPIRE (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_EXPIRE)
184#define DHCP6C_FLAG_TMOUT_DEPREF (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_DEPREF)
185#define DHCP6C_FLAG_TMOUT_SND_REF (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_REF)
186#define DHCP6C_FLAG_TMOUT_SND_IREQ (DHCP6C_FLAG_TMOUT_TIMER|DHCP6C_TIMER_SND_IREQ)
187#define DHCP6C_FLAG_TMOUT_TIMER UINT_C(0x0010)
188#define DHCP6C_FLAG_TMOUT_TIMER_MASK UINT_C(0x000f)
189#define DHCP6C_FLAG_TMOUT_MASK UINT_C(0x001f)
190
191#define DHCP6C_FLAG_RCV_MSG UINT_C(0x0200)
192#define DHCP6C_FLAG_RENEW UINT_C(0x0400)
193
194/* IAADDR 構造体の FLAG の定義(len に多重化する)*/
195
196#define DHCP6C_IAA_FLAG_EXPIRED UINT_C(0x8000)
197#define DHCP6C_IAA_FLAG_DEPREFERD UINT_C(0x4000)
198#define DHCP6C_IAA_FLAG_MASK UINT_C(0xc000)
199
200/*
201 * 関数シミュレーションマクロ
202 */
203
204/* 時間比較 */
205
206#define TIMEC_GT(a,b) ((int32_t)((a)-(b))>0)
207#define TIMEC_GE(a,b) ((int32_t)((a)-(b))>=0)
208
209/* 時間定数の変換 */
210
211#define SYSTIM2TIMER(t) (((t)<SYSTIM_HZ/DHCP6C_TIMER_HZ)?(DHCP6C_TIMER_HZ):((t)*DHCP6C_TIMER_HZ)/SYSTIM_HZ)
212#define SYSTIM2SEC(t) (((t)<SYSTIM_HZ)?1:((t)/SYSTIM_HZ))
213#define SEC2TIMER(t) ((t)*DHCP6C_TIMER_HZ)
214#define SEC2SYSTIM(t) ((t)*SYSTIM_HZ)
215
216#endif /* of #ifdef DHCP6_CLI_CFG */
217
218#endif /* of #ifndef DHCP6_CLI_VAR_H */
Note: See TracBrowser for help on using the repository browser.