source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/tinet/netapp/dhcp4_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: 10.4 KB
Line 
1/*
2 * Copyright 2004 Henning Brauer <henning@openbsd.org>
3 * Copyright (c) 1995, 1996, 1997, 1998, 1999
4 * The Internet Software Consortium. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of The Internet Software Consortium nor the names
16 * of its contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
20 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * This software has been written for the Internet Software Consortium
34 * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
35 * Enterprises. To learn more about the Internet Software Consortium,
36 * see ``http://www.vix.com/isc''. To learn more about Vixie
37 * Enterprises, see ``http://www.vix.com''.
38 *
39 * This client was substantially modified and enhanced by Elliot Poger
40 * for use on Linux while he was working on the MosquitoNet project at
41 * Stanford.
42 *
43 * The current version owes much to Elliot's Linux enhancements, but
44 * was substantially reorganized and partially rewritten by Ted Lemon
45 * so as to use the same networking framework that the Internet Software
46 * Consortium DHCP server uses. Much system-specific configuration code
47 * was moved into a shell script so that as support for more operating
48 * systems is added, it will not be necessary to port and maintain
49 * system-specific configuration code to these operating systems - instead,
50 * the shell script can invoke the native tools to accomplish the same
51 * purpose.
52 */
53/*
54 * WIDE Project DHCP Implementation
55 * Copyright (c) 1995-1997 Akihiro Tominaga
56 * Copyright (c) 1995-1997 WIDE Project
57 * All rights reserved.
58 *
59 * Permission to use, copy, modify and distribute this software and its
60 * documentation is hereby granted, provided the following conditions
61 * are satisfied,
62 *
63 * 1. Both the copyright notice and this permission notice appear in
64 * all copies of the software, derivative works or modified versions,
65 * and any portions thereof, and that both notices appear in
66 * supporting documentation.
67 * 2. All advertising materials mentioning features or use of this software
68 * must display the following acknowledgement:
69 * This product includes software developed by WIDE Project and
70 * its contributors.
71 * 3. Neither the name of WIDE Project nor the names of its contributors
72 * may be used to endorse or promote products derived from this software
73 * without specific prior written permission.
74 *
75 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND WIDE
76 * PROJECT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
77 * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ALSO, THERE
78 * IS NO WARRANTY IMPLIED OR OTHERWISE, NOR IS SUPPORT PROVIDED.
79 *
80 * Feedback of the results generated from any improvements or
81 * extensions made to this software would be much appreciated.
82 * Any such feedback should be sent to:
83 *
84 * Akihiro Tominaga
85 * WIDE Project
86 * Keio University, Endo 5322, Kanagawa, Japan
87 * (E-mail: dhcp-dist@wide.ad.jp)
88 *
89 * WIDE project has the rights to redistribute these changes.
90 */
91/*
92 * TINET (TCP/IP Protocol Stack)
93 *
94 * Copyright (C) 2011 by Dep. of Computer Science and Engineering
95 * Tomakomai National College of Technology, JAPAN
96 *
97 * 上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
98 * によって公表されている GNU General Public License の Version 2 に記
99 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
100 * を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
101 * 利用と呼ぶ)することを無償で許諾する.
102 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
103 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
104 * スコード中に含まれていること.
105 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
106 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
107 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
108 * の無保証規定を掲載すること.
109 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
110 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
111 * と.
112 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
113 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
114 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
115 * 報告すること.
116 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
117 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
118 *
119 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
120 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
121 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
122 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
123 *
124 * @(#) $Id$
125 */
126
127#ifndef DHCP4_CLI_VAR_H
128#define DHCP4_CLI_VAR_H
129
130/*
131 * DHCP クライアントコンテキスト構造体
132 */
133
134/* TIMER の定義 */
135
136#define DHCP4C_TIMER_SND_DISC 0
137#define DHCP4C_TIMER_SND_REQ 1
138#define DHCP4C_TIMER_SND_REL 2
139#define DHCP4C_TIMER_RCV_OFFER 3
140#define DHCP4C_TIMER_RCV_ACK 4
141#define DHCP4C_TIMER_RENEW 5
142#define DHCP4C_TIMER_REBIND 6
143#define DHCP4C_TIMER_EXPIRE 7
144#define NUM_DHCP4C_TIMERS 8
145
146#define DHCP4C_TIMER_HZ 1
147
148typedef struct dhcp4_cli_context {
149 T_DHCP4_CLI_MSG *rcv_lst; /* 受信メッセージ構造体リスト */
150 T_DHCP4_CLI_MSG *val_lst; /* 検証メッセージ構造体リスト */
151 T_DHCP4_CLI_MSG *prf_lst; /* 推奨メッセージ構造体リスト */
152 T_DHCP4_CLI_MSG *snd_msg; /* 送信メッセージ構造体 */
153 T_DHCP4_CLI_MSG *off_msg; /* 通知されたリース・メッセージ構造体 */
154 T_DHCP4_CLI_MSG *act_msg; /* 有効なリース・メッセージ構造体 */
155 T_IF_SOFTC *sc; /* IF のソフトウェア情報 */
156 T_IPV4EP dst; /* 送信先のIPアドレス/ポート番号 */
157 SYSTIM snd_start; /* 送信を開始した時間 */
158 SYSTIM bind_start; /* BINDを開始した時間 */
159 SYSTIM expire; /* リースの有効時間(ms) */
160 SYSTIM renew; /* RENEW(T1)までの時間(ms) */
161 SYSTIM rebind; /* REBIND(T2)までの時間(ms) */
162 SYSTIM timers[NUM_DHCP4C_TIMERS];
163 /* タイマー配列 */
164 RELTIM interval; /* 送信間隔 */
165 ER_UINT error; /* エラー・データ長 */
166 ID tskid; /* タスクID */
167 ID cepid; /* CEP ID */
168 uint32_t xid; /* トランザクション ID */
169 uint16_t flags; /* 各種フラグ */
170 uint16_t max_prefer; /* 受信メッセージの最大推奨度 */
171 uint16_t secs; /* seconds since boot began */
172 uint8_t fsm; /* 現在の状態 */
173 int timer;
174 } T_DHCP4_CLI_CONTEXT;
175
176/* fsm(状態遷移)の定義 */
177
178#define DHCP4_FSM_INIT 1
179#define DHCP4_FSM_SELECT 2
180#define DHCP4_FSM_REQUEST 3
181#define DHCP4_FSM_BOUND 4
182#define DHCP4_FSM_RENEW 5
183#define DHCP4_FSM_REBIND 6
184#define DHCP4_FSM_INIT_REBOOT 7
185#define DHCP4_FSM_REBOOT 8
186#define DHCP4_FSM_REL_INFO 11 /* DHCPv4 の RFC2131 には無い。*/
187#define DHCP4_FSM_SLEEP 12 /* DHCPv4 の RFC2131 には無い。*/
188#define DHCP4_FSM_WAKE 13 /* DHCPv4 の RFC2131 には無い。*/
189
190/* flag の定義 */
191
192#define DHCP4C_FLAG_TMOUT_SND_DISC (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_SND_DISC)
193#define DHCP4C_FLAG_TMOUT_SND_REQ (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_SND_REQ)
194#define DHCP4C_FLAG_TMOUT_SND_REL (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_SND_REL)
195#define DHCP4C_FLAG_TMOUT_RCV_OFFER (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_RCV_OFFER)
196#define DHCP4C_FLAG_TMOUT_RCV_ACK (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_RCV_ACK)
197#define DHCP4C_FLAG_TMOUT_EXPIRE (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_EXPIRE)
198#define DHCP4C_FLAG_TMOUT_RENEW (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_RENEW)
199#define DHCP4C_FLAG_TMOUT_REBIND (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_REBIND)
200#define DHCP4C_FLAG_TMOUT_TIMER UINT_C(0x0010)
201#define DHCP4C_FLAG_TMOUT_TIMER_MASK UINT_C(0x000f)
202#define DHCP4C_FLAG_TMOUT_MASK UINT_C(0x001f)
203
204#define DHCP4C_FLAG_RCV_MSG UINT_C(0x0200)
205#define DHCP4C_FLAG_RENEW UINT_C(0x0400)
206
207/*
208 * 関数シミュレーションマクロ
209 */
210
211/* タイムアウトの計算 */
212
213#define DHCP4C_TMOC(t) (((t)-1000)+dhcp_rand()%2000)
214
215/* 時間比較 */
216
217#define TIMEC_GT(a,b) ((int32_t)((a)-(b))>0)
218#define TIMEC_GE(a,b) ((int32_t)((a)-(b))>=0)
219
220/* 時間定数の変換 */
221
222#define SYSTIM2TIMER(t) (((t)<SYSTIM_HZ/DHCP4C_TIMER_HZ)?(DHCP4C_TIMER_HZ):((t)*DHCP4C_TIMER_HZ)/SYSTIM_HZ)
223#define SYSTIM2SEC(t) (((t)<SYSTIM_HZ)?1:((t)/SYSTIM_HZ))
224#define SEC2TIMER(t) ((t)*DHCP4C_TIMER_HZ)
225#define SEC2SYSTIM(t) ((t)*SYSTIM_HZ)
226
227#endif /* of #ifndef DHCP4_CLI_VAR_H */
Note: See TracBrowser for help on using the repository browser.