Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/net/modules.c

    r6b82009 rbf172825  
    4040
    4141#include <async.h>
     42#include <async_obsolete.h>
    4243#include <malloc.h>
    4344#include <errno.h>
     
    4647#include <net/modules.h>
    4748#include <ns.h>
     49#include <ns_obsolete.h>
     50
     51/** The time between connect requests in microseconds. */
     52#define MODULE_WAIT_TIME  (10 * 1000)
    4853
    4954/** Answer a call.
     
    9398}
    9499
    95 /** Create bidirectional connection with the needed module service and register
     100/** Create bidirectional connection with the needed module service and registers
    96101 * the message receiver.
    97102 *
    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 * @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.
    103108 *
    104  * @return Session to the needed service.
    105  * @return Other error codes as defined for the async_connect_to_me()
    106  *         function.
    107  *
     109 * @return              The phone of the needed service.
     110 * @return              Other error codes as defined for the ipc_connect_to_me()
     111 *                      function.
    108112 */
    109 async_sess_t *bind_service(services_t need, sysarg_t arg1, sysarg_t arg2,
    110     sysarg_t arg3, async_client_conn_t client_receiver)
     113int bind_service(services_t need, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
     114    async_client_conn_t client_receiver)
    111115{
    112116        /* Connect to the needed service */
    113         async_sess_t *sess = connect_to_service(need);
    114         if (sess != NULL) {
     117        int phone = connect_to_service(need);
     118        if (phone >= 0) {
    115119                /* Request the bidirectional connection */
    116                 async_exch_t *exch = async_exchange_begin(sess);
    117                 int rc = async_connect_to_me(exch, arg1, arg2, arg3,
     120                int rc = async_obsolete_connect_to_me(phone, arg1, arg2, arg3,
    118121                    client_receiver, NULL);
    119                 async_exchange_end(exch);
    120                
    121122                if (rc != EOK) {
    122                         async_hangup(sess);
    123                         errno = rc;
    124                         return NULL;
     123                        async_obsolete_hangup(phone);
     124                        return rc;
    125125                }
    126126        }
    127127       
    128         return sess;
     128        return phone;
    129129}
    130130
    131 /** Connect to the needed module.
     131/** Connects to the needed module.
    132132 *
    133  * @param[in] need Needed module service.
    134  *
    135  * @return Session to the needed service.
    136  * @return NULL if the connection timeouted.
    137  *
     133 * @param[in] need      The needed module service.
     134 * @return              The phone of the needed service.
    138135 */
    139 async_sess_t *connect_to_service(services_t need)
     136int connect_to_service(services_t need)
    140137{
    141         return service_connect_blocking(EXCHANGE_SERIALIZE, need, 0, 0);
     138        return service_obsolete_connect_blocking(need, 0, 0);
    142139}
    143140
    144 /** Reply the data to the other party.
     141/** Replies the data to the other party.
    145142 *
    146  * @param[in] data        The data buffer to be sent.
     143 * @param[in] data      The data buffer to be sent.
    147144 * @param[in] data_length The buffer length.
    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  *
     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.
    156151 */
    157152int data_reply(void *data, size_t data_length)
     
    159154        size_t length;
    160155        ipc_callid_t callid;
    161        
     156
    162157        /* Fetch the request */
    163158        if (!async_data_read_receive(&callid, &length))
    164159                return EINVAL;
    165        
     160
    166161        /* Check the requested data size */
    167162        if (length < data_length) {
     
    169164                return EOVERFLOW;
    170165        }
    171        
     166
    172167        /* Send the data */
    173168        return async_data_read_finalize(callid, data, data_length);
Note: See TracChangeset for help on using the changeset viewer.