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: dhcp4_cli.h 313 2017-07-23 04:50:32Z coas-nagasima $
|
---|
139 | */
|
---|
140 |
|
---|
141 | #ifndef DHCP4_CLI_H
|
---|
142 | #define DHCP4_CLI_H
|
---|
143 |
|
---|
144 | #include <netapp/dhcp4.h>
|
---|
145 |
|
---|
146 | /*
|
---|
147 | * DHCP ã¯ã©ã¤ã¢ã³ãã®ã¹ã¿ãã¯ãµã¤ãº
|
---|
148 | */
|
---|
149 |
|
---|
150 | #define DHCP4_CLI_STACK_SIZE 1024 /* DHCP ã¯ã©ã¤ã¢ã³ãã¿ã¹ã¯ã®ã¹ã¿ãã¯ãµã¤ãº */
|
---|
151 |
|
---|
152 | /*
|
---|
153 | * DHCP ã¯ã©ã¤ã¢ã³ãã®åªå
|
---|
154 | 度
|
---|
155 | */
|
---|
156 |
|
---|
157 | #define DHCP4_CLI_MAIN_PRIORITY 5 /* DHCP ã¯ã©ã¤ã¢ã³ãã¿ã¹ã¯ã®åªå
|
---|
158 | 度 */
|
---|
159 |
|
---|
160 | /* æ¨å¥¨åº¦ã®å®ç¾© */
|
---|
161 | #define DHCP4_CLI_CFG_PREFER_ADDR 100 /* ã¢ãã¬ã¹ã®æ¨å¥¨åº¦ */
|
---|
162 |
|
---|
163 | /* DHCP ã¯ã©ã¤ã¢ã³ãã¡ãã»ã¼ã¸ã®åä¿¡ãªã¹ããµã¤ãºï¼2以ä¸æå®ãããã¨ï¼ */
|
---|
164 | #define NUM_DHCP4_MSG_LIST 3
|
---|
165 |
|
---|
166 | /*
|
---|
167 | * DHCP ã¯ã©ã¤ã¢ã³ãã¡ãã»ã¼ã¸æ§é ä½æ°ãå¤æ´ç¦æ¢ã
|
---|
168 | * +1 ã¯éä¿¡ç¨
|
---|
169 | */
|
---|
170 | #define NUM_MPF_DHCP4_CLI_MSG (NUM_DHCP4_MSG_LIST+1)
|
---|
171 |
|
---|
172 | /*
|
---|
173 | * ã³ã³ãã¤ã«æã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³
|
---|
174 | */
|
---|
175 |
|
---|
176 | /* DHCP å¿
|
---|
177 | é ãªãã·ã§ã³ãªã¹ã */
|
---|
178 |
|
---|
179 | #ifndef DHCP4_CLI_CFG_REQUIRED_OLIST
|
---|
180 |
|
---|
181 | #define DHCP4_CLI_CFG_REQUIRED_OLIST { \
|
---|
182 | DHCP4_OPT_SUBNET_MASK, \
|
---|
183 | DHCP4_OPT_ROUTER, \
|
---|
184 | }
|
---|
185 |
|
---|
186 | #endif /* of #ifndef DHCP4_CLI_CFG_REQUIRED_OLIST */
|
---|
187 |
|
---|
188 | /* DHCP è¦æ±ãªãã·ã§ã³ãªã¹ã */
|
---|
189 |
|
---|
190 | #ifndef DHCP4_CLI_CFG_REQUEST_OLIST
|
---|
191 |
|
---|
192 | #if defined(USE_RESOLVER)
|
---|
193 |
|
---|
194 | #define DHCP4_CLI_CFG_REQUEST_OLIST { \
|
---|
195 | DHCP4_OPT_DNS_SERVER, \
|
---|
196 | DHCP4_OPT_DOMAIN_NAME, \
|
---|
197 | }
|
---|
198 |
|
---|
199 | #endif /* of #if defined(USE_RESOLVER) */
|
---|
200 |
|
---|
201 | #endif /* of #ifndef DHCP4_CLI_CFG_REQUEST_OLIST */
|
---|
202 |
|
---|
203 | /*
|
---|
204 | * ã¿ã¤ã ã¢ã¦ãå¤
|
---|
205 | */
|
---|
206 |
|
---|
207 | /* åä¿¡ã¿ã¤ã ã¢ã¦ã */
|
---|
208 | #define TMO_DHCP4C_OFFER ULONG_C(120*1000) /* OFFER ã¡ãã»ã¼ã¸ */
|
---|
209 | #define TMO_DHCP4C_ACK ULONG_C(60*1000) /* ACK/NAK ã¡ãã»ã¼ã¸ */
|
---|
210 |
|
---|
211 | /* ãªã¼ã¹æéã®æ¢å®å¤ */
|
---|
212 | #define TMO_DHCP4C_DEF_LEASE ULONG_C(12*60*60*1000) /* æ¨æºæé */
|
---|
213 | #define TMO_DHCP4C_MIN_LEASE ULONG_C(60*1000) /* æå°æé */
|
---|
214 |
|
---|
215 | /* ã¡ãã»ã¼ã¸ã®éä¿¡å¨æ */
|
---|
216 | #define TMO_DHCP4C_INIT_INTVL ULONG_C(3*1000) /* åæå¤ */
|
---|
217 | #define TMO_DHCP4C_MAX_BACKOFF ULONG_C(15*1000) /* å¶éå¤ */
|
---|
218 |
|
---|
219 | /* DHCP ãµã¼ãã¸ã® UDP éä¿¡ã¿ã¤ã ã¢ã¦ã */
|
---|
220 | #define TMO_DHCP4C_UDP_SND ULONG_C(1000)
|
---|
221 |
|
---|
222 | /* ã¡ãã»ã¼ã¸æ§é ä½ç²å¾ã¿ã¤ã ã¢ã¦ã */
|
---|
223 | #define TMO_DHCP4C_MPF_GET ULONG_C(1000)
|
---|
224 |
|
---|
225 | /* ARP è¦æ±ãéä¿¡ãã¦ããã®å¾
|
---|
226 | ã¡æé */
|
---|
227 | #define TMO_DHCP4C_ARP_WAIT ULONG_C(1000)
|
---|
228 |
|
---|
229 | /* RELEASE ã¡ãã»ã¼ã¸ãéä¿¡ãã¦ããã®å¾
|
---|
230 | ã¡æé */
|
---|
231 | #define TMO_DHCP4C_SND_REL_WAIT ULONG_C(1000)
|
---|
232 |
|
---|
233 | #ifndef _MACRO_ONLY
|
---|
234 |
|
---|
235 | #ifdef T_IPV4EP_DEFINED
|
---|
236 |
|
---|
237 | /*
|
---|
238 | * DHCP ã¯ã©ã¤ã¢ã³ãã¡ãã»ã¼ã¸æ§é ä½
|
---|
239 | */
|
---|
240 |
|
---|
241 | typedef struct dhcp4_cli_msg {
|
---|
242 | /* 4ãã¤ãå¢çã«ã¢ã©ã¤ã³ããã*/
|
---|
243 | T_DHCP4_MSG msg; /* DHCP ã¡ãã»ã¼ã¸æ§é ä½ */
|
---|
244 | struct dhcp4_cli_msg *next; /* ãªã¹ãã®æ¬¡ã®ã¡ãã»ã¼ã¸æ§é ä½ */
|
---|
245 | T_IPV4EP srv; /* ãµã¼ãã®IPv4ã¢ãã¬ã¹/ãã¼ãçªå· */
|
---|
246 | uint16_t len; /* msg ã®æå¹é· */
|
---|
247 | uint16_t prefer; /* msg ã®æ¨å¥¨åº¦ */
|
---|
248 | uint8_t type; /* ã¡ãã»ã¼ã¸ã¿ã¤ã */
|
---|
249 | } T_DHCP4_CLI_MSG;
|
---|
250 |
|
---|
251 | #endif /*of #ifdef T_IPV4EP_DEFINED */
|
---|
252 |
|
---|
253 | /*
|
---|
254 | * ã³ã¼ã«ããã¯é¢æ°
|
---|
255 | */
|
---|
256 |
|
---|
257 | extern ER callback_nblk_dhcp4_cli (ID cepid, FN fncd, void *p_parblk);
|
---|
258 |
|
---|
259 | /*
|
---|
260 | * ã¿ã¹ã¯
|
---|
261 | */
|
---|
262 |
|
---|
263 | extern void dhcp4_cli_task(intptr_t exinf);
|
---|
264 |
|
---|
265 | /*
|
---|
266 | * é¢æ°
|
---|
267 | */
|
---|
268 |
|
---|
269 | #ifdef T_IN4_ADDR_DEFINED
|
---|
270 |
|
---|
271 | extern ER dhcp4c_rel_info (void);
|
---|
272 | extern ER dhcp4c_renew_info (void);
|
---|
273 | extern ER dhcp4c_get_info (T_IN4_ADDR *addr, uint32_t *expire, uint32_t *renew,
|
---|
274 | uint32_t *rebind, SYSTIM *bind_start);
|
---|
275 |
|
---|
276 | #endif /* of #ifdef T_IN4_ADDR_DEFINED */
|
---|
277 |
|
---|
278 | #endif /* of #ifndef _MACRO_ONLY */
|
---|
279 |
|
---|
280 | #endif /* of #ifndef DHCP4_CLI_H */
|
---|