--- libaitrpc/src/builtin.c 2012/05/17 07:53:03 1.7.2.6 +++ libaitrpc/src/builtin.c 2012/05/17 08:42:32 1.7.2.7 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: builtin.c,v 1.7.2.6 2012/05/17 07:53:03 misho Exp $ +* $Id: builtin.c,v 1.7.2.7 2012/05/17 08:42:32 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -49,7 +49,7 @@ SUCH DAMAGE. /* builtin RPC server functions */ static int -rpcServerClients(rpc_func_t *call, int ic, array_t *iv) +rpcServerClients(rpc_func_t *call, struct tagRPCCall *rpc, array_t *iv) { rpc_srv_t *srv; rpc_cli_t *cli; @@ -89,7 +89,7 @@ rpcServerClients(rpc_func_t *call, int ic, array_t *iv } static int -rpcServerCalls(rpc_func_t *call, int ic, array_t *iv) +rpcServerCalls(rpc_func_t *call, struct tagRPCCall *rpc, array_t *iv) { rpc_srv_t *srv; rpc_func_t *f; @@ -118,13 +118,13 @@ rpcServerCalls(rpc_func_t *call, int ic, array_t *iv) strlcat(val, str, len); } - AIT_SET_STR(io_array(RPC_FUNC_RETVARS(call), 0, ait_val_t*), val); + AIT_SET_STR(io_getVars(RPC_FUNC_RETVARS(call), 0), val); free(val); return 0; } static int -rpcServerSessions(rpc_func_t *call, int ic, array_t *iv) +rpcServerSessions(rpc_func_t *call, struct tagRPCCall *rpc, array_t *iv) { rpc_srv_t *srv; ait_val_t *v; @@ -145,7 +145,7 @@ rpcServerSessions(rpc_func_t *call, int ic, array_t *i } static int -rpcServerShutdown(rpc_func_t *call, int ic, array_t *iv) +rpcServerShutdown(rpc_func_t *call, struct tagRPCCall *rpc, array_t *iv) { rpc_srv_t *srv; @@ -158,19 +158,16 @@ rpcServerShutdown(rpc_func_t *call, int ic, array_t *i } static int -rpcServerPing(rpc_func_t *call, int ic, array_t *iv) +rpcServerPing(rpc_func_t *call, struct tagRPCCall *rpc, array_t *iv) { - rpc_srv_t *srv; - - srv = RPC_FUNC_SERVER(call); - + AIT_SET_U16(io_getVars(RPC_FUNC_RETVARS(call), 0), ntohs(rpc->call_seq)); return 0; } /* ---------------------------------------------------- */ static int -rpcBLOBServerShutdown(rpc_func_t *call, int ic, array_t *iv) +rpcBLOBServerShutdown(rpc_func_t *call, struct tagRPCCall *rpc, array_t *iv) { rpc_srv_t *srv; @@ -183,7 +180,7 @@ rpcBLOBServerShutdown(rpc_func_t *call, int ic, array_ } static int -rpcBLOBServerVars(rpc_func_t *call, int ic, array_t *iv) +rpcBLOBServerVars(rpc_func_t *call, struct tagRPCCall *rpc, array_t *iv) { rpc_srv_t *srv; rpc_blob_t *b; @@ -226,7 +223,7 @@ rpcBLOBServerVars(rpc_func_t *call, int ic, array_t *i } static int -rpcBLOBServerClients(rpc_func_t *call, int ic, array_t *iv) +rpcBLOBServerClients(rpc_func_t *call, struct tagRPCCall *rpc, array_t *iv) { rpc_srv_t *srv; rpc_cli_t *cli; @@ -271,6 +268,24 @@ rpcBLOBServerClients(rpc_func_t *call, int ic, array_t } /* ----------------------------------------------------------------- */ + +/* + * rpc_register_srvPing() - Register ping service function + * + * @srv = RPC server instance + * return: -1 error or 0 ok + */ +inline int +rpc_register_srvPing(rpc_srv_t * __restrict srv) +{ + if (!srv) + return -1; + + if (rpc_srv_registerCall(srv, CALL_SRVPING, rpcServerPing, 1) < 1) + return -1; + + return 0; +} /* * rpc_register_srvServices() - Register internal service functions