Index: EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/tcp_echo_srv2.c
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/tcp_echo_srv2.c	(revision 321)
+++ EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/tcp_echo_srv2.c	(revision 331)
@@ -2,5 +2,5 @@
  *  TINET (TCP/IP Protocol Stack)
  * 
- *  Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
+ *  Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering
  *                   Tomakomai National College of Technology, JAPAN
  *
@@ -70,10 +70,9 @@
 #include <netinet/in_itron.h>
 #include <netinet/ip.h>
-#include <netinet/ip6.h>
 #include <netinet/tcp.h>
 
 #include <netapp/netapp.h>
 #include <netapp/netapp_var.h>
-#include <netapp/echo.h>
+#include <netapp/tcp_echo_srv2.h>
 
 #ifdef USE_TCP_ECHO_SRV2
@@ -161,9 +160,9 @@
 			snd_error = 1;
 			ena_rcv   = true;
-			syslog(LOG_NOTICE, "[TES:%02d CBN] connected:  %6ld, from: %s.%d",
+			syslog(LOG_NOTICE, "[TES:%02u CBN] connect: %6lu, from: %s.%d",
 			                   cepid, now / SYSTIM_HZ, IP2STR(NULL, &dst.ipaddr), dst.portno);
 			}
 		else
-			syslog(LOG_NOTICE, "[TES:%02d CBN] accept error: %s\n", cepid, itron_strerror(rcv_error));
+			syslog(LOG_NOTICE, "[TES:%02u CBN] accept error: %s\n", cepid, itron_strerror(rcv_error));
 
 		syscall(sig_sem(SEM_TCP_ECHO_SRV_RCV_READY));
@@ -176,5 +175,5 @@
 			tail = *(sptr + slen - 1);
 #ifdef SHOW_RCV_RANGE
-			syslog(LOG_NOTICE, "[TES:%02d CBN] send len: %4d, data %02x -> %02x",
+			syslog(LOG_NOTICE, "[TES:%02u CBN] send len: %4u, data %02x -> %02x",
 			                   cepid, (uint16_t)slen, head, tail);
 #endif	/* of #ifdef SHOW_RCV_RANGE */
@@ -205,5 +204,5 @@
 			}
 		else {
-			syslog(LOG_NOTICE, "[TES:%02d CBN] send error = %s", cepid, itron_strerror(snd_error));
+			syslog(LOG_NOTICE, "[TES:%02u CBN] send error = %s", cepid, itron_strerror(snd_error));
 			sig_sem(SEM_TCP_ECHO_SRV_SND_READY);
 			}
@@ -216,5 +215,5 @@
 			tail = *(rptr + rlen - 1);
 #ifdef SHOW_RCV_RANGE
-			syslog(LOG_NOTICE, "[TES:%02d CBN] recv len: %4d, data %02x -> %02x",
+			syslog(LOG_NOTICE, "[TES:%02u CBN] recv len: %4u, data %02x -> %02x",
 			                   cepid, (uint16_t)rlen, head, tail);
 #endif	/* of #ifdef SHOW_RCV_RANGE */
@@ -246,5 +245,5 @@
 		else {
 			if (rlen < 0)
-				syslog(LOG_NOTICE, "[TES:%02d CBN] recv error = %s", cepid, itron_strerror(rcv_error));
+				syslog(LOG_NOTICE, "[TES:%02u CBN] recv error = %s", cepid, itron_strerror(rcv_error));
 			sig_sem(SEM_TCP_ECHO_SRV_RCV_READY);
 			}
@@ -254,7 +253,7 @@
 		snd_error = *(ER*)p_parblk;
 		if (snd_error != E_OK)
-			syslog(LOG_NOTICE, "[TES:%02d CBN] close error = %s", cepid, itron_strerror(snd_error));
-
-		syslog(LOG_NOTICE, "[TES:%02d CBN] finished:   %6ld, snd: %4d, rcv: %4d, len: %ld",
+			syslog(LOG_NOTICE, "[TES:%02u CBN] close error = %s", cepid, itron_strerror(snd_error));
+
+		syslog(LOG_NOTICE, "[TES:%02u CBN] finish:  %6lu, snd: %4u, rcv: %4u, len: %ld",
 		                   cepid, now / SYSTIM_HZ, snd_count, rcv_count, snd_total);
 
@@ -283,10 +282,10 @@
 
 	if ((error = psnd_dtq(DTQ_TCP_ECHO_SRV_SND, (intptr_t)cepid)) != E_OK) {
-		syslog(LOG_NOTICE, "[TES:%02d RCV] sync error: %s", cepid, itron_strerror(error));
+		syslog(LOG_NOTICE, "[TES:%02u RCV] sync error: %s", cepid, itron_strerror(error));
 		return error;
 		}
 
 	if ((error = TCP_ACP_CEP(cepid, repid, &dst, TMO_NBLK)) != E_WBLK) {
-		syslog(LOG_NOTICE, "[TES:%02d ACP] accept error = %s", cepid, itron_strerror(error));
+		syslog(LOG_NOTICE, "[TES:%02u ACP] accept error = %s", cepid, itron_strerror(error));
 		return error;
 		}
@@ -300,6 +299,6 @@
 
 #ifdef USE_TCP_EXTENTIONS
-	if ((error = free_tcp_rep(repid, true)) != E_OK) {
-		syslog(LOG_NOTICE, "[TES:%02d DEL] REP delete error: %s", cepid, itron_strerror(error));
+	if ((error = FREE_TCP_REP(repid, true)) != E_OK) {
+		syslog(LOG_NOTICE, "[TES:%02u DEL] REP delete error: %s", cepid, itron_strerror(error));
 		return error;
 		}
@@ -318,5 +317,5 @@
 		/* 受信する。*/
 		if ((error = tcp_rcv_dat(cepid, rptr, blen, TMO_NBLK)) != E_WBLK) {
-			syslog(LOG_NOTICE, "[TES:%02d RCV] recv error = %s", cepid, itron_strerror(error));
+			syslog(LOG_NOTICE, "[TES:%02u RCV] recv error = %s", cepid, itron_strerror(error));
 			break;
 			}
@@ -359,5 +358,5 @@
 	while (true) {
 		if ((error = rcv_dtq(DTQ_TCP_ECHO_SRV_SND, (intptr_t*)&cepid)) != E_OK) {
-			syslog(LOG_NOTICE, "[TES:%02d SND] sync error: %s",
+			syslog(LOG_NOTICE, "[TES:%02u SND] sync error: %s",
 			                   cepid, itron_strerror(error));
 			continue;
@@ -387,5 +386,5 @@
 			/* 送信する。*/
 			if ((error = tcp_snd_dat(cepid, sptr, blen, TMO_NBLK)) != E_WBLK) {
-				syslog(LOG_NOTICE, "[TES:%02d SND] send error = %s", cepid, itron_strerror(error));
+				syslog(LOG_NOTICE, "[TES:%02u SND] send error = %s", cepid, itron_strerror(error));
 				break;
 				}
@@ -398,9 +397,9 @@
 #ifdef USE_TCP_SHT_CEP
 		if ((error = tcp_sht_cep(cepid)) != E_OK)
-			syslog(LOG_NOTICE, "[TES:%02d SND] shutdown error = %s", cepid, itron_strerror(error));
+			syslog(LOG_NOTICE, "[TES:%02u SND] shutdown error = %s", cepid, itron_strerror(error));
 #endif	/* of #ifdef USE_TCP_SHT_CEP */
 
 		if ((error = tcp_cls_cep(cepid, TMO_NBLK)) != E_WBLK) {
-			syslog(LOG_NOTICE, "[TES:%02d SND] close error = %s", cepid, itron_strerror(error));
+			syslog(LOG_NOTICE, "[TES:%02u SND] close error = %s", cepid, itron_strerror(error));
 			}
 
@@ -426,16 +425,16 @@
 
 	if ((error = psnd_dtq(DTQ_TCP_ECHO_SRV_SND, (intptr_t)cepid)) != E_OK) {
-		syslog(LOG_NOTICE, "[TES:%02d RCV] sync error: %s", cepid, itron_strerror(error));
+		syslog(LOG_NOTICE, "[TES:%02u RCV] sync error: %s", cepid, itron_strerror(error));
 		return error;
 		}
 
 	if ((error = TCP_ACP_CEP(cepid, repid, &dst, TMO_FEVR)) != E_OK) {
-		syslog(LOG_NOTICE, "[TES:%02d ACP] accept error = %s", cepid, itron_strerror(error));
+		syslog(LOG_NOTICE, "[TES:%02u ACP] accept error = %s", cepid, itron_strerror(error));
 		return error;
 		}
 
 #ifdef USE_TCP_EXTENTIONS
-	if ((error = free_tcp_rep(repid, true)) != E_OK) {
-		syslog(LOG_NOTICE, "[TES:%02d DEL] REP delete error: %s", cepid, itron_strerror(error));
+	if ((error = FREE_TCP_REP(repid, true)) != E_OK) {
+		syslog(LOG_NOTICE, "[TES:%02u DEL] REP delete error: %s", cepid, itron_strerror(error));
 		return error;
 		}
@@ -443,5 +442,5 @@
 
 	syscall(get_tim(&now));
-	syslog(LOG_NOTICE, "[TES:%02d ACP] connected:  %6ld, from: %s.%d",
+	syslog(LOG_NOTICE, "[TES:%02u ACP] connect: %6lu, from: %s.%d",
 	                   cepid, now / SYSTIM_HZ, IP2STR(NULL, &dst.ipaddr), dst.portno);
 	sptr = rptr = buffer;
@@ -461,5 +460,5 @@
 		if ((rlen = tcp_rcv_dat(cepid, rptr, blen, TMO_FEVR)) <= 0) {
 			if (rlen < 0)
-				syslog(LOG_NOTICE, "[TES:%02d RCV] recv error = %s",
+				syslog(LOG_NOTICE, "[TES:%02u RCV] recv error = %s",
 				                   cepid, itron_strerror(rlen));
 			break;
@@ -468,5 +467,5 @@
 		tail = *(rptr + rlen - 1);
 #ifdef SHOW_RCV_RANGE
-		syslog(LOG_NOTICE, "[TES:%02d RCV] len: %4d, data %02x -> %02x",
+		syslog(LOG_NOTICE, "[TES:%02u RCV] len: %4u, data %02x -> %02x",
 		                   cepid, (uint16_t)rlen, head, tail);
 #endif	/* of #ifdef SHOW_RCV_RANGE */
@@ -531,5 +530,5 @@
 	while (true) {
 		if ((error = rcv_dtq(DTQ_TCP_ECHO_SRV_SND, (intptr_t*)&cepid)) != E_OK) {
-			syslog(LOG_NOTICE, "[TES:%02d SND] sync error: %s",
+			syslog(LOG_NOTICE, "[TES:%02u SND] sync error: %s",
 			                   cepid, itron_strerror(error));
 			continue;
@@ -554,5 +553,5 @@
 
 			if ((slen = tcp_snd_dat(cepid, sptr, blen, TMO_FEVR)) <= 0) {
-				syslog(LOG_NOTICE, "[TES:%02d SND] send error = %s", cepid, itron_strerror(slen));
+				syslog(LOG_NOTICE, "[TES:%02u SND] send error = %s", cepid, itron_strerror(slen));
 				break;
 				}
@@ -561,5 +560,5 @@
 			tail = *(sptr + slen - 1);
 #ifdef SHOW_RCV_RANGE
-			syslog(LOG_NOTICE, "[TES:%02d SND] len: %4d, data %02x -> %02x",
+			syslog(LOG_NOTICE, "[TES:%02u SND] len: %4u, data %02x -> %02x",
 			                   cepid, (uint16_t)slen, head, tail);
 #endif	/* of #ifdef SHOW_RCV_RANGE */
@@ -602,12 +601,12 @@
 #ifdef USE_TCP_SHT_CEP
 		if ((error = tcp_sht_cep(cepid)) != E_OK)
-			syslog(LOG_NOTICE, "[TES:%02d SND] shtudown error = %s", cepid, itron_strerror(error));
+			syslog(LOG_NOTICE, "[TES:%02u SND] shtudown error = %s", cepid, itron_strerror(error));
 #endif	/* of #ifdef USE_TCP_SHT_CEP */
 
 		if ((error = tcp_cls_cep(cepid, TMO_FEVR)) != E_OK)
-			syslog(LOG_NOTICE, "[TES:%02d SND] close error = %s", cepid, itron_strerror(error));
+			syslog(LOG_NOTICE, "[TES:%02u SND] close error = %s", cepid, itron_strerror(error));
 
 		get_tim(&now);
-		syslog(LOG_NOTICE, "[TES:%02d SND] finished:   %6ld, snd: %4d, rcv: %4d, len: %ld",
+		syslog(LOG_NOTICE, "[TES:%02u SND] finish:  %6lu, snd: %4u, rcv: %4u, len: %ld",
 		                   cepid, now / SYSTIM_HZ, snd_count, rcv_count, snd_total);
 
@@ -646,5 +645,5 @@
 #endif
 
-	return alloc_tcp_rep(repid, tskid, &crep);
+	return ALLOC_TCP_REP(repid, tskid, &crep);
 	}
 
@@ -681,5 +680,5 @@
 #endif
 
-	return alloc_tcp_cep(cepid, tskid, &ccep);
+	return ALLOC_TCP_CEP(cepid, tskid, &ccep);
 	}
 
@@ -711,5 +710,5 @@
 				}
 			else if ((error = tcp_echo_srv_rcv(cepid, repid)) != E_OK) {
-				error = free_tcp_rep(repid, error != E_DLT);
+				error = FREE_TCP_REP(repid, error != E_DLT);
 				break;
 				}
@@ -717,5 +716,5 @@
 
 		if ((error = free_tcp_cep(cepid)) != E_OK)
-			syslog(LOG_NOTICE, "[TES:%02d EXT] CEP delete error: %s", cepid, itron_strerror(error));
+			syslog(LOG_NOTICE, "[TES:%02u EXT] CEP delete error: %s", cepid, itron_strerror(error));
 
 		}
