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