comparison spandsp-0.0.6pre17/src/spandsp/private/t38_gateway.h @ 4:26cd8f1ef0b1

import spandsp-0.0.6pre17
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 15:50:58 +0200
parents
children
comparison
equal deleted inserted replaced
3:c6c5a16ce2f2 4:26cd8f1ef0b1
1 /*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * private/t38_gateway.h - A T.38, less the packet exchange part
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2005, 2006, 2007 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 * $Id: t38_gateway.h,v 1.5 2009/11/07 08:58:58 steveu Exp $
26 */
27
28 /*! \file */
29
30 #if !defined(_SPANDSP_PRIVATE_T38_GATEWAY_H_)
31 #define _SPANDSP_PRIVATE_T38_GATEWAY_H_
32
33 /*!
34 T.38 gateway T.38 side channel descriptor.
35 */
36 typedef struct
37 {
38 /*! Core T.38 IFP support */
39 t38_core_state_t t38;
40
41 /*! \brief TRUE if the NSF, NSC, and NSS are to be suppressed by altering
42 their contents to something the far end will not recognise. */
43 int suppress_nsx_len[2];
44 /*! \brief TRUE if we need to corrupt the HDLC frame in progress, so the receiver cannot
45 interpret it. The two values are for the two directions. */
46 int corrupt_current_frame[2];
47
48 /*! \brief the current class of field being received - i.e. none, non-ECM or HDLC */
49 int current_rx_field_class;
50 /*! \brief The T.38 indicator currently in use */
51 int in_progress_rx_indicator;
52
53 /*! \brief The current T.38 data type being sent. */
54 int current_tx_data_type;
55 } t38_gateway_t38_state_t;
56
57 /*!
58 T.38 gateway audio side channel descriptor.
59 */
60 typedef struct
61 {
62 /*! \brief The FAX modem set for the audio side fo the gateway. */
63 fax_modems_state_t modems;
64 /*! \brief The current receive signal handler. Actual receiving hop between this
65 and a dummy receive routine. */
66 span_rx_handler_t *base_rx_handler;
67 } t38_gateway_audio_state_t;
68
69 /*!
70 T.38 gateway T.38 side state.
71 */
72 typedef struct
73 {
74 /*! \brief non-ECM and HDLC modem receive data buffer. */
75 uint8_t data[T38_RX_BUF_LEN];
76 /*! \brief Current pointer into the data buffer. */
77 int data_ptr;
78 /*! \brief The current octet being received as non-ECM data. */
79 unsigned int bit_stream;
80 /*! \brief The number of bits taken from the modem for the current scan row. This
81 is used during non-ECM transmission will fill bit removal to see that
82 T.38 packet transmissions do not stretch too far apart. */
83 int bits_absorbed;
84 /*! \brief The current bit number in the current non-ECM octet. */
85 int bit_no;
86 /*! \brief Progressively calculated CRC for HDLC messages received from a modem. */
87 uint16_t crc;
88 /*! \brief TRUE if non-ECM fill bits are to be stripped when sending image data. */
89 int fill_bit_removal;
90 /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
91 rate and the current specified packet interval. */
92 int octets_per_data_packet;
93
94 /*! \brief Bits into the non-ECM buffer */
95 int in_bits;
96 /*! \brief Octets fed out from the non-ECM buffer */
97 int out_octets;
98 } t38_gateway_to_t38_state_t;
99
100 /*!
101 T.38 gateway HDLC buffer.
102 */
103 typedef struct
104 {
105 /*! \brief HDLC message buffers. */
106 uint8_t buf[T38_MAX_HDLC_LEN];
107 /*! \brief HDLC message lengths. */
108 int len;
109 /*! \brief HDLC message status flags. */
110 int flags;
111 /*! \brief HDLC buffer contents. */
112 int contents;
113 } t38_gateway_hdlc_buf_t;
114
115 /*!
116 T.38 gateway HDLC state.
117 */
118 typedef struct
119 {
120 /*! \brief HDLC message buffers. */
121 t38_gateway_hdlc_buf_t buf[T38_TX_HDLC_BUFS];
122 #if 0
123 /*! \brief HDLC message buffers. */
124 uint8_t buf[T38_TX_HDLC_BUFS][T38_MAX_HDLC_LEN];
125 /*! \brief HDLC message lengths. */
126 int len[T38_TX_HDLC_BUFS];
127 /*! \brief HDLC message status flags. */
128 int flags[T38_TX_HDLC_BUFS];
129 /*! \brief HDLC buffer contents. */
130 int contents[T38_TX_HDLC_BUFS];
131 #endif
132 /*! \brief HDLC buffer number for input. */
133 int in;
134 /*! \brief HDLC buffer number for output. */
135 int out;
136 } t38_gateway_hdlc_state_t;
137
138 /*!
139 T.38 gateway core descriptor.
140 */
141 typedef struct
142 {
143 /*! \brief A bit mask of the currently supported modem types. */
144 int supported_modems;
145 /*! \brief TRUE if ECM FAX mode is allowed through the gateway. */
146 int ecm_allowed;
147
148 /*! \brief TRUE if in image data modem is to use short training. This usually
149 follows image_data_mode, but in ECM mode T.30 defines recovery
150 conditions in which long training is used for image data. */
151 int short_train;
152 /*! \brief TRUE if in image data mode, as opposed to TCF mode. */
153 int image_data_mode;
154 /*! \brief The minimum permitted bits per FAX scan line row. */
155 int min_row_bits;
156
157 /*! \brief TRUE if we should count the next MCF as a page end, else FALSE */
158 int count_page_on_mcf;
159 /*! \brief The number of pages for which a confirm (MCF) message was returned. */
160 int pages_confirmed;
161
162 /*! \brief TRUE if we are in error correcting (ECM) mode */
163 int ecm_mode;
164 /*! \brief The current bit rate for the fast modem. */
165 int fast_bit_rate;
166 /*! \brief The current fast receive modem type. */
167 int fast_rx_modem;
168 /*! \brief The type of fast receive modem currently active, which may be T38_NONE */
169 int fast_rx_active;
170
171 /*! \brief The current timed operation. */
172 int timed_mode;
173 /*! \brief The number of samples until the next timeout event */
174 int samples_to_timeout;
175
176 /*! Buffer for HDLC and non-ECM data going to the T.38 channel */
177 t38_gateway_to_t38_state_t to_t38;
178 /*! Buffer for data going to an HDLC modem. */
179 t38_gateway_hdlc_state_t hdlc_to_modem;
180 /*! Buffer for data going to a non-ECM mode modem. */
181 t38_non_ecm_buffer_state_t non_ecm_to_modem;
182
183 /*! \brief A pointer to a callback routine to be called when frames are
184 exchanged. */
185 t38_gateway_real_time_frame_handler_t *real_time_frame_handler;
186 /*! \brief An opaque pointer supplied in real time frame callbacks. */
187 void *real_time_frame_user_data;
188 } t38_gateway_core_state_t;
189
190 /*!
191 T.38 gateway state.
192 */
193 struct t38_gateway_state_s
194 {
195 /*! T.38 side state */
196 t38_gateway_t38_state_t t38x;
197 /*! Audio side state */
198 t38_gateway_audio_state_t audio;
199 /*! T.38 core state */
200 t38_gateway_core_state_t core;
201
202 /*! \brief Error and flow logging control */
203 logging_state_t logging;
204 };
205
206 #endif
207 /*- End of file ------------------------------------------------------------*/

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.