spandsp 0.0.6

t38_terminal.h
Go to the documentation of this file.
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * t38_terminal.h - T.38 termination, 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 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
26/*! \file */
27
28#if !defined(_SPANDSP_T38_TERMINAL_H_)
29#define _SPANDSP_T38_TERMINAL_H_
30
31/*! \page t38_terminal_page T.38 real time FAX over IP termination
32\section t38_terminal_page_sec_1 What does it do?
33
34\section t38_terminal_page_sec_2 How does it work?
35*/
36
37/* Make sure the HDLC frame buffers are big enough for ECM frames. */
38#define T38_MAX_HDLC_LEN 260
39
40 enum
41{
42 /*! This option enables the continuous streaming of FAX data, with no allowance for
43 FAX machine speeds. This is usually used with TCP/TPKT transmission of T.38 FAXes */
44 T38_TERMINAL_OPTION_NO_PACING = 0x01,
45 /*! This option enables the regular repeat transmission of indicator signals,
46 during periods when no FAX signal transmission occurs. */
47 T38_TERMINAL_OPTION_REGULAR_INDICATORS = 0x02,
48 /*! This option enables the regular repeat transmission of indicator signals for the
49 first 2s, during periods when no FAX signal transmission occurs. */
50 T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS = 0x04,
51 /*! This option suppresses the transmission of indicators. This is usually used with
52 TCP/TPKT transmission of T.38 FAXes */
53 T38_TERMINAL_OPTION_NO_INDICATORS = 0x08
54};
55
56 typedef struct t38_terminal_state_s t38_terminal_state_t;
57
58#if defined(__cplusplus)
59 extern "C"
60{
61#endif
62
63SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples);
64
65/*! Set configuration options.
66 \brief Set configuration options.
67 \param s The T.38 context.
68 \param config A combinations of T38_TERMINAL_OPTION_* bits.
69*/
70SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int config);
71
72/*! Select whether the time for talker echo protection tone will be allowed for when sending.
73 \brief Select whether TEP time will be allowed for.
74 \param s The T.38 context.
75 \param use_tep TRUE if TEP should be allowed for.
76*/
77SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep);
78
79/*! Select whether non-ECM fill bits are to be removed during transmission.
80 \brief Select whether non-ECM fill bits are to be removed during transmission.
81 \param s The T.38 context.
82 \param remove TRUE if fill bits are to be removed.
83*/
84SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove);
85
86/*! Get a pointer to the T.30 engine associated with a termination mode T.38 context.
87 \brief Get a pointer to the T.30 engine associated with a T.38 context.
88 \param s The T.38 context.
89 \return A pointer to the T.30 context, or NULL.
90*/
91SPAN_DECLARE(t30_state_t *) t38_terminal_get_t30_state(t38_terminal_state_t *s);
92
93/*! Get a pointer to the T.38 core IFP packet engine associated with a
94 termination mode T.38 context.
95 \brief Get a pointer to the T.38 core IFP packet engine associated
96 with a T.38 context.
97 \param s The T.38 context.
98 \return A pointer to the T.38 core context, or NULL.
99*/
100SPAN_DECLARE(t38_core_state_t *) t38_terminal_get_t38_core_state(t38_terminal_state_t *s);
101
102/*! Get a pointer to the logging context associated with a T.38 context.
103 \brief Get a pointer to the logging context associated with a T.38 context.
104 \param s The T.38 context.
105 \return A pointer to the logging context, or NULL.
106*/
107SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_state_t *s);
108
109/*! \brief Reinitialise a termination mode T.38 context.
110 \param s The T.38 context.
111 \param calling_party TRUE if the context is for a calling party. FALSE if the
112 context is for an answering party.
113 \return 0 for OK, else -1. */
114SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s,
115 int calling_party);
116
117/*! \brief Initialise a termination mode T.38 context.
118 \param s The T.38 context.
119 \param calling_party TRUE if the context is for a calling party. FALSE if the
120 context is for an answering party.
121 \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets.
122 \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine.
123 \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */
124SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s,
125 int calling_party,
126 t38_tx_packet_handler_t *tx_packet_handler,
127 void *tx_packet_user_data);
128
129/*! Release a termination mode T.38 context.
130 \brief Release a T.38 context.
131 \param s The T.38 context.
132 \return 0 for OK, else -1. */
133SPAN_DECLARE(int) t38_terminal_release(t38_terminal_state_t *s);
134
135/*! Free a a termination mode T.38 context.
136 \brief Free a T.38 context.
137 \param s The T.38 context.
138 \return 0 for OK, else -1. */
139SPAN_DECLARE(int) t38_terminal_free(t38_terminal_state_t *s);
140
141#if defined(__cplusplus)
142}
143#endif
144
145#endif
146/*- End of file ------------------------------------------------------------*/
logging_state_t
struct logging_state_s logging_state_t
Definition logging.h:75
t38_terminal_state_s
Definition private/t38_terminal.h:111
t38_core_state_t
struct t38_core_state_s t38_core_state_t
Definition t38_core.h:202
t38_terminal_restart
int t38_terminal_restart(t38_terminal_state_t *s, int calling_party)
Reinitialise a termination mode T.38 context.
Definition t38_terminal.c:1500
t38_terminal_init
t38_terminal_state_t * t38_terminal_init(t38_terminal_state_t *s, int calling_party, t38_tx_packet_handler_t *tx_packet_handler, void *tx_packet_user_data)
Initialise a termination mode T.38 context.
Definition t38_terminal.c:1509
t38_terminal_release
int t38_terminal_release(t38_terminal_state_t *s)
Release a T.38 context.
Definition t38_terminal.c:1549
t38_terminal_get_logging_state
logging_state_t * t38_terminal_get_logging_state(t38_terminal_state_t *s)
Get a pointer to the logging context associated with a T.38 context.
Definition t38_terminal.c:1494
t38_terminal_get_t30_state
t30_state_t * t38_terminal_get_t30_state(t38_terminal_state_t *s)
Get a pointer to the T.30 engine associated with a T.38 context.
Definition t38_terminal.c:1427
T38_TERMINAL_OPTION_NO_PACING
@ T38_TERMINAL_OPTION_NO_PACING
Definition t38_terminal.h:44
T38_TERMINAL_OPTION_NO_INDICATORS
@ T38_TERMINAL_OPTION_NO_INDICATORS
Definition t38_terminal.h:53
T38_TERMINAL_OPTION_REGULAR_INDICATORS
@ T38_TERMINAL_OPTION_REGULAR_INDICATORS
Definition t38_terminal.h:47
T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS
@ T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS
Definition t38_terminal.h:50
t38_terminal_set_tep_mode
void t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep)
Select whether TEP time will be allowed for.
Definition t38_terminal.c:1405
t38_terminal_set_fill_bit_removal
void t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove)
Select whether non-ECM fill bits are to be removed during transmission.
Definition t38_terminal.c:1416
t38_terminal_set_config
void t38_terminal_set_config(t38_terminal_state_t *s, int config)
Set configuration options.
Definition t38_terminal.c:1354
t38_terminal_free
int t38_terminal_free(t38_terminal_state_t *s)
Free a T.38 context.
Definition t38_terminal.c:1556
t38_terminal_get_t38_core_state
t38_core_state_t * t38_terminal_get_t38_core_state(t38_terminal_state_t *s)
Get a pointer to the T.38 core IFP packet engine associated with a T.38 context.
Definition t38_terminal.c:1433