Ignore:
File:
1 edited

Legend:

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

    r32fef47 r6b82009  
    9191                }
    9292        }
    93 }
    94 
    95 /** Connect to the needed module.
    96  *
    97  * @param[in] need Needed module service.
    98  *
    99  * @return Session to the needed service.
    100  * @return NULL if the connection timeouted.
    101  *
    102  */
    103 static async_sess_t *connect_to_service(services_t need)
    104 {
    105         return service_connect_blocking(EXCHANGE_SERIALIZE, need, 0, 0);
    10693}
    10794
     
    142129}
    143130
     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.
     147 * @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 *
     156 */
     157int data_reply(void *data, size_t data_length)
     158{
     159        size_t length;
     160        ipc_callid_t callid;
     161       
     162        /* Fetch the request */
     163        if (!async_data_read_receive(&callid, &length))
     164                return EINVAL;
     165       
     166        /* Check the requested data size */
     167        if (length < data_length) {
     168                async_data_read_finalize(callid, data, length);
     169                return EOVERFLOW;
     170        }
     171       
     172        /* Send the data */
     173        return async_data_read_finalize(callid, data, data_length);
     174}
     175
    144176/** Refresh answer structure and argument count.
    145177 *
Note: See TracChangeset for help on using the changeset viewer.