1 | /*
|
---|
2 | * TINET (TCP/IP Protocol Stack)
|
---|
3 | *
|
---|
4 | * Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
|
---|
5 | * Tomakomai National College of Technology, JAPAN
|
---|
6 | *
|
---|
7 | * ä¸è¨èä½æ¨©è
|
---|
8 | ã¯ï¼ä»¥ä¸ã® (1)ï½(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
9 | * ã«ãã£ã¦å
|
---|
10 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
11 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
12 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
13 | å¸ï¼ä»¥ä¸ï¼
|
---|
14 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
15 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
16 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
17 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
18 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
19 | * ç¨ã§ããå½¢ã§åé
|
---|
20 | å¸ããå ´åã«ã¯ï¼åé
|
---|
21 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
22 | * è
|
---|
23 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
24 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
25 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
26 | * ç¨ã§ããªãå½¢ã§åé
|
---|
27 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
28 | * (a) åé
|
---|
29 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
30 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
31 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
32 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
33 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
34 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
35 | 責ãããã¨ï¼
|
---|
36 | *
|
---|
37 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
38 | ã
|
---|
39 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
40 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
41 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
42 | *
|
---|
43 | * @(#) $Id: wwws.c 270 2017-02-09 04:03:47Z coas-nagasima $
|
---|
44 | */
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * WWW ãµã¼ã
|
---|
48 | *
|
---|
49 | * ã»éåä¿¡ã¿ã¹ã¯åä¸å
|
---|
50 | * ã»ãã³ããããã³ã°ã³ã¼ã«
|
---|
51 | * ã»çã³ãã¼ API
|
---|
52 | * ã»IPv4/IPv6
|
---|
53 | */
|
---|
54 |
|
---|
55 | #include <stdlib.h>
|
---|
56 | #include <string.h>
|
---|
57 |
|
---|
58 | #ifdef TARGET_KERNEL_ASP
|
---|
59 |
|
---|
60 | #include <kernel.h>
|
---|
61 | #include <sil.h>
|
---|
62 | #include <t_syslog.h>
|
---|
63 | #include "kernel/kernel_impl.h"
|
---|
64 | #include "target_config.h"
|
---|
65 | #include "target_syssvc.h"
|
---|
66 | #include "target_stddef.h"
|
---|
67 | #include "kernel_cfg.h"
|
---|
68 | #include "tinet_cfg.h"
|
---|
69 |
|
---|
70 | #endif /* of #ifdef TARGET_KERNEL_ASP */
|
---|
71 |
|
---|
72 | #ifdef TARGET_KERNEL_JSP
|
---|
73 |
|
---|
74 | #include <s_services.h>
|
---|
75 | #include <t_services.h>
|
---|
76 | #include "kernel_id.h"
|
---|
77 | #include "tinet_id.h"
|
---|
78 |
|
---|
79 | #endif /* of #ifdef TARGET_KERNEL_JSP */
|
---|
80 |
|
---|
81 | #include <tinet_defs.h>
|
---|
82 | #include <tinet_config.h>
|
---|
83 |
|
---|
84 | #include <net/if.h>
|
---|
85 | #include <net/if_ppp.h>
|
---|
86 | #include <net/if_loop.h>
|
---|
87 | #include <net/ethernet.h>
|
---|
88 | #include <net/net.h>
|
---|
89 | #include <net/net_buf.h>
|
---|
90 | #include <net/net_timer.h>
|
---|
91 | #include <net/net_count.h>
|
---|
92 |
|
---|
93 | #include <netinet/in.h>
|
---|
94 | #include <netinet/in_itron.h>
|
---|
95 | #include <netinet/ip.h>
|
---|
96 | #include <netinet/ip6.h>
|
---|
97 | #include <netinet/tcp.h>
|
---|
98 |
|
---|
99 | #include <netapp/netapp_var.h>
|
---|
100 | #include <netapp/wwws.h>
|
---|
101 |
|
---|
102 | #ifdef USE_WWW_SRV
|
---|
103 |
|
---|
104 | /*
|
---|
105 | * éåä¿¡ API ã®é¸æ
|
---|
106 | */
|
---|
107 |
|
---|
108 | #define EOF (-1)
|
---|
109 |
|
---|
110 | typedef struct file {
|
---|
111 | ER (*func)(ID cepid, T_WWW_RWBUF *srbuf);
|
---|
112 | char *uri;
|
---|
113 | } T_FILE;
|
---|
114 |
|
---|
115 | typedef struct status {
|
---|
116 | uint16_t code;
|
---|
117 | uint8_t *reason;
|
---|
118 | } T_STATUS;
|
---|
119 |
|
---|
120 | /*
|
---|
121 | * é¢æ°
|
---|
122 | */
|
---|
123 |
|
---|
124 | static ER index_html(ID cepid, T_WWW_RWBUF *srbuf);
|
---|
125 |
|
---|
126 | #if NET_COUNT_ENABLE
|
---|
127 |
|
---|
128 | static ER stat_html(ID cepid, T_WWW_RWBUF *srbuf);
|
---|
129 |
|
---|
130 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
131 |
|
---|
132 | /*
|
---|
133 | * å
|
---|
134 | ¨åå¤æ°
|
---|
135 | */
|
---|
136 |
|
---|
137 | /* TCP éåä¿¡ã¦ã£ã³ããããã¡ */
|
---|
138 |
|
---|
139 | #ifndef TCP_CFG_SWBUF_CSAVE
|
---|
140 | uint8_t www_srv_swbuf[NUM_WWW_SRV_TASKS][WWW_SRV_SWBUF_SIZE];
|
---|
141 | #endif
|
---|
142 |
|
---|
143 | #ifndef TCP_CFG_RWBUF_CSAVE
|
---|
144 | uint8_t www_srv_rwbuf[NUM_WWW_SRV_TASKS][WWW_SRV_RWBUF_SIZE];
|
---|
145 | #endif
|
---|
146 |
|
---|
147 | /*
|
---|
148 | * å¤æ°
|
---|
149 | */
|
---|
150 |
|
---|
151 | SYSTIM srv_start;
|
---|
152 |
|
---|
153 | static const T_FILE file[] = {
|
---|
154 | { index_html, "/" },
|
---|
155 | { index_html, "/index.html" },
|
---|
156 |
|
---|
157 | #if NET_COUNT_ENABLE
|
---|
158 |
|
---|
159 | { stat_html, "/stat.html" },
|
---|
160 |
|
---|
161 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
162 | };
|
---|
163 |
|
---|
164 | #define NUM_FILES (sizeof(file) / sizeof(T_FILE))
|
---|
165 |
|
---|
166 | static const char *status[] = {
|
---|
167 | "200 OK",
|
---|
168 | "404 Not Found",
|
---|
169 | };
|
---|
170 |
|
---|
171 | #define NUM_STATUS (sizeof(status) / sizeof(T_STATUS))
|
---|
172 |
|
---|
173 | #define ST_OK 0
|
---|
174 | #define ST_NOT_FOUND 1
|
---|
175 |
|
---|
176 | #ifdef USE_COPYSAVE_API
|
---|
177 |
|
---|
178 | /*
|
---|
179 | * get_char -- ä¸æåå
|
---|
180 | ¥åããã
|
---|
181 | */
|
---|
182 |
|
---|
183 | static int_t
|
---|
184 | get_char (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
185 | {
|
---|
186 | int_t len, ch;
|
---|
187 | ER error;
|
---|
188 |
|
---|
189 | if (srbuf->unget) {
|
---|
190 | ch = srbuf->unget;
|
---|
191 | srbuf->unget = 0;
|
---|
192 | }
|
---|
193 | else {
|
---|
194 | if (srbuf->rbuf.index >= srbuf->rbuf.len) {
|
---|
195 | if ((error = tcp_rel_buf(cepid, srbuf->rbuf.len)) != E_OK)
|
---|
196 | syslog(LOG_WARNING, "[WWW:%02d] tcp_rel_buf error: %s",
|
---|
197 | cepid, itron_strerror(error));
|
---|
198 | srbuf->rbuf.index = 0;
|
---|
199 | if ((len = tcp_rcv_buf(cepid, (void**)&srbuf->rbuf.buf, TMO_FEVR)) <= 0) {
|
---|
200 | if (len < 0)
|
---|
201 | syslog(LOG_WARNING, "[WWW:%02d] tcp_rcv_buf error: %s",
|
---|
202 | cepid, itron_strerror(len));
|
---|
203 | srbuf->rbuf.len = 0;
|
---|
204 | return EOF;
|
---|
205 | }
|
---|
206 | else
|
---|
207 | srbuf->rbuf.len = len;
|
---|
208 | }
|
---|
209 | ch = srbuf->rbuf.buf[srbuf->rbuf.index ++];
|
---|
210 | }
|
---|
211 | return ch;
|
---|
212 | }
|
---|
213 |
|
---|
214 | /*
|
---|
215 | * flush_sbuf -- éä¿¡ãããã¡ããã©ãã·ã¥ããã
|
---|
216 | */
|
---|
217 |
|
---|
218 | static ER
|
---|
219 | flush_sbuf (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
220 | {
|
---|
221 | ER_UINT error;
|
---|
222 |
|
---|
223 | error = tcp_snd_buf(cepid, srbuf->sbuf.index);
|
---|
224 | srbuf->sbuf.index = srbuf->sbuf.len = 0;
|
---|
225 |
|
---|
226 | return error;
|
---|
227 | }
|
---|
228 |
|
---|
229 | /*
|
---|
230 | * put_str -- æååãåºåããã
|
---|
231 | */
|
---|
232 |
|
---|
233 | static uint_t
|
---|
234 | put_str (ID cepid, T_WWW_RWBUF *srbuf, const char *str)
|
---|
235 | {
|
---|
236 | ER error;
|
---|
237 | ER_UINT blen;
|
---|
238 | uint16_t len, off = 0;
|
---|
239 |
|
---|
240 | len = strlen(str);
|
---|
241 | while (len > 0) {
|
---|
242 | if (srbuf->sbuf.index >= srbuf->sbuf.len)
|
---|
243 | if ((error = flush_sbuf(cepid, srbuf)) != E_OK) {
|
---|
244 | syslog(LOG_WARNING, "[WWW:%02d] tcp_snd_dat error: %s", cepid, itron_strerror(error));
|
---|
245 | return 0;
|
---|
246 | }
|
---|
247 |
|
---|
248 | if (srbuf->sbuf.len == 0) {
|
---|
249 | if ((blen = tcp_get_buf(cepid, (void**)&srbuf->sbuf.buf, TMO_FEVR)) < 0) {
|
---|
250 | syslog(LOG_WARNING, "[WWW:%02d] tcp_get_buf error: %s", cepid, itron_strerror(srbuf->sbuf.len));
|
---|
251 | return 0;
|
---|
252 | }
|
---|
253 | srbuf->sbuf.len = (uint16_t)blen;
|
---|
254 | }
|
---|
255 |
|
---|
256 | if (len > srbuf->sbuf.len - srbuf->sbuf.index)
|
---|
257 | blen = srbuf->sbuf.len - srbuf->sbuf.index;
|
---|
258 | else
|
---|
259 | blen = len;
|
---|
260 | memcpy(&srbuf->sbuf.buf[srbuf->sbuf.index], str + off, blen);
|
---|
261 | srbuf->sbuf.index += (uint16_t)blen;
|
---|
262 | off += (uint16_t)blen;
|
---|
263 | len -= (uint16_t)blen;
|
---|
264 | }
|
---|
265 |
|
---|
266 | return off;
|
---|
267 | }
|
---|
268 |
|
---|
269 | #else /* of #ifdef USE_COPYSAVE_API */
|
---|
270 |
|
---|
271 | /*
|
---|
272 | * get_char -- ä¸æåå
|
---|
273 | ¥åããã
|
---|
274 | */
|
---|
275 |
|
---|
276 | static int_t
|
---|
277 | get_char (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
278 | {
|
---|
279 | int_t len, ch;
|
---|
280 |
|
---|
281 | if (srbuf->unget) {
|
---|
282 | ch = srbuf->unget;
|
---|
283 | srbuf->unget = 0;
|
---|
284 | }
|
---|
285 | else {
|
---|
286 | if (srbuf->rbuf.index >= srbuf->rbuf.len) {
|
---|
287 | if ((len = tcp_rcv_dat(cepid, srbuf->rbuf.buf, sizeof(srbuf->rbuf.buf), TMO_FEVR)) <= 0) {
|
---|
288 | if (len < 0) {
|
---|
289 | syslog(LOG_WARNING, "[WWW:%02d] tcp_rcv_dat error: %s",
|
---|
290 | cepid, itron_strerror(len));
|
---|
291 | }
|
---|
292 | return EOF;
|
---|
293 | }
|
---|
294 | else {
|
---|
295 | srbuf->rbuf.len = len;
|
---|
296 | srbuf->rbuf.index = 0;
|
---|
297 | }
|
---|
298 | }
|
---|
299 | ch = srbuf->rbuf.buf[srbuf->rbuf.index ++];
|
---|
300 | }
|
---|
301 | return ch;
|
---|
302 | }
|
---|
303 |
|
---|
304 | /*
|
---|
305 | * flush_sbuf -- éä¿¡ãããã¡ããã©ãã·ã¥ããã
|
---|
306 | */
|
---|
307 |
|
---|
308 | static ER
|
---|
309 | flush_sbuf (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
310 | {
|
---|
311 | ER_UINT len = E_OK;
|
---|
312 | uint16_t off = 0;
|
---|
313 |
|
---|
314 | while (off < srbuf->sbuf.index) {
|
---|
315 | if ((len = tcp_snd_dat(cepid, srbuf->sbuf.buf + off, srbuf->sbuf.index - off, TMO_FEVR)) < 0)
|
---|
316 | break;
|
---|
317 | off += len;
|
---|
318 | }
|
---|
319 | srbuf->sbuf.index = 0;
|
---|
320 |
|
---|
321 | return len < 0 ? len : E_OK;
|
---|
322 | }
|
---|
323 |
|
---|
324 | /*
|
---|
325 | * put_str -- æååãåºåããã
|
---|
326 | */
|
---|
327 |
|
---|
328 | static uint16_t
|
---|
329 | put_str (ID cepid, T_WWW_RWBUF *srbuf, const char *str)
|
---|
330 | {
|
---|
331 | ER error;
|
---|
332 | uint16_t blen, len, off = 0;
|
---|
333 |
|
---|
334 | len = strlen(str);
|
---|
335 | while (len > 0) {
|
---|
336 | if (srbuf->sbuf.index >= srbuf->sbuf.len)
|
---|
337 | if ((error = flush_sbuf(cepid, srbuf)) != E_OK) {
|
---|
338 | syslog(LOG_WARNING, "[WWW:%02d] tcp_snd_dat error: %s", cepid, itron_strerror(error));
|
---|
339 | return 0;
|
---|
340 | }
|
---|
341 | if (len > srbuf->sbuf.len - srbuf->sbuf.index)
|
---|
342 | blen = srbuf->sbuf.len - srbuf->sbuf.index;
|
---|
343 | else
|
---|
344 | blen = len;
|
---|
345 | memcpy(&srbuf->sbuf.buf[srbuf->sbuf.index], str + off, blen);
|
---|
346 | srbuf->sbuf.index += blen;
|
---|
347 | off += blen;
|
---|
348 | len -= blen;
|
---|
349 | }
|
---|
350 |
|
---|
351 | return off;
|
---|
352 | }
|
---|
353 |
|
---|
354 | #endif /* of #ifdef USE_COPYSAVE_API */
|
---|
355 |
|
---|
356 | /*
|
---|
357 | * get_line -- ä¸è¡å
|
---|
358 | ¥åããã
|
---|
359 | */
|
---|
360 |
|
---|
361 | static uint16_t
|
---|
362 | get_line (ID cepid, T_WWW_LINE *line, T_WWW_RWBUF *srbuf)
|
---|
363 | {
|
---|
364 | int_t ch = 0;
|
---|
365 | uint16_t len;
|
---|
366 | char *p, *t;
|
---|
367 |
|
---|
368 | p = line->buf;
|
---|
369 | t = line->buf + WWW_LINE_SIZE;
|
---|
370 | while (p < t && (ch = get_char(cepid, srbuf)) != EOF && ch != '\n' && ch != '\r')
|
---|
371 | *p ++ = ch;
|
---|
372 | *p = '\0';
|
---|
373 | len = p - line->buf;
|
---|
374 | if (p >= t) {
|
---|
375 | while ((ch = get_char(cepid, srbuf)) != EOF && ch != '\n' && ch != '\r')
|
---|
376 | len ++;
|
---|
377 | }
|
---|
378 | if (ch == '\r') {
|
---|
379 | len ++;
|
---|
380 | if ((ch = get_char(cepid, srbuf)) != EOF && ch != '\n')
|
---|
381 | srbuf->unget = ch;
|
---|
382 | }
|
---|
383 | if (ch == '\n')
|
---|
384 | len ++;
|
---|
385 | line->len = len;
|
---|
386 | return p - line->buf;
|
---|
387 | }
|
---|
388 |
|
---|
389 | #if NET_COUNT_ENABLE
|
---|
390 |
|
---|
391 | #ifdef _int64_
|
---|
392 | #define VAL_TYPE uint64_t
|
---|
393 | #else
|
---|
394 | #define VAL_TYPE uint32_t
|
---|
395 | #endif
|
---|
396 |
|
---|
397 | /*
|
---|
398 | * convert -- æ°å¤å¤æ
|
---|
399 | */
|
---|
400 |
|
---|
401 | static int_t
|
---|
402 | convert (char *buf, VAL_TYPE val, int_t radix, int_t width, bool_t minus, char padchar)
|
---|
403 | {
|
---|
404 | static const char radhex[] = "0123456789abcdef";
|
---|
405 |
|
---|
406 | char digits[23], *start;
|
---|
407 | int_t ix, pad;
|
---|
408 |
|
---|
409 | ix = 0;
|
---|
410 | start = buf;
|
---|
411 | do {
|
---|
412 | digits[ix ++] = radhex[val % radix];
|
---|
413 | val /= radix;
|
---|
414 | } while (val != 0);
|
---|
415 | if (minus)
|
---|
416 | digits[ix ++] = '-';
|
---|
417 | for (pad = ix; pad < width; pad ++)
|
---|
418 | *buf ++ = padchar;
|
---|
419 | while (ix -- > 0)
|
---|
420 | *buf ++ = digits[ix];
|
---|
421 | *buf = '\0';
|
---|
422 | return buf - start;
|
---|
423 | }
|
---|
424 |
|
---|
425 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
426 |
|
---|
427 | /*
|
---|
428 | * split_fields -- ãã£ã¼ã«ãã«åå²ããã
|
---|
429 | */
|
---|
430 |
|
---|
431 | static void
|
---|
432 | split_fields (T_WWW_LINE *line, char *delim)
|
---|
433 | {
|
---|
434 | char *p, quote;
|
---|
435 | int_t ix = 0;
|
---|
436 |
|
---|
437 | line->off[ix ++] = 0;
|
---|
438 | for (p = line->buf; ix < WWW_NUM_FIELDS && *p; p ++) {
|
---|
439 | if (strchr("\"'`", *p) != NULL) {
|
---|
440 | for (quote = *p ++; *p && *p != quote; p ++)
|
---|
441 | ;
|
---|
442 | }
|
---|
443 | else if (strchr(delim, *p) != NULL) {
|
---|
444 | *p = '\0';
|
---|
445 | line->off[ix ++] = (uint8_t)(p - line->buf + 1);
|
---|
446 | }
|
---|
447 | }
|
---|
448 | line->num = ix;
|
---|
449 | }
|
---|
450 |
|
---|
451 | /*
|
---|
452 | * put_status -- status line ãåºåããã
|
---|
453 | */
|
---|
454 |
|
---|
455 | static uint16_t
|
---|
456 | put_status (ID cepid, T_WWW_RWBUF *srbuf, int_t index)
|
---|
457 | {
|
---|
458 | uint16_t len = 0;
|
---|
459 |
|
---|
460 | len += put_str(cepid, srbuf, "HTTP/1.0 ");
|
---|
461 | len += put_str(cepid, srbuf, status[index]);
|
---|
462 | len += put_str(cepid, srbuf, "\r\n");
|
---|
463 | return len;
|
---|
464 | }
|
---|
465 |
|
---|
466 | /*
|
---|
467 | * put_content_length -- Content-length ãåºåããã
|
---|
468 | */
|
---|
469 |
|
---|
470 | static uint16_t
|
---|
471 | put_content_length (ID cepid, T_WWW_RWBUF *srbuf, int_t content_len)
|
---|
472 | {
|
---|
473 | uint16_t len = 0;
|
---|
474 | #if 0
|
---|
475 | char length[TD_DIGITS + 1];
|
---|
476 |
|
---|
477 | convert(length, content_len, 10, 0, false, ' ');
|
---|
478 | len += put_str(cepid, srbuf, "Content-length: ");
|
---|
479 | len += put_str(cepid, srbuf, length);
|
---|
480 | len += put_str(cepid, srbuf, "\r\n");
|
---|
481 | #endif /* of #if 0 */
|
---|
482 | return len;
|
---|
483 | }
|
---|
484 |
|
---|
485 | /*
|
---|
486 | * get_method -- GET ã¡ã½ããã®å¦ç
|
---|
487 | */
|
---|
488 |
|
---|
489 | static ER
|
---|
490 | get_method (ID cepid, T_WWW_RWBUF *srbuf, T_WWW_LINE *line)
|
---|
491 | {
|
---|
492 | int_t ix;
|
---|
493 |
|
---|
494 | for (ix = NUM_FILES; ix -- > 0; )
|
---|
495 | if (!strcmp(file[ix].uri, &line->buf[line->off[1]])) {
|
---|
496 | return (*file[ix].func)(cepid, srbuf);
|
---|
497 | }
|
---|
498 | put_status(cepid, srbuf, ST_NOT_FOUND);
|
---|
499 | return E_NOEXS;
|
---|
500 | }
|
---|
501 |
|
---|
502 | /*
|
---|
503 | * parse_request -- ãªã¯ã¨ã¹ãã解æããã
|
---|
504 | */
|
---|
505 |
|
---|
506 | static ER
|
---|
507 | parse_request (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
508 | {
|
---|
509 | T_WWW_LINE *method, *line;
|
---|
510 | ER error = E_OK;
|
---|
511 | int_t blen = 0;
|
---|
512 | uint16_t len;
|
---|
513 |
|
---|
514 | if ((error = tget_mpf(MPF_WWW_LINE, (void*)&method, TMO_FEVR)) != E_OK) {
|
---|
515 | syslog(LOG_CRIT, "[WWW:%02d] get line error: %s.",
|
---|
516 | cepid, itron_strerror(error));
|
---|
517 | return error;
|
---|
518 | }
|
---|
519 |
|
---|
520 | if ((len = get_line(cepid, method, srbuf)) == 0) {
|
---|
521 | if ((error = rel_mpf(MPF_WWW_LINE, method)) != E_OK)
|
---|
522 | syslog(LOG_WARNING, "[WWW:%02d] release line buffer error: %s.",
|
---|
523 | cepid, itron_strerror(error));
|
---|
524 | return error;
|
---|
525 | }
|
---|
526 |
|
---|
527 | if ((error = tget_mpf(MPF_WWW_LINE, (void*)&line, TMO_FEVR)) != E_OK) {
|
---|
528 | syslog(LOG_CRIT, "[WWW:%02d] get line buffer error: %s.",
|
---|
529 | cepid, itron_strerror(error));
|
---|
530 | if ((error = rel_mpf(MPF_WWW_LINE, method)) != E_OK)
|
---|
531 | syslog(LOG_WARNING, "[WWW:%02d] release line buffer error: %s.",
|
---|
532 | cepid, itron_strerror(error));
|
---|
533 | return error;
|
---|
534 | }
|
---|
535 |
|
---|
536 | while ((len = get_line(cepid, line, srbuf)) > 0) { /* ããããã¹ãããããã*/
|
---|
537 | split_fields(line, ": ");
|
---|
538 | if (strcmp("Content-Length", &line->buf[line->off[0]]) == 0)
|
---|
539 | blen = atoi(&line->buf[line->off[1]]);
|
---|
540 | }
|
---|
541 | while (blen > 0 && (len = get_line(cepid, line, srbuf)) > 0) {
|
---|
542 | /* ã¨ã³ãã£ãã£ã»ããã£ãã¹ãããããã*/
|
---|
543 | blen -= line->len;
|
---|
544 | }
|
---|
545 |
|
---|
546 | if ((error = rel_mpf(MPF_WWW_LINE, line)) != E_OK)
|
---|
547 | syslog(LOG_WARNING, "[WWW:%02d] release line buffer error: %s.",
|
---|
548 | cepid, itron_strerror(error));
|
---|
549 |
|
---|
550 | split_fields(method, ": ");
|
---|
551 | if (!strcmp(&method->buf[method->off[0]], "GET"))
|
---|
552 | error = get_method(cepid, srbuf, method);
|
---|
553 |
|
---|
554 | flush_sbuf(cepid, srbuf);
|
---|
555 |
|
---|
556 | if ((error = rel_mpf(MPF_WWW_LINE, method)) != E_OK)
|
---|
557 | syslog(LOG_WARNING, "[WWW:%02d] release line buffer error: %s.",
|
---|
558 | cepid, itron_strerror(error));
|
---|
559 |
|
---|
560 | return error;
|
---|
561 | }
|
---|
562 |
|
---|
563 | /*
|
---|
564 | * index_html -- /index.html ãã¡ã¤ã«
|
---|
565 | */
|
---|
566 |
|
---|
567 | static ER
|
---|
568 | index_html (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
569 | {
|
---|
570 | static const char response[] =
|
---|
571 | "\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD html 3.2//EN\">\r\n"
|
---|
572 | "<html><head>\r\n"
|
---|
573 |
|
---|
574 | #ifdef TOPPERS_S810_CLG3_85
|
---|
575 | "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Shift_JIS\">\r\n"
|
---|
576 | #else
|
---|
577 | "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=EUC-JP\">\r\n"
|
---|
578 | #endif
|
---|
579 |
|
---|
580 | "<title>TINET TCP/IP Protocol Stack</title>\r\n"
|
---|
581 | "</head><body bgcolor=\"#ffffbb\">\r\n"
|
---|
582 | "<hr>ãã® WWW ãµã¼ãã¯<br>"
|
---|
583 |
|
---|
584 | #ifdef TARGET_KERNEL_ASP
|
---|
585 | "ASP Kernel Release 1.3 (patchlevel = 2) for " TARGET_NAME " (" __DATE__ "," __TIME__ ") ã¨<br>\r\n"
|
---|
586 | #endif
|
---|
587 |
|
---|
588 | #ifdef TARGET_KERNEL_JSP
|
---|
589 | "JSP Kernel Release 1.4 (patchlevel = 3) for " TARGET_NAME " (" __DATE__ "," __TIME__ ") ã¨<br>\r\n"
|
---|
590 | #endif
|
---|
591 |
|
---|
592 | "TINET TCP/IP ãããã³ã«ã¹ã¿ãã¯ã«ãããµã¼ãã¹ãã¦ãã¾ãã<br><hr>\r\n"
|
---|
593 | "<ul><li type=\"square\"><a href=\"stat.html\">ãããã¯ã¼ã¯çµ±è¨æ
|
---|
594 | å ±</a></ul><hr>\r\n"
|
---|
595 | "FreeBSD: Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995<br>\r\n"
|
---|
596 | "The Regents of the University of California. All rights reserved.<br><br>\r\n"
|
---|
597 |
|
---|
598 | #ifdef SUPPORT_PPP
|
---|
599 |
|
---|
600 | "pppd: Copyright (c) 1989 Carnegie Mellon University.<br>\r\n"
|
---|
601 | "All rights reserved.<br><br>\r\n"
|
---|
602 | "ppp: Written by Toshiharu OHNO (tony-o@iij.ad.jp)<br>\r\n"
|
---|
603 | "Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.<br><br>\r\n"
|
---|
604 |
|
---|
605 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
606 |
|
---|
607 | #ifdef SUPPORT_ETHER
|
---|
608 |
|
---|
609 | "if_ed: Copyright (c) 1995, David Greenman<br>\r\n"
|
---|
610 | "All rights reserved.<br><br>\r\n"
|
---|
611 |
|
---|
612 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
613 |
|
---|
614 | #ifdef TARGET_KERNEL_ASP
|
---|
615 | "TOPPERS/ASP Kernel<br>\r\n"
|
---|
616 | "Toyohashi Open Platform for Embedded Real-Time Systems/<br>\r\n"
|
---|
617 | "Advanced Standard Profile Kernel<br>\r\n"
|
---|
618 | "Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory<br>\r\n"
|
---|
619 | "Toyohashi Univ. of Technology, JAPAN<br>\r\n"
|
---|
620 | "Copyright (C) 2004-2008 by Embedded and Real-Time Systems Laboratory<br>\r\n"
|
---|
621 | "Graduate School of Information Science, Nagoya Univ., JAPAN<br><br>\r\n"
|
---|
622 | #endif /* of #ifdef TARGET_KERNEL_ASP */
|
---|
623 |
|
---|
624 | #ifdef TARGET_KERNEL_JSP
|
---|
625 | "TOPPERS/JSP Kernel<br>\r\n"
|
---|
626 | "Toyohashi Open Platform for Embedded Real-Time Systems/<br>\r\n"
|
---|
627 | "Just Standard Profile Kernel<br>\r\n"
|
---|
628 | "Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory<br>\r\n"
|
---|
629 | "Toyohashi Univ. of Technology, JAPAN<br>\r\n"
|
---|
630 | "Copyright (C) 2005 by Embedded and Real-Time Systems Laboratory<br>\r\n"
|
---|
631 | "Graduate School of Information Science, Nagoya Univ., JAPAN<br><br>\r\n"
|
---|
632 | #endif /* of #ifdef TARGET_KERNEL_JSP */
|
---|
633 |
|
---|
634 | "TINET (TCP/IP Protocol Stack)<br>\r\n"
|
---|
635 | "Copyright (C) 2001-2008 by Dep. of Computer Science and Engineering<br>\r\n"
|
---|
636 | "Tomakomai National College of Technology, JAPAN\r\n"
|
---|
637 | "</body></html>\r\n"
|
---|
638 | ;
|
---|
639 |
|
---|
640 | SYSTIM start, finish;
|
---|
641 | uint16_t len = 0;
|
---|
642 |
|
---|
643 | get_tim(&start);
|
---|
644 | len += put_status(cepid, srbuf, ST_OK);
|
---|
645 | len += put_content_length(cepid, srbuf, strlen(response) - 2); /* 2 ã¯æåã® \r\n */
|
---|
646 | len += put_str(cepid, srbuf, response);
|
---|
647 | get_tim(&finish);
|
---|
648 | syslog(LOG_NOTICE, "[WWW:%02u] send: index.html, len: %4u, time: %lu [ms]",
|
---|
649 | cepid, len, (finish - start) * 1000 / SYSTIM_HZ);
|
---|
650 | return E_OK;
|
---|
651 | }
|
---|
652 |
|
---|
653 | #if NET_COUNT_ENABLE
|
---|
654 |
|
---|
655 | #define TD_TEMPLATE1 "<tr><td></td><td align=\"right\"></td>\r\n<td align=\"right\"></td>\r\n<td align=\"right\"></td>\r\n<td align=\"right\"></td>\r\n<td align=\"right\"></td>\r\n<td align=\"right\"></td></tr>\r\n"
|
---|
656 | #define TD_TEMPLATE2 "<tr><td></td><td align=\"right\"></td><td align=\"right\"></td></tr>\r\n"
|
---|
657 | #define TD_TEMPLATE3 "<tr><td></td><td align=\"right\"></td></tr>\r\n"
|
---|
658 | #define TD_TEMPLATE4 "<tr><td></td><td align=\"right\"></td><td align=\"right\"></td><td align=\"right\"></td></tr>\r\n"
|
---|
659 |
|
---|
660 | #define TD_LEN1(i) (sizeof(i) + sizeof(TD_TEMPLATE1) + TD_DIGITS * 6 - 2)
|
---|
661 | #define TD_LEN2(i) (sizeof(i) + sizeof(TD_TEMPLATE2) + TD_DIGITS * 2 - 2)
|
---|
662 | #define TD_LEN4(i) (sizeof(i) + sizeof(TD_TEMPLATE4) + TD_DIGITS * 3 - 2)
|
---|
663 | #define TD_DIGITS 20
|
---|
664 |
|
---|
665 | static const char time_prefix[] =
|
---|
666 | "çµéæé: "
|
---|
667 | ;
|
---|
668 |
|
---|
669 | static const char time_suffix[] =
|
---|
670 | "<hr>\r\n"
|
---|
671 | ;
|
---|
672 |
|
---|
673 | static const char table_suffix[] = "</table><br><hr>";
|
---|
674 |
|
---|
675 | #if defined(SUPPORT_INET4)
|
---|
676 |
|
---|
677 | static const char table_prefix_ip4[] =
|
---|
678 | "<h2>IPv4</h2><table border>\r\n"
|
---|
679 | "<tr><th>é
|
---|
680 | ç®</th><th>ã«ã¦ã³ã</th></tr>\r\n"
|
---|
681 | ;
|
---|
682 |
|
---|
683 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
684 |
|
---|
685 | #if defined(SUPPORT_INET6)
|
---|
686 |
|
---|
687 | static const char table_prefix_ip6[] =
|
---|
688 | "<h2>IPv6</h2><table border>\r\n"
|
---|
689 | "<tr><th>é
|
---|
690 | ç®</th><th>ã«ã¦ã³ã</th></tr>\r\n"
|
---|
691 | ;
|
---|
692 |
|
---|
693 | static const char table_prefix_icmp6[] =
|
---|
694 | "<h2>ICMPv6</h2><table border>\r\n"
|
---|
695 | "<tr><th>é
|
---|
696 | ç®</th><th>ã«ã¦ã³ã</th></tr>\r\n"
|
---|
697 | ;
|
---|
698 |
|
---|
699 | static const char table_prefix_nd6[] =
|
---|
700 | "<h2>è¿é£æ¢ç´¢</h2><table border>\r\n"
|
---|
701 | "<tr><th>é
|
---|
702 | ç®</th><th>ã«ã¦ã³ã</th></tr>\r\n"
|
---|
703 | ;
|
---|
704 |
|
---|
705 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
706 |
|
---|
707 | static const char table_prefix_tcp[] =
|
---|
708 | "<h2>TCP</h2><table border>\r\n"
|
---|
709 | "<tr><th>é
|
---|
710 | ç®</th><th>ã«ã¦ã³ã</th></tr>\r\n"
|
---|
711 | ;
|
---|
712 |
|
---|
713 | static const char table_prefix_net_buf[] =
|
---|
714 | "<h2>ãããã¯ã¼ã¯ãããã¡</h2><table border>\r\n"
|
---|
715 | "<tr><th>ãµã¤ãº</th>"
|
---|
716 | "<th>ç¨ææ°</th>"
|
---|
717 | "<th>å²å½è¦æ±æ°</th>"
|
---|
718 | "<th>å²å½æ°</th>"
|
---|
719 | "<th>å²å½ã¦<br>ã¨ã©ã¼æ°</th></tr>\r\n"
|
---|
720 | ;
|
---|
721 |
|
---|
722 | #ifdef SUPPORT_PPP
|
---|
723 |
|
---|
724 | static const char table_prefix_ppp[] =
|
---|
725 | "<h2>PPP ãããã¯ã¼ã¯ã¤ã³ã¿ãã§ã¼ã¹</h2><table border>\r\n"
|
---|
726 | "<tr><th>é
|
---|
727 | ç®</th><th>ã«ã¦ã³ã</th></tr>\r\n"
|
---|
728 | ;
|
---|
729 |
|
---|
730 | static const char *ppp_item[NC_PPP_SIZE] = {
|
---|
731 | "åä¿¡ãªã¯ãããæ°",
|
---|
732 | "éä¿¡ãªã¯ãããæ°",
|
---|
733 | "åä¿¡ãã¬ã¼ã æ°",
|
---|
734 | "éä¿¡ãã¬ã¼ã æ°",
|
---|
735 | "åä¿¡ã¨ã©ã¼ãã¬ã¼ã æ°",
|
---|
736 | "éä¿¡ã¨ã©ã¼ãã¬ã¼ã æ°",
|
---|
737 | "ãããã¡å²ãå½ã¦å¤±ææ°",
|
---|
738 | };
|
---|
739 |
|
---|
740 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
741 |
|
---|
742 | #ifdef SUPPORT_ETHER
|
---|
743 |
|
---|
744 | static const char table_prefix_ether_nic[] =
|
---|
745 | "<h2>ã¤ã¼ãµãããã»ãããã¯ã¼ã¯ã¤ã³ã¿ãã§ã¼ã¹</h2><table border>\r\n"
|
---|
746 | "<tr><th>é
|
---|
747 | ç®</th><th>ã«ã¦ã³ã</th></tr>\r\n"
|
---|
748 | ;
|
---|
749 |
|
---|
750 | static const char *ether_nic_item[NC_ETHER_NIC_SIZE] = {
|
---|
751 | "ãªã»ããæ°",
|
---|
752 | "éä¿¡ã»ããã©è³æºè¿å´ãªã¼ãã¼æ°",
|
---|
753 | "éä¿¡ã¿ã¤ã ã¢ã¦ãæ°",
|
---|
754 | "è¡çªæ°",
|
---|
755 | "éä¿¡ã¨ã©ã¼ãã¬ã¼ã æ°",
|
---|
756 | "éä¿¡ãã¬ã¼ã æ°",
|
---|
757 | "éä¿¡ãªã¯ãããæ°",
|
---|
758 | "åä¿¡ã»ããã©è³æºè¿å´ãªã¼ãã¼æ°",
|
---|
759 | "åä¿¡ãããã¡å²ãå½ã¦å¤±ææ°",
|
---|
760 | "åä¿¡ã¨ã©ã¼ãã¬ã¼ã æ°",
|
---|
761 | "åä¿¡ãã¬ã¼ã æ°",
|
---|
762 | "åä¿¡ãªã¯ãããæ°",
|
---|
763 | };
|
---|
764 |
|
---|
765 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
766 |
|
---|
767 | #if defined(SUPPORT_INET4)
|
---|
768 |
|
---|
769 | static const char *ip4_item[NC_IP4_SIZE] = {
|
---|
770 | "åå²éä¿¡ããã©ã°ã¡ã³ãæ°",
|
---|
771 | "åå²éä¿¡æ°",
|
---|
772 | "éä¿¡ã¨ã©ã¼ãã¼ã¿ã°ã©ã æ°",
|
---|
773 | "éä¿¡ãã¼ã¿ã°ã©ã æ°",
|
---|
774 | "éä¿¡ãªã¯ãããæ°",
|
---|
775 | "åå²åä¿¡ã¿ã¤ã ã¢ã¦ãæ°",
|
---|
776 | "åå²åä¿¡ãããã¡å²ãå½ã¦å¤±ææ°",
|
---|
777 | "åå²åä¿¡ç ´æ£æ°",
|
---|
778 | "åå²åä¿¡åæ§ææåæ°",
|
---|
779 | "åå²åä¿¡ãã©ã°ã¡ã³ãæ°",
|
---|
780 | "åå²åä¿¡æ°",
|
---|
781 | "ãªãã·ã§ã³å
|
---|
782 | ¥åæ°",
|
---|
783 | "ãããã³ã«ã¨ã©ã¼æ°",
|
---|
784 | "ã¢ãã¬ã¹ã¨ã©ã¼æ°",
|
---|
785 | "ãã¼ã¸ã§ã³ã¨ã©ã¼æ°",
|
---|
786 | "é·ãã¨ã©ã¼æ°",
|
---|
787 | "ãã§ãã¯ãµã ã¨ã©ã¼æ°",
|
---|
788 | "åä¿¡ã¨ã©ã¼ãã¼ã¿ã°ã©ã æ°",
|
---|
789 | "åä¿¡ãã¼ã¿ã°ã©ã æ°",
|
---|
790 | "åä¿¡ãªã¯ãããæ°",
|
---|
791 | };
|
---|
792 |
|
---|
793 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
794 |
|
---|
795 | #if defined(SUPPORT_INET6)
|
---|
796 |
|
---|
797 | static const char *ip6_item[NC_IP6_SIZE] = {
|
---|
798 | "åå²éä¿¡ããã©ã°ã¡ã³ãæ°",
|
---|
799 | "åå²éä¿¡æ°",
|
---|
800 | "éä¿¡ã¨ã©ã¼ãã¼ã¿ã°ã©ã æ°",
|
---|
801 | "éä¿¡ãã¼ã¿ã°ã©ã æ°",
|
---|
802 | "éä¿¡ãªã¯ãããæ° ",
|
---|
803 | "åå²åä¿¡ã¿ã¤ã ã¢ã¦ãæ°",
|
---|
804 | "åå²åä¿¡ãããã¡å²ãå½ã¦å¤±ææ°",
|
---|
805 | "åå²åä¿¡ç ´æ£æ°",
|
---|
806 | "åå²åä¿¡åæ§ææåæ°",
|
---|
807 | "åå²åä¿¡ãã©ã°ã¡ã³ãæ°",
|
---|
808 | "åå²åä¿¡æ°",
|
---|
809 | "ãããã³ã«ã¨ã©ã¼æ° ",
|
---|
810 | "ã¢ãã¬ã¹ã¨ã©ã¼æ° ",
|
---|
811 | "ãã¼ã¸ã§ã³ã¨ã©ã¼æ° ",
|
---|
812 | "é·ãã¨ã©ã¼æ°",
|
---|
813 | "åä¿¡ã¨ã©ã¼ãã¼ã¿ã°ã©ã æ°",
|
---|
814 | "åä¿¡ãã¼ã¿ã°ã©ã æ°",
|
---|
815 | "åä¿¡ãªã¯ãããæ° ",
|
---|
816 | };
|
---|
817 |
|
---|
818 | static const char *icmp6_item[NC_ICMP6_SIZE] = {
|
---|
819 | "éä¿¡ã¨ã©ã¼ ICMP ãã¼ã¿æ° ",
|
---|
820 | "éä¿¡ ICMP ãã¼ã¿æ°",
|
---|
821 | "éä¿¡ ICMP ãªã¯ãããæ°",
|
---|
822 | "é·ãã¨ã©ã¼æ°",
|
---|
823 | "åä¿¡ã¨ã©ã¼ ICMP ãã¼ã¿æ° ",
|
---|
824 | "åä¿¡ ICMP ãã¼ã¿æ°",
|
---|
825 | "åä¿¡ ICMP ãªã¯ãããæ°",
|
---|
826 | };
|
---|
827 |
|
---|
828 | static const char *nd6_item[NC_ND6_SIZE] = {
|
---|
829 | "éè¤ã¢ãã¬ã¹æ¤åºéä¿¡æ°",
|
---|
830 | "è¿é£è¦è«éä¿¡æ°",
|
---|
831 | "è¿é£è¦è«åä¿¡æ°",
|
---|
832 | "è¿é£éç¥éä¿¡æ°",
|
---|
833 | "è¿é£éç¥åä¿¡æ°",
|
---|
834 | "ã«ã¼ã¿è¦è«åºåæ°",
|
---|
835 | "ã«ã¼ã¿éç¥åä¿¡æ°",
|
---|
836 | };
|
---|
837 |
|
---|
838 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
839 |
|
---|
840 | static const char *tcp_item[NC_TCP_SIZE] = {
|
---|
841 | "è½åãªã¼ãã³æ°",
|
---|
842 | "ååãªã¼ãã³æ°",
|
---|
843 | "RTT æ´æ°æ°",
|
---|
844 | "éä¿¡ RST æ°",
|
---|
845 | "éä¿¡ ACK æ°",
|
---|
846 | "éä¿¡ç·æ¥ã»ã°ã¡ã³ãæ°",
|
---|
847 | "éä¿¡ãã¼ã¿ã»ã°ã¡ã³ãæ°",
|
---|
848 | "åéã»ã°ã¡ã³ãæ°",
|
---|
849 | "éä¿¡ã»ã°ã¡ã³ãæ°",
|
---|
850 | "éä¿¡å¶å¾¡ã»ã°ã¡ã³ãæ°",
|
---|
851 | "éä¿¡ãã¼ã¿ãªã¯ãããæ°",
|
---|
852 | "åä¿¡ãã¥ã¼è§£æ¾æ°",
|
---|
853 | "åä¿¡å¤éæ°",
|
---|
854 | "åä¿¡ç ´æ£æ°",
|
---|
855 | "åä¿¡ RST æ°",
|
---|
856 | "åä¿¡å¤é ACK æ°",
|
---|
857 | "åä¿¡ ACK æ°",
|
---|
858 | "åä¿¡ãã§ãã¯ãµã ä¸æ£æ°",
|
---|
859 | "åä¿¡ãããä¸æ£æ°",
|
---|
860 | "åä¿¡ç·æ¥ã»ã°ã¡ã³ãæ°",
|
---|
861 | "åä¿¡ãã¼ã¿ã»ã°ã¡ã³ãæ°",
|
---|
862 | "åä¿¡ã»ã°ã¡ã³ãæ°",
|
---|
863 | "åä¿¡ãã¼ã¿ãªã¯ãããæ°",
|
---|
864 | "åä¿¡ãªã¯ãããæ°",
|
---|
865 | };
|
---|
866 |
|
---|
867 | /*
|
---|
868 | * put_count_item1 -- ã«ã¦ã³ã¿ã®å
|
---|
869 | 容ãåºåãããã°ã«ã¼ã 1
|
---|
870 | */
|
---|
871 |
|
---|
872 | static uint16_t
|
---|
873 | put_count_item1 (ID cepid, T_WWW_RWBUF *srbuf, const char *item, T_NET_COUNT *counter)
|
---|
874 | {
|
---|
875 | char buf[TD_DIGITS + 1];
|
---|
876 | uint16_t len = 0;
|
---|
877 |
|
---|
878 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
879 | len += put_str(cepid, srbuf, item);
|
---|
880 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
881 |
|
---|
882 | convert(buf, counter->in_octets, 10, TD_DIGITS, false, ' ');
|
---|
883 | len += put_str(cepid, srbuf, buf);
|
---|
884 | len += put_str(cepid, srbuf, "</td>\r\n<td align=\"right\">");
|
---|
885 |
|
---|
886 | convert(buf, counter->out_octets, 10, TD_DIGITS, false, ' ');
|
---|
887 | len += put_str(cepid, srbuf, buf);
|
---|
888 | len += put_str(cepid, srbuf, "</td>\r\n<td align=\"right\">");
|
---|
889 |
|
---|
890 | convert(buf, counter->in_packets, 10, TD_DIGITS, false, ' ');
|
---|
891 | len += put_str(cepid, srbuf, buf);
|
---|
892 | len += put_str(cepid, srbuf, "</td>\r\n<td align=\"right\">");
|
---|
893 |
|
---|
894 | convert(buf, counter->out_packets, 10, TD_DIGITS, false, ' ');
|
---|
895 | len += put_str(cepid, srbuf, buf);
|
---|
896 | len += put_str(cepid, srbuf, "</td>\r\n<td align=\"right\">");
|
---|
897 |
|
---|
898 | convert(buf, counter->in_err_packets, 10, TD_DIGITS, false, ' ');
|
---|
899 | len += put_str(cepid, srbuf, buf);
|
---|
900 | len += put_str(cepid, srbuf, "</td>\r\n<td align=\"right\">");
|
---|
901 |
|
---|
902 | convert(buf, counter->out_err_packets, 10, TD_DIGITS, false, ' ');
|
---|
903 | len += put_str(cepid, srbuf, buf);
|
---|
904 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
905 |
|
---|
906 | return len;
|
---|
907 | }
|
---|
908 |
|
---|
909 | #ifdef SUPPORT_PPP
|
---|
910 |
|
---|
911 | /*
|
---|
912 | * put_count_item2 -- ã«ã¦ã³ã¿ã®å
|
---|
913 | 容ãåºåãããã°ã«ã¼ã 2
|
---|
914 | */
|
---|
915 |
|
---|
916 | static uint16_t
|
---|
917 | put_count_item2 (ID cepid, T_WWW_RWBUF *srbuf, const char *item, uint32_t octets, uint32_t packets)
|
---|
918 | {
|
---|
919 | char buf[TD_DIGITS + 1];
|
---|
920 | uint16_t len = 0;
|
---|
921 |
|
---|
922 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
923 | len += put_str(cepid, srbuf, item);
|
---|
924 | len += put_str(cepid, srbuf, "</td><td>");
|
---|
925 |
|
---|
926 | convert(buf, octets, 10, TD_DIGITS, false, ' ');
|
---|
927 | len += put_str(cepid, srbuf, buf);
|
---|
928 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
929 |
|
---|
930 | convert(buf, packets, 10, TD_DIGITS, false, ' ');
|
---|
931 | len += put_str(cepid, srbuf, buf);
|
---|
932 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
933 |
|
---|
934 | return len;
|
---|
935 | }
|
---|
936 |
|
---|
937 | /*
|
---|
938 | * td_len_ppp -- put_count_ppp ã§åºåããæåæ°ã
|
---|
939 | */
|
---|
940 |
|
---|
941 | static uint16_t
|
---|
942 | td_len_ppp (void)
|
---|
943 | {
|
---|
944 | int_t ix;
|
---|
945 | uint16_t len = 0;
|
---|
946 |
|
---|
947 | for (ix = NC_PPP_SIZE; ix -- > 0; )
|
---|
948 | len += strlen(ppp_item[ix]);
|
---|
949 | return len + (sizeof(TD_TEMPLATE3) + TD_DIGITS - 1) * NC_PPP_SIZE;
|
---|
950 | }
|
---|
951 |
|
---|
952 | /*
|
---|
953 | * put_count_ppp -- ã«ã¦ã³ã¿ (PPP) ã®å
|
---|
954 | 容ãåºåããã
|
---|
955 | */
|
---|
956 |
|
---|
957 | static uint16_t
|
---|
958 | put_count_ppp (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
959 | {
|
---|
960 |
|
---|
961 | char buf[TD_DIGITS + 1];
|
---|
962 | uint16_t len = 0;
|
---|
963 |
|
---|
964 | len += put_str(cepid, srbuf, table_prefix_ppp);
|
---|
965 |
|
---|
966 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
967 | len += put_str(cepid, srbuf, ppp_item[0]);
|
---|
968 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
969 | convert(buf, net_count_ppp.in_octets, 10, TD_DIGITS, false, ' ');
|
---|
970 | len += put_str(cepid, srbuf, buf);
|
---|
971 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
972 |
|
---|
973 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
974 | len += put_str(cepid, srbuf, ppp_item[1]);
|
---|
975 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
976 | convert(buf, net_count_ppp.out_octets, 10, TD_DIGITS, false, ' ');
|
---|
977 | len += put_str(cepid, srbuf, buf);
|
---|
978 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
979 |
|
---|
980 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
981 | len += put_str(cepid, srbuf, ppp_item[2]);
|
---|
982 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
983 | convert(buf, net_count_ppp.in_packets, 10, TD_DIGITS, false, ' ');
|
---|
984 | len += put_str(cepid, srbuf, buf);
|
---|
985 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
986 |
|
---|
987 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
988 | len += put_str(cepid, srbuf, ppp_item[3]);
|
---|
989 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
990 | convert(buf, net_count_ppp.out_packets, 10, TD_DIGITS, false, ' ');
|
---|
991 | len += put_str(cepid, srbuf, buf);
|
---|
992 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
993 |
|
---|
994 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
995 | len += put_str(cepid, srbuf, ppp_item[4]);
|
---|
996 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
997 | convert(buf, net_count_ppp.in_err_packets, 10, TD_DIGITS, false, ' ');
|
---|
998 | len += put_str(cepid, srbuf, buf);
|
---|
999 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1000 |
|
---|
1001 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
1002 | len += put_str(cepid, srbuf, ppp_item[5]);
|
---|
1003 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1004 | convert(buf, net_count_ppp.out_err_packets, 10, TD_DIGITS, false, ' ');
|
---|
1005 | len += put_str(cepid, srbuf, buf);
|
---|
1006 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1007 |
|
---|
1008 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
1009 | len += put_str(cepid, srbuf, ppp_item[6]);
|
---|
1010 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1011 | convert(buf, net_count_ppp_no_bufs, 10, TD_DIGITS, false, ' ');
|
---|
1012 | len += put_str(cepid, srbuf, buf);
|
---|
1013 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1014 |
|
---|
1015 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1016 |
|
---|
1017 | return len;
|
---|
1018 | }
|
---|
1019 |
|
---|
1020 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
1021 |
|
---|
1022 | #if defined(SUPPORT_INET4)
|
---|
1023 |
|
---|
1024 | /*
|
---|
1025 | * td_len_ip4 -- put_count_ip4 ã§åºåããæåæ°ã
|
---|
1026 | */
|
---|
1027 |
|
---|
1028 | static uint16_t
|
---|
1029 | td_len_ip4 (void)
|
---|
1030 | {
|
---|
1031 | int_t ix;
|
---|
1032 | uint16_t len = 0;
|
---|
1033 |
|
---|
1034 | for (ix = NC_IP4_SIZE; ix -- > 0; )
|
---|
1035 | len += strlen(ip4_item[ix]);
|
---|
1036 | return len + (sizeof(TD_TEMPLATE3) + TD_DIGITS - 1) * NC_IP4_SIZE;
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 | /*
|
---|
1040 | * put_count_ip4 -- ã«ã¦ã³ã¿ (IP4) ã®å
|
---|
1041 | 容ãåºåããã
|
---|
1042 | */
|
---|
1043 |
|
---|
1044 | static uint16_t
|
---|
1045 | put_count_ip4 (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
1046 | {
|
---|
1047 | char buf[TD_DIGITS + 1];
|
---|
1048 | uint16_t len = 0;
|
---|
1049 | int_t ix;
|
---|
1050 |
|
---|
1051 | len += put_str(cepid, srbuf, table_prefix_ip4);
|
---|
1052 | for (ix = NC_IP4_SIZE; ix -- > 0; ) {
|
---|
1053 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
1054 | len += put_str(cepid, srbuf, ip4_item[ix]);
|
---|
1055 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1056 | convert(buf, net_count_ip4[ix], 10, TD_DIGITS, false, ' ');
|
---|
1057 | len += put_str(cepid, srbuf, buf);
|
---|
1058 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1059 | }
|
---|
1060 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1061 |
|
---|
1062 | return len;
|
---|
1063 | }
|
---|
1064 |
|
---|
1065 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1066 |
|
---|
1067 | #if defined(SUPPORT_INET6)
|
---|
1068 |
|
---|
1069 | /*
|
---|
1070 | * td_len_nd6 -- put_count_nd6 ã§åºåããæåæ°ã
|
---|
1071 | */
|
---|
1072 |
|
---|
1073 | static uint16_t
|
---|
1074 | td_len_nd6 (void)
|
---|
1075 | {
|
---|
1076 | int_t ix;
|
---|
1077 | uint16_t len = 0;
|
---|
1078 |
|
---|
1079 | for (ix = NC_ND6_SIZE; ix -- > 0; )
|
---|
1080 | len += strlen(nd6_item[ix]);
|
---|
1081 | return len + (sizeof(TD_TEMPLATE3) + TD_DIGITS - 1) * NC_ND6_SIZE;
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 | /*
|
---|
1085 | * put_count_nd6 -- ã«ã¦ã³ã¿ (ND6) ã®å
|
---|
1086 | 容ãåºåããã
|
---|
1087 | */
|
---|
1088 |
|
---|
1089 | static uint16_t
|
---|
1090 | put_count_nd6 (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
1091 | {
|
---|
1092 | char buf[TD_DIGITS + 1];
|
---|
1093 | uint16_t len = 0;
|
---|
1094 | int_t ix;
|
---|
1095 |
|
---|
1096 | len += put_str(cepid, srbuf, table_prefix_nd6);
|
---|
1097 | for (ix = NC_ND6_SIZE; ix -- > 0; ) {
|
---|
1098 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
1099 | len += put_str(cepid, srbuf, nd6_item[ix]);
|
---|
1100 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1101 | convert(buf, net_count_nd6[ix], 10, TD_DIGITS, false, ' ');
|
---|
1102 | len += put_str(cepid, srbuf, buf);
|
---|
1103 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1104 | }
|
---|
1105 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1106 |
|
---|
1107 | return len;
|
---|
1108 | }
|
---|
1109 |
|
---|
1110 | /*
|
---|
1111 | * td_len_icmp6 -- put_count_icmp6 ã§åºåããæåæ°ã
|
---|
1112 | */
|
---|
1113 |
|
---|
1114 | static uint16_t
|
---|
1115 | td_len_icmp6 (void)
|
---|
1116 | {
|
---|
1117 | int_t ix;
|
---|
1118 | uint16_t len = 0;
|
---|
1119 |
|
---|
1120 | for (ix = NC_ICMP6_SIZE; ix -- > 0; )
|
---|
1121 | len += strlen(icmp6_item[ix]);
|
---|
1122 | return len + (sizeof(TD_TEMPLATE3) + TD_DIGITS - 1) * NC_ICMP6_SIZE;
|
---|
1123 | }
|
---|
1124 |
|
---|
1125 | /*
|
---|
1126 | * put_count_icmp6 -- ã«ã¦ã³ã¿ (ICMP6) ã®å
|
---|
1127 | 容ãåºåããã
|
---|
1128 | */
|
---|
1129 |
|
---|
1130 | static uint16_t
|
---|
1131 | put_count_icmp6 (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
1132 | {
|
---|
1133 | char buf[TD_DIGITS + 1];
|
---|
1134 | uint16_t len = 0;
|
---|
1135 | int_t ix;
|
---|
1136 |
|
---|
1137 | len += put_str(cepid, srbuf, table_prefix_icmp6);
|
---|
1138 | for (ix = NC_ICMP6_SIZE; ix -- > 0; ) {
|
---|
1139 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
1140 | len += put_str(cepid, srbuf, icmp6_item[ix]);
|
---|
1141 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1142 | convert(buf, net_count_icmp6[ix], 10, TD_DIGITS, false, ' ');
|
---|
1143 | len += put_str(cepid, srbuf, buf);
|
---|
1144 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1145 | }
|
---|
1146 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1147 |
|
---|
1148 | return len;
|
---|
1149 | }
|
---|
1150 |
|
---|
1151 | /*
|
---|
1152 | * td_len_ip6 -- put_count_ip6 ã§åºåããæåæ°ã
|
---|
1153 | */
|
---|
1154 |
|
---|
1155 | static uint16_t
|
---|
1156 | td_len_ip6 (void)
|
---|
1157 | {
|
---|
1158 | int_t ix;
|
---|
1159 | uint16_t len = 0;
|
---|
1160 |
|
---|
1161 | for (ix = NC_IP6_SIZE; ix -- > 0; )
|
---|
1162 | len += strlen(ip6_item[ix]);
|
---|
1163 | return len + (sizeof(TD_TEMPLATE3) + TD_DIGITS - 1) * NC_IP6_SIZE;
|
---|
1164 | }
|
---|
1165 |
|
---|
1166 | /*
|
---|
1167 | * put_count_ip6 -- ã«ã¦ã³ã¿ (IP6) ã®å
|
---|
1168 | 容ãåºåããã
|
---|
1169 | */
|
---|
1170 |
|
---|
1171 | static uint16_t
|
---|
1172 | put_count_ip6 (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
1173 | {
|
---|
1174 | char buf[TD_DIGITS + 1];
|
---|
1175 | uint16_t len = 0;
|
---|
1176 | int_t ix;
|
---|
1177 |
|
---|
1178 | len += put_str(cepid, srbuf, table_prefix_ip6);
|
---|
1179 | for (ix = NC_IP6_SIZE; ix -- > 0; ) {
|
---|
1180 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
1181 | len += put_str(cepid, srbuf, ip6_item[ix]);
|
---|
1182 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1183 | convert(buf, net_count_ip6[ix], 10, TD_DIGITS, false, ' ');
|
---|
1184 | len += put_str(cepid, srbuf, buf);
|
---|
1185 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1186 | }
|
---|
1187 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1188 |
|
---|
1189 | return len;
|
---|
1190 | }
|
---|
1191 |
|
---|
1192 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1193 |
|
---|
1194 | /*
|
---|
1195 | * td_len_tcp -- put_count_tcp ã§åºåããæåæ°ã
|
---|
1196 | */
|
---|
1197 |
|
---|
1198 | static uint16_t
|
---|
1199 | td_len_tcp (void)
|
---|
1200 | {
|
---|
1201 | int_t ix;
|
---|
1202 | uint16_t len = 0;
|
---|
1203 |
|
---|
1204 | for (ix = NC_TCP_SIZE; ix -- > 0; )
|
---|
1205 | len += strlen(tcp_item[ix]);
|
---|
1206 | return len + (sizeof(TD_TEMPLATE3) + TD_DIGITS - 1) * NC_TCP_SIZE;
|
---|
1207 | }
|
---|
1208 |
|
---|
1209 | /*
|
---|
1210 | * put_count_tcp -- ã«ã¦ã³ã¿ (TCP) ã®å
|
---|
1211 | 容ãåºåããã
|
---|
1212 | */
|
---|
1213 |
|
---|
1214 | static uint16_t
|
---|
1215 | put_count_tcp (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
1216 | {
|
---|
1217 | char buf[TD_DIGITS + 1];
|
---|
1218 | uint16_t len = 0;
|
---|
1219 | int_t ix;
|
---|
1220 |
|
---|
1221 | len += put_str(cepid, srbuf, table_prefix_tcp);
|
---|
1222 | for (ix = NC_TCP_SIZE; ix -- > 0; ) {
|
---|
1223 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
1224 | len += put_str(cepid, srbuf, tcp_item[ix]);
|
---|
1225 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1226 | convert(buf, net_count_tcp[ix], 10, TD_DIGITS, false, ' ');
|
---|
1227 | len += put_str(cepid, srbuf, buf);
|
---|
1228 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1229 | }
|
---|
1230 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1231 |
|
---|
1232 | return len;
|
---|
1233 | }
|
---|
1234 |
|
---|
1235 | /*
|
---|
1236 | * put_elapse_time -- çµéæéãåºåããã
|
---|
1237 | */
|
---|
1238 |
|
---|
1239 | static uint16_t
|
---|
1240 | put_elapse_time (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
1241 | {
|
---|
1242 | SYSTIM now, elapse;
|
---|
1243 | char buf[TD_DIGITS + 1];
|
---|
1244 | uint16_t len = 0;
|
---|
1245 |
|
---|
1246 | get_tim(&now);
|
---|
1247 | elapse = now - srv_start;
|
---|
1248 |
|
---|
1249 | len += put_str(cepid, srbuf, time_prefix);
|
---|
1250 |
|
---|
1251 | convert(buf, elapse / (60 * 60 * SYSTIM_HZ), 10, 4, false, ' ');
|
---|
1252 | len += put_str(cepid, srbuf, buf);
|
---|
1253 | len += put_str(cepid, srbuf, ":");
|
---|
1254 |
|
---|
1255 | convert(buf, (elapse / (60 * SYSTIM_HZ)) % 60, 10, 2, false, ' ');
|
---|
1256 | len += put_str(cepid, srbuf, buf);
|
---|
1257 | len += put_str(cepid, srbuf, ":");
|
---|
1258 |
|
---|
1259 | convert(buf, (elapse / SYSTIM_HZ) % 60, 10, 2, false, ' ');
|
---|
1260 | len += put_str(cepid, srbuf, buf);
|
---|
1261 |
|
---|
1262 | len += put_str(cepid, srbuf, time_suffix);
|
---|
1263 |
|
---|
1264 | return len;
|
---|
1265 | }
|
---|
1266 |
|
---|
1267 | /*
|
---|
1268 | * put_count_net_buf -- ã«ã¦ã³ã¿ (TCP) ã®å
|
---|
1269 | 容ãåºåããã
|
---|
1270 | */
|
---|
1271 |
|
---|
1272 | static uint16_t
|
---|
1273 | put_count_net_buf (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
1274 | {
|
---|
1275 |
|
---|
1276 | const T_NET_BUF_ENTRY *tbl;
|
---|
1277 | char buf[TD_DIGITS + 1];
|
---|
1278 | uint16_t len = 0;
|
---|
1279 | int_t ix;
|
---|
1280 |
|
---|
1281 | len += put_str(cepid, srbuf, table_prefix_net_buf);
|
---|
1282 | tbl = nbuf_get_tbl();
|
---|
1283 | for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
|
---|
1284 | len += put_str(cepid, srbuf, "<tr><td align=\"right\">");
|
---|
1285 | convert(buf, tbl[ix].size, 10, 4, false, ' ');
|
---|
1286 | len += put_str(cepid, srbuf, buf);
|
---|
1287 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1288 | convert(buf, tbl[ix].prepares, 10, TD_DIGITS, false, ' ');
|
---|
1289 | len += put_str(cepid, srbuf, buf);
|
---|
1290 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1291 | convert(buf, tbl[ix].requests, 10, TD_DIGITS, false, ' ');
|
---|
1292 | len += put_str(cepid, srbuf, buf);
|
---|
1293 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1294 | convert(buf, tbl[ix].allocs, 10, TD_DIGITS, false, ' ');
|
---|
1295 | len += put_str(cepid, srbuf, buf);
|
---|
1296 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1297 | convert(buf, tbl[ix].errors, 10, TD_DIGITS, false, ' ');
|
---|
1298 | len += put_str(cepid, srbuf, buf);
|
---|
1299 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1300 | }
|
---|
1301 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1302 |
|
---|
1303 | return len;
|
---|
1304 | }
|
---|
1305 |
|
---|
1306 | #ifdef SUPPORT_ETHER
|
---|
1307 |
|
---|
1308 | /*
|
---|
1309 | * td_len_ether_nic -- put_count_ether_nic ã§åºåããæåæ°ã
|
---|
1310 | */
|
---|
1311 |
|
---|
1312 | static uint16_t
|
---|
1313 | td_len_ether_nic (void)
|
---|
1314 | {
|
---|
1315 | int_t ix;
|
---|
1316 | uint16_t len = 0;
|
---|
1317 |
|
---|
1318 | for (ix = NC_ETHER_NIC_SIZE; ix -- > 0; )
|
---|
1319 | len += strlen(ether_nic_item[ix]);
|
---|
1320 | return len + (sizeof(TD_TEMPLATE3) + TD_DIGITS - 1) * NC_ETHER_NIC_SIZE;
|
---|
1321 | }
|
---|
1322 |
|
---|
1323 | /*
|
---|
1324 | * put_count_ether_nic -- ã«ã¦ã³ã¿ (ETHER_NIC) ã®å
|
---|
1325 | 容ãåºåããã
|
---|
1326 | */
|
---|
1327 |
|
---|
1328 | static uint16_t
|
---|
1329 | put_count_ether_nic (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
1330 | {
|
---|
1331 | char buf[TD_DIGITS + 1];
|
---|
1332 | uint16_t len = 0;
|
---|
1333 | int_t ix;
|
---|
1334 |
|
---|
1335 | len += put_str(cepid, srbuf, table_prefix_ether_nic);
|
---|
1336 | for (ix = NC_ETHER_NIC_SIZE; ix -- > 0; ) {
|
---|
1337 | len += put_str(cepid, srbuf, "<tr><td>");
|
---|
1338 | len += put_str(cepid, srbuf, ether_nic_item[ix]);
|
---|
1339 | len += put_str(cepid, srbuf, "</td><td align=\"right\">");
|
---|
1340 | convert(buf, net_count_ether_nic[ix], 10, TD_DIGITS, false, ' ');
|
---|
1341 | len += put_str(cepid, srbuf, buf);
|
---|
1342 | len += put_str(cepid, srbuf, "</td></tr>\r\n");
|
---|
1343 | }
|
---|
1344 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1345 |
|
---|
1346 | return len;
|
---|
1347 | }
|
---|
1348 |
|
---|
1349 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1350 |
|
---|
1351 | /*
|
---|
1352 | * stat_html -- /stat.html ãã¡ã¤ã«
|
---|
1353 | */
|
---|
1354 |
|
---|
1355 | static ER
|
---|
1356 | stat_html (ID cepid, T_WWW_RWBUF *srbuf)
|
---|
1357 | {
|
---|
1358 | static const char res_prefix[] =
|
---|
1359 | "\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD html 3.2//EN\">\r\n"
|
---|
1360 | "<html><head>\r\n"
|
---|
1361 |
|
---|
1362 | #ifdef TOPPERS_S810_CLG3_85
|
---|
1363 | "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Shift_JIS\">\r\n"
|
---|
1364 | #else
|
---|
1365 | "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=EUC-JP\">\r\n"
|
---|
1366 | #endif
|
---|
1367 |
|
---|
1368 | "<title>ãããã¯ã¼ã¯çµ±è¨æ
|
---|
1369 | å ±</title>\r\n"
|
---|
1370 | "</head><body bgcolor=\"#ffffbb\">\r\n"
|
---|
1371 | "<hr><h1 align=\"center\">ãããã¯ã¼ã¯çµ±è¨æ
|
---|
1372 | å ±</h1><hr>\r\n"
|
---|
1373 | ;
|
---|
1374 |
|
---|
1375 | static const char res_suffix[] =
|
---|
1376 | "</body></html>\r\n"
|
---|
1377 | ;
|
---|
1378 |
|
---|
1379 | static const char table_prefix1[] =
|
---|
1380 | "<h2>ã°ã«ã¼ã 1</h2><table border>\r\n"
|
---|
1381 | "<tr><th>é
|
---|
1382 | ç®</th>\r\n"
|
---|
1383 | "<th>åä¿¡ãªã¯ãããæ°</th>"
|
---|
1384 | "<th>éä¿¡ãªã¯ãããæ°</th>\r\n"
|
---|
1385 | "<th>åä¿¡ãã±ããæ°</th>"
|
---|
1386 | "<th>éä¿¡ãã±ããæ°</th>\r\n"
|
---|
1387 | "<th>åä¿¡ã¨ã©ã¼<br>ãã±ããæ°</th>"
|
---|
1388 | "<th>éä¿¡ã¨ã©ã¼<br>ãã±ããæ°</th></tr>\r\n"
|
---|
1389 | ;
|
---|
1390 |
|
---|
1391 | #ifdef SUPPORT_PPP
|
---|
1392 |
|
---|
1393 | static const char table_prefix2[] =
|
---|
1394 | "<h2>ã°ã«ã¼ã 2</h2><table border>\r\n"
|
---|
1395 | "<tr><th>é
|
---|
1396 | ç®</th>"
|
---|
1397 | "<th>åä¿¡ãªã¯ãããæ°</th>"
|
---|
1398 | "<th>åä¿¡ãã¬ã¼ã æ°</th></tr>\r\n"
|
---|
1399 | ;
|
---|
1400 |
|
---|
1401 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
1402 |
|
---|
1403 | uint16_t content_len, len = 0;
|
---|
1404 | SYSTIM start, finish;
|
---|
1405 |
|
---|
1406 | get_tim(&start);
|
---|
1407 | content_len = 0
|
---|
1408 |
|
---|
1409 | #ifdef SUPPORT_PPP
|
---|
1410 |
|
---|
1411 | + TD_LEN1("HDLC")
|
---|
1412 |
|
---|
1413 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
1414 |
|
---|
1415 | #ifdef SUPPORT_PPP
|
---|
1416 |
|
---|
1417 | + td_len_ppp()
|
---|
1418 | + TD_LEN2("LCP")
|
---|
1419 | + TD_LEN2("IPCP")
|
---|
1420 |
|
---|
1421 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
1422 |
|
---|
1423 | #ifdef SUPPORT_ETHER
|
---|
1424 |
|
---|
1425 | + TD_LEN1("ARP")
|
---|
1426 | + td_len_ether_nic()
|
---|
1427 |
|
---|
1428 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1429 |
|
---|
1430 | + TD_LEN1("ICMP")
|
---|
1431 | + TD_LEN1("UDP")
|
---|
1432 |
|
---|
1433 | #if defined(SUPPORT_INET4)
|
---|
1434 |
|
---|
1435 | + td_len_ip4()
|
---|
1436 |
|
---|
1437 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1438 |
|
---|
1439 | #if defined(SUPPORT_INET6)
|
---|
1440 |
|
---|
1441 | + td_len_ip6()
|
---|
1442 | + td_len_nd6()
|
---|
1443 | + td_len_icmp6()
|
---|
1444 |
|
---|
1445 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1446 |
|
---|
1447 | + td_len_tcp()
|
---|
1448 | + TD_LEN4("0123") * nbuf_get_tbl_size();
|
---|
1449 | ;
|
---|
1450 |
|
---|
1451 | len += put_status(cepid, srbuf, ST_OK);
|
---|
1452 | len += put_content_length(cepid, srbuf, strlen(res_prefix)
|
---|
1453 | + strlen(res_suffix)
|
---|
1454 | + strlen(time_prefix)
|
---|
1455 | + strlen("1234:12:12")
|
---|
1456 | + strlen(time_suffix)
|
---|
1457 | + strlen(table_prefix1)
|
---|
1458 | + strlen(table_prefix_net_buf)
|
---|
1459 |
|
---|
1460 | #if defined(SUPPORT_INET4)
|
---|
1461 |
|
---|
1462 | + strlen(table_prefix_ip4)
|
---|
1463 |
|
---|
1464 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1465 |
|
---|
1466 | #if defined(SUPPORT_INET6)
|
---|
1467 |
|
---|
1468 | + strlen(table_prefix_ip6)
|
---|
1469 | + strlen(table_prefix_nd6)
|
---|
1470 | + strlen(table_prefix_icmp6)
|
---|
1471 |
|
---|
1472 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1473 | + strlen(table_prefix_tcp)
|
---|
1474 | + strlen(table_suffix) * 3
|
---|
1475 |
|
---|
1476 | #ifdef SUPPORT_PPP
|
---|
1477 | + strlen(table_prefix2)
|
---|
1478 | + strlen(table_prefix_ppp)
|
---|
1479 | + strlen(table_suffix) * 2
|
---|
1480 |
|
---|
1481 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
1482 |
|
---|
1483 | #ifdef SUPPORT_ETHER
|
---|
1484 |
|
---|
1485 | + strlen(table_prefix_ether_nic)
|
---|
1486 | + strlen(table_suffix) * 1
|
---|
1487 |
|
---|
1488 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1489 |
|
---|
1490 | + content_len
|
---|
1491 | - 2); /* 2 ã¯æåã® \r\n */
|
---|
1492 |
|
---|
1493 | len += put_str(cepid, srbuf, res_prefix);
|
---|
1494 | len += put_elapse_time(cepid, srbuf);
|
---|
1495 | len += put_str(cepid, srbuf, table_prefix1);
|
---|
1496 |
|
---|
1497 | #ifdef SUPPORT_PPP
|
---|
1498 |
|
---|
1499 | len += put_count_item1(cepid, srbuf, "HDLC", &net_count_hdlc);
|
---|
1500 |
|
---|
1501 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
1502 |
|
---|
1503 | #ifdef SUPPORT_ETHER
|
---|
1504 |
|
---|
1505 | len += put_count_item1(cepid, srbuf, "Ethernet", &net_count_ether);
|
---|
1506 |
|
---|
1507 | #if defined(SUPPORT_INET4)
|
---|
1508 |
|
---|
1509 | len += put_count_item1(cepid, srbuf, "ARP", &net_count_arp);
|
---|
1510 |
|
---|
1511 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1512 |
|
---|
1513 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1514 |
|
---|
1515 | #if defined(SUPPORT_INET4)
|
---|
1516 |
|
---|
1517 | len += put_count_item1(cepid, srbuf, "ICMP", &net_count_icmp4);
|
---|
1518 |
|
---|
1519 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1520 |
|
---|
1521 | #ifdef SUPPORT_UDP
|
---|
1522 |
|
---|
1523 | len += put_count_item1(cepid, srbuf, "UDP", &net_count_udp);
|
---|
1524 |
|
---|
1525 | #endif /* of #ifdef SUPPORT_UDP */
|
---|
1526 |
|
---|
1527 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1528 |
|
---|
1529 | #ifdef SUPPORT_PPP
|
---|
1530 |
|
---|
1531 | len += put_str(cepid, srbuf, table_prefix2);
|
---|
1532 | len += put_count_item2(cepid, srbuf, "LCP",
|
---|
1533 | net_count_ppp_lcp_in_octets,
|
---|
1534 | net_count_ppp_lcp_in_packets);
|
---|
1535 | len += put_count_item2(cepid, srbuf, "IPCP",
|
---|
1536 | net_count_ppp_ipcp_in_octets,
|
---|
1537 | net_count_ppp_ipcp_in_packets);
|
---|
1538 | len += put_str(cepid, srbuf, table_suffix);
|
---|
1539 |
|
---|
1540 | len += put_count_ppp(cepid, srbuf);
|
---|
1541 |
|
---|
1542 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
1543 |
|
---|
1544 | #ifdef SUPPORT_ETHER
|
---|
1545 |
|
---|
1546 | len += put_count_ether_nic(cepid, srbuf);
|
---|
1547 |
|
---|
1548 | #endif /* of #ifdef SUPPORT_ETHER */
|
---|
1549 |
|
---|
1550 | #if defined(SUPPORT_INET4)
|
---|
1551 |
|
---|
1552 | len += put_count_ip4(cepid, srbuf);
|
---|
1553 |
|
---|
1554 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1555 |
|
---|
1556 | #if defined(SUPPORT_INET6)
|
---|
1557 |
|
---|
1558 | len += put_count_ip6(cepid, srbuf);
|
---|
1559 | len += put_count_nd6(cepid, srbuf);
|
---|
1560 | len += put_count_icmp6(cepid, srbuf);
|
---|
1561 |
|
---|
1562 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1563 |
|
---|
1564 | len += put_count_tcp(cepid, srbuf);
|
---|
1565 |
|
---|
1566 | len += put_count_net_buf(cepid, srbuf);
|
---|
1567 |
|
---|
1568 | len += put_str(cepid, srbuf, res_suffix);
|
---|
1569 |
|
---|
1570 | get_tim(&finish);
|
---|
1571 | syslog(LOG_NOTICE, "[WWW:%02u] send: stat.html, len: %4u, time: %lu [ms]",
|
---|
1572 | cepid, len, (finish - start) * 1000 / SYSTIM_HZ);
|
---|
1573 | return E_OK;
|
---|
1574 | }
|
---|
1575 |
|
---|
1576 | #endif /* of #if NET_COUNT_ENABLE */
|
---|
1577 |
|
---|
1578 | /*
|
---|
1579 | * WWW ãµã¼ã
|
---|
1580 | */
|
---|
1581 |
|
---|
1582 | static ER
|
---|
1583 | www_srv (ID cepid, ID repid)
|
---|
1584 | {
|
---|
1585 | #if defined(SUPPORT_INET4)
|
---|
1586 |
|
---|
1587 | T_IPV4EP dst;
|
---|
1588 |
|
---|
1589 | #endif /* of #if defined(SUPPORT_INET4) */
|
---|
1590 |
|
---|
1591 | #if defined(SUPPORT_INET6)
|
---|
1592 |
|
---|
1593 | T_IPV6EP dst;
|
---|
1594 |
|
---|
1595 | #endif /* of #if defined(SUPPORT_INET6) */
|
---|
1596 |
|
---|
1597 | T_WWW_RWBUF *srbuf;
|
---|
1598 | ER error;
|
---|
1599 | SYSTIM time;
|
---|
1600 |
|
---|
1601 | if ((error = TCP_ACP_CEP(cepid, repid, &dst, TMO_FEVR)) != E_OK) {
|
---|
1602 | syslog(LOG_WARNING, "[WWW:%02d] accept error: %s", cepid, itron_strerror(error));
|
---|
1603 | return error;
|
---|
1604 | }
|
---|
1605 |
|
---|
1606 | get_tim(&time);
|
---|
1607 | syslog(LOG_NOTICE, "[WWW:%02u] connected: %6lu, from: %s.%u",
|
---|
1608 | cepid, time / SYSTIM_HZ, IP2STR(NULL, &dst.ipaddr), dst.portno);
|
---|
1609 |
|
---|
1610 | if ((error = tget_mpf(MPF_WWW_RWBUF, (void*)&srbuf, TMO_FEVR)) != E_OK) {
|
---|
1611 | syslog(LOG_CRIT, "[WWW:%02d] get buffer error: %s.", cepid, itron_strerror(error));
|
---|
1612 | srbuf = NULL;
|
---|
1613 | }
|
---|
1614 | else {
|
---|
1615 | srbuf->rbuf.len = srbuf->rbuf.index = srbuf->sbuf.index = srbuf->unget = 0;
|
---|
1616 |
|
---|
1617 | #ifdef USE_COPYSAVE_API
|
---|
1618 |
|
---|
1619 | srbuf->sbuf.len = 0;
|
---|
1620 |
|
---|
1621 | #else /* of #ifdef USE_COPYSAVE_API */
|
---|
1622 |
|
---|
1623 | srbuf->sbuf.len = sizeof(srbuf->sbuf.buf);
|
---|
1624 |
|
---|
1625 | #endif /* of #ifdef USE_COPYSAVE_API */
|
---|
1626 |
|
---|
1627 | if ((error = parse_request(cepid, srbuf)) != E_OK)
|
---|
1628 | syslog(LOG_WARNING, "[WWW:%02d] parse request error: %s",
|
---|
1629 | cepid, itron_strerror(error));
|
---|
1630 | }
|
---|
1631 |
|
---|
1632 | if ((error = tcp_sht_cep(cepid)) != E_OK)
|
---|
1633 | syslog(LOG_WARNING, "[WWW:%02d] shutdown error: %s", cepid, itron_strerror(error));
|
---|
1634 |
|
---|
1635 | if (srbuf != NULL) {
|
---|
1636 | while (get_char(cepid, srbuf) != EOF)
|
---|
1637 | ;
|
---|
1638 | if (srbuf != NULL && (error = rel_mpf(MPF_WWW_RWBUF, srbuf)) != E_OK)
|
---|
1639 | syslog(LOG_WARNING, "[WWW:%02d] release buffer error: %s.",
|
---|
1640 | cepid, itron_strerror(error));
|
---|
1641 | }
|
---|
1642 |
|
---|
1643 | if ((error = tcp_cls_cep(cepid, TMO_FEVR)) != E_OK)
|
---|
1644 | syslog(LOG_WARNING, "[WWW:%02d] close error: %s", cepid, itron_strerror(error));
|
---|
1645 |
|
---|
1646 | get_tim(&time);
|
---|
1647 | syslog(LOG_NOTICE, "[WWW:%02u] finished: %6lu", cepid, time / SYSTIM_HZ);
|
---|
1648 |
|
---|
1649 | return error;
|
---|
1650 | }
|
---|
1651 |
|
---|
1652 | #ifdef USE_TCP_EXTENTIONS
|
---|
1653 |
|
---|
1654 | /*
|
---|
1655 | * get_tcp_rep -- TCP åä»å£ãç²å¾ããã
|
---|
1656 | */
|
---|
1657 |
|
---|
1658 | static ER
|
---|
1659 | get_tcp_rep (ID *repid)
|
---|
1660 | {
|
---|
1661 | ID tskid;
|
---|
1662 | T_TCP_CREP crep;
|
---|
1663 |
|
---|
1664 | get_tid(&tskid);
|
---|
1665 |
|
---|
1666 | crep.repatr = UINT_C(0);
|
---|
1667 | crep.myaddr.portno = UINT_C(80);
|
---|
1668 |
|
---|
1669 | #if defined(SUPPORT_INET4)
|
---|
1670 | crep.myaddr.ipaddr = IPV4_ADDRANY;
|
---|
1671 | #endif
|
---|
1672 |
|
---|
1673 | #if defined(SUPPORT_INET6)
|
---|
1674 | memcpy(&crep.myaddr.ipaddr, &ipv6_addrany, sizeof(T_IN6_ADDR));
|
---|
1675 | #endif
|
---|
1676 |
|
---|
1677 |
|
---|
1678 | return alloc_tcp_rep(repid, tskid, &crep);
|
---|
1679 | }
|
---|
1680 |
|
---|
1681 | /*
|
---|
1682 | * get_tcp_cep -- TCP é信端ç¹ã¨ãç²å¾ããã
|
---|
1683 | */
|
---|
1684 |
|
---|
1685 | static ER
|
---|
1686 | get_tcp_cep (ID *cepid)
|
---|
1687 | {
|
---|
1688 | ID tskid;
|
---|
1689 | T_TCP_CCEP ccep;
|
---|
1690 |
|
---|
1691 | get_tid(&tskid);
|
---|
1692 |
|
---|
1693 | ccep.cepatr = UINT_C(0);
|
---|
1694 | ccep.sbufsz = WWW_SRV_SWBUF_SIZE;
|
---|
1695 | ccep.rbufsz = WWW_SRV_RWBUF_SIZE;
|
---|
1696 | ccep.callback = NULL;
|
---|
1697 |
|
---|
1698 | #ifdef TCP_CFG_SWBUF_CSAVE
|
---|
1699 | ccep.sbuf = NADR;
|
---|
1700 | #else
|
---|
1701 | ccep.sbuf = www_srv_swbuf[0];
|
---|
1702 | #endif
|
---|
1703 | #ifdef TCP_CFG_RWBUF_CSAVE
|
---|
1704 | ccep.rbuf = NADR;
|
---|
1705 | #else
|
---|
1706 | ccep.rbuf = www_srv_rwbuf[0];
|
---|
1707 | #endif
|
---|
1708 |
|
---|
1709 | return alloc_tcp_cep(cepid, tskid, &ccep);
|
---|
1710 | }
|
---|
1711 |
|
---|
1712 | /*
|
---|
1713 | * WWW ãµã¼ãã¿ã¹ã¯
|
---|
1714 | */
|
---|
1715 |
|
---|
1716 | void
|
---|
1717 | www_srv_task(intptr_t exinf)
|
---|
1718 | {
|
---|
1719 | ID tskid, cepid, repid;
|
---|
1720 | ER error = E_OK;
|
---|
1721 |
|
---|
1722 | syscall(get_tid(&tskid));
|
---|
1723 | syslog(LOG_NOTICE, "[WWW:%d] started.", tskid);
|
---|
1724 | while (true) {
|
---|
1725 |
|
---|
1726 | syscall(slp_tsk());
|
---|
1727 | if ((error = get_tcp_cep (&cepid)) != E_OK) {
|
---|
1728 | syslog(LOG_NOTICE, "[WWW:00 EXT] CEP create error: %s", itron_strerror(error));
|
---|
1729 | continue;
|
---|
1730 | }
|
---|
1731 |
|
---|
1732 | if ((error = get_tcp_rep (&repid)) != E_OK) {
|
---|
1733 | syslog(LOG_NOTICE, "[WWW:00 EXT] REP create error: %s", itron_strerror(error));
|
---|
1734 | free_tcp_cep(cepid);
|
---|
1735 | continue;
|
---|
1736 | }
|
---|
1737 |
|
---|
1738 | while (true)
|
---|
1739 | if ((error = www_srv(cepid, repid)) != E_OK) {
|
---|
1740 | error = free_tcp_rep(repid, error != E_DLT);
|
---|
1741 | break;
|
---|
1742 | }
|
---|
1743 |
|
---|
1744 | if ((error = free_tcp_cep(cepid)) != E_OK)
|
---|
1745 | syslog(LOG_NOTICE, "[WWW:%02d EXT] CEP delete error: %s", cepid, itron_strerror(error));
|
---|
1746 |
|
---|
1747 | }
|
---|
1748 | }
|
---|
1749 |
|
---|
1750 | #else /* of #ifdef USE_TCP_EXTENTIONS */
|
---|
1751 |
|
---|
1752 | /*
|
---|
1753 | * WWW ãµã¼ãã¿ã¹ã¯
|
---|
1754 | */
|
---|
1755 |
|
---|
1756 | void
|
---|
1757 | www_srv_task(intptr_t exinf)
|
---|
1758 | {
|
---|
1759 | ID tskid;
|
---|
1760 |
|
---|
1761 | get_tim(&srv_start);
|
---|
1762 | get_tid(&tskid);
|
---|
1763 | syslog(LOG_NOTICE, "[WWW:%d,%d] started.", tskid, (int_t)exinf);
|
---|
1764 | while (true) {
|
---|
1765 | while (www_srv((int_t)exinf, WWW_SRV_REPID) == E_OK)
|
---|
1766 | ;
|
---|
1767 | }
|
---|
1768 | }
|
---|
1769 |
|
---|
1770 | #endif /* of #ifdef USE_TCP_EXTENTIONS */
|
---|
1771 |
|
---|
1772 | #endif /* of #ifdef USE_WWW_SRV */
|
---|