You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.4 KiB
C
60 lines
1.4 KiB
C
/*
|
|
* Secure Network Transport Layer Library v2 implementation.
|
|
* (sntllv2) it superseed all versions before due to the:
|
|
* - memory consumption
|
|
* - new features such as pulse emitting
|
|
* - performance optimization
|
|
*
|
|
* This is a proprietary software. See COPYING for further details.
|
|
*
|
|
* (c) Askele Group 2013-2015 <http://askele.com>
|
|
*
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <pthread.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/time.h>
|
|
#include <sys/types.h>
|
|
#include <fcntl.h>
|
|
|
|
#include <tdata/usrtc.h>
|
|
#include <tdata/list.h>
|
|
#include <sexpr/sexp.h>
|
|
|
|
#include <sntl/sntllv2.h>
|
|
|
|
void _message_process(sxmsg_t *msg)
|
|
{
|
|
chnl_t *chan = msg->pch;
|
|
sexp_t *sx, *isx;
|
|
usrtc_t *listrpc = chan->rpc_list->rpc_tree;
|
|
usrtc_node_t *node;
|
|
cx_rpc_t *rpcc;
|
|
int r;
|
|
|
|
sx = parse_sexp(msg->payload, msg->mhead.payload_length);
|
|
if(!sx) sxmsg_return(msg, SNE_BADPROTO);
|
|
|
|
sexp_list_car(sx, &isx);
|
|
if(!isx) { r = SNE_BADPROTO; goto __return_err; }
|
|
if(isx->ty == SEXP_LIST) { r = SNE_BADPROTO; goto __return_err; }
|
|
if(isx->aty != SEXP_BASIC) { r = SNE_BADPROTO; goto __return_err; }
|
|
|
|
node = usrtc_lookup(listrpc, (void *)isx->val);
|
|
if(!node) { r = SNE_ENORPC; goto __return_err; }
|
|
else rpcc = (cx_rpc_t *)usrtc_node_getdata(node);
|
|
|
|
rpcc->rpcf((void *)msg, sx); /* sx *MUST* be destroy asap */
|
|
|
|
return;
|
|
|
|
__return_err:
|
|
destroy_sexp(sx);
|
|
sxmsg_return(msg, r);
|
|
return;
|
|
}
|