mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-09 09:17:34 +00:00
update
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@15 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
22433a9970
commit
f57307bf91
@ -42,6 +42,9 @@ $(MYLIB): $(OBJS)
|
|||||||
ar rcs $(MYLIB) $(OBJS)
|
ar rcs $(MYLIB) $(OBJS)
|
||||||
ranlib $(MYLIB)
|
ranlib $(MYLIB)
|
||||||
|
|
||||||
|
testapp: testapp.c $(MYLIB)
|
||||||
|
$(CC) -L. -Iinclude testapp.c -o testapp -lopenzap -lm
|
||||||
|
|
||||||
openzap.o: openzap.c
|
openzap.o: openzap.c
|
||||||
$(CC) $(MOD_CFLAGS) $(CC_CFLAGS) $(CFLAGS) -c $< -o $@
|
$(CC) $(MOD_CFLAGS) $(CC_CFLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@ static const unsigned int primes[] = {
|
|||||||
805306457, 1610612741
|
805306457, 1610612741
|
||||||
};
|
};
|
||||||
const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]);
|
const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]);
|
||||||
const float max_load_factor = 0.65f;
|
const float max_load_factor = 0.65;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
struct hashtable *
|
struct hashtable *
|
||||||
create_hashtable(unsigned int minsize,
|
create_hashtable(unsigned int minsize,
|
||||||
unsigned int (*hashf) (const void*),
|
unsigned int (*hashf) (void*),
|
||||||
int (*eqf) (const void*,const void*))
|
int (*eqf) (void*,void*))
|
||||||
{
|
{
|
||||||
struct hashtable *h;
|
struct hashtable *h;
|
||||||
unsigned int pindex, size = primes[0];
|
unsigned int pindex, size = primes[0];
|
||||||
@ -54,7 +54,7 @@ create_hashtable(unsigned int minsize,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
unsigned int
|
unsigned int
|
||||||
hash(struct hashtable *h, const void *k)
|
hash(struct hashtable *h, void *k)
|
||||||
{
|
{
|
||||||
/* Aim to protect against poor hash functions by adding logic here
|
/* Aim to protect against poor hash functions by adding logic here
|
||||||
* - logic taken from java 1.4 hashtable source */
|
* - logic taken from java 1.4 hashtable source */
|
||||||
@ -160,7 +160,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v)
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void * /* returns value associated with key */
|
void * /* returns value associated with key */
|
||||||
hashtable_search(struct hashtable *h, const void *k)
|
hashtable_search(struct hashtable *h, void *k)
|
||||||
{
|
{
|
||||||
struct entry *e;
|
struct entry *e;
|
||||||
unsigned int hashvalue, index;
|
unsigned int hashvalue, index;
|
||||||
|
@ -34,6 +34,18 @@ hashtable_iterator(struct hashtable *h)
|
|||||||
return itr;
|
return itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* key - return the key of the (key,value) pair at the current position */
|
||||||
|
/* value - return the value of the (key,value) pair at the current position */
|
||||||
|
|
||||||
|
void *
|
||||||
|
hashtable_iterator_key(struct hashtable_itr *i)
|
||||||
|
{ return i->e->k; }
|
||||||
|
|
||||||
|
void *
|
||||||
|
hashtable_iterator_value(struct hashtable_itr *i)
|
||||||
|
{ return i->e->v; }
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* advance - advance the iterator to the next element
|
/* advance - advance the iterator to the next element
|
||||||
* returns zero if advanced to end of table */
|
* returns zero if advanced to end of table */
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
#ifndef __HASHTABLE_CWC22_H__
|
#ifndef __HASHTABLE_CWC22_H__
|
||||||
#define __HASHTABLE_CWC22_H__
|
#define __HASHTABLE_CWC22_H__
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#ifndef __inline__
|
||||||
|
#define __inline__ __inline
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
struct hashtable;
|
struct hashtable;
|
||||||
|
|
||||||
@ -73,8 +78,8 @@ struct hashtable;
|
|||||||
|
|
||||||
struct hashtable *
|
struct hashtable *
|
||||||
create_hashtable(unsigned int minsize,
|
create_hashtable(unsigned int minsize,
|
||||||
unsigned int (*hashfunction) (const void*),
|
unsigned int (*hashfunction) (void*),
|
||||||
int (*key_eq_fn) (const void*,const void*));
|
int (*key_eq_fn) (void*,void*));
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* hashtable_insert
|
* hashtable_insert
|
||||||
@ -114,7 +119,7 @@ int fnname (struct hashtable *h, keytype *k, valuetype *v) \
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void *
|
void *
|
||||||
hashtable_search(struct hashtable *h, const void *k);
|
hashtable_search(struct hashtable *h, void *k);
|
||||||
|
|
||||||
#define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \
|
#define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \
|
||||||
valuetype * fnname (struct hashtable *h, keytype *k) \
|
valuetype * fnname (struct hashtable *h, keytype *k) \
|
||||||
|
@ -28,12 +28,20 @@ hashtable_iterator(struct hashtable *h);
|
|||||||
/* hashtable_iterator_key
|
/* hashtable_iterator_key
|
||||||
* - return the value of the (key,value) pair at the current position */
|
* - return the value of the (key,value) pair at the current position */
|
||||||
|
|
||||||
#define hashtable_iterator_key(i) (void *)i->e->k
|
extern __inline__ void *
|
||||||
|
hashtable_iterator_key(struct hashtable_itr *i)
|
||||||
|
{
|
||||||
|
return i->e->k;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* value - return the value of the (key,value) pair at the current position */
|
/* value - return the value of the (key,value) pair at the current position */
|
||||||
|
|
||||||
#define hashtable_iterator_value (void *)i->e->v
|
extern __inline__ void *
|
||||||
|
hashtable_iterator_value(struct hashtable_itr *i)
|
||||||
|
{
|
||||||
|
return i->e->v;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* advance - advance the iterator to the next element
|
/* advance - advance the iterator to the next element
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "hashtable.h"
|
#include "hashtable.h"
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
struct entry
|
struct entry
|
||||||
{
|
{
|
||||||
@ -19,17 +20,20 @@ struct hashtable {
|
|||||||
unsigned int entrycount;
|
unsigned int entrycount;
|
||||||
unsigned int loadlimit;
|
unsigned int loadlimit;
|
||||||
unsigned int primeindex;
|
unsigned int primeindex;
|
||||||
unsigned int (*hashfn) (const void *k);
|
unsigned int (*hashfn) (void *k);
|
||||||
int (*eqfn) (const void *k1, const void *k2);
|
int (*eqfn) (void *k1, void *k2);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
unsigned int
|
unsigned int
|
||||||
hash(struct hashtable *h, const void *k);
|
hash(struct hashtable *h, void *k);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* indexFor */
|
/* indexFor */
|
||||||
#define indexFor(hashvalue, tablelength) (unsigned int)(hashvalue % tablelength)
|
static __inline__ unsigned int
|
||||||
|
indexFor(unsigned int tablelength, unsigned int hashvalue) {
|
||||||
|
return (hashvalue % tablelength);
|
||||||
|
}
|
||||||
|
|
||||||
/* Only works if tablelength == 2^N */
|
/* Only works if tablelength == 2^N */
|
||||||
/*static inline unsigned int
|
/*static inline unsigned int
|
||||||
|
@ -209,18 +209,27 @@ typedef zap_status_t (*zint_write_t) ZINT_WRITE_ARGS ;
|
|||||||
#define ZINT_WRITE_MUZZLE assert(zchan != NULL); assert(data != NULL); assert(datalen != NULL)
|
#define ZINT_WRITE_MUZZLE assert(zchan != NULL); assert(data != NULL); assert(datalen != NULL)
|
||||||
|
|
||||||
#define ZAP_PRE __FILE__, __FUNCTION__, __LINE__
|
#define ZAP_PRE __FILE__, __FUNCTION__, __LINE__
|
||||||
#define ZAP_LOG_DEBUG ZAP_PRE, 7
|
|
||||||
#define ZAP_LOG_INFO ZAP_PRE, 6
|
#define ZAP_LOG_LEVEL_DEBUG 7
|
||||||
#define ZAP_LOG_NOTICE ZAP_PRE, 5
|
#define ZAP_LOG_LEVEL_INFO 6
|
||||||
#define ZAP_LOG_WARNING ZAP_PRE, 4
|
#define ZAP_LOG_LEVEL_NOTICE 5
|
||||||
#define ZAP_LOG_ERROR ZAP_PRE, 3
|
#define ZAP_LOG_LEVEL_WARNING 4
|
||||||
#define ZAP_LOG_CRIT ZAP_PRE, 2
|
#define ZAP_LOG_LEVEL_ERROR 3
|
||||||
#define ZAP_LOG_ALERT ZAP_PRE, 1
|
#define ZAP_LOG_LEVEL_CRIT 2
|
||||||
#define ZAP_LOG_EMERG ZAP_PRE, 0
|
#define ZAP_LOG_LEVEL_ALERT 1
|
||||||
|
#define ZAP_LOG_LEVEL_EMERG 0
|
||||||
|
|
||||||
|
#define ZAP_LOG_DEBUG ZAP_PRE, ZAP_LOG_LEVEL_DEBUG
|
||||||
|
#define ZAP_LOG_INFO ZAP_PRE, ZAP_LOG_LEVEL_INFO
|
||||||
|
#define ZAP_LOG_NOTICE ZAP_PRE, ZAP_LOG_LEVEL_NOTICE
|
||||||
|
#define ZAP_LOG_WARNING ZAP_PRE, ZAP_LOG_LEVEL_WARNING
|
||||||
|
#define ZAP_LOG_ERROR ZAP_PRE, ZAP_LOG_LEVEL_ERROR
|
||||||
|
#define ZAP_LOG_CRIT ZAP_PRE, ZAP_LOG_LEVEL_CRIT
|
||||||
|
#define ZAP_LOG_ALERT ZAP_PRE, ZAP_LOG_LEVEL_ALERT
|
||||||
|
#define ZAP_LOG_EMERG ZAP_PRE, ZAP_LOG_LEVEL_EMERG
|
||||||
|
|
||||||
typedef void (*zap_logger_t)(char *file, const char *func, int line, int level, char *fmt, ...);
|
typedef void (*zap_logger_t)(char *file, const char *func, int line, int level, char *fmt, ...);
|
||||||
extern zap_logger_t global_logger;
|
extern zap_logger_t zap_log;
|
||||||
#define zap_log global_logger;
|
|
||||||
|
|
||||||
struct zap_software_interface {
|
struct zap_software_interface {
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -252,7 +261,7 @@ zap_status_t zap_channel_write(zap_channel_t *zchan, void *data, zap_size_t *dat
|
|||||||
zap_status_t zap_global_init(void);
|
zap_status_t zap_global_init(void);
|
||||||
zap_status_t zap_global_destroy(void);
|
zap_status_t zap_global_destroy(void);
|
||||||
void zap_global_set_logger(zap_logger_t logger);
|
void zap_global_set_logger(zap_logger_t logger);
|
||||||
void zap_global_set_default_logger(void);
|
void zap_global_set_default_logger(int level);
|
||||||
|
|
||||||
typedef struct hashtable zap_hash_t;
|
typedef struct hashtable zap_hash_t;
|
||||||
|
|
||||||
|
@ -74,28 +74,32 @@ static char *cut_path(char *in)
|
|||||||
|
|
||||||
static void null_logger(char *file, const char *func, int line, int level, char *fmt, ...)
|
static void null_logger(char *file, const char *func, int line, int level, char *fmt, ...)
|
||||||
{
|
{
|
||||||
if (file && func && line && level && fmt) {
|
if (0) {
|
||||||
return;
|
null_logger(file, func, line, level, fmt, fmt + sizeof(fmt));
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int zap_log_level;
|
||||||
|
|
||||||
static void default_logger(char *file, const char *func, int line, int level, char *fmt, ...)
|
static void default_logger(char *file, const char *func, int line, int level, char *fmt, ...)
|
||||||
{
|
{
|
||||||
char *fp;
|
char *fp;
|
||||||
char data[1024];
|
char data[1024];
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
if (level < 0 || level > 7) {
|
||||||
|
level = 7;
|
||||||
|
}
|
||||||
|
if (level > zap_log_level) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fp = cut_path(file);
|
fp = cut_path(file);
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
vsnprintf(data, sizeof(data), fmt, ap);
|
vsnprintf(data, sizeof(data), fmt, ap);
|
||||||
|
|
||||||
if (level < 0 || level > 7) {
|
|
||||||
level = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "[%s] %s:%d %s() %s", LEVEL_NAMES[level], file, line, func, data);
|
fprintf(stderr, "[%s] %s:%d %s() %s", LEVEL_NAMES[level], file, line, func, data);
|
||||||
|
|
||||||
@ -103,28 +107,33 @@ static void default_logger(char *file, const char *func, int line, int level, ch
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zap_logger_t global_logger = null_logger;
|
zap_logger_t zap_log = null_logger;
|
||||||
|
|
||||||
void zap_global_set_logger(zap_logger_t logger)
|
void zap_global_set_logger(zap_logger_t logger)
|
||||||
{
|
{
|
||||||
if (logger) {
|
if (logger) {
|
||||||
global_logger = logger;
|
zap_log = logger;
|
||||||
} else {
|
} else {
|
||||||
global_logger = null_logger;
|
zap_log = null_logger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void zap_global_set_default_logger(void)
|
void zap_global_set_default_logger(int level)
|
||||||
{
|
{
|
||||||
global_logger = default_logger;
|
if (level < 0 || level > 7) {
|
||||||
|
level = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int equalkeys(const void *k1, const void *k2)
|
zap_log = default_logger;
|
||||||
|
zap_log_level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int equalkeys(void *k1, void *k2)
|
||||||
{
|
{
|
||||||
return strcmp((char *) k1, (char *) k2) ? 0 : 1;
|
return strcmp((char *) k1, (char *) k2) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned hashfromstring(const void *ky)
|
static unsigned hashfromstring(void *ky)
|
||||||
{
|
{
|
||||||
unsigned char *str = (unsigned char *) ky;
|
unsigned char *str = (unsigned char *) ky;
|
||||||
unsigned hash = 0;
|
unsigned hash = 0;
|
||||||
@ -176,7 +185,7 @@ zap_status_t zap_span_destroy(zap_span_t **span);
|
|||||||
|
|
||||||
zap_status_t zap_channel_open(const char *name, unsigned span_id, unsigned chan_id, zap_channel_t **zchan)
|
zap_status_t zap_channel_open(const char *name, unsigned span_id, unsigned chan_id, zap_channel_t **zchan)
|
||||||
{
|
{
|
||||||
zap_software_interface_t *zint = (zap_software_interface_t *) hashtable_search(globals.interface_hash, name);
|
zap_software_interface_t *zint = (zap_software_interface_t *) hashtable_search(globals.interface_hash, (char *)name);
|
||||||
|
|
||||||
if (span_id < ZAP_MAX_SPANS_INTERFACE && chan_id < ZAP_MAX_CHANNELS_SPAN && zint) {
|
if (span_id < ZAP_MAX_SPANS_INTERFACE && chan_id < ZAP_MAX_CHANNELS_SPAN && zint) {
|
||||||
zap_channel_t *check;
|
zap_channel_t *check;
|
||||||
@ -303,22 +312,34 @@ zap_status_t zap_global_init(void)
|
|||||||
char *var, *val;
|
char *var, *val;
|
||||||
unsigned configured = 0;
|
unsigned configured = 0;
|
||||||
zap_software_interface_t *zint;
|
zap_software_interface_t *zint;
|
||||||
|
int modcount;
|
||||||
|
|
||||||
globals.interface_hash = create_hashtable(16, hashfromstring, equalkeys);
|
globals.interface_hash = create_hashtable(16, hashfromstring, equalkeys);
|
||||||
zint = NULL;
|
zint = NULL;
|
||||||
|
modcount = 0;
|
||||||
|
|
||||||
#ifdef ZAP_WANPIPE_SUPPORT
|
#ifdef ZAP_WANPIPE_SUPPORT
|
||||||
if (wanpipe_init(&zint) == ZAP_SUCCESS) {
|
if (wanpipe_init(&zint) == ZAP_SUCCESS) {
|
||||||
hashtable_insert(globals.interface_hash, (void *)zint->name, zint);
|
hashtable_insert(globals.interface_hash, (void *)zint->name, zint);
|
||||||
|
modcount++;
|
||||||
|
} else {
|
||||||
|
zap_log(ZAP_LOG_ERROR, "Error initilizing wanpipe.\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
zint = NULL;
|
zint = NULL;
|
||||||
#ifdef ZAP_ZT_SUPPORT
|
#ifdef ZAP_ZT_SUPPORT
|
||||||
if (zt_init(&zint) == ZAP_SUCCESS) {
|
if (zt_init(&zint) == ZAP_SUCCESS) {
|
||||||
hashtable_insert(globals.interface_hash, (void *)zint->name, zint);
|
hashtable_insert(globals.interface_hash, (void *)zint->name, zint);
|
||||||
|
modcount++;
|
||||||
|
} else {
|
||||||
|
zap_log(ZAP_LOG_ERROR, "Error initilizing zt.\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!modcount) {
|
||||||
|
zap_log(ZAP_LOG_ERROR, "Error initilizing anything.\n");
|
||||||
|
return ZAP_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!zap_config_open_file(&cfg, "openzap.conf")) {
|
if (!zap_config_open_file(&cfg, "openzap.conf")) {
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
@ -334,6 +355,8 @@ zap_status_t zap_global_init(void)
|
|||||||
if (zint->configure(zint) == ZAP_SUCCESS) {
|
if (zint->configure(zint) == ZAP_SUCCESS) {
|
||||||
configured++;
|
configured++;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
zap_log(ZAP_LOG_WARNING, "Attempted to load Non-Existant module '%s'\n", val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,7 +364,12 @@ zap_status_t zap_global_init(void)
|
|||||||
|
|
||||||
zap_config_close_file(&cfg);
|
zap_config_close_file(&cfg);
|
||||||
|
|
||||||
return configured ? ZAP_SUCCESS : ZAP_FAIL;
|
if (configured) {
|
||||||
|
return ZAP_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
zap_log(ZAP_LOG_ERROR, "No modules configured!\n");
|
||||||
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
zap_status_t zap_global_destroy(void)
|
zap_status_t zap_global_destroy(void)
|
||||||
|
9
libs/freetdm/src/testapp.c
Normal file
9
libs/freetdm/src/testapp.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include "openzap.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
printf("hello\n");
|
||||||
|
|
||||||
|
zap_global_set_default_logger(ZAP_LOG_LEVEL_DEBUG);
|
||||||
|
zap_global_init();
|
||||||
|
}
|
@ -71,6 +71,8 @@ typedef unsigned __int32 u_int32_t;
|
|||||||
#include <sdla_front_end.h>
|
#include <sdla_front_end.h>
|
||||||
#include <sdla_aft_te1.h>
|
#include <sdla_aft_te1.h>
|
||||||
|
|
||||||
|
static zap_software_interface_t wanpipe_interface;
|
||||||
|
|
||||||
struct wanpipe_channel {
|
struct wanpipe_channel {
|
||||||
struct zap_channel zchan;
|
struct zap_channel zchan;
|
||||||
int x;
|
int x;
|
||||||
@ -81,9 +83,11 @@ static ZINT_CONFIGURE_FUNCTION(wanpipe_configure)
|
|||||||
zap_config_t cfg;
|
zap_config_t cfg;
|
||||||
char *var, *val;
|
char *var, *val;
|
||||||
int catno = -1;
|
int catno = -1;
|
||||||
|
zap_span_t *span = NULL;
|
||||||
|
|
||||||
ZINT_CONFIGURE_MUZZLE;
|
ZINT_CONFIGURE_MUZZLE;
|
||||||
|
|
||||||
|
zap_log(ZAP_LOG_DEBUG, "configuring wanpipe\n");
|
||||||
if (!zap_config_open_file(&cfg, "wanpipe.conf")) {
|
if (!zap_config_open_file(&cfg, "wanpipe.conf")) {
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
@ -91,8 +95,23 @@ static ZINT_CONFIGURE_FUNCTION(wanpipe_configure)
|
|||||||
while (zap_config_next_pair(&cfg, &var, &val)) {
|
while (zap_config_next_pair(&cfg, &var, &val)) {
|
||||||
if (!strcasecmp(cfg.category, "span")) {
|
if (!strcasecmp(cfg.category, "span")) {
|
||||||
if (cfg.catno != catno) {
|
if (cfg.catno != catno) {
|
||||||
|
zap_log(ZAP_LOG_DEBUG, "found config for span %d\n", cfg.catno);
|
||||||
|
catno = cfg.catno;
|
||||||
|
if (zap_span_create(&wanpipe_interface, &span) == ZAP_SUCCESS) {
|
||||||
|
zap_log(ZAP_LOG_DEBUG, "created span %d\n", span->span_id);
|
||||||
|
} else {
|
||||||
|
zap_log(ZAP_LOG_CRIT, "failure creating span\n");
|
||||||
|
span = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!span) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
zap_log(ZAP_LOG_DEBUG, "span %d [%s]=[%s]\n", span->span_id, var, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zap_config_close_file(&cfg);
|
zap_config_close_file(&cfg);
|
||||||
@ -142,8 +161,6 @@ static ZINT_WRITE_FUNCTION(wanpipe_write)
|
|||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static zap_software_interface_t wanpipe_interface;
|
|
||||||
|
|
||||||
zap_status_t wanpipe_init(zap_software_interface_t **zint)
|
zap_status_t wanpipe_init(zap_software_interface_t **zint)
|
||||||
{
|
{
|
||||||
assert(zint != NULL);
|
assert(zint != NULL);
|
||||||
@ -160,7 +177,7 @@ zap_status_t wanpipe_init(zap_software_interface_t **zint)
|
|||||||
wanpipe_interface.write = wanpipe_write;
|
wanpipe_interface.write = wanpipe_write;
|
||||||
*zint = &wanpipe_interface;
|
*zint = &wanpipe_interface;
|
||||||
|
|
||||||
return ZAP_FAIL;
|
return ZAP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
zap_status_t wanpipe_destroy(void)
|
zap_status_t wanpipe_destroy(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user