5
|
1 /*
|
|
2 * SpanDSP - a series of DSP components for telephony
|
|
3 *
|
|
4 * t38_terminal.h - An implementation of T.38, less the packet exchange part
|
|
5 *
|
|
6 * Written by Steve Underwood <steveu@coppice.org>
|
|
7 *
|
|
8 * Copyright (C) 2005 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 General Public License version 2, as
|
|
14 * 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 General Public License for more details.
|
|
20 *
|
|
21 * You should have received a copy of the GNU General Public License
|
|
22 * 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_terminal.h,v 1.11 2006/12/07 13:22:26 steveu Exp $
|
|
26 */
|
|
27
|
|
28 /*! \file */
|
|
29
|
|
30 #if !defined(_T38_TERMINAL_H_)
|
|
31 #define _T38_TERMINAL_H_
|
|
32
|
|
33 /*! \page t38_terminal_page T.38 real time FAX over IP termination
|
|
34 \section t38_terminal_page_sec_1 What does it do?
|
|
35
|
|
36 \section t38_terminal_page_sec_2 How does it work?
|
|
37 */
|
|
38
|
|
39 #define T38_RX_BUF_LEN 2048
|
|
40 #define T38_TX_BUF_LEN 16384
|
|
41
|
|
42 /* Make sure the HDLC frame buffers are big enough for ECM frames. */
|
|
43 #define T38_MAX_HDLC_LEN 260
|
|
44
|
|
45 typedef struct
|
|
46 {
|
|
47 t38_core_state_t t38;
|
|
48
|
|
49 uint8_t hdlc_tx_buf[T38_MAX_HDLC_LEN];
|
|
50 int hdlc_tx_len;
|
|
51 int hdlc_tx_ptr;
|
|
52 int timed_step;
|
|
53
|
|
54 uint8_t tx_data[T38_TX_BUF_LEN];
|
|
55 int tx_out_bytes;
|
|
56
|
|
57 int next_tx_indicator;
|
|
58 int current_tx_data_type;
|
|
59
|
|
60 /*! \brief TRUE is a carrier is presnt. Otherwise FALSE. */
|
|
61 int rx_signal_present;
|
|
62
|
|
63 /*! \brief A tone generator context used to generate supervisory tones during
|
|
64 FAX handling. */
|
|
65 tone_gen_state_t tone_gen;
|
|
66
|
|
67 t30_state_t t30_state;
|
|
68
|
|
69 int current_rx_type;
|
|
70 int current_tx_type;
|
|
71
|
|
72 /*! \brief TRUE is there has been some T.38 data missed */
|
|
73 int missing_data;
|
|
74
|
|
75 /*! The number of octets to send in each image packet (non-ECM or ECM) at the current
|
|
76 rate and the current specified packet interval. */
|
|
77 int octets_per_data_packet;
|
|
78
|
|
79 int32_t samples;
|
|
80 int32_t next_tx_samples;
|
|
81 int32_t timeout_rx_samples;
|
|
82
|
|
83 logging_state_t logging;
|
|
84 } t38_terminal_state_t;
|
|
85
|
|
86 #ifdef __cplusplus
|
|
87 extern "C" {
|
|
88 #endif
|
|
89
|
|
90 int t38_terminal_send_timeout(t38_terminal_state_t *s, int samples);
|
|
91
|
|
92 /*! \brief Initialise a termination mode T.38 context.
|
|
93 \param s The T.38 context.
|
|
94 \param calling_party TRUE if the context is for a calling party. FALSE if the
|
|
95 context is for an answering party.
|
|
96 \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets.
|
|
97 \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine.
|
|
98 \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */
|
|
99 t38_terminal_state_t *t38_terminal_init(t38_terminal_state_t *s,
|
|
100 int calling_party,
|
|
101 t38_tx_packet_handler_t *tx_packet_handler,
|
|
102 void *tx_packet_user_data);
|
|
103
|
|
104 #ifdef __cplusplus
|
|
105 }
|
|
106 #endif
|
|
107
|
|
108 #endif
|
|
109 /*- End of file ------------------------------------------------------------*/
|