Changes in uspace/srv/net/tcp/service.c [258d77e:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/service.c
r258d77e rb7fd2a0 37 37 #include <async.h> 38 38 #include <errno.h> 39 #include <str_error.h> 39 40 #include <inet/endpoint.h> 40 41 #include <inet/inet.h> … … 67 68 static void tcp_service_lst_cstate_change(tcp_conn_t *, void *, tcp_cstate_t); 68 69 69 static int tcp_cconn_create(tcp_client_t *, tcp_conn_t *, tcp_cconn_t **);70 static errno_t tcp_cconn_create(tcp_client_t *, tcp_conn_t *, tcp_cconn_t **); 70 71 71 72 /** Connection callbacks to tie us to lower layer */ … … 131 132 tcp_cconn_t *cconn; 132 133 inet_ep2_t epp; 133 int rc;134 errno_t rc; 134 135 tcp_error_t trc; 135 136 … … 297 298 * @return EOK on success or ENOMEM if out of memory 298 299 */ 299 static int tcp_cconn_create(tcp_client_t *client, tcp_conn_t *conn,300 static errno_t tcp_cconn_create(tcp_client_t *client, tcp_conn_t *conn, 300 301 tcp_cconn_t **rcconn) 301 302 { … … 344 345 * @return EOK on success or ENOMEM if out of memory 345 346 */ 346 static int tcp_clistener_create(tcp_client_t *client, tcp_conn_t *conn,347 static errno_t tcp_clistener_create(tcp_client_t *client, tcp_conn_t *conn, 347 348 tcp_clst_t **rclst) 348 349 { … … 389 390 * is found. 390 391 */ 391 static int tcp_cconn_get(tcp_client_t *client, sysarg_t id,392 static errno_t tcp_cconn_get(tcp_client_t *client, sysarg_t id, 392 393 tcp_cconn_t **rcconn) 393 394 { … … 411 412 * is found. 412 413 */ 413 static int tcp_clistener_get(tcp_client_t *client, sysarg_t id,414 static errno_t tcp_clistener_get(tcp_client_t *client, sysarg_t id, 414 415 tcp_clst_t **rclst) 415 416 { … … 432 433 * @param rconn_id Place to store ID of new connection 433 434 * 434 * @return EOK on success or negativeerror code435 */ 436 static int tcp_conn_create_impl(tcp_client_t *client, inet_ep2_t *epp,435 * @return EOK on success or an error code 436 */ 437 static errno_t tcp_conn_create_impl(tcp_client_t *client, inet_ep2_t *epp, 437 438 sysarg_t *rconn_id) 438 439 { 439 440 tcp_conn_t *conn; 440 441 tcp_cconn_t *cconn; 441 int rc;442 errno_t rc; 442 443 tcp_error_t trc; 443 444 char *slocal; … … 481 482 * @return EOK on success, ENOENT if no such connection is found 482 483 */ 483 static int tcp_conn_destroy_impl(tcp_client_t *client, sysarg_t conn_id)484 static errno_t tcp_conn_destroy_impl(tcp_client_t *client, sysarg_t conn_id) 484 485 { 485 486 tcp_cconn_t *cconn; 486 int rc;487 errno_t rc; 487 488 488 489 rc = tcp_cconn_get(client, conn_id, &cconn); … … 506 507 * @param rlst_id Place to store ID of new listener 507 508 * 508 * @return EOK on success or negativeerror code509 * @return EOK on success or an error code 509 510 */ 510 static int tcp_listener_create_impl(tcp_client_t *client, inet_ep_t *ep,511 static errno_t tcp_listener_create_impl(tcp_client_t *client, inet_ep_t *ep, 511 512 sysarg_t *rlst_id) 512 513 { … … 514 515 tcp_clst_t *clst; 515 516 inet_ep2_t epp; 516 int rc;517 errno_t rc; 517 518 tcp_error_t trc; 518 519 … … 554 555 * @return EOK on success, ENOENT if no such listener is found 555 556 */ 556 static int tcp_listener_destroy_impl(tcp_client_t *client, sysarg_t lst_id)557 static errno_t tcp_listener_destroy_impl(tcp_client_t *client, sysarg_t lst_id) 557 558 { 558 559 tcp_clst_t *clst; 559 int rc;560 errno_t rc; 560 561 561 562 rc = tcp_clistener_get(client, lst_id, &clst); … … 577 578 * @param conn_id Connection ID 578 579 * 579 * @return EOK on success or negativeerror code580 */ 581 static int tcp_conn_send_fin_impl(tcp_client_t *client, sysarg_t conn_id)580 * @return EOK on success or an error code 581 */ 582 static errno_t tcp_conn_send_fin_impl(tcp_client_t *client, sysarg_t conn_id) 582 583 { 583 584 tcp_cconn_t *cconn; 584 int rc;585 errno_t rc; 585 586 586 587 rc = tcp_cconn_get(client, conn_id, &cconn); … … 602 603 * @param conn_id Connection ID 603 604 * 604 * @return EOK on success or negativeerror code605 */ 606 static int tcp_conn_push_impl(tcp_client_t *client, sysarg_t conn_id)605 * @return EOK on success or an error code 606 */ 607 static errno_t tcp_conn_push_impl(tcp_client_t *client, sysarg_t conn_id) 607 608 { 608 609 tcp_cconn_t *cconn; 609 int rc;610 errno_t rc; 610 611 611 612 rc = tcp_cconn_get(client, conn_id, &cconn); … … 627 628 * @param conn_id Connection ID 628 629 * 629 * @return EOK on success or negativeerror code630 */ 631 static int tcp_conn_reset_impl(tcp_client_t *client, sysarg_t conn_id)630 * @return EOK on success or an error code 631 */ 632 static errno_t tcp_conn_reset_impl(tcp_client_t *client, sysarg_t conn_id) 632 633 { 633 634 tcp_cconn_t *cconn; 634 int rc;635 errno_t rc; 635 636 636 637 rc = tcp_cconn_get(client, conn_id, &cconn); … … 653 654 * @param size Data size in bytes 654 655 * 655 * @return EOK on success or negativeerror code656 */ 657 static int tcp_conn_send_impl(tcp_client_t *client, sysarg_t conn_id,656 * @return EOK on success or an error code 657 */ 658 static errno_t tcp_conn_send_impl(tcp_client_t *client, sysarg_t conn_id, 658 659 void *data, size_t size) 659 660 { 660 661 tcp_cconn_t *cconn; 661 int rc; 662 errno_t rc; 663 tcp_error_t trc; 662 664 663 665 rc = tcp_cconn_get(client, conn_id, &cconn); … … 665 667 return rc; 666 668 667 rc = tcp_uc_send(cconn->conn, data, size, 0);668 if ( rc !=EOK)669 return rc;669 trc = tcp_uc_send(cconn->conn, data, size, 0); 670 if (trc != TCP_EOK) 671 return EIO; 670 672 671 673 return EOK; … … 682 684 * @param nrecv Place to store actual number of bytes received 683 685 * 684 * @return EOK on success or negativeerror code685 */ 686 static int tcp_conn_recv_impl(tcp_client_t *client, sysarg_t conn_id,686 * @return EOK on success or an error code 687 */ 688 static errno_t tcp_conn_recv_impl(tcp_client_t *client, sysarg_t conn_id, 687 689 void *data, size_t size, size_t *nrecv) 688 690 { 689 691 tcp_cconn_t *cconn; 690 692 xflags_t xflags; 691 int rc; 693 errno_t rc; 694 tcp_error_t trc; 692 695 693 696 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl()"); … … 699 702 } 700 703 701 rc = tcp_uc_receive(cconn->conn, data, size, nrecv, &xflags);702 if ( rc !=EOK) {703 switch ( rc) {704 trc = tcp_uc_receive(cconn->conn, data, size, nrecv, &xflags); 705 if (trc != TCP_EOK) { 706 switch (trc) { 704 707 case TCP_EAGAIN: 705 708 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - EAGAIN"); … … 709 712 return EOK; 710 713 default: 711 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - trc=%d", rc);714 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - trc=%d", trc); 712 715 return EIO; 713 716 } … … 755 758 inet_ep2_t epp; 756 759 sysarg_t conn_id; 757 int rc;760 errno_t rc; 758 761 759 762 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_create_srv()"); … … 799 802 { 800 803 sysarg_t conn_id; 801 int rc;804 errno_t rc; 802 805 803 806 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_destroy_srv()"); … … 823 826 inet_ep_t ep; 824 827 sysarg_t lst_id; 825 int rc;828 errno_t rc; 826 829 827 830 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_listener_create_srv()"); … … 867 870 { 868 871 sysarg_t lst_id; 869 int rc;872 errno_t rc; 870 873 871 874 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_listener_destroy_srv()"); … … 888 891 { 889 892 sysarg_t conn_id; 890 int rc;893 errno_t rc; 891 894 892 895 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_send_fin_srv()"); … … 909 912 { 910 913 sysarg_t conn_id; 911 int rc;914 errno_t rc; 912 915 913 916 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_push_srv()"); … … 930 933 { 931 934 sysarg_t conn_id; 932 int rc;935 errno_t rc; 933 936 934 937 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_reset_srv()"); … … 954 957 sysarg_t conn_id; 955 958 void *data; 956 int rc;959 errno_t rc; 957 960 958 961 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_send_srv())"); … … 1015 1018 size_t size, rsize; 1016 1019 void *data; 1017 int rc;1020 errno_t rc; 1018 1021 1019 1022 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_srv()"); … … 1071 1074 size_t size, rsize; 1072 1075 void *data; 1073 int rc;1076 errno_t rc; 1074 1077 1075 1078 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv()"); … … 1095 1098 rc = tcp_conn_recv_impl(client, conn_id, data, size, &rsize); 1096 1099 if (rc != EOK) { 1097 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv - recv_impl failed rc=% d", rc);1100 log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv - recv_impl failed rc=%s", str_error_name(rc)); 1098 1101 async_answer_0(callid, rc); 1099 1102 async_answer_0(iid, rc); … … 1241 1244 /** Initialize TCP service. 1242 1245 * 1243 * @return EOK on success or negativeerror code.1244 */ 1245 int tcp_service_init(void)1246 { 1247 int rc;1246 * @return EOK on success or an error code. 1247 */ 1248 errno_t tcp_service_init(void) 1249 { 1250 errno_t rc; 1248 1251 service_id_t sid; 1249 1252
Note:
See TracChangeset
for help on using the changeset viewer.