version 1.15.22.1, 2014/01/28 14:04:57
|
version 1.19, 2025/03/31 12:21:07
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004 - 2014 | Copyright 2004 - 2025 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 46 SUCH DAMAGE.
|
Line 46 SUCH DAMAGE.
|
#include "global.h" |
#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; |
|
} |
|
|
|
RB_GENERATE(tagRPCFuncs, tagRPCFunc, func_node, rpc_funcs_cmp); |
|
|
|
#pragma GCC visibility pop |
|
|
/* |
/* |
* rpc_srv_registerCall() - Register call to RPC server |
* rpc_srv_registerCall() - Register call to RPC server |
* |
* |
Line 73 rpc_srv_registerCall(rpc_srv_t * __restrict srv, u_sho
|
Line 96 rpc_srv_registerCall(rpc_srv_t * __restrict srv, u_sho
|
} |
} |
|
|
/* search for duplicate */ |
/* search for duplicate */ |
if (AVL_FIND(tagRPCFuncs, &srv->srv_funcs, func)) { | if (RB_FIND(tagRPCFuncs, &srv->srv_funcs, func)) { |
e_free(func); |
e_free(func); |
return 0; |
return 0; |
} |
} |
Line 84 rpc_srv_registerCall(rpc_srv_t * __restrict srv, u_sho
|
Line 107 rpc_srv_registerCall(rpc_srv_t * __restrict srv, u_sho
|
/* add to list of functions */ |
/* add to list of functions */ |
RPC_FUNCS_LOCK(&srv->srv_funcs); |
RPC_FUNCS_LOCK(&srv->srv_funcs); |
SLIST_INSERT_HEAD(&srv->srv_funcs, func, func_next); |
SLIST_INSERT_HEAD(&srv->srv_funcs, func, func_next); |
AVL_INSERT(tagRPCFuncs, &srv->srv_funcs, func); | RB_INSERT(tagRPCFuncs, &srv->srv_funcs, func); |
RPC_FUNCS_UNLOCK(&srv->srv_funcs); |
RPC_FUNCS_UNLOCK(&srv->srv_funcs); |
return 1; |
return 1; |
} |
} |
Line 111 rpc_srv_unregisterCall(rpc_srv_t * __restrict srv, u_s
|
Line 134 rpc_srv_unregisterCall(rpc_srv_t * __restrict srv, u_s
|
return 0; |
return 0; |
|
|
RPC_FUNCS_LOCK(&srv->srv_funcs); |
RPC_FUNCS_LOCK(&srv->srv_funcs); |
AVL_REMOVE(tagRPCFuncs, &srv->srv_funcs, f); | RB_REMOVE(tagRPCFuncs, &srv->srv_funcs, f); |
SLIST_REMOVE(&srv->srv_funcs, f, tagRPCFunc, func_next); |
SLIST_REMOVE(&srv->srv_funcs, f, tagRPCFunc, func_next); |
RPC_FUNCS_UNLOCK(&srv->srv_funcs); |
RPC_FUNCS_UNLOCK(&srv->srv_funcs); |
|
|
Line 139 rpc_srv_getCall(rpc_srv_t * __restrict srv, uint16_t t
|
Line 162 rpc_srv_getCall(rpc_srv_t * __restrict srv, uint16_t t
|
memset(&tmp, 0, sizeof tmp); |
memset(&tmp, 0, sizeof tmp); |
|
|
AIT_KEY(&tmp.func_name) = tag; |
AIT_KEY(&tmp.func_name) = tag; |
return AVL_FIND(tagRPCFuncs, &srv->srv_funcs, &tmp); | return RB_FIND(tagRPCFuncs, &srv->srv_funcs, &tmp); |
} |
} |
|
|
/* --------------------------------------------------------- */ |
/* --------------------------------------------------------- */ |