diff --git a/libs/spandsp/spandsp-sim/make_line_models.c b/libs/spandsp/spandsp-sim/make_line_models.c index 62a46f38b3..aabbfd2602 100644 --- a/libs/spandsp/spandsp-sim/make_line_models.c +++ b/libs/spandsp/spandsp-sim/make_line_models.c @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: make_line_models.c,v 1.8 2009/02/03 16:28:39 steveu Exp $ + * $Id: make_line_models.c,v 1.9 2009/02/10 17:49:20 steveu Exp $ */ /*! \page make_line_models_page Telephony line model construction @@ -37,22 +37,23 @@ #include "config.h" #endif +#include <stdlib.h> +#include <unistd.h> #include <inttypes.h> #include <string.h> #include <stdio.h> -#include <stdlib.h> -#if defined(HAVE_TGMATH_H) -#include <tgmath.h> -#endif -#if defined(HAVE_MATH_H) -#include <math.h> -#endif #include "floating_fudge.h" #if defined(HAVE_FFTW3_H) #include <fftw3.h> #else #include <fftw.h> #endif +#if defined(HAVE_TGMATH_H) +#include <tgmath.h> +#endif +#if defined(HAVE_MATH_H) +#include <math.h> +#endif #include "spandsp.h" diff --git a/libs/spandsp/src/hdlc.c b/libs/spandsp/src/hdlc.c index 328838dd4e..221debb5e6 100644 --- a/libs/spandsp/src/hdlc.c +++ b/libs/spandsp/src/hdlc.c @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: hdlc.c,v 1.70 2009/02/10 13:06:46 steveu Exp $ + * $Id: hdlc.c,v 1.71 2009/02/12 12:38:39 steveu Exp $ */ /*! \file */ @@ -43,10 +43,19 @@ #include "spandsp/hdlc.h" #include "spandsp/private/hdlc.h" -static void rx_special_condition(hdlc_rx_state_t *s, int condition) +static void report_status_change(hdlc_rx_state_t *s, int status) +{ + if (s->status_handler) + s->status_handler(s->status_user_data, status); + else if (s->frame_handler) + s->frame_handler(s->frame_user_data, NULL, status, TRUE); +} +/*- End of function --------------------------------------------------------*/ + +static void rx_special_condition(hdlc_rx_state_t *s, int status) { /* Special conditions */ - switch (condition) + switch (status) { case SIG_STATUS_CARRIER_UP: case SIG_STATUS_TRAINING_SUCCEEDED: @@ -61,7 +70,7 @@ static void rx_special_condition(hdlc_rx_state_t *s, int condition) case SIG_STATUS_TRAINING_FAILED: case SIG_STATUS_CARRIER_DOWN: case SIG_STATUS_END_OF_DATA: - s->frame_handler(s->user_data, NULL, condition, TRUE); + report_status_change(s, status); break; default: //printf("Eh!\n"); @@ -82,7 +91,7 @@ static __inline__ void octet_set_and_count(hdlc_rx_state_t *s) if (--s->octet_count <= 0) { s->octet_count = s->octet_count_report_interval; - s->frame_handler(s->user_data, NULL, SIG_STATUS_OCTET_REPORT, TRUE); + report_status_change(s, SIG_STATUS_OCTET_REPORT); } } else @@ -105,7 +114,7 @@ static __inline__ void octet_count(hdlc_rx_state_t *s) if (--s->octet_count <= 0) { s->octet_count = s->octet_count_report_interval; - s->frame_handler(s->user_data, NULL, SIG_STATUS_OCTET_REPORT, TRUE); + report_status_change(s, SIG_STATUS_OCTET_REPORT); } } } @@ -117,7 +126,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s) { /* Hit HDLC abort */ s->rx_aborts++; - s->frame_handler(s->user_data, NULL, SIG_STATUS_ABORT, TRUE); + report_status_change(s, SIG_STATUS_ABORT); /* If we have not yet seen enough flags, restart the count. If we are beyond that point, just back off one step, so we need to see another flag before proceeding to collect frame octets. */ @@ -147,7 +156,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s) s->rx_frames++; s->rx_bytes += s->len - s->crc_bytes; s->len -= s->crc_bytes; - s->frame_handler(s->user_data, s->buffer, s->len, TRUE); + s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE); } else { @@ -155,7 +164,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s) if (s->report_bad_frames) { s->len -= s->crc_bytes; - s->frame_handler(s->user_data, s->buffer, s->len, FALSE); + s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE); } } } @@ -170,7 +179,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s) s->len -= s->crc_bytes; else s->len = 0; - s->frame_handler(s->user_data, s->buffer, s->len, FALSE); + s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE); } s->rx_length_errors++; } @@ -194,7 +203,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s) } if (++s->flags_seen >= s->framing_ok_threshold && !s->framing_ok_announced) { - s->frame_handler(s->user_data, NULL, SIG_STATUS_FRAMING_OK, TRUE); + report_status_change(s, SIG_STATUS_FRAMING_OK); s->framing_ok_announced = TRUE; } } @@ -309,7 +318,7 @@ SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s, } memset(s, 0, sizeof(*s)); s->frame_handler = handler; - s->user_data = user_data; + s->frame_user_data = user_data; s->crc_bytes = (crc32) ? 4 : 2; s->report_bad_frames = report_bad_frames; s->framing_ok_threshold = (framing_ok_threshold < 1) ? 1 : framing_ok_threshold; @@ -318,6 +327,20 @@ SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s, } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(void) hdlc_rx_set_frame_handler(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data) +{ + s->frame_handler = handler; + s->frame_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data) +{ + s->status_handler = handler; + s->status_user_data = user_data; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s) { return 0; diff --git a/libs/spandsp/src/logging.c b/libs/spandsp/src/logging.c index 9017a0c226..2ca54a1d26 100644 --- a/libs/spandsp/src/logging.c +++ b/libs/spandsp/src/logging.c @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: logging.c,v 1.31 2009/02/10 13:06:46 steveu Exp $ + * $Id: logging.c,v 1.32 2009/02/10 17:44:18 steveu Exp $ */ /*! \file */ @@ -241,7 +241,7 @@ SPAN_DECLARE(void) span_set_error_handler(error_handler_func_t func) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) span_log_init(logging_state_t *s, int level, const char *tag) +SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, const char *tag) { if (s == NULL) { @@ -256,7 +256,7 @@ SPAN_DECLARE(int) span_log_init(logging_state_t *s, int level, const char *tag) s->samples_per_second = SAMPLE_RATE; s->elapsed_samples = 0; - return 0; + return s; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/msvc/spandsp.h b/libs/spandsp/src/msvc/spandsp.h index c454e38d97..c46a5257a2 100644 --- a/libs/spandsp/src/msvc/spandsp.h +++ b/libs/spandsp/src/msvc/spandsp.h @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: spandsp.h.in,v 1.16 2009/02/03 16:28:40 steveu Exp $ + * $Id: spandsp.h.in,v 1.17 2009/02/12 12:38:39 steveu Exp $ */ /*! \file */ @@ -69,8 +69,8 @@ #include <spandsp/echo.h> #include <spandsp/modem_echo.h> #include <spandsp/crc.h> -#include <spandsp/hdlc.h> #include <spandsp/async.h> +#include <spandsp/hdlc.h> #include <spandsp/noise.h> #include <spandsp/saturated.h> #include <spandsp/time_scale.h> diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in index 0744559ab0..f0be865e25 100644 --- a/libs/spandsp/src/spandsp.h.in +++ b/libs/spandsp/src/spandsp.h.in @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: spandsp.h.in,v 1.16 2009/02/03 16:28:40 steveu Exp $ + * $Id: spandsp.h.in,v 1.17 2009/02/12 12:38:39 steveu Exp $ */ /*! \file */ @@ -69,8 +69,8 @@ #include <spandsp/echo.h> #include <spandsp/modem_echo.h> #include <spandsp/crc.h> -#include <spandsp/hdlc.h> #include <spandsp/async.h> +#include <spandsp/hdlc.h> #include <spandsp/noise.h> #include <spandsp/saturated.h> #include <spandsp/time_scale.h> diff --git a/libs/spandsp/src/spandsp/async.h b/libs/spandsp/src/spandsp/async.h index a167618b37..4584e13181 100644 --- a/libs/spandsp/src/spandsp/async.h +++ b/libs/spandsp/src/spandsp/async.h @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: async.h,v 1.23 2009/02/10 13:06:47 steveu Exp $ + * $Id: async.h,v 1.24 2009/02/12 12:38:39 steveu Exp $ */ /*! \file */ @@ -100,10 +100,10 @@ typedef void (*put_bit_func_t)(void *user_data, int bit); typedef int (*get_bit_func_t)(void *user_data); /*! Completion callback function for tx data pumps */ -typedef int (*modem_tx_status_func_t)(void *user_data, int status); +typedef void (*modem_tx_status_func_t)(void *user_data, int status); /*! Completion callback function for rx data pumps */ -typedef int (*modem_rx_status_func_t)(void *user_data, int status); +typedef void (*modem_rx_status_func_t)(void *user_data, int status); enum { diff --git a/libs/spandsp/src/spandsp/hdlc.h b/libs/spandsp/src/spandsp/hdlc.h index 145234ec57..47ae1ca164 100644 --- a/libs/spandsp/src/spandsp/hdlc.h +++ b/libs/spandsp/src/spandsp/hdlc.h @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: hdlc.h,v 1.43 2009/02/10 13:06:47 steveu Exp $ + * $Id: hdlc.h,v 1.44 2009/02/12 12:38:39 steveu Exp $ */ /*! \file */ @@ -101,8 +101,32 @@ SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data); +/*! Change the put_bit function associated with an HDLC receiver context. + \brief Change the put_bit function associated with an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \param handler The function to be called when a good HDLC frame is received. + \param user_data An opaque parameter for the callback routine. +*/ +SPAN_DECLARE(void) hdlc_rx_set_frame_handler(hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data); + +/*! Change the status report function associated with an HDLC receiver context. + \brief Change the status report function associated with an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \param handler The callback routine used to report status changes. + \param user_data An opaque parameter for the callback routine. +*/ +SPAN_DECLARE(void) hdlc_rx_set_status_handler(hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data); + +/*! Release an HDLC receiver context. + \brief Release an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \return 0 for OK */ SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s); +/*! Free an HDLC receiver context. + \brief Free an HDLC receiver context. + \param s A pointer to an HDLC receiver context. + \return 0 for OK */ SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s); /*! \brief Set the maximum frame length for an HDLC receiver context. diff --git a/libs/spandsp/src/spandsp/logging.h b/libs/spandsp/src/spandsp/logging.h index db36fdbf74..9a93f82394 100644 --- a/libs/spandsp/src/spandsp/logging.h +++ b/libs/spandsp/src/spandsp/logging.h @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: logging.h,v 1.19 2009/02/10 13:06:47 steveu Exp $ + * $Id: logging.h,v 1.20 2009/02/10 17:44:18 steveu Exp $ */ /*! \file */ @@ -127,7 +127,7 @@ SPAN_DECLARE(void) span_set_message_handler(message_handler_func_t func); SPAN_DECLARE(void) span_set_error_handler(error_handler_func_t func); -SPAN_DECLARE(int) span_log_init(logging_state_t *s, int level, const char *tag); +SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, const char *tag); SPAN_DECLARE(int) span_log_release(logging_state_t *s); diff --git a/libs/spandsp/src/spandsp/private/hdlc.h b/libs/spandsp/src/spandsp/private/hdlc.h index 17c9955fec..f3ffb6c290 100644 --- a/libs/spandsp/src/spandsp/private/hdlc.h +++ b/libs/spandsp/src/spandsp/private/hdlc.h @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: hdlc.h,v 1.2 2009/01/31 08:48:11 steveu Exp $ + * $Id: hdlc.h,v 1.3 2009/02/12 12:38:39 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_HDLC_H_) @@ -39,8 +39,12 @@ struct hdlc_rx_state_s size_t max_frame_len; /*! \brief The callback routine called to process each good received frame. */ hdlc_frame_handler_t frame_handler; - /*! \brief An opaque parameter passed to the callback routine. */ - void *user_data; + /*! \brief An opaque parameter passed to the frame callback routine. */ + void *frame_user_data; + /*! \brief The callback routine called to report status changes. */ + modem_rx_status_func_t status_handler; + /*! \brief An opaque parameter passed to the status callback routine. */ + void *status_user_data; /*! \brief TRUE if bad frames are to be reported. */ int report_bad_frames; /*! \brief The number of consecutive flags which must be seen before framing is diff --git a/libs/spandsp/src/spandsp/private/t31.h b/libs/spandsp/src/spandsp/private/t31.h index 0d349d7f73..c061e0121a 100644 --- a/libs/spandsp/src/spandsp/private/t31.h +++ b/libs/spandsp/src/spandsp/private/t31.h @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: t31.h,v 1.6 2009/01/16 15:13:16 steveu Exp $ + * $Id: t31.h,v 1.7 2009/02/12 12:38:39 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_T31_H_) @@ -103,6 +103,10 @@ typedef struct int extra_bits; } hdlc_tx; + /*! \brief TRUE if we are using ECM mode. This is used to select HDLC faking, necessary + with clunky class 1 modems. */ + int ecm_mode; + /*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */ int non_ecm_trailer_bytes; diff --git a/libs/spandsp/src/spandsp/version.h b/libs/spandsp/src/spandsp/version.h index 3c83ec5634..a2f63979da 100644 --- a/libs/spandsp/src/spandsp/version.h +++ b/libs/spandsp/src/spandsp/version.h @@ -30,8 +30,8 @@ /* The date and time of the version are in UTC form. */ -#define SPANDSP_RELEASE_DATE 20090210 -#define SPANDSP_RELEASE_TIME 172413 +#define SPANDSP_RELEASE_DATE 20090212 +#define SPANDSP_RELEASE_TIME 142337 #endif /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/super_tone_tx.c b/libs/spandsp/src/super_tone_tx.c index a54d3fdd69..1d1beee280 100644 --- a/libs/spandsp/src/super_tone_tx.c +++ b/libs/spandsp/src/super_tone_tx.c @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: super_tone_tx.c,v 1.29 2009/02/10 13:06:46 steveu Exp $ + * $Id: super_tone_tx.c,v 1.30 2009/02/10 17:44:18 steveu Exp $ */ /*! \file */ @@ -120,7 +120,7 @@ SPAN_DECLARE(int) super_tone_tx_free_tone(super_tone_tx_step_t *s) { /* Follow nesting... */ if (s->nest) - super_tone_tx_free(s->nest); + super_tone_tx_free_tone(s->nest); t = s; s = s->next; free(t); diff --git a/libs/spandsp/src/t31.c b/libs/spandsp/src/t31.c index ce048e6562..be2390614c 100644 --- a/libs/spandsp/src/t31.c +++ b/libs/spandsp/src/t31.c @@ -25,7 +25,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: t31.c,v 1.140 2009/02/10 13:06:46 steveu Exp $ + * $Id: t31.c,v 1.142 2009/02/12 14:14:58 steveu Exp $ */ /*! \file */ @@ -82,6 +82,7 @@ #include "spandsp/at_interpreter.h" #include "spandsp/fax_modems.h" #include "spandsp/t31.h" +#include "spandsp/t30_fcf.h" #include "spandsp/private/logging.h" #include "spandsp/private/t38_core.h" @@ -115,9 +116,24 @@ typedef const char *(*at_cmd_service_t)(t31_state_t *s, const char *cmd); -#define ETX 0x03 -#define DLE 0x10 -#define SUB 0x1A +enum +{ + ETX = 0x03, + DLE = 0x10, + SUB = 0x1A +}; + +enum +{ + DISBIT1 = 0x01, + DISBIT2 = 0x02, + DISBIT3 = 0x04, + DISBIT4 = 0x08, + DISBIT5 = 0x10, + DISBIT6 = 0x20, + DISBIT7 = 0x40, + DISBIT8 = 0x80 +}; /* BEWARE: right now this must match up with a list in the AT interpreter code. */ enum @@ -159,12 +175,17 @@ enum T38_TIMED_STEP_HDLC_MODEM_3 = 0x22, T38_TIMED_STEP_HDLC_MODEM_4 = 0x23, T38_TIMED_STEP_HDLC_MODEM_5 = 0x24, - T38_TIMED_STEP_CED = 0x30, - T38_TIMED_STEP_CED_2 = 0x31, - T38_TIMED_STEP_CED_3 = 0x32, - T38_TIMED_STEP_CNG = 0x40, - T38_TIMED_STEP_CNG_2 = 0x41, - T38_TIMED_STEP_PAUSE = 0x50 + T38_TIMED_STEP_FAKE_HDLC_MODEM = 0x30, + T38_TIMED_STEP_FAKE_HDLC_MODEM_2 = 0x31, + T38_TIMED_STEP_FAKE_HDLC_MODEM_3 = 0x32, + T38_TIMED_STEP_FAKE_HDLC_MODEM_4 = 0x33, + T38_TIMED_STEP_FAKE_HDLC_MODEM_5 = 0x34, + T38_TIMED_STEP_CED = 0x40, + T38_TIMED_STEP_CED_2 = 0x41, + T38_TIMED_STEP_CED_3 = 0x42, + T38_TIMED_STEP_CNG = 0x50, + T38_TIMED_STEP_CNG_2 = 0x51, + T38_TIMED_STEP_PAUSE = 0x60 }; static int restart_modem(t31_state_t *s, int new_modem); @@ -186,6 +207,30 @@ static __inline__ void t31_set_at_rx_mode(t31_state_t *s, int new_mode) } /*- End of function --------------------------------------------------------*/ +#if 0 +static void monitor_control_messages(t31_state_t *s, const uint8_t *buf, int len) +{ + /* Monitor the control messages, at the point where we have the whole message, so we can + see what is happening to things like training success/failure. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Monitoring %s\n", t30_frametype(buf[2])); + if (len < 3) + return; + /*endif*/ + switch (buf[2]) + { + case T30_DCS: + case T30_DCS | 1: + /* We need to know if ECM is about to be used, so we can fake HDLC stuff. */ + s->t38_fe.ecm_mode = (len >= 7) && (buf[6] & DISBIT3); + break; + default: + break; + } + /*endswitch*/ +} +/*- End of function --------------------------------------------------------*/ +#endif + static void front_end_status(t31_state_t *s, int status) { span_log(&s->logging, SPAN_LOG_FLOW, "Front end status %d\n", status); @@ -980,6 +1025,9 @@ SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples) case T38_TIMED_STEP_HDLC_MODEM: delay = stream_hdlc(s); break; + //case T38_TIMED_STEP_FAKE_HDLC_MODEM: + // delay = stream_fake_hdlc(s); + // break; case T38_TIMED_STEP_CED: delay = stream_ced(s); break; @@ -2244,7 +2292,7 @@ static int v29_v21_rx(void *user_data, const int16_t amp[], int len) } /*- End of function --------------------------------------------------------*/ -static void t31_fax_modems_init(fax_modems_state_t *s, int use_tep, void *user_data) +static fax_modems_state_t *t31_fax_modems_init(fax_modems_state_t *s, int use_tep, void *user_data) { s->use_tep = use_tep; @@ -2273,6 +2321,7 @@ static void t31_fax_modems_init(fax_modems_state_t *s, int use_tep, void *user_d s->rx_user_data = NULL; s->tx_handler = (span_tx_handler_t *) &silence_gen; s->tx_user_data = &s->silence_gen; + return s; } /*- End of function --------------------------------------------------------*/ @@ -2458,7 +2507,6 @@ static int t31_t38_fe_init(t31_state_t *t, 2, NULL, NULL); - return 0; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index f47fa4c69b..d591c26422 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -23,7 +23,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: t38_gateway.c,v 1.154 2009/02/10 13:06:46 steveu Exp $ + * $Id: t38_gateway.c,v 1.155 2009/02/12 12:38:39 steveu Exp $ */ /*! \file */ @@ -747,7 +747,10 @@ static void edit_control_messages(t38_gateway_state_t *s, int from_modem, uint8_ } /*- End of function --------------------------------------------------------*/ -static void monitor_control_messages(t38_gateway_state_t *s, int from_modem, uint8_t *buf, int len) +static void monitor_control_messages(t38_gateway_state_t *s, + int from_modem, + const uint8_t *buf, + int len) { static const struct { @@ -1704,7 +1707,7 @@ static void hdlc_rx_status(hdlc_rx_state_t *t, int status) { t38_gateway_state_t *s; - s = (t38_gateway_state_t *) t->user_data; + s = (t38_gateway_state_t *) t->frame_user_data; span_log(&s->logging, SPAN_LOG_FLOW, "HDLC signal status is %s (%d)\n", signal_status_to_str(status), status); switch (status) { @@ -1761,7 +1764,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *t) t38_gateway_state_t *s; t38_gateway_to_t38_state_t *u; - s = (t38_gateway_state_t *) t->user_data; + s = (t38_gateway_state_t *) t->frame_user_data; u = &s->core.to_t38; if ((t->raw_bit_stream & 0x80)) { @@ -1916,7 +1919,7 @@ static void t38_hdlc_rx_put_bit(hdlc_rx_state_t *t, int new_bit) return; } /*endif*/ - s = (t38_gateway_state_t *) t->user_data; + s = (t38_gateway_state_t *) t->frame_user_data; u = &s->core.to_t38; t->buffer[t->len] = (uint8_t) t->byte_in_progress; /* Calculate the CRC progressively, before we start altering the frame */ diff --git a/libs/spandsp/tests/fax_tester.c b/libs/spandsp/tests/fax_tester.c index b2491d0929..4ce830a32b 100644 --- a/libs/spandsp/tests/fax_tester.c +++ b/libs/spandsp/tests/fax_tester.c @@ -22,7 +22,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: fax_tester.c,v 1.21 2009/01/28 03:41:27 steveu Exp $ + * $Id: fax_tester.c,v 1.22 2009/02/12 12:38:39 steveu Exp $ */ /*! \file */ @@ -146,7 +146,7 @@ static void hdlc_underflow_handler(void *user_data) } /*- End of function --------------------------------------------------------*/ -static int modem_tx_status(void *user_data, int status) +static void modem_tx_status(void *user_data, int status) { faxtester_state_t *s; @@ -158,7 +158,6 @@ static int modem_tx_status(void *user_data, int status) front_end_step_complete(s); break; } - return 0; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/tests/fsk_tests.c b/libs/spandsp/tests/fsk_tests.c index cb05e9a988..c100aa5c8d 100644 --- a/libs/spandsp/tests/fsk_tests.c +++ b/libs/spandsp/tests/fsk_tests.c @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: fsk_tests.c,v 1.53 2008/11/30 10:17:31 steveu Exp $ + * $Id: fsk_tests.c,v 1.55 2009/02/12 14:21:16 steveu Exp $ */ /*! \page fsk_tests_page FSK modem tests @@ -69,17 +69,15 @@ both_ways_line_model_state_t *model; int rx_bits = 0; int cutoff_test_carrier = FALSE; -static int rx_status(void *user_data, int status) +static void rx_status(void *user_data, int status) { printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status); - return 0; } /*- End of function --------------------------------------------------------*/ -static int tx_status(void *user_data, int status) +static void tx_status(void *user_data, int status) { printf("FSK tx status is %s (%d)\n", signal_status_to_str(status), status); - return 0; } /*- End of function --------------------------------------------------------*/ @@ -95,7 +93,7 @@ static void put_bit(void *user_data, int bit) } /*- End of function --------------------------------------------------------*/ -static int cutoff_test_rx_status(void *user_data, int status) +static void cutoff_test_rx_status(void *user_data, int status) { printf("FSK rx status is %s (%d)\n", signal_status_to_str(status), status); switch (status) @@ -107,7 +105,6 @@ static int cutoff_test_rx_status(void *user_data, int status) cutoff_test_carrier = FALSE; break; } - return 0; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/tests/logging_tests.c b/libs/spandsp/tests/logging_tests.c index 2a7aba60d5..18351ad091 100644 --- a/libs/spandsp/tests/logging_tests.c +++ b/libs/spandsp/tests/logging_tests.c @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: logging_tests.c,v 1.15 2008/11/30 13:44:35 steveu Exp $ + * $Id: logging_tests.c,v 1.16 2009/02/12 12:38:39 steveu Exp $ */ /*! \page logging_tests_page Logging tests @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) struct timespec delay; /* Set up a logger */ - if (span_log_init(&log, 123, "TAG")) + if (span_log_init(&log, 123, "TAG") == NULL) { fprintf(stderr, "Failed to initialise log.\n"); exit(2); diff --git a/libs/spandsp/tests/make_g168_css.c b/libs/spandsp/tests/make_g168_css.c index 41c9bf4920..b65024c0af 100644 --- a/libs/spandsp/tests/make_g168_css.c +++ b/libs/spandsp/tests/make_g168_css.c @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: make_g168_css.c,v 1.16 2008/11/30 12:38:27 steveu Exp $ + * $Id: make_g168_css.c,v 1.17 2009/02/10 17:49:20 steveu Exp $ */ /*! \page makecss_page CSS construction for G.168 testing @@ -49,9 +49,6 @@ #else #include <fftw.h> #endif -#if defined(HAVE_MATH_H) -#define GEN_CONST -#endif //#if defined(WITH_SPANDSP_INTERNALS) #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES diff --git a/libs/spandsp/tests/super_tone_tx_tests.c b/libs/spandsp/tests/super_tone_tx_tests.c index 541e56950f..8a82b11d92 100644 --- a/libs/spandsp/tests/super_tone_tx_tests.c +++ b/libs/spandsp/tests/super_tone_tx_tests.c @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: super_tone_tx_tests.c,v 1.24 2008/11/30 10:17:31 steveu Exp $ + * $Id: super_tone_tx_tests.c,v 1.25 2009/02/10 17:44:18 steveu Exp $ */ /*! \file */ @@ -202,7 +202,7 @@ static void parse_tone_set(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) super_tone_tx_init(&tone, tone_tree); //printf("Len %p %p %d %d\n", (void *) tone.levels[0], (void *) tone_tree, tone_tree->length, tone_tree->tone); play_tones(&tone, 99999999); - super_tone_tx_free(tone_tree); + super_tone_tx_free_tone(tone_tree); } /*endif*/ cur = cur->next; diff --git a/libs/spandsp/tests/v17_tests.c b/libs/spandsp/tests/v17_tests.c index d26bd46654..1bcf6e7241 100644 --- a/libs/spandsp/tests/v17_tests.c +++ b/libs/spandsp/tests/v17_tests.c @@ -23,7 +23,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: v17_tests.c,v 1.98 2009/01/12 17:20:59 steveu Exp $ + * $Id: v17_tests.c,v 1.100 2009/02/12 14:21:16 steveu Exp $ */ /*! \page v17_tests_page V.17 modem tests @@ -114,7 +114,7 @@ static void reporter(void *user_data, int reason, bert_results_t *results) } /*- End of function --------------------------------------------------------*/ -static int v17_rx_status(void *user_data, int status) +static void v17_rx_status(void *user_data, int status) { v17_rx_state_t *rx; int i; @@ -132,7 +132,6 @@ static int v17_rx_status(void *user_data, int status) printf("%3d (%15.5f, %15.5f) -> %15.5f\n", i, coeffs[i].re, coeffs[i].im, powerf(&coeffs[i])); break; } - return 0; } /*- End of function --------------------------------------------------------*/ @@ -154,10 +153,9 @@ static void v17putbit(void *user_data, int bit) } /*- End of function --------------------------------------------------------*/ -static int v17_tx_status(void *user_data, int status) +static void v17_tx_status(void *user_data, int status) { printf("V.17 tx status is %s (%d)\n", signal_status_to_str(status), status); - return 0; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/tests/v27ter_tests.c b/libs/spandsp/tests/v27ter_tests.c index 388b398d50..23eb6954f3 100644 --- a/libs/spandsp/tests/v27ter_tests.c +++ b/libs/spandsp/tests/v27ter_tests.c @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: v27ter_tests.c,v 1.99 2009/01/12 17:20:59 steveu Exp $ + * $Id: v27ter_tests.c,v 1.101 2009/02/12 14:21:16 steveu Exp $ */ /*! \page v27ter_tests_page V.27ter modem tests @@ -110,10 +110,9 @@ static void reporter(void *user_data, int reason, bert_results_t *results) } /*- End of function --------------------------------------------------------*/ -static int v27ter_rx_status(void *user_data, int status) +static void v27ter_rx_status(void *user_data, int status) { printf("V.27ter rx status is %s (%d)\n", signal_status_to_str(status), status); - return 0; } /*- End of function --------------------------------------------------------*/ @@ -131,10 +130,9 @@ static void v27terputbit(void *user_data, int bit) } /*- End of function --------------------------------------------------------*/ -static int v27ter_tx_status(void *user_data, int status) +static void v27ter_tx_status(void *user_data, int status) { printf("V.27ter tx status is %s (%d)\n", signal_status_to_str(status), status); - return 0; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/tests/v29_tests.c b/libs/spandsp/tests/v29_tests.c index 9b51a5b5b6..344e4cef31 100644 --- a/libs/spandsp/tests/v29_tests.c +++ b/libs/spandsp/tests/v29_tests.c @@ -22,7 +22,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: v29_tests.c,v 1.113 2009/01/12 17:20:59 steveu Exp $ + * $Id: v29_tests.c,v 1.115 2009/02/12 14:21:16 steveu Exp $ */ /*! \page v29_tests_page V.29 modem tests @@ -109,7 +109,7 @@ static void reporter(void *user_data, int reason, bert_results_t *results) } /*- End of function --------------------------------------------------------*/ -static int v29_rx_status(void *user_data, int status) +static void v29_rx_status(void *user_data, int status) { v29_rx_state_t *rx; int i; @@ -139,7 +139,6 @@ static int v29_rx_status(void *user_data, int status) #endif break; } - return 0; } /*- End of function --------------------------------------------------------*/ @@ -161,10 +160,9 @@ static void v29putbit(void *user_data, int bit) } /*- End of function --------------------------------------------------------*/ -static int v29_tx_status(void *user_data, int status) +static void v29_tx_status(void *user_data, int status) { printf("V.29 tx status is %s (%d)\n", signal_status_to_str(status), status); - return 0; } /*- End of function --------------------------------------------------------*/