source: EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dhcp4_cli_var.h@ 331

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

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 10.3 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 * 上記著作権者
98は,以下の (1)~(4) の条件か,Free Software Foundation
99 * によってå…
100¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
101 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
102 * を改変したものを含む.以下同じ)を使用・複製・改変・再é…
103å¸ƒï¼ˆä»¥ä¸‹ï¼Œ
104 * 利用と呼ぶ)することを無償で許諾する.
105 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
106 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
107 * スコード中に含まれていること.
108 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
109 * 用できる形で再é…
110å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
111å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
112 * 者
113マニュアルなど)に,上記の著作権表示,この利用条件および下記
114 * の無保証規定を掲載すること.
115 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
116 * 用できない形で再é…
117å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこ
118 * と.
119 * (a) 再é…
120å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
121マニュアルなど)に,上記の著
122 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
123 * (b) 再é…
124å¸ƒã®å½¢æ…
125‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
126 * 報告すること.
127 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
128 * 害からも,上記著作権者
129およびTOPPERSプロジェクトをå…
130è²¬ã™ã‚‹ã“と.
131 *
132 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
133お
134 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
135 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
136 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
137 *
138 * @(#) $Id$
139 */
140
141#ifndef DHCP4_CLI_VAR_H
142#define DHCP4_CLI_VAR_H
143
144/*
145 * DHCP クライアントコンテキスト構造体
146 */
147
148/* TIMER の定義 */
149
150#define DHCP4C_TIMER_SND_DISC 0
151#define DHCP4C_TIMER_SND_REQ 1
152#define DHCP4C_TIMER_SND_REL 2
153#define DHCP4C_TIMER_RCV_OFFER 3
154#define DHCP4C_TIMER_RCV_ACK 4
155#define DHCP4C_TIMER_RENEW 5
156#define DHCP4C_TIMER_REBIND 6
157#define DHCP4C_TIMER_EXPIRE 7
158#define NUM_DHCP4C_TIMERS 8
159
160#define DHCP4C_TIMER_HZ 1
161
162typedef struct dhcp4_cli_context {
163 T_DHCP4_CLI_MSG *rcv_lst; /* 受信メッセージ構造体リスト */
164 T_DHCP4_CLI_MSG *val_lst; /* 検証メッセージ構造体リスト */
165 T_DHCP4_CLI_MSG *prf_lst; /* 推奨メッセージ構造体リスト */
166 T_DHCP4_CLI_MSG *snd_msg; /* 送信メッセージ構造体 */
167 T_DHCP4_CLI_MSG *off_msg; /* 通知されたリース・メッセージ構造体 */
168 T_DHCP4_CLI_MSG *act_msg; /* 有効なリース・メッセージ構造体 */
169 T_IF_SOFTC *sc; /* IF のソフトウェア情
170å ± */
171 T_IPV4EP dst; /* 送信å…
172ˆã®IPアドレス/ポート番号 */
173 SYSTIM snd_start; /* 送信を開始した時間 */
174 SYSTIM bind_start; /* BINDを開始した時間 */
175 SYSTIM expire; /* リースの有効時間(ms) */
176 SYSTIM renew; /* RENEW(T1)までの時間(ms) */
177 SYSTIM rebind; /* REBIND(T2)までの時間(ms) */
178 SYSTIM timers[NUM_DHCP4C_TIMERS];
179 /* タイマーé…
180åˆ— */
181 RELTIM interval; /* 送信間隔 */
182 ER_UINT error; /* エラー・データ長 */
183 ID cepid; /* CEP ID */
184 uint32_t xid; /* トランザクション ID */
185 uint16_t flags; /* 各種フラグ */
186 uint16_t max_prefer; /* 受信メッセージの最大推奨度 */
187 uint16_t secs; /* seconds since boot began */
188 uint8_t fsm; /* 現在の状æ…
189‹ */
190 void (* set_addr_callback)(); /* アドレス設定時のコールバック */
191 } T_DHCP4_CLI_CONTEXT;
192
193/* fsm(状æ…
194‹é·ç§»ï¼‰ã®å®šç¾© */
195
196#define DHCP4_FSM_INIT 1
197#define DHCP4_FSM_SELECT 2
198#define DHCP4_FSM_REQUEST 3
199#define DHCP4_FSM_BOUND 4
200#define DHCP4_FSM_RENEW 5
201#define DHCP4_FSM_REBIND 6
202#define DHCP4_FSM_INIT_REBOOT 7
203#define DHCP4_FSM_REBOOT 8
204#define DHCP4_FSM_REL_INFO 11 /* DHCPv4 の RFC2131 には無い。*/
205#define DHCP4_FSM_SLEEP 12 /* DHCPv4 の RFC2131 には無い。*/
206
207/* flag の定義 */
208
209#define DHCP4C_FLAG_TMOUT_SND_DISC (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_SND_DISC)
210#define DHCP4C_FLAG_TMOUT_SND_REQ (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_SND_REQ)
211#define DHCP4C_FLAG_TMOUT_SND_REL (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_SND_REL)
212#define DHCP4C_FLAG_TMOUT_RCV_OFFER (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_RCV_OFFER)
213#define DHCP4C_FLAG_TMOUT_RCV_ACK (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_RCV_ACK)
214#define DHCP4C_FLAG_TMOUT_EXPIRE (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_EXPIRE)
215#define DHCP4C_FLAG_TMOUT_RENEW (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_RENEW)
216#define DHCP4C_FLAG_TMOUT_REBIND (DHCP4C_FLAG_TMOUT_TIMER|DHCP4C_TIMER_REBIND)
217#define DHCP4C_FLAG_TMOUT_TIMER UINT_C(0x0010)
218#define DHCP4C_FLAG_TMOUT_TIMER_MASK UINT_C(0x000f)
219#define DHCP4C_FLAG_TMOUT_MASK UINT_C(0x001f)
220
221#define DHCP4C_FLAG_RCV_MSG UINT_C(0x0200)
222#define DHCP4C_FLAG_RENEW UINT_C(0x0400)
223
224/*
225 * 関数シミュレーションマクロ
226 */
227
228/* タイムアウトの計算 */
229
230#define DHCP4C_TMOC(t) (((t)-1000)+dhcp_rand()%2000)
231
232/* 時間比較 */
233
234#define TIMEC_GT(a,b) ((int32_t)((a)-(b))>0)
235#define TIMEC_GE(a,b) ((int32_t)((a)-(b))>=0)
236
237/* 時間定数の変換 */
238
239#define SYSTIM2TIMER(t) (((t)<SYSTIM_HZ/DHCP4C_TIMER_HZ)?(DHCP4C_TIMER_HZ):((t)*DHCP4C_TIMER_HZ)/SYSTIM_HZ)
240#define SYSTIM2SEC(t) (((t)<SYSTIM_HZ)?1:((t)/SYSTIM_HZ))
241#define SEC2TIMER(t) ((t)*DHCP4C_TIMER_HZ)
242#define SEC2SYSTIM(t) ((t)*SYSTIM_HZ)
243
244#endif /* of #ifndef DHCP4_CLI_VAR_H */
Note: See TracBrowser for help on using the repository browser.