Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset bc03679 in mainline


Ignore:
Timestamp:
2012-04-25T18:14:25Z (10 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master
Children:
291af81
Parents:
ee3b615 (diff), b1bd89ea (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with mainline

Location:
uspace
Files:
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    ree3b615 rbc03679  
    122122        generic/vfs/canonify.c \
    123123        generic/net/inet.c \
    124         generic/net/modules.c \
    125124        generic/net/socket_client.c \
    126125        generic/net/socket_parse.c \
  • uspace/lib/c/generic/net/socket_client.c

    ree3b615 rbc03679  
    4444#include <errno.h>
    4545#include <task.h>
     46#include <ns.h>
    4647#include <ipc/services.h>
    4748#include <ipc/socket.h>
    48 #include <net/modules.h>
    4949#include <net/in.h>
    5050#include <net/socket.h>
     
    284284{
    285285        if (socket_globals.tcp_sess == NULL) {
    286                 socket_globals.tcp_sess = bind_service(SERVICE_TCP,
     286                socket_globals.tcp_sess = service_bind(SERVICE_TCP,
    287287                    0, 0, SERVICE_TCP, socket_connection);
    288288        }
     
    301301{
    302302        if (socket_globals.udp_sess == NULL) {
    303                 socket_globals.udp_sess = bind_service(SERVICE_UDP,
     303                socket_globals.udp_sess = service_bind(SERVICE_UDP,
    304304                    0, 0, SERVICE_UDP, socket_connection);
    305305        }
     
    378378 * @return              Other error codes as defined for the NET_SOCKET message.
    379379 * @return              Other error codes as defined for the
    380  *                      bind_service() function.
     380 *                      service_bind() function.
    381381 */
    382382int socket(int domain, int type, int protocol)
  • uspace/lib/c/generic/ns.c

    ree3b615 rbc03679  
    3737#include <async.h>
    3838#include <macros.h>
     39#include <errno.h>
    3940#include "private/ns.h"
    4041
     
    4849}
    4950
    50 async_sess_t *service_connect(exch_mgmt_t mgmt, sysarg_t service, sysarg_t arg2,
     51async_sess_t *service_connect(exch_mgmt_t mgmt, services_t service, sysarg_t arg2,
    5152    sysarg_t arg3)
    5253{
     
    7273}
    7374
    74 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, sysarg_t service,
     75async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, services_t service,
    7576    sysarg_t arg2, sysarg_t arg3)
    7677{
     
    8182            async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3);
    8283        async_exchange_end(exch);
    83 
     84       
    8485        if (!sess)
    8586                return NULL;
     
    9192         */
    9293        async_sess_args_set(sess, arg2, arg3, 0);
     94       
     95        return sess;
     96}
     97
     98/** Create bidirectional connection with a service
     99 *
     100 * @param[in] service         Service.
     101 * @param[in] arg1            First parameter.
     102 * @param[in] arg2            Second parameter.
     103 * @param[in] arg3            Third parameter.
     104 * @param[in] client_receiver Message receiver.
     105 *
     106 * @return Session to the service.
     107 * @return Other error codes as defined by async_connect_to_me().
     108 *
     109 */
     110async_sess_t *service_bind(services_t service, sysarg_t arg1, sysarg_t arg2,
     111    sysarg_t arg3, async_client_conn_t client_receiver)
     112{
     113        /* Connect to the needed service */
     114        async_sess_t *sess =
     115            service_connect_blocking(EXCHANGE_SERIALIZE, service, 0, 0);
     116        if (sess != NULL) {
     117                /* Request callback connection */
     118                async_exch_t *exch = async_exchange_begin(sess);
     119                int rc = async_connect_to_me(exch, arg1, arg2, arg3,
     120                    client_receiver, NULL);
     121                async_exchange_end(exch);
     122               
     123                if (rc != EOK) {
     124                        async_hangup(sess);
     125                        errno = rc;
     126                        return NULL;
     127                }
     128        }
    93129       
    94130        return sess;
  • uspace/lib/c/include/ns.h

    ree3b615 rbc03679  
    3737
    3838#include <sys/types.h>
     39#include <ipc/services.h>
    3940#include <task.h>
    4041#include <async.h>
    4142
    4243extern int service_register(sysarg_t);
    43 extern async_sess_t *service_connect(exch_mgmt_t, sysarg_t, sysarg_t, sysarg_t);
    44 extern async_sess_t *service_connect_blocking(exch_mgmt_t, sysarg_t, sysarg_t,
     44extern async_sess_t *service_connect(exch_mgmt_t, services_t, sysarg_t, sysarg_t);
     45extern async_sess_t *service_connect_blocking(exch_mgmt_t, services_t, sysarg_t,
    4546    sysarg_t);
     47extern async_sess_t *service_bind(services_t, sysarg_t, sysarg_t, sysarg_t,
     48    async_client_conn_t);
    4649
    4750extern int ns_ping(void);
  • uspace/lib/net/tl/socket_core.c

    ree3b615 rbc03679  
    3939#include <net/in.h>
    4040#include <net/inet.h>
    41 #include <net/modules.h>
    4241#include <stdint.h>
    4342#include <stdlib.h>
  • uspace/srv/net/tcp/sock.c

    ree3b615 rbc03679  
    4242#include <ipc/services.h>
    4343#include <ipc/socket.h>
    44 #include <net/modules.h>
    4544#include <net/socket.h>
    4645#include <ns.h>
     
    144143        sock->sock_core = sock_core;
    145144
    146         refresh_answer(&answer, NULL);
    147145        SOCKET_SET_SOCKET_ID(answer, sock_id);
    148146
    149147        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE);
    150148        SOCKET_SET_HEADER_SIZE(answer, sizeof(tcp_header_t));
    151         answer_call(callid, EOK, &answer, 3);
     149       
     150        async_answer_3(callid, EOK, IPC_GET_ARG1(answer),
     151            IPC_GET_ARG2(answer), IPC_GET_ARG3(answer));
    152152}
    153153
     
    468468        assert(asock_core != NULL);
    469469
    470         refresh_answer(&answer, NULL);
    471 
    472470        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE);
    473471        SOCKET_SET_SOCKET_ID(answer, asock_id);
    474472        SOCKET_SET_ADDRESS_LENGTH(answer, sizeof(struct sockaddr_in));
    475 
    476         answer_call(callid, asock_core->socket_id, &answer, 3);
    477 
     473       
     474        async_answer_3(callid, asock_core->socket_id,
     475            IPC_GET_ARG1(answer), IPC_GET_ARG2(answer),
     476            IPC_GET_ARG3(answer));
     477       
    478478        /* Push one fragment notification to client's queue */
    479479        log_msg(LVL_DEBUG, "tcp_sock_accept(): notify data\n");
     
    559559        }
    560560
    561         refresh_answer(&answer, NULL);
     561        IPC_SET_ARG1(answer, 0);
    562562        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE);
    563         answer_call(callid, EOK, &answer, 2);
     563        async_answer_2(callid, EOK, IPC_GET_ARG1(answer),
     564            IPC_GET_ARG2(answer));
    564565        fibril_mutex_unlock(&socket->lock);
    565566}
     
    679680
    680681        SOCKET_SET_READ_DATA_LENGTH(answer, length);
    681         answer_call(callid, EOK, &answer, 1);
    682 
     682        async_answer_1(callid, EOK, IPC_GET_ARG1(answer));
     683       
    683684        /* Push one fragment notification to client's queue */
    684685        tcp_sock_notify_data(sock_core);
  • uspace/srv/net/udp/sock.c

    ree3b615 rbc03679  
    4343#include <ipc/services.h>
    4444#include <ipc/socket.h>
    45 #include <net/modules.h>
    4645#include <net/socket.h>
    4746#include <ns.h>
     
    134133        assert(sock_core != NULL);
    135134        sock->sock_core = sock_core;
    136 
    137 
    138         refresh_answer(&answer, NULL);
     135       
    139136        SOCKET_SET_SOCKET_ID(answer, sock_id);
    140137
    141138        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE);
    142139        SOCKET_SET_HEADER_SIZE(answer, sizeof(udp_header_t));
    143         answer_call(callid, EOK, &answer, 3);
     140        async_answer_3(callid, EOK, IPC_GET_ARG1(answer),
     141            IPC_GET_ARG2(answer), IPC_GET_ARG3(answer));
    144142}
    145143
     
    369367                }
    370368        }
    371 
    372         refresh_answer(&answer, NULL);
     369       
     370        IPC_SET_ARG1(answer, 0);
    373371        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, FRAGMENT_SIZE);
    374         answer_call(callid, EOK, &answer, 2);
     372        async_answer_2(callid, EOK, IPC_GET_ARG1(answer),
     373            IPC_GET_ARG2(answer));
    375374        fibril_mutex_unlock(&socket->lock);
     375       
    376376out:
    377377        if (addr != NULL)
     
    486486
    487487        log_msg(LVL_DEBUG, "read_data_length <- %zu", length);
     488        IPC_SET_ARG2(answer, 0);
    488489        SOCKET_SET_READ_DATA_LENGTH(answer, length);
    489490        SOCKET_SET_ADDRESS_LENGTH(answer, sizeof(addr));
    490         answer_call(callid, EOK, &answer, 3);
    491 
     491        async_answer_3(callid, EOK, IPC_GET_ARG1(answer),
     492            IPC_GET_ARG2(answer), IPC_GET_ARG3(answer));
     493       
    492494        /* Push one fragment notification to client's queue */
    493495        udp_sock_notify_data(sock_core);
Note: See TracChangeset for help on using the changeset viewer.