Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3685 → Rev 3846

/branches/network/uspace/srv/net/modules.c
33,6 → 33,7
/** @file
*/
#include <async.h>
 
#include <ipc/ipc.h>
#include <ipc/services.h>
 
53,34 → 54,21
return phone;
}
 
int start_service( services_t me, services_t need[], int * need_phone[], void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall ), int ( * initialize_me )( void )){
ipcarg_t phonehash;
int bind_service( services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver ){
ERROR_DECLARE;
 
if( ! client_connection ) return EINVAL;
async_set_client_connection( client_connection );
ipcarg_t phone;
ipcarg_t phonehash;
 
if( need ){
if( ! need_phone ) return EINVAL;
while( * need ){
if( ! * need_phone ) return EINVAL;
 
/* Connect to the needed service */
** need_phone = connect_to_service( * need );
++ need;
++ need_phone;
phone = connect_to_service( need );
if( phone >= 0 ){
if( ERROR_OCCURED( ipc_connect_to_me( phone, arg1, arg2, arg3, & phonehash ))){
async_msg_0( phone, IPC_M_PHONE_HUNGUP );
return ERROR_CODE;
}
async_new_connection( phonehash, 0, NULL, client_receiver );
}
 
/* Initialize service by its callback */
if( initialize_me ) ERROR_PROPAGATE( initialize_me());
 
/* Register service at NS */
if( me ) ERROR_PROPAGATE( REGISTER_ME( me, & phonehash ));
 
async_manager();
 
return EOK;
return phone;
}
 
/** @}