From: <do...@us...> - 2007-10-29 04:55:20
|
Revision: 1234 http://iaxclient.svn.sourceforge.net/iaxclient/?rev=1234&view=rev Author: dohpaz Date: 2007-10-28 21:55:25 -0700 (Sun, 28 Oct 2007) Log Message: ----------- Add --enable-debug-iax option to enable libiax2 DEBUG_SUPPORT. Make ALL code enabled by DEBUG_SUPPORT in libiax2 pay attention to the current debug setting. Added an iaxclient public API iaxc_debug_iax_set to control the IAX protocol debugging state. Modified Paths: -------------- branches/team/elbunce/iaxclient/configure.ac branches/team/elbunce/iaxclient/lib/Makefile.am branches/team/elbunce/iaxclient/lib/iaxclient.h branches/team/elbunce/iaxclient/lib/iaxclient_lib.c branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c Modified: branches/team/elbunce/iaxclient/configure.ac =================================================================== --- branches/team/elbunce/iaxclient/configure.ac 2007-10-27 06:50:47 UTC (rev 1233) +++ branches/team/elbunce/iaxclient/configure.ac 2007-10-29 04:55:25 UTC (rev 1234) @@ -75,6 +75,12 @@ [Don't use local iax library])],, [enable_local_iax="yes"]) +AC_ARG_ENABLE(debug-iax, + [AS_HELP_STRING([--enable-debug-iax], + [Enable debug support in local iax library])], + enable_debug_iax2=$enableval, + enable_debug_iax2="no") + AC_ARG_ENABLE(speex_preprocess, [AS_HELP_STRING([--disable-speex-preprocess], [Turn off speex preprocessing])],, @@ -358,6 +364,7 @@ AM_CONDITIONAL(USE_CODEC_GSM, test x$has_gsm = xyes && test ! x$with_gsm = xno) AM_CONDITIONAL(USE_LOCAL_GSM, test x$enable_local_gsm = xyes) AM_CONDITIONAL(USE_LOCAL_IAX2, test x$enable_local_iax2 = xyes) +AM_CONDITIONAL(USE_DEBUG_IAX2, test x$enable_debug_iax2 = xyes) AM_CONDITIONAL(USE_LOCAL_ILBC, test x$enable_local_ilbc = xyes) AM_CONDITIONAL(LINUX, test x$OSTYPE = xLINUX) AM_CONDITIONAL(WIN32, test x$OSTYPE = xWIN32) Modified: branches/team/elbunce/iaxclient/lib/Makefile.am =================================================================== --- branches/team/elbunce/iaxclient/lib/Makefile.am 2007-10-27 06:50:47 UTC (rev 1233) +++ branches/team/elbunce/iaxclient/lib/Makefile.am 2007-10-29 04:55:25 UTC (rev 1234) @@ -73,7 +73,9 @@ if USE_LOCAL_IAX2 SRCS += $(SRCS_IAX2) -# AM_CFLAGS += -DDEBUG_SUPPORT +if USE_DEBUG_IAX2 +AM_CFLAGS += -DDEBUG_SUPPORT +endif USE_DEBUG_IAX2 endif USE_LOCAL_IAX2 if USE_LOCAL_ILBC Modified: branches/team/elbunce/iaxclient/lib/iaxclient.h =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient.h 2007-10-27 06:50:47 UTC (rev 1233) +++ branches/team/elbunce/iaxclient/lib/iaxclient.h 2007-10-29 04:55:25 UTC (rev 1234) @@ -1334,6 +1334,12 @@ */ EXPORT int iaxc_push_video(void *data, unsigned int size, int fragment); +/*! + Sets the IAX debug set to \a enable. + \param enable If non-zero enable iax protocol debugging +*/ +EXPORT int iaxc_debug_iax_set(int enable); + #ifdef __cplusplus } #endif Modified: branches/team/elbunce/iaxclient/lib/iaxclient_lib.c =================================================================== --- branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2007-10-27 06:50:47 UTC (rev 1233) +++ branches/team/elbunce/iaxclient/lib/iaxclient_lib.c 2007-10-29 04:55:25 UTC (rev 1234) @@ -1979,3 +1979,13 @@ return 0; } +int iaxc_debug_iax_set(int enable) +{ +#ifdef DEBUG_SUPPORT + if (enable) + iax_enable_debug(); + else + iax_disable_debug(); +#endif +} + Modified: branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c =================================================================== --- branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-10-27 06:50:47 UTC (rev 1233) +++ branches/team/elbunce/iaxclient/lib/libiax2/src/iax.c 2007-10-29 04:55:25 UTC (rev 1234) @@ -249,22 +249,7 @@ debug = 0; } -void iax_set_private(struct iax_session *s, void *ptr) -{ - s->pvt = ptr; -} -void *iax_get_private(struct iax_session *s) -{ - return s->pvt; -} - -void iax_set_sendto(struct iax_session *s, iax_sendto_t ptr) -{ - s->sendto = ptr; -} - - /* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */ #if defined(WIN32) || defined(_WIN32_WCE) #define G __FILE__, __LINE__, @@ -274,7 +259,7 @@ #define DEBU __debug #if defined(WIN32) || defined(_WIN32_WCE) -static int __debug(char *file, int lineno, char *fmt, ...) +static int __debug(const char *file, int lineno, const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -286,7 +271,7 @@ return 0; } #else -static int __debug(char *file, int lineno, char *func, char *fmt, ...) +static int __debug(const char *file, int lineno, const char *func, const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -825,13 +810,15 @@ { int res; #ifdef DEBUG_SUPPORT - struct ast_iax2_full_hdr *h = (struct ast_iax2_full_hdr *)(f->data); + if (debug) { + struct ast_iax2_full_hdr *h = (struct ast_iax2_full_hdr *)(f->data); - if (ntohs(h->scallno) & IAX_FLAG_FULL) - iax_showframe(f, NULL, 0, f->transfer ? - &(f->session->transfer) : - &(f->session->peeraddr), - f->datalen - sizeof(struct ast_iax2_full_hdr)); + if (ntohs(h->scallno) & IAX_FLAG_FULL) + iax_showframe(f, NULL, 0, f->transfer ? + &(f->session->transfer) : + &(f->session->peeraddr), + f->datalen - sizeof(struct ast_iax2_full_hdr)); + } #endif /* Send the frame raw */ res = f->session->sendto(netfd, (const char *) f->data, f->datalen, IAX_SOCKOPTS, @@ -2494,7 +2481,8 @@ } #ifdef DEBUG_SUPPORT - iax_showframe(NULL, fh, 1, sin, datalen); + if (debug) + iax_showframe(NULL, fh, 1, sin, datalen); #endif /* Get things going with it, timestamp wise, if we This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |