Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tcp/service.c

    rb7fd2a0 r258d77e  
    3737#include <async.h>
    3838#include <errno.h>
    39 #include <str_error.h>
    4039#include <inet/endpoint.h>
    4140#include <inet/inet.h>
     
    6867static void tcp_service_lst_cstate_change(tcp_conn_t *, void *, tcp_cstate_t);
    6968
    70 static errno_t tcp_cconn_create(tcp_client_t *, tcp_conn_t *, tcp_cconn_t **);
     69static int tcp_cconn_create(tcp_client_t *, tcp_conn_t *, tcp_cconn_t **);
    7170
    7271/** Connection callbacks to tie us to lower layer */
     
    132131        tcp_cconn_t *cconn;
    133132        inet_ep2_t epp;
    134         errno_t rc;
     133        int rc;
    135134        tcp_error_t trc;
    136135
     
    298297 * @return EOK on success or ENOMEM if out of memory
    299298 */
    300 static errno_t tcp_cconn_create(tcp_client_t *client, tcp_conn_t *conn,
     299static int tcp_cconn_create(tcp_client_t *client, tcp_conn_t *conn,
    301300    tcp_cconn_t **rcconn)
    302301{
     
    345344 * @return EOK on success or ENOMEM if out of memory
    346345 */
    347 static errno_t tcp_clistener_create(tcp_client_t *client, tcp_conn_t *conn,
     346static int tcp_clistener_create(tcp_client_t *client, tcp_conn_t *conn,
    348347    tcp_clst_t **rclst)
    349348{
     
    390389 *         is found.
    391390 */
    392 static errno_t tcp_cconn_get(tcp_client_t *client, sysarg_t id,
     391static int tcp_cconn_get(tcp_client_t *client, sysarg_t id,
    393392    tcp_cconn_t **rcconn)
    394393{
     
    412411 *         is found.
    413412 */
    414 static errno_t tcp_clistener_get(tcp_client_t *client, sysarg_t id,
     413static int tcp_clistener_get(tcp_client_t *client, sysarg_t id,
    415414    tcp_clst_t **rclst)
    416415{
     
    433432 * @param rconn_id Place to store ID of new connection
    434433 *
    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,
     434 * @return EOK on success or negative error code
     435 */
     436static int tcp_conn_create_impl(tcp_client_t *client, inet_ep2_t *epp,
    438437    sysarg_t *rconn_id)
    439438{
    440439        tcp_conn_t *conn;
    441440        tcp_cconn_t *cconn;
    442         errno_t rc;
     441        int rc;
    443442        tcp_error_t trc;
    444443        char *slocal;
     
    482481 * @return EOK on success, ENOENT if no such connection is found
    483482 */
    484 static errno_t tcp_conn_destroy_impl(tcp_client_t *client, sysarg_t conn_id)
     483static int tcp_conn_destroy_impl(tcp_client_t *client, sysarg_t conn_id)
    485484{
    486485        tcp_cconn_t *cconn;
    487         errno_t rc;
     486        int rc;
    488487
    489488        rc = tcp_cconn_get(client, conn_id, &cconn);
     
    507506 * @param rlst_id Place to store ID of new listener
    508507 *
    509  * @return EOK on success or an error code
     508 * @return EOK on success or negative error code
    510509*/
    511 static errno_t tcp_listener_create_impl(tcp_client_t *client, inet_ep_t *ep,
     510static int tcp_listener_create_impl(tcp_client_t *client, inet_ep_t *ep,
    512511    sysarg_t *rlst_id)
    513512{
     
    515514        tcp_clst_t *clst;
    516515        inet_ep2_t epp;
    517         errno_t rc;
     516        int rc;
    518517        tcp_error_t trc;
    519518
     
    555554 * @return EOK on success, ENOENT if no such listener is found
    556555 */
    557 static errno_t tcp_listener_destroy_impl(tcp_client_t *client, sysarg_t lst_id)
     556static int tcp_listener_destroy_impl(tcp_client_t *client, sysarg_t lst_id)
    558557{
    559558        tcp_clst_t *clst;
    560         errno_t rc;
     559        int rc;
    561560
    562561        rc = tcp_clistener_get(client, lst_id, &clst);
     
    578577 * @param conn_id Connection ID
    579578 *
    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)
     579 * @return EOK on success or negative error code
     580 */
     581static int tcp_conn_send_fin_impl(tcp_client_t *client, sysarg_t conn_id)
    583582{
    584583        tcp_cconn_t *cconn;
    585         errno_t rc;
     584        int rc;
    586585
    587586        rc = tcp_cconn_get(client, conn_id, &cconn);
     
    603602 * @param conn_id Connection ID
    604603 *
    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)
     604 * @return EOK on success or negative error code
     605 */
     606static int tcp_conn_push_impl(tcp_client_t *client, sysarg_t conn_id)
    608607{
    609608        tcp_cconn_t *cconn;
    610         errno_t rc;
     609        int rc;
    611610
    612611        rc = tcp_cconn_get(client, conn_id, &cconn);
     
    628627 * @param conn_id Connection ID
    629628 *
    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)
     629 * @return EOK on success or negative error code
     630 */
     631static int tcp_conn_reset_impl(tcp_client_t *client, sysarg_t conn_id)
    633632{
    634633        tcp_cconn_t *cconn;
    635         errno_t rc;
     634        int rc;
    636635
    637636        rc = tcp_cconn_get(client, conn_id, &cconn);
     
    654653 * @param size    Data size in bytes
    655654 *
    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,
     655 * @return EOK on success or negative error code
     656 */
     657static int tcp_conn_send_impl(tcp_client_t *client, sysarg_t conn_id,
    659658    void *data, size_t size)
    660659{
    661660        tcp_cconn_t *cconn;
    662         errno_t rc;
    663         tcp_error_t trc;
     661        int rc;
    664662
    665663        rc = tcp_cconn_get(client, conn_id, &cconn);
     
    667665                return rc;
    668666
    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;
    672670
    673671        return EOK;
     
    684682 * @param nrecv   Place to store actual number of bytes received
    685683 *
    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,
     684 * @return EOK on success or negative error code
     685 */
     686static int tcp_conn_recv_impl(tcp_client_t *client, sysarg_t conn_id,
    689687    void *data, size_t size, size_t *nrecv)
    690688{
    691689        tcp_cconn_t *cconn;
    692690        xflags_t xflags;
    693         errno_t rc;
    694         tcp_error_t trc;
     691        int rc;
    695692
    696693        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl()");
     
    702699        }
    703700
    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) {
    707704                case TCP_EAGAIN:
    708705                        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - EAGAIN");
     
    712709                        return EOK;
    713710                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);
    715712                        return EIO;
    716713                }
     
    758755        inet_ep2_t epp;
    759756        sysarg_t conn_id;
    760         errno_t rc;
     757        int rc;
    761758
    762759        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_create_srv()");
     
    802799{
    803800        sysarg_t conn_id;
    804         errno_t rc;
     801        int rc;
    805802
    806803        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_destroy_srv()");
     
    826823        inet_ep_t ep;
    827824        sysarg_t lst_id;
    828         errno_t rc;
     825        int rc;
    829826
    830827        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_listener_create_srv()");
     
    870867{
    871868        sysarg_t lst_id;
    872         errno_t rc;
     869        int rc;
    873870
    874871        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_listener_destroy_srv()");
     
    891888{
    892889        sysarg_t conn_id;
    893         errno_t rc;
     890        int rc;
    894891
    895892        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_send_fin_srv()");
     
    912909{
    913910        sysarg_t conn_id;
    914         errno_t rc;
     911        int rc;
    915912
    916913        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_push_srv()");
     
    933930{
    934931        sysarg_t conn_id;
    935         errno_t rc;
     932        int rc;
    936933
    937934        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_reset_srv()");
     
    957954        sysarg_t conn_id;
    958955        void *data;
    959         errno_t rc;
     956        int rc;
    960957
    961958        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_send_srv())");
     
    10181015        size_t size, rsize;
    10191016        void *data;
    1020         errno_t rc;
     1017        int rc;
    10211018
    10221019        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_srv()");
     
    10741071        size_t size, rsize;
    10751072        void *data;
    1076         errno_t rc;
     1073        int rc;
    10771074
    10781075        log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv()");
     
    10981095        rc = tcp_conn_recv_impl(client, conn_id, data, size, &rsize);
    10991096        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);
    11011098                async_answer_0(callid, rc);
    11021099                async_answer_0(iid, rc);
     
    12441241/** Initialize TCP service.
    12451242 *
    1246  * @return EOK on success or an error code.
    1247  */
    1248 errno_t tcp_service_init(void)
    1249 {
    1250         errno_t rc;
     1243 * @return EOK on success or negative error code.
     1244 */
     1245int tcp_service_init(void)
     1246{
     1247        int rc;
    12511248        service_id_t sid;
    12521249
Note: See TracChangeset for help on using the changeset viewer.