messagesx.c: initial;

v0.5.xx
Alexander Vdolainen 9 years ago
parent f142cd3f6f
commit f51d128ac2

@ -0,0 +1,19 @@
/*
* 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>
*
*/
#ifndef __SNTL_LIMITS_H__
#define __SNTL_LIMITS_H__
#define MAX_RPC_LIST 512
#endif /* __SNTL_LIMITS_H__ */

@ -223,6 +223,11 @@ int sxmsg_rreply_pp(sxmsg_t *msg, const char *data, size_t datalen);
int sxmsg_return(sxmsg_t *msg, int opcode);
int sxmsg_return_pp(sxmsg_t *msg, int opcode);
/* RPC List API */
#define SNTL_FILTER_INC 0xa
#define SNTL_FILTER_EXC 0xb
#define SNTL_FILTER_END -1
#endif /* __SNTL_SNTLLV2_H__ */

@ -14,7 +14,7 @@ lib_LTLIBRARIES = libsntllv2.la
libsntllv2_la_SOURCES = \
connex.c sntllv2.c chansx.c
connex.c sntllv2.c chansx.c messagesx.c rpclist.c
libsntllv2_la_LDFLAGS = -Wl,--export-dynamic

@ -5,4 +5,7 @@
uint8_t _channel_open(conn_t *co, uint16_t *chid);
uint8_t _channel_close(conn_t *co, uint16_t chid);
/* messages */
void _message_process(sxmsg_t *msg);
#endif /* __SNTLL_INTERNAL_H__ */

@ -0,0 +1,33 @@
/*
* 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)
{
return;
}

@ -10,29 +10,14 @@
#include <errno.h>
#include <string.h>
#include <pthread.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#ifdef WIN32
#include <Winsock2.h>
#else
#include <sys/select.h>
#include <netdb.h>
#include <unistd.h>
#include <uuid/uuid.h>
#endif
#include <fcntl.h>
#include <openssl/ssl.h>
#include <tdata/usrtc.h>
#include <sexpr/sexp.h>
#include <sntl/connection.h>
#include <sntl/sntllv2.h>
#include <sntl/limits.h>
static long __cmp_int(const void *a, const void *b)
{

@ -49,6 +49,28 @@ typedef struct __sntll_bundle_type {
conn_t *conn;
} sntllv2_bundle_t;
/* networking helpers */
#ifndef WIN32
int __resolvehost(const char *hostname, char *buf, int buf_len,
struct hostent **rhp)
{
struct hostent *hostbuf ;//= malloc(sizeof(struct hostent));
struct hostent *hp = *rhp = NULL;
int herr = 0, hres = 0;
hostbuf = malloc(sizeof(struct hostent));
if(!hostbuf) return NO_ADDRESS;
hres = gethostbyname_r(hostname, hostbuf,
buf, buf_len, &hp, &herr);
if(hres) return NO_ADDRESS;
*rhp = hp;
return NETDB_SUCCESS;
}
#endif
static int __conn_read(conn_t *co, void *buf, size_t buf_len)
{
int rfd = SSL_get_fd(co->ssl), r;
@ -527,7 +549,7 @@ static void *__sntll_thread(void *b)
pthread_mutex_unlock(&co->idx_ch_lock);
/* now we are able to process the message */
__message_process(msg);
_message_process(msg);
} else if(mhead->attr & SXMSG_CLOSED) {
/* check for the message */
if(mhead->msgid >= 1024) goto __inval_idx_nor;

Loading…
Cancel
Save