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 
00026 /*! \file */
00027 
00028 #if !defined(_SPANDSP_PRIVATE_T38_GATEWAY_H_)
00029 #define _SPANDSP_PRIVATE_T38_GATEWAY_H_
00030 
00031 /*!
00032     T.38 gateway T.38 side channel descriptor.
00033 */
00034 typedef struct
00035 {
00036     /*! \brief Core T.38 IFP support */
00037     t38_core_state_t t38;
00038 
00039     /*! \brief TRUE if the NSF, NSC, and NSS are to be suppressed by altering
00040                their contents to something the far end will not recognise. */
00041     int suppress_nsx_len[2];
00042     /*! \brief TRUE if we need to corrupt the HDLC frame in progress, so the receiver cannot
00043                interpret it. The two values are for the two directions. */
00044     int corrupt_current_frame[2];
00045 
00046     /*! \brief the current class of field being received - i.e. none, non-ECM or HDLC */
00047     int current_rx_field_class;
00048     /*! \brief The T.38 indicator currently in use */
00049     int in_progress_rx_indicator;
00050 
00051     /*! \brief The current T.38 data type being sent. */
00052     int current_tx_data_type;
00053 } t38_gateway_t38_state_t;
00054 
00055 /*!
00056     T.38 gateway audio side channel descriptor.
00057 */
00058 typedef struct
00059 {
00060     /*! \brief The FAX modem set for the audio side fo the gateway. */
00061     fax_modems_state_t modems;
00062     /*! \brief The current receive signal handler. Actual receiving hops between this
00063                and a dummy receive routine. */
00064     span_rx_handler_t *base_rx_handler;
00065     span_rx_fillin_handler_t *base_rx_fillin_handler;
00066 } t38_gateway_audio_state_t;
00067 
00068 /*!
00069     T.38 gateway T.38 side state.
00070 */
00071 typedef struct
00072 {
00073     /*! \brief non-ECM and HDLC modem receive data buffer. */
00074     uint8_t data[T38_RX_BUF_LEN];
00075     /*! \brief Current pointer into the data buffer. */
00076     int data_ptr;
00077     /*! \brief The current octet being received as non-ECM data. */
00078     unsigned int bit_stream;
00079     /*! \brief The number of bits taken from the modem for the current scan row. This
00080                is used during non-ECM transmission will fill bit removal to see that
00081                T.38 packet transmissions do not stretch too far apart. */
00082     int bits_absorbed;
00083     /*! \brief The current bit number in the current non-ECM octet. */
00084     int bit_no;
00085     /*! \brief Progressively calculated CRC for HDLC messages received from a modem. */
00086     uint16_t crc;
00087     /*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */
00088     int fill_bit_removal;
00089     /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
00090                rate and the current specified packet interval. */
00091     int octets_per_data_packet;
00092 
00093     /*! \brief Bits into the non-ECM buffer */
00094     int in_bits;
00095     /*! \brief Octets fed out from the non-ECM buffer */
00096     int out_octets;
00097 } t38_gateway_to_t38_state_t;
00098 
00099 /*!
00100     T.38 gateway HDLC buffer.
00101 */
00102 typedef struct
00103 {
00104     /*! \brief HDLC message buffers. */
00105     uint8_t buf[T38_MAX_HDLC_LEN];
00106     /*! \brief HDLC message lengths. */
00107     int len;
00108     /*! \brief HDLC message status flags. */
00109     int flags;
00110     /*! \brief HDLC buffer contents. */
00111     int contents;
00112 } t38_gateway_hdlc_buf_t;
00113 
00114 /*!
00115     T.38 gateway HDLC state.
00116 */
00117 typedef struct
00118 {
00119     /*! \brief HDLC message buffers. */
00120     t38_gateway_hdlc_buf_t buf[T38_TX_HDLC_BUFS];
00121 #if 0
00122     /*! \brief HDLC message buffers. */
00123     uint8_t buf[T38_TX_HDLC_BUFS][T38_MAX_HDLC_LEN];
00124     /*! \brief HDLC message lengths. */
00125     int len[T38_TX_HDLC_BUFS];
00126     /*! \brief HDLC message status flags. */
00127     int flags[T38_TX_HDLC_BUFS];
00128     /*! \brief HDLC buffer contents. */
00129     int contents[T38_TX_HDLC_BUFS];
00130 #endif
00131     /*! \brief HDLC buffer number for input. */
00132     int in;
00133     /*! \brief HDLC buffer number for output. */
00134     int out;
00135 } t38_gateway_hdlc_state_t;
00136 
00137 /*!
00138     T.38 gateway core descriptor.
00139 */
00140 typedef struct
00141 {
00142     /*! \brief A bit mask of the currently supported modem types. */
00143     int supported_modems;
00144     /*! \brief TRUE if ECM FAX mode is allowed through the gateway. */
00145     int ecm_allowed;
00146     /*! \brief Required time between T.38 transmissions, in ms. */
00147     int ms_per_tx_chunk;
00148 
00149     /*! \brief TRUE if in image data modem is to use short training. This usually
00150                follows image_data_mode, but in ECM mode T.30 defines recovery
00151                conditions in which long training is used for image data. */
00152     int short_train;
00153     /*! \brief TRUE if in image data mode, as opposed to TCF mode. */
00154     int image_data_mode;
00155     /*! \brief The minimum permitted bits per FAX scan line row. */
00156     int min_row_bits;
00157 
00158     /*! \brief TRUE if we should count the next MCF as a page end, else FALSE */
00159     int count_page_on_mcf;
00160     /*! \brief The number of pages for which a confirm (MCF) message was returned. */
00161     int pages_confirmed;
00162 
00163     /*! \brief TRUE if we are in error correcting (ECM) mode */
00164     int ecm_mode;
00165     /*! \brief The current bit rate for the fast modem. */
00166     int fast_bit_rate;
00167     /*! \brief The current fast receive modem type. */
00168     int fast_rx_modem;
00169     /*! \brief The type of fast receive modem currently active, which may be T38_NONE */
00170     int fast_rx_active;
00171 
00172     /*! \brief The current timed operation. */
00173     int timed_mode;
00174     /*! \brief The number of samples until the next timeout event */
00175     int samples_to_timeout;
00176 
00177     /*! Buffer for HDLC and non-ECM data going to the T.38 channel */
00178     t38_gateway_to_t38_state_t to_t38;
00179     /*! Buffer for data going to an HDLC modem. */
00180     t38_gateway_hdlc_state_t hdlc_to_modem;
00181     /*! Buffer for data going to a non-ECM mode modem. */
00182     t38_non_ecm_buffer_state_t non_ecm_to_modem;
00183 
00184     /*! \brief A pointer to a callback routine to be called when frames are
00185         exchanged. */
00186     t38_gateway_real_time_frame_handler_t *real_time_frame_handler;
00187     /*! \brief An opaque pointer supplied in real time frame callbacks. */
00188     void *real_time_frame_user_data;
00189 } t38_gateway_core_state_t;
00190 
00191 /*!
00192     T.38 gateway state.
00193 */
00194 struct t38_gateway_state_s
00195 {
00196     /*! T.38 side state */
00197     t38_gateway_t38_state_t t38x;
00198     /*! Audio side state */
00199     t38_gateway_audio_state_t audio;
00200     /*! T.38 core state */
00201     t38_gateway_core_state_t core;
00202 
00203     /*! \brief Error and flow logging control */
00204     logging_state_t logging;
00205 };
00206 
00207 #endif
00208 /*- End of file ------------------------------------------------------------*/

Generated on 25 Jan 2012 for spandsp by  doxygen 1.6.1