36,15 → 36,14 |
#include <async.h> |
#include <stdio.h> |
#include <task.h> |
|
#include <ipc/ipc.h> |
|
#include "err.h" |
#include "modules.h" |
|
extern int module_call( ipc_callid_t callid ); |
extern int module_message( ipc_callid_t callid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t * result1, ipcarg_t * result2, ipcarg_t * result3 ); |
extern int module_message( ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count ); |
extern void module_print_name( void ); |
extern int module_start( void ( * client_connection )( ipc_callid_t iid, ipc_call_t * icall )); |
extern int module_start( async_client_conn_t client_connection ); |
|
void client_connection( ipc_callid_t iid, ipc_call_t * icall ); |
int main( int argc, char * argv[] ); |
54,22 → 53,45 |
void client_connection( ipc_callid_t iid, ipc_call_t * icall ){ |
ipc_callid_t callid; |
ipc_call_t call; |
ipcarg_t arg1, arg2, arg3; |
ipc_call_t answer; |
int count; |
int res; |
|
/* Accept the connection */ |
/* |
* Accept the connection |
* - Answer the first IPC_M_CONNECT_ME_TO call. |
*/ |
ipc_answer_0( iid, EOK ); |
|
while( true ){ |
// refresh data |
count = 0; |
IPC_SET_RETVAL( answer, 0 ); |
// just to be precize |
IPC_SET_RETVAL( answer, 0 ); |
IPC_SET_ARG1( answer, 0 ); |
IPC_SET_ARG2( answer, 0 ); |
IPC_SET_ARG3( answer, 0 ); |
IPC_SET_ARG4( answer, 0 ); |
IPC_SET_ARG5( answer, 0 ); |
|
callid = async_get_call( & call ); |
arg1 = 0; |
arg2 = 0; |
arg3 = 0; |
res = module_call( callid ); |
if( res == EOK ){ |
res = module_message( callid, IPC_GET_METHOD( call ), IPC_GET_ARG1( call ), IPC_GET_ARG2( call ), IPC_GET_ARG3( call ), & arg1, & arg2, & arg3 ); |
res = module_message( callid, & call, & answer, & count ); |
|
switch( count ){ |
case 0: ipc_answer_0( callid, res ); |
continue; |
case 1: ipc_answer_1( callid, res, IPC_GET_ARG1( answer )); |
continue; |
case 2: ipc_answer_2( callid, res, IPC_GET_ARG1( answer ), IPC_GET_ARG2( answer )); |
continue; |
case 3: ipc_answer_3( callid, res, IPC_GET_ARG1( answer ), IPC_GET_ARG2( answer ), IPC_GET_ARG3( answer )); |
continue; |
case 4: ipc_answer_4( callid, res, IPC_GET_ARG1( answer ), IPC_GET_ARG2( answer ), IPC_GET_ARG3( answer ), IPC_GET_ARG4( answer )); |
continue; |
default: ipc_answer_5( callid, res, IPC_GET_ARG1( answer ), IPC_GET_ARG2( answer ), IPC_GET_ARG3( answer ), IPC_GET_ARG4( answer ), IPC_GET_ARG5( answer )); |
continue; |
} |
ipc_answer_2( callid, res, arg1, arg2 ); |
} |
} |
|