private/t38_gateway.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/t38_gateway.h - A T.38, less the packet exchange part
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2005, 2006, 2007 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 2.1,
00014  * as published by the Free Software Foundation.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  *
00025  * $Id: t38_gateway.h,v 1.1 2008/10/13 13:14:01 steveu Exp $
00026  */
00027 
00028 /*! \file */
00029 
00030 #if !defined(_SPANDSP_PRIVATE_T38_GATEWAY_H_)
00031 #define _SPANDSP_PRIVATE_T38_GATEWAY_H_
00032 
00033 /*!
00034     T.38 gateway T.38 side channel descriptor.
00035 */
00036 typedef struct
00037 {
00038     /*! Core T.38 IFP support */
00039     t38_core_state_t t38;
00040 
00041     /*! \brief TRUE if the NSF, NSC, and NSS are to be suppressed by altering
00042                their contents to something the far end will not recognise. */
00043     int suppress_nsx_len[2];
00044     /*! \brief TRUE if we need to corrupt the HDLC frame in progress, so the receiver cannot
00045                interpret it. The two values are for the two directions. */
00046     int corrupt_current_frame[2];
00047 
00048     /*! \brief the current class of field being received - i.e. none, non-ECM or HDLC */
00049     int current_rx_field_class;
00050     /*! \brief The T.38 indicator currently in use */
00051     int in_progress_rx_indicator;
00052 
00053     /*! \brief The current T.38 data type being sent. */
00054     int current_tx_data_type;
00055 } t38_gateway_t38_state_t;
00056 
00057 /*!
00058     T.38 gateway audio side channel descriptor.
00059 */
00060 typedef struct
00061 {
00062     fax_modems_state_t modems;
00063     /*! \brief The current receive signal handler. Actual receiving hop between this
00064                and a dummy receive routine. */
00065     span_rx_handler_t *base_rx_handler;
00066 } t38_gateway_audio_state_t;
00067 
00068 typedef struct
00069 {
00070     /*! \brief non-ECM and HDLC modem receive data buffer. */
00071     uint8_t data[T38_RX_BUF_LEN];
00072     /*! \brief Current pointer into the data buffer. */
00073     int data_ptr;
00074     /*! \brief The current octet being received as non-ECM data. */
00075     unsigned int bit_stream;
00076     /*! \brief The number of bits taken from the modem for the current scan row. This
00077                is used during non-ECM transmission will fill bit removal to see that
00078                T.38 packet transmissions do not stretch too far apart. */
00079     int bits_absorbed;
00080     /*! \brief The current bit number in the current non-ECM octet. */
00081     int bit_no;
00082     /*! \brief Progressively calculated CRC for HDLC messages received from a modem. */
00083     uint16_t crc;
00084     /*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */
00085     int fill_bit_removal;
00086     /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
00087                rate and the current specified packet interval. */
00088     int octets_per_data_packet;
00089 
00090     int in_bits;
00091     int out_octets;
00092 } t38_gateway_to_t38_state_t;
00093 
00094 typedef struct
00095 {
00096     /*! \brief HDLC message buffers. */
00097     uint8_t buf[T38_MAX_HDLC_LEN];
00098     /*! \brief HDLC message lengths. */
00099     int len;
00100     /*! \brief HDLC message status flags. */
00101     int flags;
00102     /*! \brief HDLC buffer contents. */
00103     int contents;
00104 } t38_gateway_hdlc_buf_t;
00105 
00106 typedef struct
00107 {
00108     /*! \brief HDLC message buffers. */
00109     t38_gateway_hdlc_buf_t buf[T38_TX_HDLC_BUFS];
00110 #if 0
00111     /*! \brief HDLC message buffers. */
00112     uint8_t buf[T38_TX_HDLC_BUFS][T38_MAX_HDLC_LEN];
00113     /*! \brief HDLC message lengths. */
00114     int len[T38_TX_HDLC_BUFS];
00115     /*! \brief HDLC message status flags. */
00116     int flags[T38_TX_HDLC_BUFS];
00117     /*! \brief HDLC buffer contents. */
00118     int contents[T38_TX_HDLC_BUFS];
00119 #endif
00120     /*! \brief HDLC buffer number for input. */
00121     int in;
00122     /*! \brief HDLC buffer number for output. */
00123     int out;
00124 } t38_gateway_hdlc_state_t;
00125 
00126 /*!
00127     T.38 gateway core descriptor.
00128 */
00129 typedef struct
00130 {
00131     /*! \brief A bit mask of the currently supported modem types. */
00132     int supported_modems;
00133     /*! \brief TRUE if ECM FAX mode is allowed through the gateway. */
00134     int ecm_allowed;
00135 
00136     /*! \brief TRUE if in image data modem is to use short training. This usually
00137                follows image_data_mode, but in ECM mode T.30 defines recovery
00138                conditions in which long training is used for image data. */
00139     int short_train;
00140     /*! \brief TRUE if in image data mode, as opposed to TCF mode. */
00141     int image_data_mode;
00142     /*! \brief The minimum permitted bits per FAX scan line row. */
00143     int min_row_bits;
00144 
00145     /*! \brief TRUE if we should count the next MCF as a page end, else FALSE */
00146     int count_page_on_mcf;
00147     /*! \brief The number of pages for which a confirm (MCF) message was returned. */
00148     int pages_confirmed;
00149 
00150     /*! \brief TRUE if we are in error correcting (ECM) mode */
00151     int ecm_mode;
00152     /*! \brief The current bit rate for the fast modem. */
00153     int fast_bit_rate;
00154     /*! \brief The current fast modem type. */
00155     int fast_modem;
00156     /*! \brief The type of fast receive modem currently active, which may be T38_NONE */
00157     int fast_rx_active;
00158 
00159     /*! \brief TRUE if between DCS and TCF, and we want the fast image modem to
00160                start in the T.38 data at a predictable time from the end of the
00161                V.21 signal. */
00162     int tcf_mode_predictable_modem_start;
00163 
00164     /*! \brief The number of samples until the next timeout event */
00165     int samples_to_timeout;
00166 
00167     /*! Buffer for HDLC and non-ECM data going to the T.38 channel */
00168     t38_gateway_to_t38_state_t to_t38;
00169     /*! Buffer for data going to an HDLC modem. */
00170     t38_gateway_hdlc_state_t hdlc_to_modem;
00171     /*! Buffer for data going to a non-ECM mode modem. */
00172     t38_non_ecm_buffer_state_t non_ecm_to_modem;
00173 
00174     /*! \brief A pointer to a callback routine to be called when frames are
00175         exchanged. */
00176     t38_gateway_real_time_frame_handler_t *real_time_frame_handler;
00177     /*! \brief An opaque pointer supplied in real time frame callbacks. */
00178     void *real_time_frame_user_data;
00179 } t38_gateway_core_state_t;
00180 
00181 /*!
00182     T.38 gateway state.
00183 */
00184 struct t38_gateway_state_s
00185 {
00186     t38_gateway_t38_state_t t38x;
00187     t38_gateway_audio_state_t audio;
00188     t38_gateway_core_state_t core;
00189 
00190     /*! \brief Error and flow logging control */
00191     logging_state_t logging;
00192 };
00193 
00194 #endif
00195 /*- End of file ------------------------------------------------------------*/

Generated on Thu Feb 12 14:16:07 2009 for spandsp by  doxygen 1.5.5