/* * 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 * */ #include #include #include #include #include #include #include #include #include #include #include #include #include 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; }