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.
libsxmp/lib/messagesx.c

114 lines
2.5 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;
}
9 years ago
int sxmsg_send(chnl_t *channel, const char *data, size_t datalen, sxmsg_t **msg)
{
return SNE_FAILED;
}
/* the same - postponed message i.e. will be written to the queue - not to write immendatly */
int sxmsg_send_pp(chnl_t *channel, const char *data, size_t datalen, sxmsg_t **msg)
{
return SNE_FAILED;
}
/* send a pulse message */
int sxmsg_pulse(conn_t *co, const char *data, size_t datalen)
{
return SNE_FAILED;
}
/* the same but will be postponed */
int sxmsg_pulse_pp(conn_t *co, const char *data, size_t datalen)
{
return SNE_FAILED;
}
int sxmsg_reply(sxmsg_t *msg, const char *data, size_t datalen)
{
return SNE_FAILED;
}
int sxmsg_reply_pp(sxmsg_t *msg, const char *data, size_t datalen)
{
return SNE_FAILED;
}
int sxmsg_rreply(sxmsg_t *msg, const char *data, size_t datalen)
{
return SNE_FAILED;
}
int sxmsg_rreply_pp(sxmsg_t *msg, const char *data, size_t datalen)
{
return SNE_FAILED;
}
int sxmsg_return(sxmsg_t *msg, int opcode)
{
return SNE_FAILED;
}
int sxmsg_return_pp(sxmsg_t *msg, int opcode)
{
return SNE_FAILED;
}