From 7e3412baf1f0147c84a3a494e89d9a4cd6a6e682 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 17 May 2007 03:31:21 +0000 Subject: [PATCH] add core wanpipe headers etc and tweak build flags git-svn-id: http://svn.openzap.org/svn/openzap/trunk@10 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/openzap/src/Makefile | 13 +++++++++--- libs/openzap/src/general.makefile | 2 +- libs/openzap/src/include/openzap.h | 2 -- libs/openzap/src/openzap.c | 4 +++- libs/openzap/src/wanpipe | 9 ++++++++ libs/openzap/src/zap_wanpipe.c | 34 +++++++++++++++++++++++++++++- 6 files changed, 56 insertions(+), 8 deletions(-) diff --git a/libs/openzap/src/Makefile b/libs/openzap/src/Makefile index ae2bf9db0c..ac6a8ffdec 100644 --- a/libs/openzap/src/Makefile +++ b/libs/openzap/src/Makefile @@ -35,13 +35,20 @@ MYLIB=libopenzap.a include general.makefile $(ZAP_MODS) +all: $(MYLIB) + $(MYLIB): $(OBJS) ar rcs $(MYLIB) $(OBJS) ranlib $(MYLIB) -%.o: %.c - $(CC) $(CFLAGS) -c $< -o $@ -all: $(MYLIB) +zap_wanpipe.o: zap_wanpipe.c + $(CC) $(CFLAGS) $(ZAP_CFLAGS) $(WP_CFLAGS) -c $< -o $@ + +zap_zt.o: zap_zt.c + $(CC) $(CFLAGS) $(ZAP_CFLAGS) $(ZT_CFLAGS) -c $< -o $@ + +%.o: %.c + $(CC) $(CC_CFLAGS) $(CFLAGS) -c $< -o $@ clean: rm -f *.o $(MYLIB) *~ \#* diff --git a/libs/openzap/src/general.makefile b/libs/openzap/src/general.makefile index c27766a22f..b1177dc860 100644 --- a/libs/openzap/src/general.makefile +++ b/libs/openzap/src/general.makefile @@ -1,3 +1,3 @@ CC=gcc -CFLAGS += -Wall -Werror -Wextra -std=c99 -pedantic -ansi +CC_CFLAGS += -Wall -Werror -Wextra -std=c99 -pedantic -ansi diff --git a/libs/openzap/src/include/openzap.h b/libs/openzap/src/include/openzap.h index ca80a3874c..725196225d 100644 --- a/libs/openzap/src/include/openzap.h +++ b/libs/openzap/src/include/openzap.h @@ -102,7 +102,6 @@ struct zap_software_interface; */ #define zap_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags)) - /*! \brief Free a pointer and set it to NULL unless it already is NULL \param it the pointer @@ -201,7 +200,6 @@ typedef zap_status_t (*zint_write_t) ZINT_WRITE_ARGS ; #define ZINT_READ_MUZZLE assert(zchan != NULL); assert(data != NULL); assert(datalen != NULL) #define ZINT_WRITE_MUZZLE assert(zchan != NULL); assert(data != NULL); assert(datalen != NULL) - struct zap_software_interface { const char *name; zint_configure_t configure; diff --git a/libs/openzap/src/openzap.c b/libs/openzap/src/openzap.c index ee795bb8db..40c3173975 100644 --- a/libs/openzap/src/openzap.c +++ b/libs/openzap/src/openzap.c @@ -229,7 +229,7 @@ zap_status_t zap_global_init(void) char *var, *val; unsigned configured = 0; zap_software_interface_t *zint; - + globals.interface_hash = create_hashtable(16, hashfromstring, equalkeys); zint = NULL; @@ -265,6 +265,8 @@ zap_status_t zap_global_init(void) } } + zap_config_close_file(&cfg); + return configured ? ZAP_SUCCESS : ZAP_FAIL; } diff --git a/libs/openzap/src/wanpipe b/libs/openzap/src/wanpipe index aef6e1cbac..4f410a083b 100644 --- a/libs/openzap/src/wanpipe +++ b/libs/openzap/src/wanpipe @@ -1,2 +1,11 @@ CFLAGS +=-DZAP_WANPIPE_SUPPORT OBJS += zap_wanpipe.o +WANPIPE_INCLUDE=/usr/include/wanpipe +#WANPIPE_INCLUDE=../../wanpipe-3.1.0.p18/patches/kdrivers/include + +WP_CFLAGS =-I$(WANPIPE_INCLUDE) -I/usr/local/include -I/usr/src/linux/include -I. -I/usr/include +WP_CFLAGS +=-D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -DAFT_A104 -DWANPIPE_TDM_API -D_GNUC_ -DWANPIPE_TDM_API + + + + diff --git a/libs/openzap/src/zap_wanpipe.c b/libs/openzap/src/zap_wanpipe.c index ba05bfd586..cea8594bac 100644 --- a/libs/openzap/src/zap_wanpipe.c +++ b/libs/openzap/src/zap_wanpipe.c @@ -31,13 +31,45 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "openzap.h" #include "zap_wanpipe.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct wanpipe_channel { + struct zap_channel zchan; + int x; +}; static ZINT_CONFIGURE_FUNCTION(wanpipe_configure) { + zap_config_t cfg; + char *var, *val; + int catno = -1; + ZINT_CONFIGURE_MUZZLE; + + if (!zap_config_open_file(&cfg, "wanpipe.conf")) { + return ZAP_FAIL; + } + + while (zap_config_next_pair(&cfg, &var, &val)) { + if (!strcasecmp(cfg.category, "span")) { + if (cfg.catno != catno) { + + } + } + } + zap_config_close_file(&cfg); + return ZAP_FAIL; }