From 48b7fc8f1d4d20f24e9b06c2fca41789dceb32dd Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 15 May 2009 19:08:19 +0000 Subject: [PATCH] add wanpipe and pika to windows build (OPENZAP-65) git-svn-id: http://svn.openzap.org/svn/openzap/trunk@733 a93c3328-9c30-0410-af19-c9cd2b2d52af --- .../msvc/testanalog/testanalog.2005.vcproj | 2 + .../msvc/testanalog/testanalog.2008.vcproj | 2 + .../msvc/testisdn/testisdn.2005.vcproj | 2 + .../msvc/testisdn/testisdn.2008.vcproj | 2 + libs/openzap/openzap.2005.sln | 8 + libs/openzap/openzap.2008.sln | 11 + libs/openzap/src/hashtable.c | 18 +- libs/openzap/src/include/hashtable.h | 19 +- libs/openzap/src/include/zap_config.h | 2 +- .../ozmod_analog/ozmod_analog.2005.vcproj | 2 + .../ozmod_analog/ozmod_analog.2008.vcproj | 2 + .../ozmod_analog_em.2005.vcproj | 2 + .../ozmod_analog_em.2008.vcproj | 2 + .../ozmod/ozmod_pika/ozmod_pika.2005.vcproj | 197 ++++++++++++++++++ .../ozmod/ozmod_pika/ozmod_pika.2008.vcproj | 197 ++++++++++++++++++ .../openzap/src/ozmod/ozmod_pika/ozmod_pika.c | 22 +- libs/openzap/src/ozmod/ozmod_pika/zap_pika.h | 34 ++- .../ozmod_wanpipe/ozmod_wanpipe.2005.vcproj | 196 +++++++++++++++++ .../ozmod_wanpipe/ozmod_wanpipe.2008.vcproj | 196 +++++++++++++++++ .../src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c | 27 ++- libs/openzap/src/zap_config.c | 2 +- 21 files changed, 911 insertions(+), 34 deletions(-) create mode 100644 libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.2005.vcproj create mode 100644 libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.2008.vcproj create mode 100644 libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2005.vcproj create mode 100644 libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2008.vcproj diff --git a/libs/openzap/msvc/testanalog/testanalog.2005.vcproj b/libs/openzap/msvc/testanalog/testanalog.2005.vcproj index 7f762fe4ad..93553d2a5f 100644 --- a/libs/openzap/msvc/testanalog/testanalog.2005.vcproj +++ b/libs/openzap/msvc/testanalog/testanalog.2005.vcproj @@ -51,6 +51,7 @@ WarnAsError="true" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" + DisableSpecificWarnings="4100" /> entrycount; } /*****************************************************************************/ -int +OZ_DECLARE(int) hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags) { /* This method allows duplicate keys - but they shouldn't be used */ @@ -191,7 +191,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags) } /*****************************************************************************/ -void * /* returns value associated with key */ +OZ_DECLARE(void *) /* returns value associated with key */ hashtable_search(struct hashtable *h, void *k) { struct entry *e; @@ -209,7 +209,7 @@ hashtable_search(struct hashtable *h, void *k) } /*****************************************************************************/ -void * /* returns value associated with key */ +OZ_DECLARE(void *) /* returns value associated with key */ hashtable_remove(struct hashtable *h, void *k) { /* TODO: consider compacting the table when the load factor drops enough, @@ -246,7 +246,7 @@ hashtable_remove(struct hashtable *h, void *k) /*****************************************************************************/ /* destroy */ -void +OZ_DECLARE(void) hashtable_destroy(struct hashtable *h) { unsigned int i; @@ -264,7 +264,7 @@ hashtable_destroy(struct hashtable *h) free(h); } -struct hashtable_iterator *hashtable_next(struct hashtable_iterator *i) +OZ_DECLARE(struct hashtable_iterator *) hashtable_next(struct hashtable_iterator *i) { if (i->e) { @@ -290,7 +290,7 @@ struct hashtable_iterator *hashtable_next(struct hashtable_iterator *i) return NULL; } -struct hashtable_iterator *hashtable_first(struct hashtable *h) +OZ_DECLARE(struct hashtable_iterator *) hashtable_first(struct hashtable *h) { h->iterator.pos = 0; h->iterator.e = NULL; @@ -300,7 +300,7 @@ struct hashtable_iterator *hashtable_first(struct hashtable *h) -void hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val) +OZ_DECLARE(void) hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val) { if (i->e) { if (key) { diff --git a/libs/openzap/src/include/hashtable.h b/libs/openzap/src/include/hashtable.h index 137e9460e6..ea63e2e91d 100644 --- a/libs/openzap/src/include/hashtable.h +++ b/libs/openzap/src/include/hashtable.h @@ -7,6 +7,7 @@ #define __inline__ __inline #endif #endif +#include "openzap.h" struct hashtable; struct hashtable_iterator; @@ -77,7 +78,7 @@ struct hashtable_iterator; * @return newly created hashtable or NULL on failure */ -struct hashtable * +OZ_DECLARE(struct hashtable *) create_hashtable(unsigned int minsize, unsigned int (*hashfunction) (void*), int (*key_eq_fn) (void*,void*)); @@ -108,7 +109,7 @@ typedef enum { HASHTABLE_FLAG_FREE_VALUE = (1 << 1) } hashtable_flag_t; -int +OZ_DECLARE(int) hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags); #define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \ @@ -126,7 +127,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v, hashtable_flag_t flags); * @return the value associated with the key, or NULL if none found */ -void * +OZ_DECLARE(void *) hashtable_search(struct hashtable *h, void *k); #define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \ @@ -144,7 +145,7 @@ hashtable_search(struct hashtable *h, void *k); * @return the value associated with the key, or NULL if none found */ -void * /* returns value */ +OZ_DECLARE(void *) /* returns value */ hashtable_remove(struct hashtable *h, void *k); #define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \ @@ -161,7 +162,7 @@ hashtable_remove(struct hashtable *h, void *k); * @param h the hashtable * @return the number of items stored in the hashtable */ -unsigned int +OZ_DECLARE(unsigned int) hashtable_count(struct hashtable *h); @@ -173,12 +174,12 @@ hashtable_count(struct hashtable *h); * @param free_values whether to call 'free' on the remaining values */ -void +OZ_DECLARE(void) hashtable_destroy(struct hashtable *h); -struct hashtable_iterator *hashtable_first(struct hashtable *h); -struct hashtable_iterator *hashtable_next(struct hashtable_iterator *i); -void hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val); +OZ_DECLARE(struct hashtable_iterator*) hashtable_first(struct hashtable *h); +OZ_DECLARE(struct hashtable_iterator*) hashtable_next(struct hashtable_iterator *i); +OZ_DECLARE(void) hashtable_this(struct hashtable_iterator *i, const void **key, int *klen, void **val); #endif /* __HASHTABLE_CWC22_H__ */ diff --git a/libs/openzap/src/include/zap_config.h b/libs/openzap/src/include/zap_config.h index f550029388..967c09cd79 100644 --- a/libs/openzap/src/include/zap_config.h +++ b/libs/openzap/src/include/zap_config.h @@ -121,7 +121,7 @@ int zap_config_next_pair(zap_config_t * cfg, char **var, char **val); \param strvalue pointer to the configuration string value (expected to be in format whatever:xxxx) \param outbits pointer to aim at the CAS bits */ -int zap_config_get_cas_bits(char *strvalue, unsigned char *outbits); +OZ_DECLARE (int) zap_config_get_cas_bits(char *strvalue, unsigned char *outbits); /** @} */ diff --git a/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.2005.vcproj b/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.2005.vcproj index f0d697c619..964393805c 100644 --- a/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.2005.vcproj +++ b/libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.2005.vcproj @@ -49,6 +49,7 @@ WarningLevel="4" WarnAsError="true" DebugInformationFormat="4" + DisableSpecificWarnings="4100" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.2008.vcproj b/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.2008.vcproj new file mode 100644 index 0000000000..2e3cfceb13 --- /dev/null +++ b/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.2008.vcproj @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.c b/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.c index c409f9535e..5de8ac3974 100644 --- a/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.c +++ b/libs/openzap/src/ozmod/ozmod_pika/ozmod_pika.c @@ -35,6 +35,12 @@ #include "openzap.h" #include "zap_pika.h" +#if defined(__WINDOWS__) +#define EX_DECLARE_DATA __declspec(dllexport) +#else +EX_DECLARE_DATA +#endif + #define MAX_NUMBER_OF_TRUNKS 64 #define PIKA_BLOCK_SIZE 160 #define PIKA_BLOCK_LEN 20 @@ -45,19 +51,19 @@ PK_VOID PK_CALLBACK media_out_callback(PKH_TPikaEvent *event); ZAP_ENUM_NAMES(PIKA_SPAN_NAMES, PIKA_SPAN_STRINGS) -ZAP_STR2ENUM(pika_str2span, pika_span2str, PIKA_TSpanFraming, PIKA_SPAN_NAMES, PIKA_SPAN_INVALID) +PIKA_STR2ENUM(pika_str2span, pika_span2str, PIKA_TSpanFraming, PIKA_SPAN_NAMES, PIKA_SPAN_INVALID) ZAP_ENUM_NAMES(PIKA_SPAN_ENCODING_NAMES, PIKA_SPAN_ENCODING_STRINGS) -ZAP_STR2ENUM(pika_str2span_encoding, pika_span_encoding2str, PIKA_TSpanEncoding, PIKA_SPAN_ENCODING_NAMES, PIKA_SPAN_ENCODING_INVALID) +PIKA_STR2ENUM(pika_str2span_encoding, pika_span_encoding2str, PIKA_TSpanEncoding, PIKA_SPAN_ENCODING_NAMES, PIKA_SPAN_ENCODING_INVALID) ZAP_ENUM_NAMES(PIKA_LL_NAMES, PIKA_LL_STRINGS) -ZAP_STR2ENUM(pika_str2loop_length, pika_loop_length2str, PIKA_TSpanLoopLength, PIKA_LL_NAMES, PIKA_SPAN_LOOP_INVALID) +PIKA_STR2ENUM(pika_str2loop_length, pika_loop_length2str, PIKA_TSpanLoopLength, PIKA_LL_NAMES, PIKA_SPAN_LOOP_INVALID) ZAP_ENUM_NAMES(PIKA_LBO_NAMES, PIKA_LBO_STRINGS) -ZAP_STR2ENUM(pika_str2lbo, pika_lbo2str, PIKA_TSpanBuildOut, PIKA_LBO_NAMES, PIKA_SPAN_LBO_INVALID) +PIKA_STR2ENUM(pika_str2lbo, pika_lbo2str, PIKA_TSpanBuildOut, PIKA_LBO_NAMES, PIKA_SPAN_LBO_INVALID) ZAP_ENUM_NAMES(PIKA_SPAN_COMPAND_MODE_NAMES, PIKA_SPAN_COMPAND_MODE_STRINGS) -ZAP_STR2ENUM(pika_str2compand_mode, pika_compand_mode2str, PIKA_TSpanCompandMode, PIKA_SPAN_COMPAND_MODE_NAMES, PIKA_SPAN_COMPAND_MODE_INVALID) +PIKA_STR2ENUM(pika_str2compand_mode, pika_compand_mode2str, PIKA_TSpanCompandMode, PIKA_SPAN_COMPAND_MODE_NAMES, PIKA_SPAN_COMPAND_MODE_INVALID) typedef enum { @@ -153,7 +159,7 @@ static ZIO_CONFIGURE_FUNCTION(pika_configure) profile->ec_config = globals.ec_config; profile->record_config = globals.record_config; profile->play_config = globals.play_config; - hashtable_insert(globals.profile_hash, (void *)profile->name, profile); + hashtable_insert(globals.profile_hash, (void *)profile->name, profile, HASHTABLE_FLAG_NONE); zap_log(ZAP_LOG_INFO, "creating profile [%s]\n", category); } @@ -1335,12 +1341,12 @@ static ZIO_IO_UNLOAD_FUNCTION(pika_destroy) zap_log(ZAP_LOG_INFO, "Closing system handle\n"); } - hashtable_destroy(globals.profile_hash, 0, 1); + hashtable_destroy(globals.profile_hash); return ZAP_SUCCESS; } -zap_module_t zap_module = { +EX_DECLARE_DATA zap_module_t zap_module = { "pika", pika_init, pika_destroy, diff --git a/libs/openzap/src/ozmod/ozmod_pika/zap_pika.h b/libs/openzap/src/ozmod/ozmod_pika/zap_pika.h index c8401c6aa1..da1864d486 100644 --- a/libs/openzap/src/ozmod/ozmod_pika/zap_pika.h +++ b/libs/openzap/src/ozmod/ozmod_pika/zap_pika.h @@ -38,6 +38,30 @@ +#define PIKA_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type); +#define PIKA_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ + _TYPE _FUNC1 (const char *name) \ + { \ + int i; \ + _TYPE t = _MAX ; \ + \ + for (i = 0; i < _MAX ; i++) { \ + if (!strcasecmp(name, _STRINGS[i])) { \ + t = (_TYPE) i; \ + break; \ + } \ + } \ + \ + return t; \ + } \ + const char * _FUNC2 (_TYPE type) \ + { \ + if (type > _MAX) { \ + type = _MAX; \ + } \ + return _STRINGS[(int)type]; \ + } + typedef enum { PIKA_SPAN_FRAMING_T1_D4, @@ -47,7 +71,7 @@ typedef enum { PIKA_SPAN_INVALID } PIKA_TSpanFraming; #define PIKA_SPAN_STRINGS "T1_D4", "T1_ESF", "E1_BASIC", "E1_CRC4" -ZAP_STR2ENUM_P(pika_str2span, pika_span2str, PIKA_TSpanFraming) +PIKA_STR2ENUM_P(pika_str2span, pika_span2str, PIKA_TSpanFraming) typedef enum { PIKA_SPAN_ENCODING_T1_AMI_ZS_NONE, @@ -60,7 +84,7 @@ typedef enum { PIKA_SPAN_ENCODING_INVALID } PIKA_TSpanEncoding; #define PIKA_SPAN_ENCODING_STRINGS "T1_AMI_ZS_NONE", "T1_AMI_ZS_GTE", "T1_AMI_ZS_BELL", "T1_AMI_ZS_JAM8", "T1_B8ZS", "E1_AMI", "E1_HDB3" -ZAP_STR2ENUM_P(pika_str2span_encoding, pika_span_encoding2str, PIKA_TSpanEncoding) +PIKA_STR2ENUM_P(pika_str2span_encoding, pika_span_encoding2str, PIKA_TSpanEncoding) typedef enum { PIKA_SPAN_LOOP_LENGTH_SHORT_HAUL, @@ -68,7 +92,7 @@ typedef enum { PIKA_SPAN_LOOP_INVALID } PIKA_TSpanLoopLength; #define PIKA_LL_STRINGS "SHORT_HAUL", "LONG_HAUL" -ZAP_STR2ENUM_P(pika_str2loop_length, pika_loop_length2str, PIKA_TSpanLoopLength) +PIKA_STR2ENUM_P(pika_str2loop_length, pika_loop_length2str, PIKA_TSpanLoopLength) typedef enum { PIKA_SPAN_LBO_T1_LONG_0_DB, @@ -84,7 +108,7 @@ typedef enum { PIKA_SPAN_LBO_INVALID } PIKA_TSpanBuildOut; #define PIKA_LBO_STRINGS "T1_LONG_0_DB", "T1_LONG_7_DB", "T1_LONG_15_DB", "T1_LONG_22_DB", "T1_SHORT_133_FT", "T1_SHORT_266_FT", "T1_SHORT_399_FT", "T1_SHORT_533_FT", "T1_SHORT_655_FT", "E1_WAVEFORM_120_OHM" -ZAP_STR2ENUM_P(pika_str2lbo, pika_lbo2str, PIKA_TSpanBuildOut) +PIKA_STR2ENUM_P(pika_str2lbo, pika_lbo2str, PIKA_TSpanBuildOut) typedef enum { PIKA_SPAN_COMPAND_MODE_MU_LAW = 1, @@ -92,7 +116,7 @@ typedef enum { PIKA_SPAN_COMPAND_MODE_INVALID } PIKA_TSpanCompandMode; #define PIKA_SPAN_COMPAND_MODE_STRINGS "MU_LAW", "A_LAW" -ZAP_STR2ENUM_P(pika_str2compand_mode, pika_compand_mode2str, PIKA_TSpanCompandMode) +PIKA_STR2ENUM_P(pika_str2compand_mode, pika_compand_mode2str, PIKA_TSpanCompandMode) #endif diff --git a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2005.vcproj b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2005.vcproj new file mode 100644 index 0000000000..da21a76b7a --- /dev/null +++ b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2005.vcproj @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2008.vcproj b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2008.vcproj new file mode 100644 index 0000000000..1c8685c6d4 --- /dev/null +++ b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2008.vcproj @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c index 7e72f214ea..9974d7a786 100644 --- a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c +++ b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c @@ -36,10 +36,35 @@ #include #endif #include "openzap.h" +#ifndef __WINDOWS__ #include #include +#endif #include "libsangoma.h" +#if defined(__WINDOWS__) +/*! Backward compatible defines - current code is all using the old names*/ +#define sangoma_open_tdmapi_span_chan sangoma_open_api_span_chan +#define sangoma_open_tdmapi_span sangoma_open_api_span +#define sangoma_open_tdmapi_ctrl sangoma_open_api_ctrl +#define sangoma_tdm_get_fe_status sangoma_get_fe_status +#define sangoma_socket_close sangoma_close +#define sangoma_tdm_get_hw_coding sangoma_get_hw_coding +#define sangoma_tdm_set_fe_status sangoma_set_fe_status +#define sangoma_tdm_get_link_status sangoma_get_link_status +#define sangoma_tdm_flush_bufs sangoma_flush_bufs +#define sangoma_tdm_cmd_exec sangoma_cmd_exec +#define sangoma_tdm_read_event sangoma_read_event +#define sangoma_readmsg_tdm sangoma_readmsg +#define sangoma_readmsg_socket sangoma_readmsg +#define sangoma_sendmsg_socket sangoma_writemsg +#define sangoma_writemsg_tdm sangoma_writemsg +#define sangoma_create_socket_intr sangoma_open_api_span_chan +#define EX_DECLARE_DATA __declspec(dllexport) +#else +WP_DECLARE_DATA +#endif + typedef enum { WP_RINGING = (1 << 0) } wp_flag_t; @@ -849,7 +874,7 @@ static ZIO_IO_UNLOAD_FUNCTION(wanpipe_destroy) } -zap_module_t zap_module = { +EX_DECLARE_DATA zap_module_t zap_module = { "wanpipe", wanpipe_init, wanpipe_destroy, diff --git a/libs/openzap/src/zap_config.c b/libs/openzap/src/zap_config.c index ab622dd7d3..32567041eb 100644 --- a/libs/openzap/src/zap_config.c +++ b/libs/openzap/src/zap_config.c @@ -209,7 +209,7 @@ int zap_config_next_pair(zap_config_t *cfg, char **var, char **val) } -int zap_config_get_cas_bits(char *strvalue, unsigned char *outbits) +OZ_DECLARE (int) zap_config_get_cas_bits(char *strvalue, unsigned char *outbits) { char cas_bits[5]; unsigned char bit = 0x8;