t38_terminal.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * t38_terminal.h - T.38 termination, less the packet exchange part
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2005 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_T38_TERMINAL_H_)
00029 #define _SPANDSP_T38_TERMINAL_H_
00030 
00031 /*! \page t38_terminal_page T.38 real time FAX over IP termination
00032 \section t38_terminal_page_sec_1 What does it do?
00033 
00034 \section t38_terminal_page_sec_2 How does it work?
00035 */
00036 
00037 /* Make sure the HDLC frame buffers are big enough for ECM frames. */
00038 #define T38_MAX_HDLC_LEN        260
00039 
00040 enum
00041 {
00042     /*! This option enables the continuous streaming of FAX data, with no allowance for
00043         FAX machine speeds. This is usually used with TCP/TPKT transmission of T.38 FAXes */
00044     T38_TERMINAL_OPTION_NO_PACING = 0x01,
00045     /*! This option enables the regular repeat transmission of indicator signals,
00046         during periods when no FAX signal transmission occurs. */
00047     T38_TERMINAL_OPTION_REGULAR_INDICATORS = 0x02,
00048     /*! This option enables the regular repeat transmission of indicator signals for the 
00049         first 2s, during periods when no FAX signal transmission occurs. */
00050     T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS = 0x04
00051 };
00052 
00053 typedef struct t38_terminal_state_s t38_terminal_state_t;
00054 
00055 #if defined(__cplusplus)
00056 extern "C"
00057 {
00058 #endif
00059 
00060 SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples);
00061 
00062 /*! Set configuration options.
00063     \brief Set configuration options.
00064     \param s The T.38 context.
00065     \param config A combinations of T38_TERMINAL_OPTION_* bits.
00066 */
00067 SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int config);
00068 
00069 /*! Select whether the time for talker echo protection tone will be allowed for when sending.
00070     \brief Select whether TEP time will be allowed for.
00071     \param s The T.38 context.
00072     \param use_tep TRUE if TEP should be allowed for.
00073 */
00074 SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep);
00075 
00076 /*! Select whether non-ECM fill bits are to be removed during transmission.
00077     \brief Select whether non-ECM fill bits are to be removed during transmission.
00078     \param s The T.38 context.
00079     \param remove TRUE if fill bits are to be removed.
00080 */
00081 SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove);
00082 
00083 /*! Get a pointer to the T.30 engine associated with a termination mode T.38 context.
00084     \brief Get a pointer to the T.30 engine associated with a T.38 context.
00085     \param s The T.38 context.
00086     \return A pointer to the T.30 context, or NULL.
00087 */
00088 SPAN_DECLARE(t30_state_t *) t38_terminal_get_t30_state(t38_terminal_state_t *s);
00089 
00090 /*! Get a pointer to the T.38 core IFP packet engine associated with a
00091     termination mode T.38 context.
00092     \brief Get a pointer to the T.38 core IFP packet engine associated
00093            with a T.38 context.
00094     \param s The T.38 context.
00095     \return A pointer to the T.38 core context, or NULL.
00096 */
00097 SPAN_DECLARE(t38_core_state_t *) t38_terminal_get_t38_core_state(t38_terminal_state_t *s);
00098 
00099 /*! Get a pointer to the logging context associated with a T.38 context.
00100     \brief Get a pointer to the logging context associated with a T.38 context.
00101     \param s The T.38 context.
00102     \return A pointer to the logging context, or NULL.
00103 */
00104 SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_state_t *s);
00105 
00106 /*! \brief Reinitialise a termination mode T.38 context.
00107     \param s The T.38 context.
00108     \param calling_party TRUE if the context is for a calling party. FALSE if the
00109            context is for an answering party.
00110     \return 0 for OK, else -1. */
00111 SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s,
00112                                        int calling_party);
00113 
00114 /*! \brief Initialise a termination mode T.38 context.
00115     \param s The T.38 context.
00116     \param calling_party TRUE if the context is for a calling party. FALSE if the
00117            context is for an answering party.
00118     \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets.
00119     \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine.
00120     \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */
00121 SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s,
00122                                                        int calling_party,
00123                                                        t38_tx_packet_handler_t *tx_packet_handler,
00124                                                        void *tx_packet_user_data);
00125 
00126 /*! Release a termination mode T.38 context.
00127     \brief Release a T.38 context.
00128     \param s The T.38 context.
00129     \return 0 for OK, else -1. */
00130 SPAN_DECLARE(int) t38_terminal_release(t38_terminal_state_t *s);
00131 
00132 /*! Free a a termination mode T.38 context.
00133     \brief Free a T.38 context.
00134     \param s The T.38 context.
00135     \return 0 for OK, else -1. */
00136 SPAN_DECLARE(int) t38_terminal_free(t38_terminal_state_t *s);
00137 
00138 #if defined(__cplusplus)
00139 }
00140 #endif
00141 
00142 #endif
00143 /*- End of file ------------------------------------------------------------*/

Generated on Thu Oct 18 15:26:53 2012 for spandsp by  doxygen 1.4.7