- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/asp3_dcre/tinet/netapp/tcp_echo_srv2.c
r321 r331 2 2 * TINET (TCP/IP Protocol Stack) 3 3 * 4 * Copyright (C) 2001-20 09by Dep. of Computer Science and Engineering4 * Copyright (C) 2001-2017 by Dep. of Computer Science and Engineering 5 5 * Tomakomai National College of Technology, JAPAN 6 6 * … … 70 70 #include <netinet/in_itron.h> 71 71 #include <netinet/ip.h> 72 #include <netinet/ip6.h>73 72 #include <netinet/tcp.h> 74 73 75 74 #include <netapp/netapp.h> 76 75 #include <netapp/netapp_var.h> 77 #include <netapp/ echo.h>76 #include <netapp/tcp_echo_srv2.h> 78 77 79 78 #ifdef USE_TCP_ECHO_SRV2 … … 161 160 snd_error = 1; 162 161 ena_rcv = true; 163 syslog(LOG_NOTICE, "[TES:%02 d CBN] connected: %6ld, from: %s.%d",162 syslog(LOG_NOTICE, "[TES:%02u CBN] connect: %6lu, from: %s.%d", 164 163 cepid, now / SYSTIM_HZ, IP2STR(NULL, &dst.ipaddr), dst.portno); 165 164 } 166 165 else 167 syslog(LOG_NOTICE, "[TES:%02 dCBN] accept error: %s\n", cepid, itron_strerror(rcv_error));166 syslog(LOG_NOTICE, "[TES:%02u CBN] accept error: %s\n", cepid, itron_strerror(rcv_error)); 168 167 169 168 syscall(sig_sem(SEM_TCP_ECHO_SRV_RCV_READY)); … … 176 175 tail = *(sptr + slen - 1); 177 176 #ifdef SHOW_RCV_RANGE 178 syslog(LOG_NOTICE, "[TES:%02 d CBN] send len: %4d, data %02x -> %02x",177 syslog(LOG_NOTICE, "[TES:%02u CBN] send len: %4u, data %02x -> %02x", 179 178 cepid, (uint16_t)slen, head, tail); 180 179 #endif /* of #ifdef SHOW_RCV_RANGE */ … … 205 204 } 206 205 else { 207 syslog(LOG_NOTICE, "[TES:%02 dCBN] send error = %s", cepid, itron_strerror(snd_error));206 syslog(LOG_NOTICE, "[TES:%02u CBN] send error = %s", cepid, itron_strerror(snd_error)); 208 207 sig_sem(SEM_TCP_ECHO_SRV_SND_READY); 209 208 } … … 216 215 tail = *(rptr + rlen - 1); 217 216 #ifdef SHOW_RCV_RANGE 218 syslog(LOG_NOTICE, "[TES:%02 d CBN] recv len: %4d, data %02x -> %02x",217 syslog(LOG_NOTICE, "[TES:%02u CBN] recv len: %4u, data %02x -> %02x", 219 218 cepid, (uint16_t)rlen, head, tail); 220 219 #endif /* of #ifdef SHOW_RCV_RANGE */ … … 246 245 else { 247 246 if (rlen < 0) 248 syslog(LOG_NOTICE, "[TES:%02 dCBN] recv error = %s", cepid, itron_strerror(rcv_error));247 syslog(LOG_NOTICE, "[TES:%02u CBN] recv error = %s", cepid, itron_strerror(rcv_error)); 249 248 sig_sem(SEM_TCP_ECHO_SRV_RCV_READY); 250 249 } … … 254 253 snd_error = *(ER*)p_parblk; 255 254 if (snd_error != E_OK) 256 syslog(LOG_NOTICE, "[TES:%02 dCBN] close error = %s", cepid, itron_strerror(snd_error));257 258 syslog(LOG_NOTICE, "[TES:%02 d CBN] finished: %6ld, snd: %4d, rcv: %4d, len: %ld",255 syslog(LOG_NOTICE, "[TES:%02u CBN] close error = %s", cepid, itron_strerror(snd_error)); 256 257 syslog(LOG_NOTICE, "[TES:%02u CBN] finish: %6lu, snd: %4u, rcv: %4u, len: %ld", 259 258 cepid, now / SYSTIM_HZ, snd_count, rcv_count, snd_total); 260 259 … … 283 282 284 283 if ((error = psnd_dtq(DTQ_TCP_ECHO_SRV_SND, (intptr_t)cepid)) != E_OK) { 285 syslog(LOG_NOTICE, "[TES:%02 dRCV] sync error: %s", cepid, itron_strerror(error));284 syslog(LOG_NOTICE, "[TES:%02u RCV] sync error: %s", cepid, itron_strerror(error)); 286 285 return error; 287 286 } 288 287 289 288 if ((error = TCP_ACP_CEP(cepid, repid, &dst, TMO_NBLK)) != E_WBLK) { 290 syslog(LOG_NOTICE, "[TES:%02 dACP] accept error = %s", cepid, itron_strerror(error));289 syslog(LOG_NOTICE, "[TES:%02u ACP] accept error = %s", cepid, itron_strerror(error)); 291 290 return error; 292 291 } … … 300 299 301 300 #ifdef USE_TCP_EXTENTIONS 302 if ((error = free_tcp_rep(repid, true)) != E_OK) {303 syslog(LOG_NOTICE, "[TES:%02 dDEL] REP delete error: %s", cepid, itron_strerror(error));301 if ((error = FREE_TCP_REP(repid, true)) != E_OK) { 302 syslog(LOG_NOTICE, "[TES:%02u DEL] REP delete error: %s", cepid, itron_strerror(error)); 304 303 return error; 305 304 } … … 318 317 /* 受信する。*/ 319 318 if ((error = tcp_rcv_dat(cepid, rptr, blen, TMO_NBLK)) != E_WBLK) { 320 syslog(LOG_NOTICE, "[TES:%02 dRCV] recv error = %s", cepid, itron_strerror(error));319 syslog(LOG_NOTICE, "[TES:%02u RCV] recv error = %s", cepid, itron_strerror(error)); 321 320 break; 322 321 } … … 359 358 while (true) { 360 359 if ((error = rcv_dtq(DTQ_TCP_ECHO_SRV_SND, (intptr_t*)&cepid)) != E_OK) { 361 syslog(LOG_NOTICE, "[TES:%02 dSND] sync error: %s",360 syslog(LOG_NOTICE, "[TES:%02u SND] sync error: %s", 362 361 cepid, itron_strerror(error)); 363 362 continue; … … 387 386 /* 送信する。*/ 388 387 if ((error = tcp_snd_dat(cepid, sptr, blen, TMO_NBLK)) != E_WBLK) { 389 syslog(LOG_NOTICE, "[TES:%02 dSND] send error = %s", cepid, itron_strerror(error));388 syslog(LOG_NOTICE, "[TES:%02u SND] send error = %s", cepid, itron_strerror(error)); 390 389 break; 391 390 } … … 398 397 #ifdef USE_TCP_SHT_CEP 399 398 if ((error = tcp_sht_cep(cepid)) != E_OK) 400 syslog(LOG_NOTICE, "[TES:%02 dSND] shutdown error = %s", cepid, itron_strerror(error));399 syslog(LOG_NOTICE, "[TES:%02u SND] shutdown error = %s", cepid, itron_strerror(error)); 401 400 #endif /* of #ifdef USE_TCP_SHT_CEP */ 402 401 403 402 if ((error = tcp_cls_cep(cepid, TMO_NBLK)) != E_WBLK) { 404 syslog(LOG_NOTICE, "[TES:%02 dSND] close error = %s", cepid, itron_strerror(error));403 syslog(LOG_NOTICE, "[TES:%02u SND] close error = %s", cepid, itron_strerror(error)); 405 404 } 406 405 … … 426 425 427 426 if ((error = psnd_dtq(DTQ_TCP_ECHO_SRV_SND, (intptr_t)cepid)) != E_OK) { 428 syslog(LOG_NOTICE, "[TES:%02 dRCV] sync error: %s", cepid, itron_strerror(error));427 syslog(LOG_NOTICE, "[TES:%02u RCV] sync error: %s", cepid, itron_strerror(error)); 429 428 return error; 430 429 } 431 430 432 431 if ((error = TCP_ACP_CEP(cepid, repid, &dst, TMO_FEVR)) != E_OK) { 433 syslog(LOG_NOTICE, "[TES:%02 dACP] accept error = %s", cepid, itron_strerror(error));432 syslog(LOG_NOTICE, "[TES:%02u ACP] accept error = %s", cepid, itron_strerror(error)); 434 433 return error; 435 434 } 436 435 437 436 #ifdef USE_TCP_EXTENTIONS 438 if ((error = free_tcp_rep(repid, true)) != E_OK) {439 syslog(LOG_NOTICE, "[TES:%02 dDEL] REP delete error: %s", cepid, itron_strerror(error));437 if ((error = FREE_TCP_REP(repid, true)) != E_OK) { 438 syslog(LOG_NOTICE, "[TES:%02u DEL] REP delete error: %s", cepid, itron_strerror(error)); 440 439 return error; 441 440 } … … 443 442 444 443 syscall(get_tim(&now)); 445 syslog(LOG_NOTICE, "[TES:%02 d ACP] connected: %6ld, from: %s.%d",444 syslog(LOG_NOTICE, "[TES:%02u ACP] connect: %6lu, from: %s.%d", 446 445 cepid, now / SYSTIM_HZ, IP2STR(NULL, &dst.ipaddr), dst.portno); 447 446 sptr = rptr = buffer; … … 461 460 if ((rlen = tcp_rcv_dat(cepid, rptr, blen, TMO_FEVR)) <= 0) { 462 461 if (rlen < 0) 463 syslog(LOG_NOTICE, "[TES:%02 dRCV] recv error = %s",462 syslog(LOG_NOTICE, "[TES:%02u RCV] recv error = %s", 464 463 cepid, itron_strerror(rlen)); 465 464 break; … … 468 467 tail = *(rptr + rlen - 1); 469 468 #ifdef SHOW_RCV_RANGE 470 syslog(LOG_NOTICE, "[TES:%02 d RCV] len: %4d, data %02x -> %02x",469 syslog(LOG_NOTICE, "[TES:%02u RCV] len: %4u, data %02x -> %02x", 471 470 cepid, (uint16_t)rlen, head, tail); 472 471 #endif /* of #ifdef SHOW_RCV_RANGE */ … … 531 530 while (true) { 532 531 if ((error = rcv_dtq(DTQ_TCP_ECHO_SRV_SND, (intptr_t*)&cepid)) != E_OK) { 533 syslog(LOG_NOTICE, "[TES:%02 dSND] sync error: %s",532 syslog(LOG_NOTICE, "[TES:%02u SND] sync error: %s", 534 533 cepid, itron_strerror(error)); 535 534 continue; … … 554 553 555 554 if ((slen = tcp_snd_dat(cepid, sptr, blen, TMO_FEVR)) <= 0) { 556 syslog(LOG_NOTICE, "[TES:%02 dSND] send error = %s", cepid, itron_strerror(slen));555 syslog(LOG_NOTICE, "[TES:%02u SND] send error = %s", cepid, itron_strerror(slen)); 557 556 break; 558 557 } … … 561 560 tail = *(sptr + slen - 1); 562 561 #ifdef SHOW_RCV_RANGE 563 syslog(LOG_NOTICE, "[TES:%02 d SND] len: %4d, data %02x -> %02x",562 syslog(LOG_NOTICE, "[TES:%02u SND] len: %4u, data %02x -> %02x", 564 563 cepid, (uint16_t)slen, head, tail); 565 564 #endif /* of #ifdef SHOW_RCV_RANGE */ … … 602 601 #ifdef USE_TCP_SHT_CEP 603 602 if ((error = tcp_sht_cep(cepid)) != E_OK) 604 syslog(LOG_NOTICE, "[TES:%02 dSND] shtudown error = %s", cepid, itron_strerror(error));603 syslog(LOG_NOTICE, "[TES:%02u SND] shtudown error = %s", cepid, itron_strerror(error)); 605 604 #endif /* of #ifdef USE_TCP_SHT_CEP */ 606 605 607 606 if ((error = tcp_cls_cep(cepid, TMO_FEVR)) != E_OK) 608 syslog(LOG_NOTICE, "[TES:%02 dSND] close error = %s", cepid, itron_strerror(error));607 syslog(LOG_NOTICE, "[TES:%02u SND] close error = %s", cepid, itron_strerror(error)); 609 608 610 609 get_tim(&now); 611 syslog(LOG_NOTICE, "[TES:%02 d SND] finished: %6ld, snd: %4d, rcv: %4d, len: %ld",610 syslog(LOG_NOTICE, "[TES:%02u SND] finish: %6lu, snd: %4u, rcv: %4u, len: %ld", 612 611 cepid, now / SYSTIM_HZ, snd_count, rcv_count, snd_total); 613 612 … … 646 645 #endif 647 646 648 return alloc_tcp_rep(repid, tskid, &crep);647 return ALLOC_TCP_REP(repid, tskid, &crep); 649 648 } 650 649 … … 681 680 #endif 682 681 683 return alloc_tcp_cep(cepid, tskid, &ccep);682 return ALLOC_TCP_CEP(cepid, tskid, &ccep); 684 683 } 685 684 … … 711 710 } 712 711 else if ((error = tcp_echo_srv_rcv(cepid, repid)) != E_OK) { 713 error = free_tcp_rep(repid, error != E_DLT);712 error = FREE_TCP_REP(repid, error != E_DLT); 714 713 break; 715 714 } … … 717 716 718 717 if ((error = free_tcp_cep(cepid)) != E_OK) 719 syslog(LOG_NOTICE, "[TES:%02 dEXT] CEP delete error: %s", cepid, itron_strerror(error));718 syslog(LOG_NOTICE, "[TES:%02u EXT] CEP delete error: %s", cepid, itron_strerror(error)); 720 719 721 720 }
Note:
See TracChangeset
for help on using the changeset viewer.