diff --git a/libs/freetdm/src/include/fsk.h b/libs/freetdm/src/include/fsk.h index b098444d03..66da140df9 100644 --- a/libs/freetdm/src/include/fsk.h +++ b/libs/freetdm/src/include/fsk.h @@ -35,6 +35,10 @@ #define __FSK_H__ #include "uart.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { int freq_space; /* Frequency of the 0 bit */ int freq_mark; /* Frequency of the 1 bit */ @@ -109,5 +113,9 @@ void dsp_fsk_sample(dsp_fsk_handle_t *handle, double normalized_sample); extern fsk_modem_definition_t fsk_modem_definitions[]; +#ifdef __cplusplus +} /* extern C */ +#endif + #endif diff --git a/libs/freetdm/src/include/hashtable.h b/libs/freetdm/src/include/hashtable.h index 0d185bbc5b..7a94354d5d 100644 --- a/libs/freetdm/src/include/hashtable.h +++ b/libs/freetdm/src/include/hashtable.h @@ -9,6 +9,9 @@ #endif #include "openzap.h" +#ifdef __cplusplus +extern "C" { +#endif struct hashtable; struct hashtable_iterator; @@ -181,6 +184,10 @@ 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); +#ifdef __cplusplus +} /* extern C */ +#endif + #endif /* __HASHTABLE_CWC22_H__ */ /* diff --git a/libs/freetdm/src/include/hashtable_itr.h b/libs/freetdm/src/include/hashtable_itr.h index 6897ce949c..59b73a5863 100644 --- a/libs/freetdm/src/include/hashtable_itr.h +++ b/libs/freetdm/src/include/hashtable_itr.h @@ -5,6 +5,9 @@ #include "hashtable.h" #include "hashtable_private.h" /* needed to enable inlining */ +#ifdef __cplusplus +extern "C" { +#endif /*****************************************************************************/ /* This struct is only concrete here to allow the inlining of two of the * accessor functions. */ @@ -79,7 +82,9 @@ hashtable_iterator_search(struct hashtable_itr *itr, return (hashtable_iterator_search(i,h,k)); \ } - +#ifdef __cplusplus +} +#endif #endif /* __HASHTABLE_ITR_CWC22__*/ diff --git a/libs/freetdm/src/include/hashtable_private.h b/libs/freetdm/src/include/hashtable_private.h index 1bb10fd016..47988d8d8f 100644 --- a/libs/freetdm/src/include/hashtable_private.h +++ b/libs/freetdm/src/include/hashtable_private.h @@ -5,7 +5,9 @@ #include "hashtable.h" - +#ifdef __cplusplus +extern "C" { +#endif /*****************************************************************************/ struct entry @@ -56,6 +58,9 @@ indexFor(unsigned int tablelength, unsigned int hashvalue) { #define freekey(X) free(X) /*define freekey(X) ; */ +#ifdef __cplusplus +} +#endif /*****************************************************************************/ diff --git a/libs/freetdm/src/include/openzap.h b/libs/freetdm/src/include/openzap.h index 7c5280e0ee..4547951cd3 100644 --- a/libs/freetdm/src/include/openzap.h +++ b/libs/freetdm/src/include/openzap.h @@ -297,12 +297,6 @@ } while(0); -typedef enum { - ZAP_STATE_CHANGE_FAIL, - ZAP_STATE_CHANGE_SUCCESS, - ZAP_STATE_CHANGE_SAME, -} zap_state_change_result_t; - #define zap_set_state_r(obj, s, l, r) if ( obj->state == s ) { \ zap_log(ZAP_LOG_WARNING, "Why bother changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(obj->state), zap_channel_state2str(s)); r = ZAP_STATE_CHANGE_SAME; \ } else if (zap_test_flag(obj, ZAP_CHANNEL_READY)) { \ @@ -323,6 +317,16 @@ typedef enum { */ #define zap_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags)) +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + ZAP_STATE_CHANGE_FAIL, + ZAP_STATE_CHANGE_SUCCESS, + ZAP_STATE_CHANGE_SAME, +} zap_state_change_result_t; + struct zap_stream_handle { zap_stream_handle_write_function_t write_function; zap_stream_handle_raw_write_function_t raw_write_function; @@ -851,6 +855,10 @@ static __inline__ void zap_clear_flag_all(zap_span_t *span, uint32_t flag) zap_mutex_unlock(span->mutex); } +#ifdef __cplusplus +} /* extern C */ +#endif + #endif /* For Emacs: diff --git a/libs/freetdm/src/include/uart.h b/libs/freetdm/src/include/uart.h index 89c3a13abc..b1b04c09a4 100644 --- a/libs/freetdm/src/include/uart.h +++ b/libs/freetdm/src/include/uart.h @@ -34,6 +34,10 @@ #ifndef __UART_H__ #define __UART_H__ +#ifdef __cplusplus +extern "C" { +#endif + typedef void (*bytehandler_func_t) (void *, int); typedef void (*bithandler_func_t) (void *, int); @@ -72,5 +76,8 @@ void dsp_uart_destroy(dsp_uart_handle_t **handle); void dsp_uart_bit_handler(void *handle, int bit); +#ifdef __cplusplus +} +#endif #endif diff --git a/libs/freetdm/src/include/zap_buffer.h b/libs/freetdm/src/include/zap_buffer.h index 9a05420979..03d4caae11 100644 --- a/libs/freetdm/src/include/zap_buffer.h +++ b/libs/freetdm/src/include/zap_buffer.h @@ -36,6 +36,10 @@ #include "openzap.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @defgroup zap_buffer Buffer Routines * @ingroup buffer @@ -133,6 +137,10 @@ OZ_DECLARE(zap_size_t) zap_buffer_seek(zap_buffer_t *buffer, zap_size_t datalen) OZ_DECLARE(zap_size_t) zap_buffer_zwrite(zap_buffer_t *buffer, const void *data, zap_size_t datalen); +#ifdef __cplusplus +} +#endif + #endif /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/include/zap_config.h b/libs/freetdm/src/include/zap_config.h index f2f2e374bf..d961700ea4 100644 --- a/libs/freetdm/src/include/zap_config.h +++ b/libs/freetdm/src/include/zap_config.h @@ -70,6 +70,10 @@ #define zap_is_file_path(file) ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)) #endif +#ifdef __cplusplus +extern "C" { +#endif + typedef struct zap_config zap_config_t; /*! \brief A simple file handle representing an open configuration file **/ @@ -123,6 +127,9 @@ int zap_config_next_pair(zap_config_t * cfg, char **var, char **val); */ OZ_DECLARE (int) zap_config_get_cas_bits(char *strvalue, unsigned char *outbits); +#ifdef __cplusplus +} +#endif /** @} */ #endif diff --git a/libs/freetdm/src/include/zap_dso.h b/libs/freetdm/src/include/zap_dso.h index bf51f92b18..9cfe87e962 100644 --- a/libs/freetdm/src/include/zap_dso.h +++ b/libs/freetdm/src/include/zap_dso.h @@ -21,6 +21,10 @@ #ifndef _ZAP_DSO_H #define _ZAP_DSO_H +#ifdef __cplusplus +extern "C" { +#endif + typedef void (*zap_func_ptr_t) (void); typedef void * zap_dso_lib_t; @@ -28,6 +32,9 @@ void zap_dso_destroy(zap_dso_lib_t *lib); zap_dso_lib_t zap_dso_open(const char *path, char **err); void *zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err); +#ifdef __cplusplus +} +#endif #endif diff --git a/libs/freetdm/src/include/zap_m3ua.h b/libs/freetdm/src/include/zap_m3ua.h index 18de6db838..c06d112093 100644 --- a/libs/freetdm/src/include/zap_m3ua.h +++ b/libs/freetdm/src/include/zap_m3ua.h @@ -39,6 +39,10 @@ //#include "m3ua_client.h" #include "openzap.h" + +#ifdef __cplusplus +extern "C" { +#endif enum e_sigboost_event_id_values { SIGBOOST_EVENT_CALL_START = 0x80, /*128*/ @@ -113,7 +117,9 @@ zap_status_t m3ua_init(zap_io_interface_t **zint); zap_status_t m3ua_destroy(void); zap_status_t m3ua_start(zap_span_t *span); - +#ifdef __cplusplus +} +#endif /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/include/zap_threadmutex.h b/libs/freetdm/src/include/zap_threadmutex.h index f131c48cf0..488dca1c42 100644 --- a/libs/freetdm/src/include/zap_threadmutex.h +++ b/libs/freetdm/src/include/zap_threadmutex.h @@ -27,6 +27,9 @@ #include "openzap.h" +#ifdef __cplusplus +extern "C" { +#endif typedef struct zap_mutex zap_mutex_t; typedef struct zap_thread zap_thread_t; typedef struct zap_condition zap_condition_t; @@ -45,6 +48,10 @@ OZ_DECLARE(zap_status_t) zap_condition_destroy(zap_condition_t **cond); OZ_DECLARE(zap_status_t) zap_condition_signal(zap_condition_t *cond); OZ_DECLARE(zap_status_t) zap_condition_wait(zap_condition_t *cond, int ms); +#ifdef __cplusplus +} +#endif + #endif /* For Emacs: diff --git a/libs/freetdm/src/include/zap_types.h b/libs/freetdm/src/include/zap_types.h index b415ecfb31..5833e6401a 100644 --- a/libs/freetdm/src/include/zap_types.h +++ b/libs/freetdm/src/include/zap_types.h @@ -63,6 +63,9 @@ typedef ssize_t zap_ssize_t; typedef int zap_filehandle_t; #endif +#ifdef __cplusplus +extern "C" { +#endif #define TAG_END NULL typedef size_t zap_size_t; @@ -655,6 +658,10 @@ typedef enum { ZAP_CAUSE_MEDIA_TIMEOUT = 604 } zap_call_cause_t; +#ifdef __cplusplus +} +#endif + #endif /* For Emacs: diff --git a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c index 96be901f69..0ede9ce653 100644 --- a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c +++ b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c @@ -1635,7 +1635,7 @@ static ZIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(zap_sangoma_boost_configure_span) FAIL_CONFIG_RETURN(ZAP_FAIL); } - if (!(sigmod_iface = (boost_sigmod_interface_t *)zap_dso_func_sym(lib, BOOST_INTERFACE_NAME, &err))) { + if (!(sigmod_iface = (boost_sigmod_interface_t *)zap_dso_func_sym(lib, BOOST_INTERFACE_NAME_STR, &err))) { zap_log(ZAP_LOG_ERROR, "Failed to read Sangoma boost signaling module interface '%s': %s\n", path, err); snprintf(span->last_error, sizeof(span->last_error), "Failed to read Sangoma boost signaling module interface '%s': %s", path, err); diff --git a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_interface.h b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_interface.h index 4d91f86a05..78e1655d60 100644 --- a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_interface.h +++ b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/sangoma_boost_interface.h @@ -35,7 +35,7 @@ #ifndef SANGOMA_BOOST_INTERFACE_H #define SANGOMA_BOOST_INTERFACE_H -#include "zap_types.h" +#include "openzap.h" /*! \brief Callback used to notify signaling status changes on a channel @@ -111,7 +111,7 @@ typedef void (*boost_on_hw_link_status_change_t) BOOST_ON_HW_LINK_STATUS_CHANGE_ */ #define BOOST_SET_SIG_STATUS_ARGS (zap_channel_t *zchan, zap_channel_sig_status_t status) typedef zap_status_t (*boost_set_sig_status_func_t) BOOST_SET_SIG_STATUS_ARGS; -#define BOOST_SET_SIG_STATUS_FUNCTION(name) zap_status_t BOOST_SET_SIG_STATUS_ARGS +#define BOOST_SET_SIG_STATUS_FUNCTION(name) zap_status_t name BOOST_SET_SIG_STATUS_ARGS /*! \brief Configure the given span signaling @@ -169,7 +169,8 @@ typedef struct boost_sigmod_interface_s { void *pvt; } boost_sigmod_interface_t; -#define BOOST_INTERFACE_NAME "boost_sigmod_interface" +#define BOOST_INTERFACE_NAME boost_sigmod_interface +#define BOOST_INTERFACE_NAME_STR "boost_sigmod_interface" /* use this in your sig boost module to declare your interface */ #define BOOST_INTERFACE boost_sigmod_interface_t BOOST_INTERFACE_NAME #endif