--- libaitrpc/src/lists.c 2013/01/17 16:33:57 1.12.6.1 +++ libaitrpc/src/lists.c 2015/07/02 22:20:48 1.17.4.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: lists.c,v 1.12.6.1 2013/01/17 16:33:57 misho Exp $ +* $Id: lists.c,v 1.17.4.1 2015/07/02 22:20:48 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 +Copyright 2004 - 2015 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -46,6 +46,29 @@ SUCH DAMAGE. #include "global.h" +#pragma GCC visibility push(hidden) + +static int +rpc_funcs_cmp(struct tagRPCFunc *a, struct tagRPCFunc *b) +{ + int ret; + + assert(a && b); + + ret = AIT_KEY(&a->func_name) - AIT_KEY(&b->func_name); + + if (ret < 0) + return -1; + else if (ret > 0) + return 1; + + return ret; +} + +AVL_GENERATE(tagRPCFuncs, tagRPCFunc, func_node, rpc_funcs_cmp); + +#pragma GCC visibility pop + /* * rpc_srv_registerCall() - Register call to RPC server * @@ -127,7 +150,7 @@ rpc_srv_unregisterCall(rpc_srv_t * __restrict srv, u_s * @tag = tag for function * return: NULL not found call, !=NULL return call */ -inline rpc_func_t * +rpc_func_t * rpc_srv_getCall(rpc_srv_t * __restrict srv, uint16_t tag) { rpc_func_t tmp; @@ -151,7 +174,7 @@ rpc_srv_getCall(rpc_srv_t * __restrict srv, uint16_t t * @var = hash for variable * return: NULL not found, !=NULL return blob var */ -inline rpc_blob_t * +rpc_blob_t * rpc_srv_getBLOB(rpc_srv_t * __restrict srv, uint32_t var) { rpc_blob_t *b, *tmp; @@ -173,10 +196,11 @@ rpc_srv_getBLOB(rpc_srv_t * __restrict srv, uint32_t v * * @srv = RPC Server instance * @len = BLOB length + * @tout = BLOB live timeout in seconds * return: NULL error or new registered BLOB */ rpc_blob_t * -rpc_srv_registerBLOB(rpc_srv_t * __restrict srv, size_t len) +rpc_srv_registerBLOB(rpc_srv_t * __restrict srv, size_t len, int tout) { rpc_blob_t *blob = NULL; @@ -185,9 +209,10 @@ rpc_srv_registerBLOB(rpc_srv_t * __restrict srv, size_ return blob; } - blob = rpc_srv_blobCreate(srv, len); + blob = rpc_srv_blobCreate(srv, len, tout); TAILQ_INSERT_TAIL(&srv->srv_blob.blobs, blob, blob_node); + return blob; }