Changeset 6b82009 in mainline for uspace/lib/c


Ignore:
Timestamp:
2011-06-22T20:41:41Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ef09a7a
Parents:
55091847
Message:

networking stack: convert to the new async framework

Location:
uspace/lib/c
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/adt/measured_strings.c

    r55091847 r6b82009  
    4242#include <errno.h>
    4343#include <async.h>
    44 #include <async_obsolete.h>
    4544
    4645/** Creates a new measured string bundled with a copy of the given string
     
    298297 * size has to be negotiated in advance.
    299298 *
    300  * @param[in] phone     The other module phone.
     299 * @param[in] exch      Exchange.
    301300 * @param[out] strings  The returned measured strings array.
    302301 * @param[out] data     The measured strings data. This memory block stores the
     
    305304 * @return              EOK on success.
    306305 * @return              EINVAL if the strings or data parameter is NULL.
    307  * @return              EINVAL if the phone or count parameter is not positive.
     306 * @return              EINVAL if the exch or count parameter is invalid.
    308307 * @return              EINVAL if the sent array differs in size.
    309308 * @return              ENOMEM if there is not enough memory left.
     
    311310 *                      async_data_read_start() function.
    312311 */
    313 int
    314 measured_strings_return(int phone, measured_string_t **strings, uint8_t **data,
    315     size_t count)
     312int measured_strings_return(async_exch_t *exch, measured_string_t **strings,
     313    uint8_t **data, size_t count)
    316314{
    317315        size_t *lengths;
     
    320318        int rc;
    321319
    322         if ((phone < 0) || (!strings) || (!data) || (count <= 0))
     320        if ((exch == NULL) || (!strings) || (!data) || (count <= 0))
    323321                return EINVAL;
    324322
     
    327325                return ENOMEM;
    328326
    329         rc = async_obsolete_data_read_start(phone, lengths,
     327        rc = async_data_read_start(exch, lengths,
    330328            sizeof(size_t) * (count + 1));
    331329        if (rc != EOK) {
     
    352350                (*strings)[index].length = lengths[index];
    353351                if (lengths[index] > 0) {
    354                         rc = async_obsolete_data_read_start(phone, next, lengths[index]);
     352                        rc = async_data_read_start(exch, next, lengths[index]);
    355353                        if (rc != EOK) {
    356354                                free(lengths);
     
    376374 * size has to be negotiated in advance.
    377375 *
    378  * @param[in] phone     The other module phone.
     376 * @param[in] exch      Exchange.
    379377 * @param[in] strings   The measured strings array to be transferred.
    380378 * @param[in] count     The measured strings array size.
    381379 * @return              EOK on success.
    382380 * @return              EINVAL if the strings parameter is NULL.
    383  * @return              EINVAL if the phone or count parameter is not positive.
     381 * @return              EINVAL if the exch or count parameter is invalid.
    384382 * @return              Other error codes as defined for the
    385383 *                      async_data_write_start() function.
    386384 */
    387 int
    388 measured_strings_send(int phone, const measured_string_t *strings,
     385int measured_strings_send(async_exch_t *exch, const measured_string_t *strings,
    389386    size_t count)
    390387{
     
    393390        int rc;
    394391
    395         if ((phone < 0) || (!strings) || (count <= 0))
     392        if ((exch == NULL) || (!strings) || (count <= 0))
    396393                return EINVAL;
    397394
     
    400397                return ENOMEM;
    401398
    402         rc = async_obsolete_data_write_start(phone, lengths,
     399        rc = async_data_write_start(exch, lengths,
    403400            sizeof(size_t) * (count + 1));
    404401        if (rc != EOK) {
     
    411408        for (index = 0; index < count; index++) {
    412409                if (strings[index].length > 0) {
    413                         rc = async_obsolete_data_write_start(phone, strings[index].value,
     410                        rc = async_data_write_start(exch, strings[index].value,
    414411                            strings[index].length);
    415412                        if (rc != EOK)
     
    423420/** @}
    424421 */
    425 
  • uspace/lib/c/generic/net/icmp_api.c

    r55091847 r6b82009  
    4242#include <net/ip_codes.h>
    4343#include <async.h>
    44 #include <async_obsolete.h>
    4544#include <sys/types.h>
    4645#include <sys/time.h>
     
    5554 * timeout occurs.
    5655 *
    57  * @param[in] icmp_phone The ICMP module phone used for (semi)remote calls.
     56 * @param[in] sess The ICMP session.
    5857 * @param[in] size      The message data length in bytes.
    5958 * @param[in] timeout   The timeout in milliseconds.
     
    7473 */
    7574int
    76 icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl,
     75icmp_echo_msg(async_sess_t *sess, size_t size, mseconds_t timeout, ip_ttl_t ttl,
    7776    ip_tos_t tos, int dont_fragment, const struct sockaddr *addr,
    7877    socklen_t addrlen)
     
    8382        if (addrlen <= 0)
    8483                return EINVAL;
    85 
    86         message_id = async_obsolete_send_5(icmp_phone, NET_ICMP_ECHO, size, timeout, ttl,
     84       
     85        async_exch_t *exch = async_exchange_begin(sess);
     86       
     87        message_id = async_send_5(exch, NET_ICMP_ECHO, size, timeout, ttl,
    8788            tos, (sysarg_t) dont_fragment, NULL);
    88 
     89       
    8990        /* Send the address */
    90         async_obsolete_data_write_start(icmp_phone, addr, (size_t) addrlen);
     91        async_data_write_start(exch, addr, (size_t) addrlen);
     92       
     93        async_exchange_end(exch);
    9194
    9295        async_wait_for(message_id, &result);
  • uspace/lib/c/generic/net/icmp_common.c

    r55091847 r6b82009  
    4545/** Connect to the ICMP module.
    4646 *
    47  * @return ICMP module phone on success.
     47 * @return ICMP module session.
    4848 *
    4949 */
    50 int icmp_connect_module(void)
     50async_sess_t *icmp_connect_module(void)
    5151{
    5252        return connect_to_service(SERVICE_ICMP);
  • uspace/lib/c/generic/net/modules.c

    r55091847 r6b82009  
    4040
    4141#include <async.h>
    42 #include <async_obsolete.h>
    4342#include <malloc.h>
    4443#include <errno.h>
     
    4746#include <net/modules.h>
    4847#include <ns.h>
    49 #include <ns_obsolete.h>
    50 
    51 /** The time between connect requests in microseconds. */
    52 #define MODULE_WAIT_TIME  (10 * 1000)
    5348
    5449/** Answer a call.
     
    9893}
    9994
    100 /** Create bidirectional connection with the needed module service and registers
     95/** Create bidirectional connection with the needed module service and register
    10196 * the message receiver.
    10297 *
    103  * @param[in] need      The needed module service.
    104  * @param[in] arg1      The first parameter.
    105  * @param[in] arg2      The second parameter.
    106  * @param[in] arg3      The third parameter.
    107  * @param[in] client_receiver The message receiver.
    108  *
    109  * @return              The phone of the needed service.
    110  * @return              Other error codes as defined for the ipc_connect_to_me()
    111  *                      function.
    112  */
    113 int bind_service(services_t need, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
    114     async_client_conn_t client_receiver)
     98 * @param[in] need            Needed module service.
     99 * @param[in] arg1            First parameter.
     100 * @param[in] arg2            Second parameter.
     101 * @param[in] arg3            Third parameter.
     102 * @param[in] client_receiver Message receiver.
     103 *
     104 * @return Session to the needed service.
     105 * @return Other error codes as defined for the async_connect_to_me()
     106 *         function.
     107 *
     108 */
     109async_sess_t *bind_service(services_t need, sysarg_t arg1, sysarg_t arg2,
     110    sysarg_t arg3, async_client_conn_t client_receiver)
    115111{
    116112        /* Connect to the needed service */
    117         int phone = connect_to_service(need);
    118         if (phone >= 0) {
     113        async_sess_t *sess = connect_to_service(need);
     114        if (sess != NULL) {
    119115                /* Request the bidirectional connection */
    120                 int rc = async_obsolete_connect_to_me(phone, arg1, arg2, arg3,
     116                async_exch_t *exch = async_exchange_begin(sess);
     117                int rc = async_connect_to_me(exch, arg1, arg2, arg3,
    121118                    client_receiver, NULL);
     119                async_exchange_end(exch);
     120               
    122121                if (rc != EOK) {
    123                         async_obsolete_hangup(phone);
    124                         return rc;
     122                        async_hangup(sess);
     123                        errno = rc;
     124                        return NULL;
    125125                }
    126126        }
    127127       
    128         return phone;
    129 }
    130 
    131 /** Connects to the needed module.
    132  *
    133  * @param[in] need      The needed module service.
    134  * @return              The phone of the needed service.
    135  */
    136 int connect_to_service(services_t need)
    137 {
    138         return service_obsolete_connect_blocking(need, 0, 0);
    139 }
    140 
    141 /** Replies the data to the other party.
    142  *
    143  * @param[in] data      The data buffer to be sent.
     128        return sess;
     129}
     130
     131/** Connect to the needed module.
     132 *
     133 * @param[in] need Needed module service.
     134 *
     135 * @return Session to the needed service.
     136 * @return NULL if the connection timeouted.
     137 *
     138 */
     139async_sess_t *connect_to_service(services_t need)
     140{
     141        return service_connect_blocking(EXCHANGE_SERIALIZE, need, 0, 0);
     142}
     143
     144/** Reply the data to the other party.
     145 *
     146 * @param[in] data        The data buffer to be sent.
    144147 * @param[in] data_length The buffer length.
    145  * @return              EOK on success.
    146  * @return              EINVAL if the client does not expect the data.
    147  * @return              EOVERFLOW if the client does not expect all the data.
    148  *                      Only partial data are transfered.
    149  * @return              Other error codes as defined for the
    150  *                      async_data_read_finalize() function.
     148 *
     149 * @return EOK on success.
     150 * @return EINVAL if the client does not expect the data.
     151 * @return EOVERFLOW if the client does not expect all the data.
     152 *         Only partial data are transfered.
     153 * @return Other error codes as defined for the
     154 *         async_data_read_finalize() function.
     155 *
    151156 */
    152157int data_reply(void *data, size_t data_length)
     
    154159        size_t length;
    155160        ipc_callid_t callid;
    156 
     161       
    157162        /* Fetch the request */
    158163        if (!async_data_read_receive(&callid, &length))
    159164                return EINVAL;
    160 
     165       
    161166        /* Check the requested data size */
    162167        if (length < data_length) {
     
    164169                return EOVERFLOW;
    165170        }
    166 
     171       
    167172        /* Send the data */
    168173        return async_data_read_finalize(callid, data, data_length);
  • uspace/lib/c/generic/net/socket_client.c

    r55091847 r6b82009  
    3939#include <assert.h>
    4040#include <async.h>
    41 #include <async_obsolete.h>
    4241#include <fibril_synch.h>
    4342#include <stdint.h>
     
    8483        /** Socket identifier. */
    8584        int socket_id;
    86         /** Parent module phone. */
    87         int phone;
     85        /** Parent module session. */
     86        async_sess_t *sess;
    8887        /** Parent module service. */
    8988        services_t service;
     
    144143/** Socket client library global data. */
    145144static struct socket_client_globals {
    146         /** TCP module phone. */
    147         int tcp_phone;
    148         /** UDP module phone. */
    149         int udp_phone;
    150 
    151 //      /** The last socket identifier.
    152 //       */
    153 //      int last_id;
     145        /** TCP module session. */
     146        async_sess_t *tcp_sess;
     147        /** UDP module session. */
     148        async_sess_t *udp_sess;
    154149
    155150        /** Active sockets. */
     
    164159        fibril_rwlock_t lock;
    165160} socket_globals = {
    166         .tcp_phone = -1,
    167         .udp_phone = -1,
    168 //      .last_id = 0,
     161        .tcp_sess = NULL,
     162        .udp_sess = NULL,
    169163        .sockets = NULL,
    170164        .lock = FIBRIL_RWLOCK_INITIALIZER(socket_globals.lock)
     
    280274}
    281275
    282 /** Returns the TCP module phone.
    283  *
    284  * Connects to the TCP module if necessary.
    285  *
    286  * @return              The TCP module phone.
    287  * @return              Other error codes as defined for the
    288  *                      bind_service() function.
    289  */
    290 static int socket_get_tcp_phone(void)
    291 {
    292         if (socket_globals.tcp_phone < 0) {
    293                 socket_globals.tcp_phone = bind_service(SERVICE_TCP,
     276/** Return the TCP module session.
     277 *
     278 * Connect to the TCP module if necessary.
     279 *
     280 * @return The TCP module session.
     281 *
     282 */
     283static async_sess_t *socket_get_tcp_sess(void)
     284{
     285        if (socket_globals.tcp_sess == NULL) {
     286                socket_globals.tcp_sess = bind_service(SERVICE_TCP,
    294287                    0, 0, SERVICE_TCP, socket_connection);
    295288        }
    296289
    297         return socket_globals.tcp_phone;
    298 }
    299 
    300 /** Returns the UDP module phone.
    301  *
    302  * Connects to the UDP module if necessary.
    303  *
    304  * @return              The UDP module phone.
    305  * @return              Other error codes as defined for the
    306  *                      bind_service() function.
    307  */
    308 static int socket_get_udp_phone(void)
    309 {
    310         if (socket_globals.udp_phone < 0) {
    311                 socket_globals.udp_phone = bind_service(SERVICE_UDP,
     290        return socket_globals.tcp_sess;
     291}
     292
     293/** Return the UDP module session.
     294 *
     295 * Connect to the UDP module if necessary.
     296 *
     297 * @return The UDP module session.
     298 *
     299 */
     300static async_sess_t *socket_get_udp_sess(void)
     301{
     302        if (socket_globals.udp_sess == NULL) {
     303                socket_globals.udp_sess = bind_service(SERVICE_UDP,
    312304                    0, 0, SERVICE_UDP, socket_connection);
    313305        }
    314306
    315         return socket_globals.udp_phone;
     307        return socket_globals.udp_sess;
    316308}
    317309
     
    329321        sockets = socket_get_sockets();
    330322        count = 0;
    331 //      socket_id = socket_globals.last_id;
    332323
    333324        do {
     
    342333                        if (socket_id < INT_MAX) {
    343334                                ++socket_id;
    344 /*                      } else if(socket_globals.last_id) {
    345  *                              socket_globals.last_id = 0;
    346  *                              socket_id = 1;
    347  */                     } else {
     335                        } else {
    348336                                return ELIMIT;
    349337                        }
    350338                }
    351339        } while (sockets_find(sockets, socket_id));
    352 
    353 //      last_id = socket_id
     340       
    354341        return socket_id;
    355342}
     
    358345 *
    359346 * @param[in,out] socket The socket to be initialized.
    360  * @param[in] socket_id The new socket identifier.
    361  * @param[in] phone     The parent module phone.
    362  * @param[in] service   The parent module service.
    363  */
    364 static void
    365 socket_initialize(socket_t *socket, int socket_id, int phone,
    366     services_t service)
     347 * @param[in] socket_id  The new socket identifier.
     348 * @param[in] sess       The parent module session.
     349 * @param[in] service    The parent module service.
     350 */
     351static void socket_initialize(socket_t *socket, int socket_id,
     352    async_sess_t *sess, services_t service)
    367353{
    368354        socket->socket_id = socket_id;
    369         socket->phone = phone;
     355        socket->sess = sess;
    370356        socket->service = service;
    371357        dyn_fifo_initialize(&socket->received, SOCKET_INITIAL_RECEIVED_SIZE);
     
    397383{
    398384        socket_t *socket;
    399         int phone;
     385        async_sess_t *sess;
    400386        int socket_id;
    401387        services_t service;
     
    414400                        switch (protocol) {
    415401                        case IPPROTO_TCP:
    416                                 phone = socket_get_tcp_phone();
     402                                sess = socket_get_tcp_sess();
    417403                                service = SERVICE_TCP;
    418404                                break;
     
    429415                        switch (protocol) {
    430416                        case IPPROTO_UDP:
    431                                 phone = socket_get_udp_phone();
     417                                sess = socket_get_udp_sess();
    432418                                service = SERVICE_UDP;
    433419                                break;
     
    450436        }
    451437
    452         if (phone < 0)
    453                 return phone;
     438        if (sess == NULL)
     439                return ENOENT;
    454440
    455441        /* Create a new socket structure */
     
    468454                return socket_id;
    469455        }
    470 
    471         rc = (int) async_obsolete_req_3_3(phone, NET_SOCKET, socket_id, 0, service, NULL,
     456       
     457        async_exch_t *exch = async_exchange_begin(sess);
     458        rc = (int) async_req_3_3(exch, NET_SOCKET, socket_id, 0, service, NULL,
    472459            &fragment_size, &header_size);
     460        async_exchange_end(exch);
     461       
    473462        if (rc != EOK) {
    474463                fibril_rwlock_write_unlock(&socket_globals.lock);
     
    481470
    482471        /* Finish the new socket initialization */
    483         socket_initialize(socket, socket_id, phone, service);
     472        socket_initialize(socket, socket_id, sess, service);
    484473        /* Store the new socket */
    485474        rc = sockets_add(socket_get_sockets(), socket_id, socket);
     
    490479                dyn_fifo_destroy(&socket->accepted);
    491480                free(socket);
    492                 async_obsolete_msg_3(phone, NET_SOCKET_CLOSE, (sysarg_t) socket_id, 0,
     481               
     482                exch = async_exchange_begin(sess);
     483                async_msg_3(exch, NET_SOCKET_CLOSE, (sysarg_t) socket_id, 0,
    493484                    service);
     485                async_exchange_end(exch);
     486               
    494487                return rc;
    495488        }
     
    535528
    536529        /* Request the message */
    537         message_id = async_obsolete_send_3(socket->phone, message,
     530        async_exch_t *exch = async_exchange_begin(socket->sess);
     531        message_id = async_send_3(exch, message,
    538532            (sysarg_t) socket->socket_id, arg2, socket->service, NULL);
    539533        /* Send the address */
    540         async_obsolete_data_write_start(socket->phone, data, datalength);
     534        async_data_write_start(exch, data, datalength);
     535        async_exchange_end(exch);
    541536
    542537        fibril_rwlock_read_unlock(&socket_globals.lock);
     
    595590
    596591        /* Request listen backlog change */
    597         result = (int) async_obsolete_req_3_0(socket->phone, NET_SOCKET_LISTEN,
     592        async_exch_t *exch = async_exchange_begin(socket->sess);
     593        result = (int) async_req_3_0(exch, NET_SOCKET_LISTEN,
    598594            (sysarg_t) socket->socket_id, (sysarg_t) backlog, socket->service);
     595        async_exchange_end(exch);
    599596
    600597        fibril_rwlock_read_unlock(&socket_globals.lock);
     
    666663                return socket_id;
    667664        }
    668         socket_initialize(new_socket, socket_id, socket->phone,
     665        socket_initialize(new_socket, socket_id, socket->sess,
    669666            socket->service);
    670667        result = sockets_add(socket_get_sockets(), new_socket->socket_id,
     
    678675
    679676        /* Request accept */
    680         message_id = async_obsolete_send_5(socket->phone, NET_SOCKET_ACCEPT,
     677        async_exch_t *exch = async_exchange_begin(socket->sess);
     678        message_id = async_send_5(exch, NET_SOCKET_ACCEPT,
    681679            (sysarg_t) socket->socket_id, 0, socket->service, 0,
    682680            new_socket->socket_id, &answer);
    683681
    684682        /* Read address */
    685         async_obsolete_data_read_start(socket->phone, cliaddr, *addrlen);
     683        async_data_read_start(exch, cliaddr, *addrlen);
     684        async_exchange_end(exch);
     685       
    686686        fibril_rwlock_write_unlock(&socket_globals.lock);
    687687        async_wait_for(message_id, &ipc_result);
     
    777777
    778778        /* Request close */
    779         rc = (int) async_obsolete_req_3_0(socket->phone, NET_SOCKET_CLOSE,
     779        async_exch_t *exch = async_exchange_begin(socket->sess);
     780        rc = (int) async_req_3_0(exch, NET_SOCKET_CLOSE,
    780781            (sysarg_t) socket->socket_id, 0, socket->service);
     782        async_exchange_end(exch);
     783       
    781784        if (rc != EOK) {
    782785                fibril_rwlock_write_unlock(&socket_globals.lock);
     
    850853
    851854        /* Request send */
    852         message_id = async_obsolete_send_5(socket->phone, message,
     855        async_exch_t *exch = async_exchange_begin(socket->sess);
     856       
     857        message_id = async_send_5(exch, message,
    853858            (sysarg_t) socket->socket_id,
    854859            (fragments == 1 ? datalength : socket->data_fragment_size),
     
    857862        /* Send the address if given */
    858863        if (!toaddr ||
    859             (async_obsolete_data_write_start(socket->phone, toaddr, addrlen) == EOK)) {
     864            (async_data_write_start(exch, toaddr, addrlen) == EOK)) {
    860865                if (fragments == 1) {
    861866                        /* Send all if only one fragment */
    862                         async_obsolete_data_write_start(socket->phone, data, datalength);
     867                        async_data_write_start(exch, data, datalength);
    863868                } else {
    864869                        /* Send the first fragment */
    865                         async_obsolete_data_write_start(socket->phone, data,
     870                        async_data_write_start(exch, data,
    866871                            socket->data_fragment_size - socket->header_size);
    867872                        data = ((const uint8_t *) data) +
     
    870875                        /* Send the middle fragments */
    871876                        while (--fragments > 1) {
    872                                 async_obsolete_data_write_start(socket->phone, data,
     877                                async_data_write_start(exch, data,
    873878                                    socket->data_fragment_size);
    874879                                data = ((const uint8_t *) data) +
     
    877882
    878883                        /* Send the last fragment */
    879                         async_obsolete_data_write_start(socket->phone, data,
     884                        async_data_write_start(exch, data,
    880885                            (datalength + socket->header_size) %
    881886                            socket->data_fragment_size);
    882887                }
    883888        }
     889       
     890        async_exchange_end(exch);
    884891
    885892        async_wait_for(message_id, &result);
     
    10231030                return 0;
    10241031        }
     1032       
     1033        async_exch_t *exch = async_exchange_begin(socket->sess);
    10251034
    10261035        /* Prepare lengths if more fragments */
     
    10351044
    10361045                /* Request packet data */
    1037                 message_id = async_obsolete_send_4(socket->phone, message,
     1046                message_id = async_send_4(exch, message,
    10381047                    (sysarg_t) socket->socket_id, 0, socket->service,
    10391048                    (sysarg_t) flags, &answer);
     
    10411050                /* Read the address if desired */
    10421051                if(!fromaddr ||
    1043                     (async_obsolete_data_read_start(socket->phone, fromaddr,
     1052                    (async_data_read_start(exch, fromaddr,
    10441053                    *addrlen) == EOK)) {
    10451054                        /* Read the fragment lengths */
    1046                         if (async_obsolete_data_read_start(socket->phone, lengths,
     1055                        if (async_data_read_start(exch, lengths,
    10471056                            sizeof(int) * (fragments + 1)) == EOK) {
    10481057                                if (lengths[fragments] <= datalength) {
     
    10511060                                        for (index = 0; index < fragments;
    10521061                                            ++index) {
    1053                                                 async_obsolete_data_read_start(
    1054                                                     socket->phone, data,
     1062                                                async_data_read_start(exch, data,
    10551063                                                    lengths[index]);
    10561064                                                data = ((uint8_t *) data) +
     
    10641072        } else { /* fragments == 1 */
    10651073                /* Request packet data */
    1066                 message_id = async_obsolete_send_4(socket->phone, message,
     1074                message_id = async_send_4(exch, message,
    10671075                    (sysarg_t) socket->socket_id, 0, socket->service,
    10681076                    (sysarg_t) flags, &answer);
     
    10701078                /* Read the address if desired */
    10711079                if (!fromaddr ||
    1072                     (async_obsolete_data_read_start(socket->phone, fromaddr,
    1073                         *addrlen) == EOK)) {
     1080                    (async_data_read_start(exch, fromaddr, *addrlen) == EOK)) {
    10741081                        /* Read all if only one fragment */
    1075                         async_obsolete_data_read_start(socket->phone, data, datalength);
     1082                        async_data_read_start(exch, data, datalength);
    10761083                }
    10771084        }
     1085       
     1086        async_exchange_end(exch);
    10781087
    10791088        async_wait_for(message_id, &ipc_result);
     
    11871196
    11881197        /* Request option value */
    1189         message_id = async_obsolete_send_3(socket->phone, NET_SOCKET_GETSOCKOPT,
     1198        async_exch_t *exch = async_exchange_begin(socket->sess);
     1199       
     1200        message_id = async_send_3(exch, NET_SOCKET_GETSOCKOPT,
    11901201            (sysarg_t) socket->socket_id, (sysarg_t) optname, socket->service,
    11911202            NULL);
    11921203
    11931204        /* Read the length */
    1194         if (async_obsolete_data_read_start(socket->phone, optlen,
     1205        if (async_data_read_start(exch, optlen,
    11951206            sizeof(*optlen)) == EOK) {
    11961207                /* Read the value */
    1197                 async_obsolete_data_read_start(socket->phone, value, *optlen);
    1198         }
     1208                async_data_read_start(exch, value, *optlen);
     1209        }
     1210       
     1211        async_exchange_end(exch);
    11991212
    12001213        fibril_rwlock_read_unlock(&socket_globals.lock);
  • uspace/lib/c/include/adt/measured_strings.h

    r55091847 r6b82009  
    4141
    4242#include <sys/types.h>
     43#include <async.h>
    4344
    4445/** Type definition of the character string with measured length.
     
    6465extern int measured_strings_receive(measured_string_t **, uint8_t **, size_t);
    6566extern int measured_strings_reply(const measured_string_t *, size_t);
    66 extern int measured_strings_return(int, measured_string_t **, uint8_t **, size_t);
    67 extern int measured_strings_send(int, const measured_string_t *, size_t);
     67
     68extern int measured_strings_return(async_exch_t *, measured_string_t **,
     69    uint8_t **, size_t);
     70extern int measured_strings_send(async_exch_t *, const measured_string_t *,
     71    size_t);
    6872
    6973#endif
  • uspace/lib/c/include/ipc/net.h

    r55091847 r6b82009  
    335335#define IPC_GET_ERROR(call)  ((services_t) IPC_GET_ARG4(call))
    336336
    337 /** Return the phone message argument.
    338  *
    339  * @param[in] call Message call structure.
    340  *
    341  */
    342 #define IPC_GET_PHONE(call)  ((int) IPC_GET_ARG5(call))
    343 
    344337/** Set the device identifier in the message answer.
    345338 *
  • uspace/lib/c/include/net/icmp_api.h

    r55091847 r6b82009  
    4242#include <sys/types.h>
    4343#include <sys/time.h>
    44 
    4544#include <adt/measured_strings.h>
    4645#include <net/ip_codes.h>
    4746#include <net/icmp_codes.h>
    4847#include <net/icmp_common.h>
     48#include <async.h>
    4949
    5050/** @name ICMP module application interface
     
    5353/*@{*/
    5454
    55 extern int icmp_echo_msg(int, size_t, mseconds_t, ip_ttl_t, ip_tos_t, int,
    56     const struct sockaddr *, socklen_t);
     55extern int icmp_echo_msg(async_sess_t *, size_t, mseconds_t, ip_ttl_t, ip_tos_t,
     56    int, const struct sockaddr *, socklen_t);
    5757
    5858/*@}*/
  • uspace/lib/c/include/net/icmp_common.h

    r55091847 r6b82009  
    4040#include <ipc/services.h>
    4141#include <sys/time.h>
     42#include <async.h>
    4243
    43 extern int icmp_connect_module(void);
     44extern async_sess_t *icmp_connect_module(void);
    4445
    4546#endif
  • uspace/lib/c/include/net/modules.h

    r55091847 r6b82009  
    4646#include <sys/time.h>
    4747
    48 /** Connect to the needed module function type definition.
     48/** Connect to module function type definition.
    4949 *
    50  * @param[in] need The needed module service.
    51  *
    52  * @return The phone of the needed service.
     50 * @return Session to the service.
    5351 *
    5452 */
    55 typedef int connect_module_t(services_t need);
     53typedef async_sess_t *connect_module_t(services_t);
    5654
    5755extern void answer_call(ipc_callid_t, int, ipc_call_t *, size_t);
    58 extern int bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
     56extern async_sess_t *bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
    5957    async_client_conn_t);
    60 extern int connect_to_service(services_t);
     58extern async_sess_t *connect_to_service(services_t);
    6159extern int data_reply(void *, size_t);
    6260extern void refresh_answer(ipc_call_t *, size_t *);
Note: See TracChangeset for help on using the changeset viewer.