source: EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/dbg_cons.c@ 270

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

mruby版ECNLプロトタイピング・ツールを追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 67.7 KB
Line 
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: dbg_cons.c 270 2017-02-09 04:03:47Z coas-nagasima $
44 */
45
46/*
47 * デバッグコンソール
48 */
49
50#include <stdlib.h>
51
52#ifdef TARGET_KERNEL_ASP
53
54#include <kernel.h>
55#include <sil.h>
56#include <syssvc/serial.h>
57#include <syssvc/logtask.h>
58#include "kernel_cfg.h"
59#include "kernel/kernel_impl.h"
60#include "kernel/task.h"
61
62#endif /* of #ifdef TARGET_KERNEL_ASP */
63
64#ifdef TARGET_KERNEL_JSP
65
66#include <s_services.h>
67#include <t_services.h>
68#include "kernel_id.h"
69
70#include "../kernel/jsp_kernel.h"
71#include "../kernel/task.h"
72
73#endif /* of #ifdef TARGET_KERNEL_JSP */
74
75#include <tinet_defs.h>
76#include <tinet_config.h>
77
78#include <net/if.h>
79#include <net/if_ppp.h>
80#include <net/if_loop.h>
81#include <net/ethernet.h>
82#include <net/net.h>
83#include <net/net_buf.h>
84#include <net/net_timer.h>
85#include <net/ppp_var.h>
86#include <net/ppp_fsm.h>
87#include <net/ppp_lcp.h>
88#include <net/ppp_ipcp.h>
89#include <net/ppp_modem.h>
90#include <net/net_count.h>
91
92#include <netinet/in.h>
93#include <netinet/in_var.h>
94#include <netinet/in_itron.h>
95#include <netinet/ip.h>
96#include <netinet/ip_var.h>
97#include <netinet/ip6.h>
98#include <netinet6/ip6_var.h>
99#include <netinet6/nd6.h>
100#include <netinet/if_ether.h>
101#include <netinet/tcp.h>
102#include <netinet/tcp_timer.h>
103#include <netinet/tcp_var.h>
104#include <netinet/tcp_fsm.h>
105#include <netinet/udp.h>
106#include <netinet/udp_var.h>
107
108#include <net/if_var.h>
109#include <net/if6_var.h>
110
111#include <netapp/netapp.h>
112#include <netapp/netapp_var.h>
113#include <netapp/echo.h>
114#include <netapp/discard.h>
115#include <netapp/dbg_cons.h>
116
117#ifdef USE_LCD
118
119#include "sc1602/lcd.h"
120
121#endif /* of #ifdef USE_LCD */
122
123#ifdef USE_DBG_CONS
124
125#define DBG_LINE_SIZE 63
126
127/*
128 * task_status -- タスクの状æ…
129‹ã®å‡ºåŠ›
130 */
131
132static const char task_stat_str[][sizeof("SUSPENDED")] = {
133 "DORMANT", /* 休止状æ…
134‹ */
135 "RUNNABLE", /* 実行できる状æ…
136‹ */
137 "WAINTING", /* 待
138ち状æ…
139‹ */
140 "SUSPENDED", /* 強制待
141ち状æ…
142‹ */
143 "SLEEP", /* 起床待
144ち状æ…
145‹ */
146 "WOBJ", /* 同期・通信オブジェクトに対する待
147ち状æ…
148‹ */
149 "WOBJCB", /* å…
150±é€šéƒ¨åˆ†ã®å¾…
151ちキューにつながっている。 */
152 };
153
154static void
155task_status (ID portid, char *line)
156{
157 TCB *tcb;
158 int_t ix, st, sx;
159
160 WAI_NET_CONS_PRINTF();
161 cons_printf(portid,
162 "TASK Status\n"
163 "ID PI State\n");
164 for (ix = TMIN_TSKID; ix <= tmax_tskid; ix ++) {
165 tcb = get_tcb(ix);
166 cons_printf(portid, "%2d %2d ", ix, tcb->priority);
167 st = tcb->tstat;
168 for (sx = 0; st; sx ++) {
169 if (st & 0x01) {
170 cons_printf(portid, "%s", task_stat_str[sx]);
171 if (st & 0xfe)
172 cons_printf(portid, "|");
173 }
174 st >>= 1;
175 }
176 cons_printf(portid, "\n");
177 }
178
179 SIG_NET_CONS_PRINTF();
180 FLUSH_SND_BUFF();
181 }
182
183#ifdef SUPPORT_TCP
184
185/*
186 * tcp_status -- TCP の状æ…
187‹ã®å‡ºåŠ›
188 */
189
190static const char tcp_fsm_str[][sizeof("ESTABLISHED")] = {
191 "CLOSED", /* クローズ */
192 "LISTEN", /* 受動オープン */
193 "SYN_SENT", /* 能動オープン、SYN 送信済み */
194 "SYN_RECVD", /* 受動オープン、SYN 受信済み */
195 "ESTABLISHED", /* コネクション開設完了 */
196 "CLOSE_WAIT", /* 相手から FIN 受信、APP の終了待
197ち */
198 "FIN_WAIT_1", /* APP が終了、FIN 送信済み、ACK 待
199ち */
200 "CLOSING", /* 同時クローズ、FIN 交換済み、ACK 待
201ち */
202 "LAST_ACK", /* APP が終了、ACK 待
203ち */
204 "FIN_WAIT_2", /* 相手からの FIN 待
205ち */
206 "TIME_WAIT", /* 相手からの FIN 受信済み、時間待
207ち */
208 };
209
210#if defined(SUPPORT_INET4)
211
212static void
213tcp_status (ID portid, char *line)
214{
215 T_TCP_CEP* cep;
216 uint_t len;
217
218#if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
219
220 T_TCP_TWCEP* twcep;
221
222#endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
223
224#ifdef TCP_CFG_PASSIVE_OPEN
225
226 T_TCP_REP* rep;
227 int_t cnt;
228
229#endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */
230
231 WAI_NET_CONS_PRINTF();
232 cons_printf(portid,
233 "TCP CEP Status\n"
234 "ID Snd-Q Rcv-Q Local Address Foreign Address State\n");
235
236 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++)
237 if (!VALID_TCP_CEP(cep)) {
238 cons_printf(portid,
239 "%2d%c 0 0"
240 " - "
241 " - "
242 " INVALID\n",
243 GET_TCP_CEPID(cep),
244 DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
245 }
246 else if (cep->fsm_state == TCP_FSM_CLOSED) {
247 cons_printf(portid,
248 "%2d%c 0 0"
249 " - "
250 " - "
251 " CLOSED\n",
252 GET_TCP_CEPID(cep),
253 DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
254 }
255 else if (cep->fsm_state == TCP_FSM_LISTEN) {
256 cons_printf(portid,
257 "%2d%c 0 0 ",
258 GET_TCP_CEPID(cep),
259 DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
260 len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
261 cons_putchar(portid, ':');
262 len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
263 for (len = 20 - len; len -- > 0; )
264 cons_putchar(portid, ' ');
265 cons_printf(portid,
266 " - "
267 " LISTEN\n");
268 }
269 else {
270 cons_printf(portid,
271 "%2d%c %5d %5d ",
272 GET_TCP_CEPID(cep),
273 DYNAMIC_TCP_CEP(cep) ? 'D' : ' ',
274 cep->swbuf_count, cep->rwbuf_count);
275 len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
276 cons_putchar(portid, ':');
277 len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
278 for (len = 21 - len; len -- > 0; )
279 cons_putchar(portid, ' ');
280 len = PUT_IPADDR(portid, &cep->dstaddr.ipaddr, 0);
281 cons_putchar(portid, ':');
282 len += cons_putnumber(portid, cep->dstaddr.portno, 10, radhex, 0, false, ' ');
283 for (len = 20 - len; len -- > 0; )
284 cons_putchar(portid, ' ');
285 if (cep->fsm_state == TCP_FSM_TIME_WAIT)
286 cons_printf(portid, " %s(%d)\n", tcp_fsm_str[cep->fsm_state],
287 cep->timer[TCP_TIM_2MSL] / TCP_SLOW_HZ);
288 else
289 cons_printf(portid, " %s\n", tcp_fsm_str[cep->fsm_state]);
290 }
291
292#if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
293
294 for (twcep = tcp_twcep; twcep < &tcp_twcep[NUM_TCP_TW_CEP_ENTRY]; twcep ++) {
295 if (twcep->fsm_state == TCP_FSM_CLOSED) {
296 cons_printf(portid,
297 "%2dTW 0 0"
298 " - "
299 " - "
300 " CLOSED\n",
301 GET_TCP_TWCEPID(twcep));
302 }
303 else {
304 cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep));
305 len = PUT_IPADDR(portid, &twcep->myaddr.ipaddr, 0);
306 cons_putchar(portid, ':');
307 len += cons_putnumber(portid, twcep->myaddr.portno, 10, radhex, 0, false, ' ');
308 for (len = 21 - len; len -- > 0; )
309 cons_putchar(portid, ' ');
310 len = PUT_IPADDR(portid, &twcep->dstaddr.ipaddr, 0);
311 cons_putchar(portid, ':');
312 len += cons_putnumber(portid, twcep->dstaddr.portno, 10, radhex, 0, false, ' ');
313 for (len = 20 - len; len -- > 0; )
314 cons_putchar(portid, ' ');
315 if (twcep->fsm_state == TCP_FSM_TIME_WAIT)
316 cons_printf(portid, " %s(%d)\n", tcp_fsm_str[twcep->fsm_state],
317 twcep->timer_2msl / TCP_SLOW_HZ);
318 else
319 cons_printf(portid, " %s\n", tcp_fsm_str[twcep->fsm_state]);
320 }
321 }
322
323#endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
324
325#ifdef TCP_CFG_PASSIVE_OPEN
326
327 cons_printf(portid,
328 "TCP REP Status\n"
329 "ID Local Address CEP\n");
330 for (rep = tcp_rep; rep < &tcp_rep[tmax_tcp_repid]; rep ++) {
331 cons_printf(portid, "%2d%c ", GET_TCP_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' ');
332 if (VALID_TCP_REP(rep)) {
333 len = PUT_IPADDR(portid, &rep->myaddr.ipaddr, 0);
334 cons_putchar(portid, ':');
335 len += cons_putnumber(portid, rep->myaddr.portno, 10, radhex, 0, false, ' ');
336 for (len = 21 - len; len -- > 0; )
337 cons_putchar(portid, ' ');
338 cnt = 0;
339 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
340 if (cep->rep == rep) {
341 if (cnt > 0)
342 cons_printf(portid, ",%d", GET_TCP_CEPID(cep));
343 else
344 cons_printf(portid, "%d", GET_TCP_CEPID(cep));
345 cnt ++;
346 }
347 }
348 }
349 else
350 cons_printf(portid, "INVALID");
351 cons_putchar(portid, '\n');
352 }
353
354#endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */
355
356 SIG_NET_CONS_PRINTF();
357 FLUSH_SND_BUFF();
358 }
359
360#endif /* of #if defined(SUPPORT_INET4) */
361
362#if defined(SUPPORT_INET6)
363
364static void
365tcp_status (ID portid, char *line)
366{
367 T_TCP_CEP* cep;
368 uint_t len;
369
370#if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
371
372 T_TCP_TWCEP* twcep;
373
374#endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
375
376#ifdef TCP_CFG_PASSIVE_OPEN
377
378 T_TCP_REP* rep;
379 int_t cnt;
380
381#endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */
382
383 WAI_NET_CONS_PRINTF();
384 cons_printf(portid,
385 "TCP CEP Status\n"
386 "ID Snd-Q Rcv-Q Foreign Address State\n");
387
388 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++)
389 if (!VALID_TCP_CEP(cep)) {
390 cons_printf(portid,
391 "%2d%c 0 0"
392 " - "
393 " INVALID\n",
394 GET_TCP_CEPID(cep),
395 DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
396 }
397 else if (cep->fsm_state == TCP_FSM_CLOSED) {
398 cons_printf(portid,
399 "%2d%c 0 0"
400 " - "
401 " CLOSED\n",
402 GET_TCP_CEPID(cep),
403 DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
404 }
405 else if (cep->fsm_state == TCP_FSM_LISTEN) {
406 cons_printf(portid,
407 "%2d%c 0 0"
408 " - "
409 " LISTEN\n",
410 GET_TCP_CEPID(cep),
411 DYNAMIC_TCP_CEP(cep) ? 'D' : ' ');
412 }
413 else {
414 cons_printf(portid,
415 "%2d%c %5d %5d ",
416 GET_TCP_CEPID(cep),
417 DYNAMIC_TCP_CEP(cep) ? 'D' : ' ',
418 cep->swbuf_count, cep->rwbuf_count);
419 len = PUT_IPADDR(portid, &cep->dstaddr.ipaddr, 0);
420 cons_putchar(portid, '.');
421 len += cons_putnumber(portid, cep->dstaddr.portno, 10, radhex, 0, false, ' ');
422 for (len = 42 - len; len -- > 0; )
423 cons_putchar(portid, ' ');
424 if (cep->fsm_state == TCP_FSM_TIME_WAIT)
425 cons_printf(portid, " %s(%d)\n", tcp_fsm_str[cep->fsm_state],
426 cep->timer[TCP_TIM_2MSL] / TCP_SLOW_HZ);
427 else
428 cons_printf(portid, " %s\n", tcp_fsm_str[cep->fsm_state]);
429 }
430
431#if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0
432
433 for (twcep = tcp_twcep; twcep < &tcp_twcep[NUM_TCP_TW_CEP_ENTRY]; twcep ++) {
434 if (twcep->fsm_state == TCP_FSM_CLOSED) {
435 cons_printf(portid,
436 "%2dTW 0 0"
437 " - "
438 " CLOSED\n",
439 GET_TCP_TWCEPID(twcep));
440 }
441 else {
442 cons_printf(portid, "%2dTW 0 0 ", GET_TCP_TWCEPID(twcep));
443 len = PUT_IPADDR(portid, &twcep->dstaddr.ipaddr, 0);
444 cons_putchar(portid, '.');
445 len += cons_putnumber(portid, twcep->dstaddr.portno, 10, radhex, 0, false, ' ');
446 for (len = 42 - len; len -- > 0; )
447 cons_putchar(portid, ' ');
448 if (twcep->fsm_state == TCP_FSM_TIME_WAIT)
449 cons_printf(portid, " %s(%d)\n", tcp_fsm_str[twcep->fsm_state],
450 twcep->timer_2msl / TCP_SLOW_HZ);
451 else
452 cons_printf(portid, " %s\n", tcp_fsm_str[twcep->fsm_state]);
453 }
454 }
455
456#endif /* of #if defined(NUM_TCP_TW_CEP_ENTRY) && NUM_TCP_TW_CEP_ENTRY > 0 */
457
458#ifdef TCP_CFG_PASSIVE_OPEN
459
460 cons_printf(portid,
461 "TCP REP Status\n"
462 "ID Local Address CEP\n");
463 for (rep = tcp_rep; rep < &tcp_rep[tmax_tcp_repid]; rep ++) {
464 cons_printf(portid, "%2d%c ", GET_TCP_REPID(rep), DYNAMIC_TCP_REP(rep) ? 'D' : ' ');
465 if (VALID_TCP_REP(rep)) {
466 len = PUT_IPADDR(portid, &rep->myaddr.ipaddr, 0);
467 cons_putchar(portid, '.');
468 len += cons_putnumber(portid, rep->myaddr.portno, 10, radhex, 0, false, ' ');
469 for (len = 21 - len; len -- > 0; )
470 cons_putchar(portid, ' ');
471 cnt = 0;
472 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
473 if (cep->rep == rep) {
474 if (cnt > 0)
475 cons_printf(portid, ",%d", GET_TCP_CEPID(cep));
476 else
477 cons_printf(portid, "%d", GET_TCP_CEPID(cep));
478 cnt ++;
479 }
480 }
481 }
482 else
483 cons_printf(portid, "INVALID");
484 cons_putchar(portid, '\n');
485 }
486
487#endif /* of #ifdef TCP_CFG_PASSIVE_OPEN */
488
489 SIG_NET_CONS_PRINTF();
490 FLUSH_SND_BUFF();
491 }
492
493#endif /* of #if defined(SUPPORT_INET6) */
494
495#endif /* of #ifdef SUPPORT_TCP */
496
497#ifdef SUPPORT_UDP
498
499/*
500 * udp_status -- UDP の状æ…
501‹ã®å‡ºåŠ›
502 */
503
504static void
505udp_status (ID portid, char *line)
506{
507 T_UDP_CEP* cep;
508 uint_t len;
509
510 WAI_NET_CONS_PRINTF();
511 cons_printf(portid,
512 "UDP CEP Status\n"
513 "ID Local Address\n");
514
515 for (cep = udp_cep; cep < &udp_cep[tmax_udp_ccepid]; cep ++) {
516 cons_printf(portid, "%2d%c ", GET_UDP_CEPID(cep), DYNAMIC_UDP_CEP(cep) ? 'D' : ' ');
517 if (VALID_UDP_CEP(cep)) {
518 len = PUT_IPADDR(portid, &cep->myaddr.ipaddr, 0);
519 cons_putchar(portid, '.');
520 len += cons_putnumber(portid, cep->myaddr.portno, 10, radhex, 0, false, ' ');
521 }
522 else
523 cons_printf(portid, "INVALID");
524 cons_putchar(portid, '\n');
525 }
526
527 SIG_NET_CONS_PRINTF();
528 FLUSH_SND_BUFF();
529 }
530
531#endif /* of #ifdef SUPPORT_UDP */
532
533#ifdef SUPPORT_ETHER
534
535#if defined(SUPPORT_INET4)
536
537/*
538 * ifa_status -- ARP キャッシュ出力
539 */
540
541static void
542ifa_status (ID portid, char *line)
543{
544 const T_ARP_ENTRY *cache;
545 int_t ix;
546
547 WAI_NET_CONS_PRINTF();
548 cons_printf(portid,
549 "ARP Cache\n"
550 "IX Expire IP Address MAC Address\n");
551
552 /* expire の単位は [ms]。*/
553 cache = arp_get_cache();
554 for (ix = 0; ix < NUM_ARP_ENTRY; ix ++) {
555 if (cache[ix].expire != 0)
556 cons_printf(portid, "%2d %6d %15I %M\n",
557 ix, cache[ix].expire / NET_TIMER_HZ,
558 &cache[ix].ip_addr, cache[ix].mac_addr);
559 }
560
561 SIG_NET_CONS_PRINTF();
562 FLUSH_SND_BUFF();
563 }
564
565#endif /* of #if defined(SUPPORT_INET4) */
566
567#if defined(SUPPORT_INET6)
568
569/*
570 * ifa_status -- 近隣キャッシュ状æ…
571‹ã®å‡ºåŠ›
572 */
573
574static const char nd_state_str[][sizeof("INCOMPLETE")] = {
575 "FREE", /* 未使用 */
576 "NO STATE", /* 状æ…
577‹æœªå®šç¾© */
578 "INCOMPLETE", /* 未解決 */
579 "REACHABLE", /* 到達可能 */
580 "STALE", /* 到達可能性は未確認 */
581 "DELAY", /* 到達可能性の確認待
582機 */
583 "PROBE", /* 到達可能性を確認中 */
584 };
585
586static void
587ifa_status (ID portid, char *line)
588{
589 const T_LLINFO_ND6 *cache;
590 SYSTIM now;
591 int_t ix;
592
593 WAI_NET_CONS_PRINTF();
594 cons_printf(portid,
595 "ND Cache Status\n"
596 "IX Expire State MAC Address IP Address\n");
597
598 /* expire の単位は [ms]。*/
599 get_tim(&now);
600 cache = nd6_get_cache();
601 for (ix = 0; ix < NUM_ND6_CACHE_ENTRY; ix ++) {
602 if (cache[ix].state != ND6_LLINFO_FREE) {
603 cons_printf(portid, "%2d %6d %10s %M %I\n",
604 ix,
605 cache[ix].state == ND6_LLINFO_STALE ||
606 (uint32_t)(cache[ix].expire - now) <= 0
607 ? 0 : (cache[ix].expire - now) / SYSTIM_HZ,
608 nd_state_str[cache[ix].state],
609 &cache[ix].ifaddr,
610 &cache[ix].addr);
611 }
612 }
613
614 SIG_NET_CONS_PRINTF();
615 FLUSH_SND_BUFF();
616 }
617
618#endif /* of #if defined(SUPPORT_INET6) */
619
620#endif /* of #ifdef SUPPORT_ETHER */
621
622#if NET_COUNT_ENABLE
623
624/*
625 * net_count_struct -- ネットワーク統計情
626å ±
627 */
628
629static void
630net_count_struct (ID portid, char *name, T_NET_COUNT *item)
631{
632 cons_printf(portid, "\n%s\n", name);
633 cons_printf(portid, "\t受信オクテット数\t%lu\n", item->in_octets);
634 cons_printf(portid, "\t送信オクテット数\t%lu\n", item->out_octets);
635 cons_printf(portid, "\t受信バケット数\t%lu\n", item->in_packets);
636 cons_printf(portid, "\t送信バケット数\t%lu\n", item->out_packets);
637 cons_printf(portid, "\t受信エラーバケット数\t%lu\n", item->in_err_packets);
638 cons_printf(portid, "\t送信エラーバケット数\t%lu\n", item->out_err_packets);
639 }
640
641/*
642 * net_count -- ネットワーク統計情
643å ±
644 */
645
646static void
647net_count (ID portid, char *line)
648{
649 const T_NET_BUF_ENTRY *tbl;
650 SYSTIM now;
651 int_t ix;
652
653 WAI_NET_CONS_PRINTF();
654 get_tim(&now);
655 cons_printf(portid, "ネットワーク統計情
656報\t経過時間[ms]\t%lu\t", now);
657 if (now > (1000 * 3600 * 24))
658 cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
659 now / (1000 * 3600 * 24),
660 (now / (1000 * 3600)) % 24,
661 (now / (1000 * 60 )) % 60,
662 (now / 1000 ) % 60);
663 else
664 cons_printf(portid, "%2lu時間 %2lu分 %2lu秒\n",
665 (now / (1000 * 3600)) % 24,
666 (now / (1000 * 60 )) % 60,
667 (now / 1000 ) % 60);
668
669#ifdef SUPPORT_PPP
670
671 net_count_struct(portid, "HDLC", &net_count_hdlc);
672 cons_printf(portid, "\nPPP\n");
673 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp.in_octets);
674 cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ppp.out_octets);
675 cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp.in_packets);
676 cons_printf(portid, "\t送信バケット数\t%lu\n", net_count_ppp.out_packets);
677 cons_printf(portid, "\t受信エラーバケット数\t%lu\n", net_count_ppp.in_err_packets);
678 cons_printf(portid, "\t送信エラーバケット数\t%lu\n", net_count_ppp.out_err_packets);
679 cons_printf(portid, "\tnet_buf 割り当て失敗数\t%lu\n", net_count_ppp_no_bufs);
680
681 cons_printf(portid, "\nLCP\n");
682 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp_lcp_in_octets);
683 cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp_lcp_in_packets);
684
685 cons_printf(portid, "\nIPCP\n");
686 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp_ipcp_in_octets);
687 cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp_ipcp_in_packets);
688
689 cons_printf(portid, "\nPAP\n");
690 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ppp_upap_in_octets);
691 cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ppp_upap_in_packets);
692
693#endif /* of #ifdef SUPPORT_PPP */
694
695#ifdef SUPPORT_ETHER
696
697 net_count_struct(portid, "イーサネット", &net_count_ether);
698
699 cons_printf(portid, "\nイーサネット・ネットワークインタフェース\n");
700 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_OCTETS]);
701 cons_printf(portid, "\t受信バケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_PACKETS]);
702 cons_printf(portid, "\t受信エラーバケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_IN_ERR_PACKETS]);
703 cons_printf(portid, "\tnet_buf 割り当て失敗数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_NO_BUFS]);
704 cons_printf(portid, "\t受信セマフォ資源返却上限オーバー数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_RXB_QOVRS]);
705 cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_OCTETS]);
706 cons_printf(portid, "\t送信バケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_PACKETS]);
707 cons_printf(portid, "\t送信エラーバケット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_OUT_ERR_PACKETS]);
708 cons_printf(portid, "\tコリジョン数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_COLS]);
709 cons_printf(portid, "\t送信セマフォ資源返却上限オーバー数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_TXB_QOVRS]);
710 cons_printf(portid, "\t送信タイムアウト数 \t%lu\n", net_count_ether_nic[NC_ETHER_NIC_TIMEOUTS]);
711 cons_printf(portid, "\tリセット数\t%lu\n", net_count_ether_nic[NC_ETHER_NIC_RESETS]);
712
713#endif /* of #ifdef SUPPORT_ETHER */
714
715#if defined(SUPPORT_INET4)
716
717#ifdef SUPPORT_ETHER
718
719 net_count_struct(portid, "ARP", &net_count_arp);
720
721#endif /* of #ifdef SUPPORT_ETHER */
722
723 cons_printf(portid, "\nIPv4\n");
724 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ip4[NC_IP4_IN_OCTETS]);
725 cons_printf(portid, "\t受信データグラム数\t%lu\n", net_count_ip4[NC_IP4_IN_PACKETS]);
726 cons_printf(portid, "\t受信エラーデータグラム数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_PACKETS]);
727 cons_printf(portid, "\tチェックサムエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_CKSUM]);
728 cons_printf(portid, "\t長さエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_SHORT]);
729 cons_printf(portid, "\tバージョンエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_VER]);
730 cons_printf(portid, "\tアドレスエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_ADDR]);
731 cons_printf(portid, "\tプロトコルエラー数\t%lu\n", net_count_ip4[NC_IP4_IN_ERR_PROTO]);
732 cons_printf(portid, "\tオプションå…
733¥åŠ›æ•°\t%lu\n", net_count_ip4[NC_IP4_OPTS]);
734 cons_printf(portid, "\t分割受信数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN]);
735 cons_printf(portid, "\t分割受信フラグメント数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_FRAGS]);
736 cons_printf(portid, "\t分割受信再構成成功数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_OK]);
737 cons_printf(portid, "\t分割受信破棄数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_DROP]);
738 cons_printf(portid, "\t分割受信バッファり当て失敗数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_NO_BUF]);
739 cons_printf(portid, "\t分割受信タイムアウト数\t%lu\n", net_count_ip4[NC_IP4_FRAG_IN_TMOUT]);
740 cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ip4[NC_IP4_OUT_OCTETS]);
741 cons_printf(portid, "\t送信データグラム数\t%lu\n", net_count_ip4[NC_IP4_OUT_PACKETS]);
742 cons_printf(portid, "\t送信エラーデータグラム数\t%lu\n", net_count_ip4[NC_IP4_OUT_ERR_PACKETS]);
743 cons_printf(portid, "\t分割送信数\t%lu\n", net_count_ip4[NC_IP4_FRAG_OUT]);
744 cons_printf(portid, "\t分割送信フラグメント数\t%lu\n", net_count_ip4[NC_IP4_FRAG_OUT_FRAGS]);
745
746 net_count_struct(portid, "ICMP", &net_count_icmp4);
747
748#endif /* of #if defined(SUPPORT_INET4) */
749
750#if defined(SUPPORT_INET6)
751
752 cons_printf(portid, "\nIPv6\n");
753 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_ip6[NC_IP6_IN_OCTETS]);
754 cons_printf(portid, "\t受信データグラム数\t%lu\n", net_count_ip6[NC_IP6_IN_PACKETS]);
755 cons_printf(portid, "\t受信エラーデータグラム数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PACKETS]);
756 cons_printf(portid, "\t長さエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_SHORT]);
757 cons_printf(portid, "\tバージョンエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_VER]);
758 cons_printf(portid, "\tアドレスエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_ADDR]);
759 cons_printf(portid, "\tプロトコルエラー数\t%lu\n", net_count_ip6[NC_IP6_IN_ERR_PROTO]);
760 cons_printf(portid, "\t分割受信数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN]);
761 cons_printf(portid, "\t分割受信フラグメント数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_FRAGS]);
762 cons_printf(portid, "\t分割受信再構成成功数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_OK]);
763 cons_printf(portid, "\t分割受信破棄数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_DROP]);
764 cons_printf(portid, "\t分割受信バッファり当て失敗数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_NO_BUF]);
765 cons_printf(portid, "\t分割受信タイムアウト数\t%lu\n", net_count_ip6[NC_IP6_FRAG_IN_TMOUT]);
766 cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_ip6[NC_IP6_OUT_OCTETS]);
767 cons_printf(portid, "\t送信データグラム数\t%lu\n", net_count_ip6[NC_IP6_OUT_PACKETS]);
768 cons_printf(portid, "\t送信エラーデータグラム数\t%lu\n", net_count_ip6[NC_IP6_OUT_ERR_PACKETS]);
769 cons_printf(portid, "\t分割送信数\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT]);
770 cons_printf(portid, "\t分割送信フラグメント数\t%lu\n", net_count_ip6[NC_IP6_FRAG_OUT_FRAGS]);
771
772 cons_printf(portid, "\nICMPv6\n");
773 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_OCTETS]);
774 cons_printf(portid, "\t受信パケット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_PACKETS]);
775 cons_printf(portid, "\t受信エラーパケット数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_PACKETS]);
776 cons_printf(portid, "\t受信チックサムエラー数\t%lu\n", net_count_icmp6[NC_ICMP6_IN_ERR_CKSUM]);
777 cons_printf(portid, "\t送信オクテット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_OCTETS]);
778 cons_printf(portid, "\t送信パケット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_PACKETS]);
779 cons_printf(portid, "\t送信エラーパケット数\t%lu\n", net_count_icmp6[NC_ICMP6_OUT_ERR_PACKETS]);
780
781 cons_printf(portid, "\n近隣探索\n");
782 cons_printf(portid, "\tルータ通知受信数\t%lu\n", net_count_nd6[NC_ND6_RA_IN_PACKETS]);
783 cons_printf(portid, "\tルータ要請送信数\t%lu\n", net_count_nd6[NC_ND6_RS_OUT_PACKETS]);
784 cons_printf(portid, "\t近隣通知受信数\t%lu\n", net_count_nd6[NC_ND6_NA_IN_PACKETS]);
785 cons_printf(portid, "\t近隣通知送信数\t%lu\n", net_count_nd6[NC_ND6_NA_OUT_PACKETS]);
786 cons_printf(portid, "\t近隣要請受信数\t%lu\n", net_count_nd6[NC_ND6_NS_IN_PACKETS]);
787 cons_printf(portid, "\t近隣要請送信数\t%lu\n", net_count_nd6[NC_ND6_NS_OUT_PACKETS]);
788 cons_printf(portid, "\t重複アドレス検出送信数\t%lu\n", net_count_nd6[NC_ND6_DAD_OUT_PACKETS]);
789
790#endif /* of #if defined(SUPPORT_INET6) */
791
792#ifdef SUPPORT_TCP
793
794 cons_printf(portid, "\nTCP\n");
795 cons_printf(portid, "\t受信オクテット数\t%lu\n", net_count_tcp[NC_TCP_RECV_OCTETS]);
796 cons_printf(portid, "\t受信データオクテット数\t%lu\n", net_count_tcp[NC_TCP_RECV_DATA_OCTETS]);
797 cons_printf(portid, "\t受信セグメント数\t%lu\n", net_count_tcp[NC_TCP_RECV_SEGS]);
798 cons_printf(portid, "\t受信データセグメント数\t%lu\n", net_count_tcp[NC_TCP_RECV_DATA_SEGS]);
799 cons_printf(portid, "\t受信、緊急セグメント数\t%lu\n", net_count_tcp[NC_TCP_RECV_URG_SEGS]);
800 cons_printf(portid, "\t受信、ヘッダ不正数\t%lu\n", net_count_tcp[NC_TCP_RECV_BAD_HEADERS]);
801 cons_printf(portid, "\t受信、チェックサム不正数\t%lu\n", net_count_tcp[NC_TCP_RECV_BAD_CKSUMS]);
802 cons_printf(portid, "\t受信、ACK 数\t%lu\n", net_count_tcp[NC_TCP_RECV_ACKS]);
803 cons_printf(portid, "\t受信、多重 ACK 数\t%lu\n", net_count_tcp[NC_TCP_RECV_DUP_ACKS]);
804 cons_printf(portid, "\t受信、RST 数\t%lu\n", net_count_tcp[NC_TCP_RECV_RSTS]);
805 cons_printf(portid, "\t受信、多重数\t%lu\n", net_count_tcp[NC_TCP_RECV_DUP_SEGS]);
806 cons_printf(portid, "\t受信、破棄数\t%lu\n", net_count_tcp[NC_TCP_RECV_DROP_SEGS]);
807 cons_printf(portid, "\t受信キュー解放数\t%lu\n", net_count_tcp[NC_TCP_FREE_RCV_QUEUE]);
808 cons_printf(portid, "\t送信データオクテット数\t%lu\n", net_count_tcp[NC_TCP_SEND_DATA_OCTETS]);
809 cons_printf(portid, "\t送信制御セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_CNTL_SEGS]);
810 cons_printf(portid, "\t送信セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_SEGS]);
811 cons_printf(portid, "\t再送信セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_REXMIT_SEGS]);
812 cons_printf(portid, "\t送信データセグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_DATA_SEGS]);
813 cons_printf(portid, "\t送信、緊急セグメント数\t%lu\n", net_count_tcp[NC_TCP_SEND_URG_SEGS]);
814 cons_printf(portid, "\t送信、ACK 数\t%lu\n", net_count_tcp[NC_TCP_SEND_ACKS]);
815 cons_printf(portid, "\t送信、RST 数\t%lu\n", net_count_tcp[NC_TCP_SEND_RSTS]);
816 cons_printf(portid, "\tRTT 更新数\t%lu\n", net_count_tcp[NC_TCP_RTT_UPDATES]);
817 cons_printf(portid, "\t受動オープン数\t%lu\n", net_count_tcp[NC_TCP_ACCEPTS]);
818 cons_printf(portid, "\t能動オープン数\t%lu\n", net_count_tcp[NC_TCP_CONNECTS]);
819
820#endif /* of #ifdef SUPPORT_TCP */
821
822#ifdef SUPPORT_UDP
823
824 net_count_struct(portid, "UDP", &net_count_udp);
825
826#endif /* of #ifdef SUPPORT_UDP */
827
828 tbl = nbuf_get_tbl();
829 cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t割当要求数\t割当数\t割当てエラー数\n");
830 for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
831 cons_printf(portid, "\t%lu\t%lu\t%lu\t%lu\t%lu\n",
832 tbl[ix].size,
833 tbl[ix].prepares,
834 tbl[ix].requests,
835 tbl[ix].allocs,
836 tbl[ix].errors);
837 }
838
839 cons_printf(portid, "\nネットワーク統計情
840報\t経過時間[ms]\t%lu\t", now);
841 if (now > (1000 * 3600 * 24))
842 cons_printf(portid, "%3lu日 %2lu時間 %2lu分 %2lu秒\n",
843 now / (1000 * 3600 * 24),
844 (now / (1000 * 3600)) % 24,
845 (now / (1000 * 60 )) % 60,
846 (now / 1000 ) % 60);
847 else
848 cons_printf(portid, "%2lu時間 %2lu分 %2lu秒\n",
849 (now / (1000 * 3600)) % 24,
850 (now / (1000 * 60 )) % 60,
851 (now / 1000 ) % 60);
852
853 SIG_NET_CONS_PRINTF();
854 FLUSH_SND_BUFF();
855 }
856
857#if defined(SUPPORT_INET4)
858
859#ifdef IP4_CFG_FRAGMENT
860
861/*
862 * nbuf_stat_ip4_frag_queue -- IPv4 再構成キュー内
863ネットワークバッファ情
864å ±
865 */
866
867static void
868nbuf_stat_ip4_frag_queue (ID portid)
869{
870 const T_NET_BUF_ENTRY *tbl;
871 const T_NET_BUF *nbuf, **queue;
872 int_t ix, fix, count;
873
874 cons_printf(portid, "\nIPv4再構成キュー内
875\nIndex\tTime");
876 tbl = nbuf_get_tbl();
877 for (ix = nbuf_get_tbl_size(); ix -- > 0; )
878 cons_printf(portid, "\t%d", tbl[ix].size);
879 cons_printf(portid, "\n");
880
881 queue = ip_get_frag_queue();
882 for (fix = 0; fix < NUM_IP4_FRAG_QUEUE; fix ++) {
883 if (queue[fix] != NULL) {
884 cons_printf(portid, "%d\t%d", fix, GET_QIP4_HDR(queue[fix])->ttl);
885 for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
886 count = 0;
887 for (nbuf = queue[fix]; nbuf != NULL; nbuf = GET_QIP4_HDR(nbuf)->next)
888 if (nbuf->idix == ix)
889 count ++;
890 cons_printf(portid, "\t%d", count);
891 }
892 cons_printf(portid, "\n");
893 }
894 }
895 }
896
897#endif /* of #ifdef IP4_CFG_FRAGMENT */
898
899#endif /* of #if defined(SUPPORT_INET4) */
900
901#if defined(SUPPORT_INET6)
902
903#ifdef IP6_CFG_FRAGMENT
904
905/*
906 * nbuf_stat_ip6_frag_queue -- IPv6 再構成キュー内
907ネットワークバッファ情
908å ±
909 */
910
911static void
912nbuf_stat_ip6_frag_queue (ID portid)
913{
914 const T_NET_BUF_ENTRY *tbl;
915 const T_NET_BUF *nbuf, **queue;
916 int_t ix, fix, count;
917
918 cons_printf(portid, "\nIPv6再構成キュー内
919\nIndex\tTime");
920 tbl = nbuf_get_tbl();
921 for (ix = nbuf_get_tbl_size(); ix -- > 0; )
922 cons_printf(portid, "\t%d", tbl[ix].size);
923 cons_printf(portid, "\n");
924
925 queue = ip6_get_frag_queue();
926 for (fix = 0; fix < NUM_IP6_FRAG_QUEUE; fix ++) {
927 if (queue[fix] != NULL) {
928 cons_printf(portid, "%d\t%d", fix, GET_QIP6_HDR(queue[fix])->ftim);
929 for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
930 count = 0;
931 for (nbuf = queue[fix]; nbuf != NULL; nbuf = GET_QIP6_HDR(nbuf)->next_frag)
932 if (nbuf->idix == ix)
933 count ++;
934 cons_printf(portid, "\t%d", count);
935 }
936 cons_printf(portid, "\n");
937 }
938 }
939 }
940
941#endif /* of #ifdef IP6_CFG_FRAGMENT */
942
943#endif /* of #if defined(SUPPORT_INET6) */
944
945#endif /* of #if NET_COUNT_ENABLE */
946
947/*
948 * nbuf_status -- ネットワークバッファ情
949å ±
950 */
951
952static void
953nbuf_status (ID portid, char *line)
954{
955 SYSTIM now;
956
957#if NET_COUNT_ENABLE
958 const T_NET_BUF_ENTRY *tbl;
959 int_t ix;
960#endif /* of #if NET_COUNT_ENABLE */
961
962#ifdef SUPPORT_TCP
963 T_NET_BUF *nbuf;
964 T_TCP_CEP* cep;
965 T_TCP_Q_HDR* tqhdr;
966
967#ifdef TCP_CFG_SWBUF_CSAVE
968 T_IP_HDR* iph;
969 T_TCP_HDR* tcph;
970#endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */
971#endif /* of #ifdef SUPPORT_TCP */
972
973 WAI_NET_CONS_PRINTF();
974 get_tim(&now);
975 cons_printf(portid, "ネットワークバッファ情
976報\t経過時間[ms]\t%lu\n", now);
977
978#if NET_COUNT_ENABLE
979
980 cons_printf(portid, "\nネットワークバッファ\n\tサイズ\t用意数\t割当要求数\t割当数\t割当てエラー数\n");
981 tbl = nbuf_get_tbl();
982 for (ix = nbuf_get_tbl_size(); ix -- > 0; ) {
983 cons_printf(portid, "\t%lu\t%lu\t%lu\t%lu\t%lu\n",
984 tbl[ix].size,
985 tbl[ix].prepares,
986 tbl[ix].requests,
987 tbl[ix].allocs,
988 tbl[ix].errors);
989 }
990
991#endif /* of #if NET_COUNT_ENABLE */
992
993#ifdef SUPPORT_TCP
994
995 cons_printf(portid, "\nCEP内
996\nCEPID\n");
997
998 for (cep = tcp_cep; cep < &tcp_cep[tmax_tcp_cepid]; cep ++) {
999 cons_printf(portid, "%2d", GET_TCP_CEPID(cep));
1000 for (nbuf = cep->reassq; nbuf != NULL; nbuf = tqhdr->next) {
1001 tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_IP_Q_HDR(nbuf)->thoff);
1002 cons_printf(portid, "[a:%6d-%6d] ",
1003 ntohl(tqhdr->seq) - cep->irs + tqhdr->soff,
1004 ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen);
1005 }
1006
1007#ifdef TCP_CFG_RWBUF_CSAVE
1008 for (nbuf = cep->rwbufq; nbuf != NULL; nbuf = tqhdr->next) {
1009 tqhdr = GET_TCP_Q_HDR(nbuf, GET_TCP_IP_Q_HDR(nbuf)->thoff);
1010 cons_printf(portid, "[r:%6d-%6d] ",
1011 ntohl(tqhdr->seq) - cep->irs + tqhdr->soff,
1012 ntohl(tqhdr->seq) - cep->irs + tqhdr->soff + tqhdr->slen);
1013 }
1014#endif /* of #ifdef TCP_CFG_RWBUF_CSAVE */
1015
1016#ifdef TCP_CFG_SWBUF_CSAVE
1017 if (cep->swbufq != NULL) {
1018 iph = GET_IP_HDR(cep->swbufq);
1019 tcph = GET_TCP_HDR(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq));
1020 cons_printf(portid, "[s:%6d-%6d] ",
1021 ntohl(tcph->seq) - cep->iss,
1022 ntohl(tcph->seq) - cep->iss + (GET_IP_SDU_SIZE(iph) -
1023 GET_TCP_HDR_SIZE2(cep->swbufq, GET_TCP_HDR_OFFSET(cep->swbufq))));
1024 }
1025#endif /* of #ifdef TCP_CFG_SWBUF_CSAVE */
1026
1027 cons_printf(portid, "\n");
1028 }
1029
1030#endif /* of #ifdef SUPPORT_TCP */
1031
1032#if NET_COUNT_ENABLE
1033
1034#if defined(SUPPORT_INET4)
1035
1036#ifdef IP4_CFG_FRAGMENT
1037
1038 nbuf_stat_ip4_frag_queue(portid);
1039
1040#endif /* of #ifdef IP4_CFG_FRAGMENT */
1041
1042#endif /* of #if defined(SUPPORT_INET4) */
1043
1044#if defined(SUPPORT_INET6)
1045
1046#ifdef IP6_CFG_FRAGMENT
1047
1048 nbuf_stat_ip6_frag_queue(portid);
1049
1050#endif /* of #ifdef IP6_CFG_FRAGMENT */
1051
1052#endif /* of #if defined(SUPPORT_INET6) */
1053
1054#endif /* of #if NET_COUNT_ENABLE */
1055
1056 SIG_NET_CONS_PRINTF();
1057 FLUSH_SND_BUFF();
1058 }
1059
1060#if defined(SUPPORT_INET4)
1061
1062#if NUM_ROUTE_ENTRY > 0
1063
1064/*
1065 * routing_table_status -- 経路表の出力
1066 */
1067
1068static void
1069routing_table_status (ID portid, char *line)
1070{
1071 int_t ix;
1072
1073 if ('0' <= *(line = skip_blanks(line)) && *line <= '9') {
1074 T_IN4_ADDR target, mask, gateway;
1075
1076 ix = atoi(line);
1077 while ('0' <= *line && *line <= '9')
1078 line ++;
1079 line = GET_IPADDR(&target, skip_blanks(line));
1080 line = GET_IPADDR(&mask, skip_blanks(line));
1081 GET_IPADDR(&gateway, skip_blanks(line));
1082 in4_add_route(ix, target, mask, gateway);
1083 }
1084
1085 WAI_NET_CONS_PRINTF();
1086 cons_printf(portid,
1087 "Routing Table Status\n"
1088 "IX Target Mask Gateway Expire\n");
1089
1090 for (ix = 0; ix < NUM_ROUTE_ENTRY; ix ++) {
1091 if ((routing_tbl[ix].flags & IN_RTF_DEFINED) == 0)
1092 ;
1093 else if ((routing_tbl[ix].flags & IN_RTF_REDIRECT) != 0)
1094 cons_printf(portid, "%2d %15I %15I %15I %4d\n",
1095 ix,
1096 &routing_tbl[ix].target,
1097 &routing_tbl[ix].mask,
1098 &routing_tbl[ix].gateway,
1099 &routing_tbl[ix].expire);
1100 else
1101 cons_printf(portid, "%2d %15I %15I %I\n",
1102 ix,
1103 &routing_tbl[ix].target,
1104 &routing_tbl[ix].mask,
1105 &routing_tbl[ix].gateway);
1106
1107 }
1108
1109 SIG_NET_CONS_PRINTF();
1110 FLUSH_SND_BUFF();
1111 }
1112
1113#endif /* of #if NUM_ROUTE_ENTRY > 0 */
1114
1115#endif /* of #if defined(SUPPORT_INET4) */
1116
1117#if defined(SUPPORT_INET6)
1118
1119#if NUM_ND6_DEF_RTR_ENTRY > 0
1120
1121/*
1122 * defrtrlist_status -- ディフォルトルータ・リスト状æ…
1123‹ã®å‡ºåŠ›
1124 */
1125
1126static void
1127defrtrlist_status (ID portid, char *line)
1128{
1129 const T_DEF_ROUTER *dr;
1130 SYSTIM now;
1131 int_t rix, pix, pcnt, ptitle;
1132 uint_t count, mask;
1133
1134 WAI_NET_CONS_PRINTF();
1135 cons_printf(portid,
1136 "Default Router List Status\n"
1137 "IX Expire Lifetime flags prefix");
1138 for (ptitle = NUM_ND6_PREFIX_ENTRY * 2 - sizeof("prefix"); ptitle -- > 0; )
1139 cons_printf(portid, " ");
1140 cons_printf(portid, " IP Address\n");
1141
1142 /* expire の単位は [ms]。*/
1143 get_tim(&now);
1144 dr = nd6_get_drl(&count);
1145 for (rix = 0; rix < count; rix ++) {
1146 if (dr[rix].state == ND6_DEF_RTR_BUSY) {
1147 cons_printf(portid, "%2d", rix);
1148 if (dr[rix].lifetime == ND6_INFINITE_LIFETIME)
1149 cons_printf(portid, " INFIN INFIN");
1150 else
1151 cons_printf(portid, " %6d %8d",
1152 (uint32_t)(dr[rix].expire - now) <= 0
1153 ? 0 : (dr[rix].expire - now) / SYSTIM_HZ,
1154 dr[rix].lifetime / SYSTIM_HZ);
1155 cons_printf(portid, " %02x", dr[rix].flags);
1156 pcnt = NUM_ND6_PREFIX_ENTRY;
1157 ptitle = NUM_ND6_PREFIX_ENTRY * 2 - sizeof(" prefix");
1158 mask = 1;
1159 for (pix = 0; pix < NUM_ND6_PREFIX_ENTRY; pix ++) {
1160 if ((dr[rix].plistmap & mask) != 0) {
1161 if (pcnt == NUM_ND6_PREFIX_ENTRY)
1162 cons_printf(portid, " ");
1163 else
1164 cons_printf(portid, ",");
1165 cons_printf(portid, "%d", pix);
1166 pcnt --;
1167 ptitle -= 2;
1168 }
1169 mask <<= 1;
1170 }
1171 while (pcnt --) {
1172 cons_printf(portid, " ");
1173 ptitle -= 2;
1174 }
1175 while (ptitle -- > 0)
1176 cons_printf(portid, " ");
1177 cons_printf(portid, " %I\n", &dr[rix].addr);
1178 }
1179 }
1180
1181 SIG_NET_CONS_PRINTF();
1182 FLUSH_SND_BUFF();
1183 }
1184
1185/*
1186 * prefixlist_status -- プレフィックス・リスト状æ…
1187‹ã®å‡ºåŠ›
1188 */
1189
1190static void
1191prefixlist_status (ID portid, char *line)
1192{
1193 const T_ND6_PREFIX *pr;
1194 SYSTIM now;
1195 int_t rix, pix, rcnt, rtitle;
1196 uint_t mask;
1197
1198 WAI_NET_CONS_PRINTF();
1199 cons_printf(portid,
1200 "Prefix List Status\n"
1201 "IX Expire Lifetime flags router");
1202 for (rtitle = NUM_ND6_DEF_RTR_ENTRY * 2 - sizeof("router"); rtitle -- > 0; )
1203 cons_printf(portid, " ");
1204 cons_printf(portid, " Len Prefix\n");
1205
1206 /* expire の単位は [s]。*/
1207 get_tim(&now);
1208 now /= SYSTIM_HZ;
1209 pr = nd6_get_prl();
1210 for (pix = 0; pix < NUM_ND6_PREFIX_ENTRY; pix ++) {
1211 if ((pr[pix].flags & ND6_PREFIX_STATE_BUSY) != 0) {
1212 cons_printf(portid, "%2d", pix);
1213 if (pr[pix].vltime == ND6_INFINITE_LIFETIME)
1214 cons_printf(portid, " INFIN INFIN");
1215 else
1216 cons_printf(portid, " %7d %8d",
1217 (uint32_t)(pr[pix].expire - now) <= 0
1218 ? 0 : (pr[pix].expire - now),
1219 pr[pix].vltime);
1220 cons_printf(portid, " %02x", pr[pix].flags);
1221 rcnt = NUM_ND6_DEF_RTR_ENTRY;
1222 rtitle = NUM_ND6_DEF_RTR_ENTRY * 2 - sizeof(" router");
1223 mask = 1;
1224 for (rix = 0; rix < NUM_ND6_DEF_RTR_ENTRY; rix ++) {
1225 if ((pr[pix].routermap & mask) != 0) {
1226 if (rcnt == NUM_ND6_DEF_RTR_ENTRY)
1227 cons_printf(portid, " ");
1228 else
1229 cons_printf(portid, ",");
1230 cons_printf(portid, "%d", rix);
1231 rcnt --;
1232 rtitle -= 2;
1233 }
1234 mask <<= 1;
1235 }
1236 while (rcnt --) {
1237 cons_printf(portid, " ");
1238 rtitle -= 2;
1239 }
1240 while (rtitle -- > 0)
1241 cons_printf(portid, " ");
1242 cons_printf(portid, "%4d %I\n", pr[pix].prefix_len, &pr[pix].prefix);
1243 }
1244 }
1245
1246 SIG_NET_CONS_PRINTF();
1247 FLUSH_SND_BUFF();
1248 }
1249
1250#endif /* of #if NUM_ND6_DEF_RTR_ENTRY > 0 */
1251
1252#if NUM_ROUTE_ENTRY > 0
1253
1254/*
1255 * routing_table_status -- 経路表の出力
1256 */
1257
1258static void
1259routing_table_status (ID portid, char *line)
1260{
1261 SYSTIM now;
1262 int_t ix;
1263
1264 WAI_NET_CONS_PRINTF();
1265 cons_printf(portid,
1266 "Routing Table Status\n"
1267 "IX Expire flags Prefix Target Gateway\n");
1268
1269 for (ix = 0; ix < NUM_STATIC_ROUTE_ENTRY; ix ++) {
1270 cons_printf(portid, "%2d STATIC - %6d %30I %I\n",
1271 ix,
1272 routing_tbl[ix].prefix_len,
1273 &routing_tbl[ix].target,
1274 &routing_tbl[ix].gateway);
1275
1276 }
1277
1278 /* expire の単位は [s]。*/
1279 get_tim(&now);
1280 now /= SYSTIM_HZ;
1281
1282 for ( ; ix < NUM_ROUTE_ENTRY; ix ++)
1283 if (routing_tbl[ix].flags & IN_RTF_DEFINED)
1284 cons_printf(portid, "%2d %6d %02x %6d %30I %I\n",
1285 ix,
1286 (uint32_t)(routing_tbl[ix].expire - now) <= 0
1287 ? 0 : routing_tbl[ix].expire - now,
1288 routing_tbl[ix].flags,
1289 routing_tbl[ix].prefix_len,
1290 &routing_tbl[ix].target,
1291 &routing_tbl[ix].gateway);
1292
1293 SIG_NET_CONS_PRINTF();
1294 FLUSH_SND_BUFF();
1295 }
1296
1297#endif /* of #if NUM_ROUTE_ENTRY > 0 */
1298
1299#endif /* of #if defined(SUPPORT_INET6) */
1300
1301#if NUM_ROUTE_ENTRY > 0
1302
1303/*
1304 * routing_status -- ルーティング情
1305å ±
1306 */
1307
1308static void
1309routing_status (ID portid, char *line)
1310{
1311 switch (*line) {
1312
1313#if defined(SUPPORT_INET6)
1314
1315#if NUM_ND6_DEF_RTR_ENTRY > 0
1316
1317 case 'l': /* ディフォルトルータ・リスト情
1318å ± */
1319 defrtrlist_status(portid, line + 1);
1320 break;
1321
1322 case 'p': /* プレフィックス・リスト情
1323å ± */
1324 prefixlist_status(portid, line + 1);
1325 break;
1326
1327#endif /* of #if NUM_ND6_DEF_RTR_ENTRY > 0 */
1328
1329#endif /* of #if defined(SUPPORT_INET6) */
1330
1331 default: /* ルーティング表情
1332å ± */
1333 routing_table_status(portid, line);
1334 break;
1335
1336 break;
1337 }
1338 }
1339
1340#endif /* of #if NUM_ROUTE_ENTRY > 0 */
1341
1342/*
1343 * network_status -- ネットワークの状æ…
1344‹ã®å‡ºåŠ›
1345 */
1346
1347static void
1348network_status (ID portid, char *line)
1349{
1350 switch (*line) {
1351
1352#ifdef SUPPORT_ETHER
1353
1354 case 'a': /* IF アドレス情
1355å ± */
1356 ifa_status(portid, line + 1);
1357 break;
1358
1359#endif /* of #ifdef SUPPORT_ETHER */
1360
1361 case 'b': /* ネットワークバッファ情
1362å ± */
1363 nbuf_status(portid, line + 1);
1364 break;
1365
1366#if NET_COUNT_ENABLE
1367
1368 case 'c': /* ネットワーク統計情
1369å ± */
1370 net_count(portid, line + 1);
1371 break;
1372
1373#endif /* of #if NET_COUNT_ENABLE */
1374
1375#if NUM_ROUTE_ENTRY > 0
1376
1377 case 'r': /* ルーティング情
1378å ± */
1379 routing_status(portid, line + 1);
1380 break;
1381
1382#endif /* of #if NUM_ROUTE_ENTRY > 0 */
1383
1384#ifdef SUPPORT_TCP
1385
1386 case 't': /* TCP status */
1387 tcp_status(portid, line + 1);
1388 break;
1389
1390#endif /* of #ifdef SUPPORT_TCP */
1391
1392#ifdef SUPPORT_UDP
1393
1394 case 'u': /* UDP status */
1395 udp_status(portid, line + 1);
1396 break;
1397
1398#endif /* of #ifdef SUPPORT_UDP */
1399
1400 default:
1401 cons_printf(portid, "no such command: '%c%c'\n", *(line - 1), *line);
1402 SIG_NET_CONS_PRINTF();
1403 FLUSH_SND_BUFF();
1404 break;
1405 }
1406 }
1407
1408#if defined(SUPPORT_INET4)
1409
1410/*
1411 * ifconfig -- ネットワークインタフェースの構成情
1412å ±
1413 */
1414
1415static void
1416ifconfig (ID portid, char *line)
1417{
1418 T_IFNET *ifp = IF_GET_IFNET();
1419 T_IN4_ADDR bc;
1420
1421#ifdef SUPPORT_ETHER
1422
1423 if (*(line = skip_blanks(line))) {
1424 T_IN4_ADDR addr, mask;
1425
1426 GET_IPADDR(&mask, skip_blanks(GET_IPADDR(&addr, line)));
1427 in4_add_ifaddr(addr, mask);
1428 }
1429
1430#endif /* of #ifdef SUPPORT_ETHER */
1431
1432 WAI_NET_CONS_PRINTF();
1433 cons_printf(portid,
1434 "Network Interface Configurations\n");
1435
1436#ifdef SUPPORT_ETHER
1437
1438 cons_printf(portid,
1439 "ether: %M\n",
1440 IF_ETHER_NIC_GET_SOFTC()->ifaddr.lladdr);
1441
1442#endif /* of #ifdef SUPPORT_ETHER */
1443
1444 bc = (ifp->in_ifaddr.addr & ifp->in_ifaddr.mask) | ~ifp->in_ifaddr.mask;
1445 cons_printf(portid,
1446 "inet: %I, mask: %I, broadcast: %I\n",
1447 &ifp->in_ifaddr.addr,
1448 &ifp->in_ifaddr.mask,
1449 &bc);
1450
1451 SIG_NET_CONS_PRINTF();
1452 FLUSH_SND_BUFF();
1453 }
1454
1455#endif /* of #if defined(SUPPORT_INET4) */
1456
1457#if defined(SUPPORT_INET6)
1458
1459/*
1460 * ifconfig -- ネットワークインタフェースの構成情
1461å ±
1462 */
1463
1464static void
1465ifconfig (ID portid, char *line)
1466{
1467#ifdef SUPPORT_ETHER
1468
1469 T_IF_SOFTC *ic;
1470 T_IFNET *ifp = IF_GET_IFNET();
1471 int_t ix;
1472 SYSTIM now;
1473
1474 WAI_NET_CONS_PRINTF();
1475 ic = IF_ETHER_NIC_GET_SOFTC();
1476 cons_printf(portid, "ether: %M\ninet6:\nIX Expire Preffered RTR PFX Flags IP Address\n",
1477 ic->ifaddr.lladdr);
1478
1479 /* expire と vltime の単位は [s]。*/
1480 get_tim(&now);
1481 now /= SYSTIM_HZ;
1482
1483 for (ix = 0; ix < NUM_IN6_IFADDR_ENTRY; ix ++) {
1484 if (ifp->in_ifaddrs[ix].flags & IN6_IFF_DEFINED) {
1485 cons_printf(portid, " %d", ix);
1486 if (ifp->in_ifaddrs[ix].lifetime.vltime == ND6_INFINITE_LIFETIME)
1487 cons_printf(portid, " INFIN INFIN");
1488 else
1489 cons_printf(portid, " %8d %9d",
1490 (uint32_t)(ifp->in_ifaddrs[ix].lifetime.expire - now) <= 0
1491 ? 0 : ifp->in_ifaddrs[ix].lifetime.expire - now,
1492 (uint32_t)(ifp->in_ifaddrs[ix].lifetime.preferred - now) <= 0
1493 ? 0 : ifp->in_ifaddrs[ix].lifetime.preferred - now);
1494 if (ifp->in_ifaddrs[ix].router_index == IN6_RTR_IX_UNREACH)
1495 cons_printf(portid, " -");
1496 else
1497 cons_printf(portid, " %3d", ifp->in_ifaddrs[ix].router_index);
1498 if (ifp->in_ifaddrs[ix].prefix_index == ND6_PREFIX_IX_INVALID)
1499 cons_printf(portid, " -");
1500 else
1501 cons_printf(portid, " %3d", ifp->in_ifaddrs[ix].prefix_index);
1502 cons_printf(portid, " %02x %I\n",
1503 ifp->in_ifaddrs[ix].flags,
1504 &ifp->in_ifaddrs[ix].addr);
1505 }
1506 }
1507
1508 SIG_NET_CONS_PRINTF();
1509 FLUSH_SND_BUFF();
1510
1511#endif /* of #ifdef SUPPORT_ETHER */
1512 }
1513
1514#endif /* of #if defined(SUPPORT_INET6) */
1515
1516/*
1517 * show_config -- コンフィギュレーション設定の表示
1518 */
1519
1520static void
1521show_config (ID portid, char *line)
1522{
1523#if defined(SUPPORT_ETHER)
1524#if defined(SUPPORT_INET4)
1525 T_IN4_ADDR addr;
1526#endif
1527#endif /* of #if defined(SUPPORT_ETHER) */
1528
1529#if defined(DHCP_CFG)
1530
1531 cons_printf(portid, "DHCP:\n");
1532
1533 cons_printf(portid, " DHCP_CFG: On\n");
1534
1535#endif /* of #if define(DHCP_CFG) */
1536
1537#if defined(SUPPORT_TCP)
1538
1539 cons_printf(portid, "TCP:\n");
1540
1541 cons_printf(portid, " TCP_CFG_PASSIVE_OPEN: ");
1542#if defined(TCP_CFG_PASSIVE_OPEN)
1543 cons_printf(portid, "On\n");
1544#else
1545 cons_printf(portid, "Off\n");
1546#endif
1547
1548 cons_printf(portid, " TCP_CFG_OPT_MSS: ");
1549#if defined(TCP_CFG_OPT_MSS)
1550 cons_printf(portid, "On\n");
1551#else
1552 cons_printf(portid, "Off\n");
1553#endif
1554
1555 cons_printf(portid, " TCP_CFG_DELAY_ACK: ");
1556#if defined(TCP_CFG_DELAY_ACK)
1557 cons_printf(portid, "On\n");
1558#else
1559 cons_printf(portid, "Off\n");
1560#endif
1561
1562 cons_printf(portid, " TCP_CFG_ALWAYS_KEEP: ");
1563#if defined(TCP_CFG_ALWAYS_KEEP)
1564 cons_printf(portid, "On\n");
1565#else
1566 cons_printf(portid, "Off\n");
1567#endif
1568
1569 cons_printf(portid, " TCP_CFG_RWBUF_CSAVE: ");
1570#if defined(TCP_CFG_RWBUF_CSAVE_ONLY)
1571 cons_printf(portid, "Only, ");
1572#if defined(TCP_CFG_RWBUF_CSAVE_MAX_QUEUES)
1573 cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: %2d\n",
1574 TCP_CFG_RWBUF_CSAVE_MAX_QUEUES);
1575#else
1576 cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: Undefined\n");
1577#endif
1578#elif defined(TCP_CFG_RWBUF_CSAVE)
1579 cons_printf(portid, "On, ");
1580#if defined(TCP_CFG_RWBUF_CSAVE_MAX_QUEUES)
1581 cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: %2d\n",
1582 TCP_CFG_RWBUF_CSAVE_MAX_QUEUES);
1583#else
1584 cons_printf(portid, "TCP_CFG_RWBUF_CSAVE_MAX_QUEUES: Undefined\n");
1585#endif
1586#else
1587 cons_printf(portid, "Off\n");
1588#endif
1589
1590 cons_printf(portid, " TCP_CFG_SWBUF_CSAVE: ");
1591#if defined(TCP_CFG_SWBUF_CSAVE_ONLY)
1592 cons_printf(portid, "Only, TCP_CFG_SWBUF_CSAVE_MAX_SIZE: %4d\n"
1593 " "
1594 " TCP_CFG_SWBUF_CSAVE_MIN_SIZE: %4d\n",
1595 TCP_CFG_SWBUF_CSAVE_MAX_SIZE,
1596 TCP_CFG_SWBUF_CSAVE_MIN_SIZE);
1597#elif defined(TCP_CFG_SWBUF_CSAVE)
1598 cons_printf(portid, "On, TCP_CFG_SWBUF_CSAVE_MAX_SIZE: %4d\n"
1599 " "
1600 " TCP_CFG_SWBUF_CSAVE_MIN_SIZE: %4d\n",
1601 TCP_CFG_SWBUF_CSAVE_MAX_SIZE,
1602 TCP_CFG_SWBUF_CSAVE_MIN_SIZE);
1603#else
1604 cons_printf(portid, "Off\n");
1605#endif
1606
1607 cons_printf(portid, " TCP_CFG_NON_BLOCKING: ");
1608#if defined(TCP_CFG_NON_BLOCKING)
1609#if defined(USE_TCP_NON_BLOCKING)
1610 cons_printf(portid, "Use\n");
1611#else
1612 cons_printf(portid, "On\n");
1613#endif
1614#else
1615 cons_printf(portid, "Off\n");
1616#endif
1617
1618 cons_printf(portid, " TCP_CFG_EXTENTIONS: ");
1619#if defined(TCP_CFG_EXTENTIONS)
1620#if defined(USE_TCP_EXTENTIONS)
1621 cons_printf(portid, "Use\n");
1622#if defined(SUPPORT_INET4)
1623 cons_printf(portid, " NUM_VRID_TCP_REPS: %3d\n", NUM_VRID_TCP_REPS);
1624 cons_printf(portid, " NUM_VRID_TCP_CEPS: %3d\n", NUM_VRID_TCP_CEPS);
1625#endif
1626#if defined(SUPPORT_INET6)
1627 cons_printf(portid, " NUM_VRID_TCP6_REPS: %3d\n", NUM_VRID_TCP6_REPS);
1628 cons_printf(portid, " NUM_VRID_TCP6_CEPS: %3d\n", NUM_VRID_TCP6_CEPS);
1629#endif
1630#else
1631 cons_printf(portid, "On\n");
1632#endif
1633#else
1634 cons_printf(portid, "Off\n");
1635#endif
1636
1637 cons_printf(portid, " USE_COPYSAVE_API: ");
1638#if defined(USE_COPYSAVE_API)
1639 cons_printf(portid, "Use\n");
1640#else
1641 cons_printf(portid, "Off\n");
1642#endif
1643
1644#if NUM_TCP_TW_CEP_ENTRY > 0
1645 cons_printf(portid, " TCP_TW_CEP: On, NUM_TCP_TW_CEP_ENTRY: %d\n", NUM_TCP_TW_CEP_ENTRY);
1646#else
1647 cons_printf(portid, " TCP_TW_CEP: Off\n");
1648#endif
1649
1650#if defined(TCP_CFG_TRACE)
1651 cons_printf(portid, " TCP_CFG_TRACE: On, TCP_CFG_TRACE_LPORTNO: %d\n", TCP_CFG_TRACE_LPORTNO);
1652#if defined(SUPPORT_INET4)
1653 addr = TCP_CFG_TRACE_IPV4_RADDR;
1654 cons_printf(portid, " TCP_CFG_TRACE_IPV4_RADDR: %I\n", &addr);
1655#endif
1656 cons_printf(portid, " TCP_CFG_TRACE_RPORTNO: %d\n", TCP_CFG_TRACE_RPORTNO);
1657#else
1658 cons_printf(portid, " TCP_CFG_TRACE: Off\n");
1659#endif
1660
1661 cons_printf(portid, " MAX_TCP_SND_SEG: %4d\n", MAX_TCP_SND_SEG);
1662 cons_printf(portid, " DEF_TCP_SND_SEG: %4d\n", DEF_TCP_SND_SEG);
1663 cons_printf(portid, " MAX_TCP_RCV_SEG: %4d\n", MAX_TCP_RCV_SEG);
1664 cons_printf(portid, " DEF_TCP_RCV_SEG: %4d\n", DEF_TCP_RCV_SEG);
1665 cons_printf(portid, " MAX_TCP_REALLOC_SIZE: %4d\n", MAX_TCP_REALLOC_SIZE);
1666
1667#endif /* of #if defined(SUPPORT_TCP) */
1668
1669#if defined(SUPPORT_UDP)
1670
1671 cons_printf(portid, "UDP:\n");
1672
1673 cons_printf(portid, " UDP_CFG_IN_CHECKSUM: ");
1674#if defined(UDP_CFG_IN_CHECKSUM)
1675 cons_printf(portid, "On\n");
1676#else
1677 cons_printf(portid, "Off\n");
1678#endif
1679
1680 cons_printf(portid, " UDP_CFG_OUT_CHECKSUM: ");
1681#if defined(UDP_CFG_OUT_CHECKSUM)
1682 cons_printf(portid, "On\n");
1683#else
1684 cons_printf(portid, "Off\n");
1685#endif
1686
1687 cons_printf(portid, " UDP_CFG_NON_BLOCKING: ");
1688#if defined(UDP_CFG_NON_BLOCKING)
1689#if defined(USE_UDP_NON_BLOCKING)
1690 cons_printf(portid, "Use\n");
1691#else
1692 cons_printf(portid, "On\n");
1693#endif
1694#else
1695 cons_printf(portid, "Off\n");
1696#endif
1697
1698 cons_printf(portid, " UDP_CFG_EXTENTIONS: ");
1699#if defined(UDP_CFG_EXTENTIONS)
1700#if defined(USE_UDP_EXTENTIONS)
1701 cons_printf(portid, "Use\n");
1702#else
1703 cons_printf(portid, "On\n");
1704#endif
1705 cons_printf(portid, " NUM_VRID_UDP_CEPS: %3d\n", NUM_VRID_UDP_CEPS);
1706 cons_printf(portid, " NUM_VRID_UDP6_CEPS: %3d\n", NUM_VRID_UDP6_CEPS);
1707#else
1708 cons_printf(portid, "Off\n");
1709#endif
1710
1711 cons_printf(portid, " NUM_DTQ_UDP_RCVQ: %3d\n", NUM_DTQ_UDP_RCVQ);
1712 cons_printf(portid, " NUM_DTQ_UDP_OUTPUT: %3d\n", NUM_DTQ_UDP_OUTPUT);
1713
1714#endif /* of #if defined(SUPPORT_UDP) */
1715
1716 cons_printf(portid, "ICMP:\n");
1717
1718 cons_printf(portid, " ICMP_CFG_CALLBACK_ECHO_REPLY: ");
1719#if defined(ICMP_CFG_CALLBACK_ECHO_REPLY)
1720 cons_printf(portid, "On\n");
1721#else
1722 cons_printf(portid, "Off\n");
1723#endif
1724
1725 cons_printf(portid, " ICMP_REPLY_ERROR: ");
1726#if defined(ICMP_REPLY_ERROR)
1727 cons_printf(portid, "On\n");
1728#else
1729 cons_printf(portid, "Off\n");
1730#endif
1731
1732#if NUM_REDIRECT_ROUTE_ENTRY > 0
1733 cons_printf(portid, " TMO_IN_REDIRECT: %4d[s]\n", TMO_IN_REDIRECT / NET_TIMER_HZ);
1734#endif
1735
1736#if defined(SUPPORT_INET4)
1737
1738 cons_printf(portid, "IPv4:\n");
1739
1740 cons_printf(portid, " IP4_CFG_FRAGMENT: ");
1741
1742#if defined(IP4_CFG_FRAGMENT)
1743 cons_printf(portid, "On\n");
1744 cons_printf(portid, " NUM_IP4_FRAG_QUEUE: %4d\n", NUM_IP4_FRAG_QUEUE);
1745 cons_printf(portid, " IP4_CFG_FRAG_REASSM_SIZE: %4d\n", IP4_CFG_FRAG_REASSM_SIZE);
1746#else
1747 cons_printf(portid, "Off\n");
1748#endif /* of #if defined(IP4_CFG_FRAGMENT) */
1749
1750#if defined(SUPPORT_ETHER)
1751 addr = IPV4_ADDR_LOCAL;
1752 cons_printf(portid, " IPV4_ADDR_LOCAL: %I\n", &addr);
1753 addr = IPV4_ADDR_LOCAL_MASK;
1754 cons_printf(portid, " IPV4_ADDR_LOCAL_MASK: %I\n", &addr);
1755 addr = IPV4_ADDR_DEFAULT_GW;
1756 cons_printf(portid, " IPV4_ADDR_DEFAULT_GW: %I\n", &addr);
1757#endif /* of #if defined(SUPPORT_ETHER) */
1758
1759 cons_printf(portid, " Routing Table:\n");
1760 cons_printf(portid, " NUM_STATIC_ROUTE_ENTRY: %d\n", NUM_STATIC_ROUTE_ENTRY);
1761 cons_printf(portid, " NUM_REDIRECT_ROUTE_ENTRY: %d\n", NUM_REDIRECT_ROUTE_ENTRY);
1762
1763#endif /* of #if defined(SUPPORT_INET4) */
1764
1765#if defined(SUPPORT_INET6)
1766
1767 cons_printf(portid, "IPv6:\n");
1768
1769 cons_printf(portid, " Routing Table:\n");
1770 cons_printf(portid, " NUM_STATIC_ROUTE_ENTRY: %d\n", NUM_STATIC_ROUTE_ENTRY);
1771 cons_printf(portid, " NUM_REDIRECT_ROUTE_ENTRY: %d\n", NUM_REDIRECT_ROUTE_ENTRY);
1772
1773 cons_printf(portid, "ND:\n");
1774 cons_printf(portid, " TMO_ND6_RTR_SOL_DELAY: %5d[ms]\n", TMO_ND6_RTR_SOL_DELAY);
1775 cons_printf(portid, " TMO_ND6_RTR_SOL_INTERVAL: %5d[ms]\n", TMO_ND6_RTR_SOL_INTERVAL);
1776 cons_printf(portid, " NUM_IP6_DAD_COUNT: %5d\n", NUM_IP6_DAD_COUNT);
1777 cons_printf(portid, " NUM_ND6_CACHE_ENTRY: %5d\n", NUM_ND6_CACHE_ENTRY);
1778
1779#if defined(SUPPORT_ETHER)
1780
1781 cons_printf(portid, " NUM_ND6_DEF_RTR_ENTRY %5d\n", NUM_ND6_DEF_RTR_ENTRY);
1782 cons_printf(portid, " NUM_ND6_RTR_SOL_RETRY %5d\n", NUM_ND6_RTR_SOL_RETRY);
1783
1784 cons_printf(portid, " IP6_CFG_AUTO_LINKLOCAL: ");
1785#if defined(IP6_CFG_AUTO_LINKLOCAL)
1786 cons_printf(portid, "On\n");
1787#else
1788 cons_printf(portid, "Off\n");
1789#endif
1790
1791#endif /* of #if defined(SUPPORT_ETHER) */
1792
1793#endif /* of #if defined(SUPPORT_INET6) */
1794
1795#if defined(SUPPORT_INET4) && defined(SUPPORT_ETHER)
1796
1797 cons_printf(portid, "ARP:\n");
1798 cons_printf(portid, " ARP_CACHE_KEEP: %4d[s]\n", ARP_CACHE_KEEP / NET_TIMER_HZ);
1799
1800#endif /* of #if defined(SUPPORT_INET4) && defined(SUPPORT_ETHER) */
1801
1802#if defined(SUPPORT_ETHER)
1803
1804 cons_printf(portid, "Ethernet:\n");
1805
1806 cons_printf(portid, " NUM_DTQ_ETHER_OUTPUT: %3d\n", NUM_DTQ_ETHER_OUTPUT);
1807
1808 cons_printf(portid, " ETHER_CFG_ACCEPT_ALL: ");
1809#if defined(ETHER_CFG_ACCEPT_ALL)
1810 cons_printf(portid, "On\n");
1811#else
1812 cons_printf(portid, "Off\n");
1813#endif
1814
1815 cons_printf(portid, " ETHER_CFG_UNEXP_WARNING: ");
1816#if defined(ETHER_CFG_UNEXP_WARNING)
1817 cons_printf(portid, "On\n");
1818#else
1819 cons_printf(portid, "Off\n");
1820#endif
1821
1822 cons_printf(portid, " ETHER_CFG_802_WARNING: ");
1823#if defined(ETHER_CFG_802_WARNING)
1824 cons_printf(portid, "On\n");
1825#else
1826 cons_printf(portid, "Off\n");
1827#endif
1828
1829 cons_printf(portid, " ETHER_CFG_MCAST_WARNING: ");
1830#if defined(ETHER_CFG_MCAST_WARNING)
1831 cons_printf(portid, "On\n");
1832#else
1833 cons_printf(portid, "Off\n");
1834#endif
1835
1836#endif /* of #if defined(SUPPORT_ETHER) */
1837
1838#if defined(SUPPORT_PPP)
1839
1840 cons_printf(portid, "PPP:\n");
1841
1842 cons_printf(portid, " HDLC_PORTNO: %d", HDLC_PORTID);
1843
1844 cons_printf(portid, " PPP_IDLE_TIMEOUT: ");
1845#if defined(PPP_IDLE_TIMEOUT)
1846 cons_printf(portid, " %4d[s]\n", PPP_IDLE_TIMEOUT / NET_TIMER_HZ);
1847#else
1848 cons_printf(portid, " Off\n");
1849#endif
1850
1851 cons_printf(portid, " PPP_CFG_MODEM: ");
1852#if defined(PPP_CFG_MODEM)
1853 cons_printf(portid, "On\n");
1854#else
1855 cons_printf(portid, "Off\n");
1856#endif
1857
1858#endif /* of #if defined(SUPPORT_PPP) */
1859
1860 cons_printf(portid, "Network Buffer:\n");
1861
1862#if defined(NUM_MPF_NET_BUF_64)
1863 cons_printf(portid, " NUM_MPF_NET_BUF_64: %2d\n", NUM_MPF_NET_BUF_64);
1864#endif
1865
1866#if defined(NUM_MPF_NET_BUF_CSEG)
1867 cons_printf(portid, " NUM_MPF_NET_BUF_CSEG: %2d\n", NUM_MPF_NET_BUF_CSEG);
1868#endif
1869
1870#if defined(NUM_MPF_NET_BUF_128)
1871 cons_printf(portid, " NUM_MPF_NET_BUF_128: %2d\n", NUM_MPF_NET_BUF_128);
1872#endif
1873
1874#if defined(NUM_MPF_NET_BUF_256)
1875 cons_printf(portid, " NUM_MPF_NET_BUF_256: %2d\n", NUM_MPF_NET_BUF_256);
1876#endif
1877
1878#if defined(NUM_MPF_NET_BUF_512)
1879 cons_printf(portid, " NUM_MPF_NET_BUF_512: %2d\n", NUM_MPF_NET_BUF_512);
1880#endif
1881
1882#if defined(NUM_MPF_NET_BUF_IP_MSS)
1883 cons_printf(portid, " NUM_MPF_NET_BUF_IP_MSS: %2d\n", NUM_MPF_NET_BUF_IP_MSS);
1884#endif
1885
1886#if defined(NUM_MPF_NET_BUF_1024)
1887 cons_printf(portid, " NUM_MPF_NET_BUF_1024: %2d\n", NUM_MPF_NET_BUF_1024);
1888#endif
1889
1890#if defined(NUM_MPF_NET_BUF_IPV6_MMTU)
1891 cons_printf(portid, " NUM_MPF_NET_BUF_IPV6_MMTU: %2d\n", NUM_MPF_NET_BUF_IPV6_MMTU);
1892#endif
1893
1894#if defined(NUM_MPF_NET_BUF_IF_PDU)
1895 cons_printf(portid, " NUM_MPF_NET_BUF_IF_PDU: %2d\n", NUM_MPF_NET_BUF_IF_PDU);
1896#endif
1897
1898#if defined(NUM_MPF_NET_BUF_REASSM)
1899 cons_printf(portid, " NUM_MPF_NET_BUF_REASSM: %2d\n", NUM_MPF_NET_BUF_REASSM);
1900#endif
1901
1902#if defined(NUM_MPF_NET_BUF6_65536)
1903 cons_printf(portid, " NUM_MPF_NET_BUF6_65536: %2d\n", NUM_MPF_NET_BUF6_65536);
1904#endif
1905
1906 cons_printf(portid, "Network Counter Mask: %08x\n", NET_COUNT_ENABLE);
1907
1908 cons_printf(portid, "SUPPORT_MIB: ");
1909#if defined(SUPPORT_MIB)
1910 cons_printf(portid, "On\n");
1911#else
1912 cons_printf(portid, "Off\n");
1913#endif
1914
1915 SIG_NET_CONS_PRINTF();
1916 FLUSH_SND_BUFF();
1917 }
1918
1919/*
1920 * デバッグコマンド解析
1921 */
1922
1923static void
1924dbg_parse (ID portid, char *line)
1925{
1926 int_t cepid;
1927 ER error;
1928
1929 switch (*line) {
1930
1931 case 'c': /* cancel CEP */
1932 switch (*(line + 1)) {
1933
1934 case 'f': /* show configurations */
1935 show_config(portid, line + 1);
1936 break;
1937
1938#ifdef SUPPORT_TCP
1939
1940 case 't': /* cancel TCP */
1941 cepid = atoi(line = skip_blanks(line + 2));
1942 while ('0' <= *line && *line <= '9')
1943 line ++;
1944 if ((error = tcp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
1945 cons_printf(portid, "[TCP CAN CEP] error: %s\n", itron_strerror(error));
1946 SIG_NET_CONS_PRINTF();
1947 FLUSH_SND_BUFF();
1948 }
1949 break;
1950
1951#endif /* of #ifdef SUPPORT_TCP */
1952
1953#ifdef SUPPORT_UDP
1954
1955 case 'u': /* cancel UDP */
1956 cepid = atoi(line = skip_blanks(line + 2));
1957 while ('0' <= *line && *line <= '9')
1958 line ++;
1959 if ((error = udp_can_cep((ID)cepid, atoi(skip_blanks(line)))) != E_OK && error != E_RLWAI) {
1960 cons_printf(portid, "[UDP CAN CEP] error: %s\n", itron_strerror(error));
1961 SIG_NET_CONS_PRINTF();
1962 FLUSH_SND_BUFF();
1963 }
1964 break;
1965
1966#endif /* of #ifdef SUPPORT_UDP */
1967
1968 }
1969
1970 break;
1971
1972#if defined(USE_UDP_DISCARD_CLI) || defined(USE_TCP_DISCARD_CLI) || defined(SUPPORT_PPP) || defined(SUPPORT_ETHER) && defined(USE_NET_CONS)
1973
1974 case 'd': /* discard client */
1975 switch (*(line + 1)) {
1976
1977#if defined(SUPPORT_PPP)
1978
1979 case 'c': /* disconnect */
1980 if (lcp_fsm.state != PPP_FSM_STOPPED)
1981 lcp_close();
1982 break;
1983
1984#endif /* of #if defined(SUPPORT_PPP) */
1985
1986#if defined(SUPPORT_ETHER) && defined(USE_NET_CONS)
1987
1988 case 'c': /* disconnect */
1989 discon_net_cons();
1990 break;
1991
1992#endif /* of #if defined(SUPPORT_ETHER) && defined(USE_NET_CONS) */
1993
1994#ifdef USE_TCP_DISCARD_CLI
1995
1996 case 't': /* TCP discard client */
1997 line += 2;
1998 switch (*line) {
1999
2000 case 's': /* cancel TCP discard client */
2001 tcp_discard_cli_valid = false;
2002 break;
2003
2004 default:
2005 if ((error = psnd_dtq(DTQ_TCP_DISCARD_CLI, (intptr_t)line)) != E_OK) {
2006 cons_printf(portid, "[TCP DISCARD CLI] error: %s\n",
2007 itron_strerror(error));
2008 SIG_NET_CONS_PRINTF();
2009 FLUSH_SND_BUFF();
2010 }
2011 break;
2012
2013 }
2014 break;
2015
2016#endif /* of #ifdef USE_TCP_DISCARD_CLI */
2017
2018#ifdef USE_UDP_DISCARD_CLI
2019
2020 case 'u': /* UDP discard client */
2021 line += 2;
2022 switch (*line) {
2023
2024 case 's': /* cancel UDP discard client */
2025 udp_discard_cli_valid = false;
2026 break;
2027
2028 default:
2029 if ((error = psnd_dtq(DTQ_UDP_DISCARD_CLI, (intptr_t)line)) != E_OK) {
2030 cons_printf(portid, "[UDP DISCARD CLI] error: %s\n",
2031 itron_strerror(error));
2032 SIG_NET_CONS_PRINTF();
2033 FLUSH_SND_BUFF();
2034 }
2035 break;
2036
2037 }
2038 break;
2039
2040#endif /* of #ifdef USE_UDP_DISCARD_CLI */
2041
2042 }
2043
2044 break;
2045
2046#endif /* of #if defined(USE_UDP_DISCARD_CLI) || defined(USE_TCP_DISCARD_CLI) || defined(SUPPORT_PPP) || defined(SUPPORT_ETHER) && defined(USE_NET_CONS) */
2047
2048#if defined(USE_UDP_ECHO_CLI) || defined(USE_TCP_ECHO_CLI)
2049
2050 case 'e': /* echo client */
2051 switch (*(line + 1)) {
2052
2053#ifdef USE_TCP_ECHO_CLI
2054
2055 case 't': /* TCP echo client */
2056 line += 2;
2057 switch (*line) {
2058
2059 case 's': /* cancel TCP echo */
2060 tcp_echo_cli_valid = false;
2061 break;
2062
2063 default:
2064 if ((error = psnd_dtq(DTQ_TCP_ECHO_CLI_SND, (intptr_t)line)) != E_OK) {
2065 cons_printf(portid, "[TCP ECHO CLI] error: %s\n", itron_strerror(error));
2066 SIG_NET_CONS_PRINTF();
2067 FLUSH_SND_BUFF();
2068 }
2069 break;
2070
2071 }
2072 break;
2073
2074#endif /* of #ifdef USE_TCP_ECHO_CLI */
2075
2076#ifdef USE_UDP_ECHO_CLI
2077
2078 case 'u': /* UDP echo client */
2079 line += 2;
2080 switch (*line) {
2081
2082 case 's': /* cancel UDP echo */
2083 udp_echo_cli_valid = false;
2084 break;
2085
2086 default:
2087 if ((error = psnd_dtq(DTQ_UDP_ECHO_CLI, (intptr_t)line)) != E_OK) {
2088 cons_printf(portid, "[UDP ECHO CLI] error: %s\n", itron_strerror(error));
2089 SIG_NET_CONS_PRINTF();
2090 FLUSH_SND_BUFF();
2091 }
2092 break;
2093
2094 }
2095 break;
2096
2097#endif /* of #ifdef USE_UDP_ECHO_CLI */
2098
2099 }
2100
2101 break;
2102
2103#endif /* of #if defined(USE_UDP_ECHO_CLI) || defined(USE_TCP_ECHO_CLI) */
2104
2105 case 'i':
2106
2107 if (*(line + 1) == 'f')
2108 ifconfig(portid, line + 2);
2109
2110#ifdef SUPPORT_PPP
2111
2112#ifdef PPP_CFG_MODEM
2113
2114 else if (lcp_fsm.state == PPP_FSM_STOPPED)
2115 dial(); /* initiate */
2116
2117#else /* of #ifdef PPP_CFG_MODEM */
2118
2119 else if (lcp_fsm.state == PPP_FSM_STOPPED)
2120 lcp_open(PPP_OPEN_ACTIVE);
2121
2122#endif /* of #ifdef PPP_CFG_MODEM */
2123
2124#endif /* of #ifdef SUPPORT_PPP */
2125
2126 break;
2127
2128 case 'n': /* network status */
2129 network_status(portid, line + 1);
2130 break;
2131
2132 case 'p': /* ping or task status */
2133
2134 if (*(line + 1) == 's')
2135 task_status(portid, skip_blanks(line + 2));
2136
2137#ifdef USE_PING
2138
2139 else {
2140 int_t tmo, size;
2141 T_IN_ADDR addr;
2142
2143#ifdef PING_CFG_I6RLP
2144 static const char i6rlp_pmtu_str1[] = " FF1E::1:2 1 1452";
2145 static const char i6rlp_pmtu_str2[] = " FF1E::1:2 1 1352";
2146 static const char i6rlp_pmtu_str3[] = " fe80::0200:00ff:fe00:0100 1 2";
2147
2148 if (*(line + 1) == '1')
2149 strcpy(line + 1, i6rlp_pmtu_str1);
2150 else if (*(line + 1) == '2')
2151 strcpy(line + 1, i6rlp_pmtu_str2);
2152 else if (*(line + 1) == '3')
2153 strcpy(line + 1, i6rlp_pmtu_str3);
2154
2155#endif /* of #ifdef PING_CFG_I6RLP */
2156
2157 line = skip_blanks(GET_IPADDR(&addr, skip_blanks(line + 1)));
2158 if ('0' <= *line && *line <= '9')
2159 line = get_int(&tmo, line);
2160 else
2161 tmo = 3;
2162
2163 line = skip_blanks(line + 1);
2164 if ('0' <= *line && *line <= '9')
2165 line = get_int(&size, line);
2166 else
2167 size = 64;
2168
2169 PING(&addr, (uint_t)tmo, (uint_t)size);
2170 }
2171
2172#endif /* of #ifdef USE_PING */
2173
2174 break;
2175
2176 case 'r': /* release wait task */
2177 if ((error = rel_wai(atoi(skip_blanks(line + 1)))) != E_OK) {
2178 cons_printf(portid, "[REL WAI TSK] error: %s\n", itron_strerror(error));
2179 SIG_NET_CONS_PRINTF();
2180 FLUSH_SND_BUFF();
2181 }
2182 break;
2183
2184 case 't': /* terminate (delete) REP/CEP */
2185 switch (*(line + 1)) {
2186
2187#ifdef USE_TCP_EXTENTIONS
2188
2189 case 't': /* TCP REP */
2190 if ((error = tcp_del_rep(atoi(skip_blanks(line + 2)))) != E_OK) {
2191 cons_printf(portid, "[TCP DEL REP] error: %s\n", itron_strerror(error));
2192 SIG_NET_CONS_PRINTF();
2193 FLUSH_SND_BUFF();
2194 }
2195 break;
2196
2197#endif /* of #ifdef USE_TCP_EXTENTIONS */
2198
2199#ifdef USE_UDP_EXTENTIONS
2200
2201 case 'u': /* UDP CEP */
2202 if ((error = udp_del_cep(atoi(skip_blanks(line + 2)))) != E_OK) {
2203 cons_printf(portid, "[UDP DEL CEP] error: %s\n", itron_strerror(error));
2204 SIG_NET_CONS_PRINTF();
2205 FLUSH_SND_BUFF();
2206 }
2207 break;
2208
2209#endif /* of #ifdef USE_UDP_EXTENTIONS */
2210
2211 }
2212 break;
2213
2214#if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS)
2215
2216 case 'w': /* wakeup server */
2217 /* wake up task */
2218 switch (*(line + 1)) {
2219
2220#ifdef USE_TCP_EXTENTIONS
2221
2222 case 't': /* tcp server */
2223 switch (*(line + 2)) {
2224
2225#ifdef USE_TCP_DISCARD_SRV
2226 case 'd': /* tcp discard server */
2227 if ((error = wup_tsk(TCP_DISCARD_SRV_TASK)) != E_OK) {
2228 cons_printf(portid, "[WUP TCP DISCARD SRV] error: %s\n", itron_strerror(error));
2229 SIG_NET_CONS_PRINTF();
2230 FLUSH_SND_BUFF();
2231 }
2232 break;
2233#endif /* of #ifdef USE_TCP_DISCARD_SRV */
2234
2235#if defined(USE_TCP_ECHO_SRV1) || defined(USE_TCP_ECHO_SRV2)
2236 case 'e': /* tcp echo server */
2237 if ((error = wup_tsk(TCP_ECHO_SRV_TASK)) != E_OK) {
2238 cons_printf(portid, "[WUP UDP DISCARD SRV] error: %s\n", itron_strerror(error));
2239 SIG_NET_CONS_PRINTF();
2240 FLUSH_SND_BUFF();
2241 }
2242 break;
2243#endif /* of #if defined(USE_TCP_ECHO_SRV1) || defined(USE_TCP_ECHO_SRV2) */
2244
2245#ifdef USE_WWW_SRV
2246 case 'w': /* WWW server */
2247 if ((error = wup_tsk(WWW_SRV_TASK1)) != E_OK) {
2248 cons_printf(portid, "[WUP WWW SRV] error: %s\n", itron_strerror(error));
2249 SIG_NET_CONS_PRINTF();
2250 FLUSH_SND_BUFF();
2251 }
2252 break;
2253#endif /* of #ifdef USE_TCP_DISCARD_SRV */
2254
2255 }
2256 break;
2257
2258#endif /* of #ifdef USE_TCP_EXTENTIONS */
2259
2260#ifdef USE_UDP_EXTENTIONS
2261
2262 case 'u': /* udp server */
2263 switch (*(line + 2)) {
2264
2265#if defined(USE_UDP_ECHO_SRV) && !defined(USE_UDP_CALL_BACK)
2266 case 'e': /* udp echo server */
2267 if ((error = wup_tsk(UDP_ECHO_SRV_TASK)) != E_OK) {
2268 cons_printf(portid, "[WUP UDP ECHO SRV] error: %s\n", itron_strerror(error));
2269 SIG_NET_CONS_PRINTF();
2270 FLUSH_SND_BUFF();
2271 }
2272 break;
2273#endif /* of #if defined(USE_UDP_ECHO_SRV) && !defined(USE_UDP_CALL_BACK) */
2274
2275 }
2276 break;
2277
2278#endif /* of #ifdef USE_UDP_EXTENTIONS */
2279
2280 default:
2281 if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) {
2282 cons_printf(portid, "[WUP TSK] error: %s\n", itron_strerror(error));
2283 SIG_NET_CONS_PRINTF();
2284 FLUSH_SND_BUFF();
2285 }
2286 break;
2287
2288 }
2289 break;
2290
2291#else /* of #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS) */
2292
2293 case 'w': /* wake up task */
2294 if ((error = wup_tsk(atoi(skip_blanks(line + 1)))) != E_OK) {
2295 cons_printf(portid, "[WUP TSK] error: %s\n", itron_strerror(error));
2296 SIG_NET_CONS_PRINTF();
2297 FLUSH_SND_BUFF();
2298 }
2299 break;
2300
2301#endif /* of #if defined(USE_TCP_EXTENTIONS) || defined(USE_UDP_EXTENTIONS) */
2302
2303 default:
2304
2305 if (*line) {
2306
2307#ifdef USE_EXTRA_PARSE
2308
2309 extra_parse(line);
2310
2311#else /* of #ifdef USE_EXTRA_PARSE */
2312
2313 cons_printf(portid, "no such command: '%c'\n", *line);
2314 SIG_NET_CONS_PRINTF();
2315 FLUSH_SND_BUFF();
2316
2317#endif /* of #ifdef USE_EXTRA_PARSE */
2318
2319 }
2320 break;
2321 }
2322 }
2323
2324/*
2325 * デバッグコンソールタスク
2326 */
2327
2328void
2329dbg_con_task (intptr_t exinf)
2330{
2331 static char line[DBG_LINE_SIZE + 1];
2332
2333 uint_t len;
2334 ID tskid;
2335
2336#ifdef USE_LCD
2337#ifdef SUPPORT_ETHER
2338
2339#if defined(SUPPORT_INET6)
2340
2341 int_t lllen;
2342 const uint8_t *lladdr;
2343
2344#endif /* of #if defined(SUPPORT_INET6) */
2345
2346 lcd_init();
2347
2348 if ((TINET_PRVER & UINT_C(0x0f)) > 0)
2349 lcd_printf("TINET-%d.%d.%d\n",
2350 (TINET_PRVER >> 12) & UINT_C(0x0f),
2351 (TINET_PRVER >> 4) & UINT_C(0x0f),
2352 TINET_PRVER & UINT_C(0x0f));
2353 else
2354 lcd_printf("TINET-%d.%d\n",
2355 (TINET_PRVER >> 12) & UINT_C(0x0f),
2356 (TINET_PRVER >> 4) & UINT_C(0x0f));
2357
2358#if defined(SUPPORT_INET6)
2359
2360 lladdr = IF_ETHER_NIC_GET_SOFTC()->ifaddr.lladdr;
2361 for (lllen = ETHER_ADDR_LEN; lllen --; )
2362 lcd_printf("%02x", *lladdr ++);
2363 lcd_printf("\n");
2364
2365#else /* of #if defined(SUPPORT_INET6) */
2366
2367 lcd_puts(ip2str(NULL, in4_get_ifaddr(0)));
2368
2369#endif /* of #if defined(SUPPORT_INET6) */
2370
2371#endif /* of #ifdef SUPPORT_ETHER */
2372#else /* of #ifdef USE_LCD */
2373
2374 get_tid(&tskid);
2375 cons_printf(CONSOLE_PORTID, "[CONSOLE:%d] started.\n", tskid);
2376
2377#endif /* of #ifdef USE_LCD */
2378
2379 serial_ctl_por(CONSOLE_PORTID,
2380 IOCTL_ECHO | IOCTL_CRLF |
2381 IOCTL_FCSND | IOCTL_FCANY | IOCTL_FCRCV);
2382 while (true) {
2383 len = cons_getline(CONSOLE_PORTID, line, DBG_LINE_SIZE);
2384 dbg_parse(CONSOLE_PORTID, line);
2385 }
2386 }
2387
2388#endif /* of #ifdef USE_DBG_CONS */
Note: See TracBrowser for help on using the repository browser.