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 } t38_gateway_audio_state_t; 00063 00064 /*! 00065 T.38 gateway T.38 side state. 00066 */ 00067 typedef struct 00068 { 00069 /*! \brief non-ECM and HDLC modem receive data buffer. */ 00070 uint8_t data[T38_RX_BUF_LEN]; 00071 /*! \brief Current pointer into the data buffer. */ 00072 int data_ptr; 00073 /*! \brief The current octet being received as non-ECM data. */ 00074 unsigned int bit_stream; 00075 /*! \brief The number of bits taken from the modem for the current scan row. This 00076 is used during non-ECM transmission will fill bit removal to see that 00077 T.38 packet transmissions do not stretch too far apart. */ 00078 int bits_absorbed; 00079 /*! \brief The current bit number in the current non-ECM octet. */ 00080 int bit_no; 00081 /*! \brief Progressively calculated CRC for HDLC messages received from a modem. */ 00082 uint16_t crc; 00083 /*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */ 00084 int fill_bit_removal; 00085 /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at 00086 the current rate and the current specified packet interval. */ 00087 int octets_per_data_packet; 00088 00089 /*! \brief Bits into the non-ECM buffer */ 00090 int in_bits; 00091 /*! \brief Octets fed out from the non-ECM buffer */ 00092 int out_octets; 00093 } t38_gateway_to_t38_state_t; 00094 00095 /*! 00096 T.38 gateway HDLC buffer. 00097 */ 00098 typedef struct 00099 { 00100 /*! \brief HDLC message buffers. */ 00101 uint8_t buf[T38_MAX_HDLC_LEN]; 00102 /*! \brief HDLC message lengths. */ 00103 int len; 00104 /*! \brief HDLC message status flags. */ 00105 int flags; 00106 /*! \brief HDLC buffer contents. */ 00107 int contents; 00108 } t38_gateway_hdlc_buf_t; 00109 00110 /*! 00111 T.38 gateway HDLC state. 00112 */ 00113 typedef struct 00114 { 00115 /*! \brief HDLC message buffers. */ 00116 t38_gateway_hdlc_buf_t buf[T38_TX_HDLC_BUFS]; 00117 #if 0 00118 /*! \brief HDLC message buffers. */ 00119 uint8_t buf[T38_TX_HDLC_BUFS][T38_MAX_HDLC_LEN]; 00120 /*! \brief HDLC message lengths. */ 00121 int len[T38_TX_HDLC_BUFS]; 00122 /*! \brief HDLC message status flags. */ 00123 int flags[T38_TX_HDLC_BUFS]; 00124 /*! \brief HDLC buffer contents. */ 00125 int contents[T38_TX_HDLC_BUFS]; 00126 #endif 00127 /*! \brief HDLC buffer number for input. */ 00128 int in; 00129 /*! \brief HDLC buffer number for output. */ 00130 int out; 00131 } t38_gateway_hdlc_state_t; 00132 00133 /*! 00134 T.38 gateway core descriptor. 00135 */ 00136 typedef struct 00137 { 00138 /*! \brief A bit mask of the currently supported modem types. */ 00139 int supported_modems; 00140 /*! \brief TRUE if ECM FAX mode is allowed through the gateway. */ 00141 int ecm_allowed; 00142 /*! \brief Required time between T.38 transmissions, in ms. */ 00143 int ms_per_tx_chunk; 00144 00145 /*! \brief TRUE if in image data modem is to use short training. This usually 00146 follows image_data_mode, but in ECM mode T.30 defines recovery 00147 conditions in which long training is used for image data. */ 00148 int short_train; 00149 /*! \brief TRUE if in image data mode, as opposed to TCF mode. */ 00150 int image_data_mode; 00151 /*! \brief The minimum permitted bits per FAX scan line row. */ 00152 int min_row_bits; 00153 00154 /*! \brief TRUE if we should count the next MCF as a page end, else FALSE */ 00155 int count_page_on_mcf; 00156 /*! \brief The number of pages for which a confirm (MCF) message was returned. */ 00157 int pages_confirmed; 00158 00159 /*! \brief TRUE if we are in error correcting (ECM) mode */ 00160 int ecm_mode; 00161 /*! \brief The current bit rate for the fast modem. */ 00162 int fast_bit_rate; 00163 /*! \brief The current fast receive modem type. */ 00164 int fast_rx_modem; 00165 /*! \brief The type of fast receive modem currently active, which may be T38_NONE */ 00166 int fast_rx_active; 00167 00168 /*! \brief The current timed operation. */ 00169 int timed_mode; 00170 /*! \brief The number of samples until the next timeout event */ 00171 int samples_to_timeout; 00172 00173 /*! Buffer for HDLC and non-ECM data going to the T.38 channel */ 00174 t38_gateway_to_t38_state_t to_t38; 00175 /*! Buffer for data going to an HDLC modem. */ 00176 t38_gateway_hdlc_state_t hdlc_to_modem; 00177 /*! Buffer for data going to a non-ECM mode modem. */ 00178 t38_non_ecm_buffer_state_t non_ecm_to_modem; 00179 00180 /*! \brief A pointer to a callback routine to be called when frames are 00181 exchanged. */ 00182 t38_gateway_real_time_frame_handler_t real_time_frame_handler; 00183 /*! \brief An opaque pointer supplied in real time frame callbacks. */ 00184 void *real_time_frame_user_data; 00185 } t38_gateway_core_state_t; 00186 00187 /*! 00188 T.38 gateway state. 00189 */ 00190 struct t38_gateway_state_s 00191 { 00192 /*! T.38 side state */ 00193 t38_gateway_t38_state_t t38x; 00194 /*! Audio side state */ 00195 t38_gateway_audio_state_t audio; 00196 /*! T.38 core state */ 00197 t38_gateway_core_state_t core; 00198 00199 /*! \brief Error and flow logging control */ 00200 logging_state_t logging; 00201 }; 00202 00203 #endif 00204 /*- End of file ------------------------------------------------------------*/
1.6.1