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 /*! This option suppresses the transmission of indicators. This is usually used with 00052 TCP/TPKT transmission of T.38 FAXes */ 00053 T38_TERMINAL_OPTION_NO_INDICATORS = 0x08 00054 }; 00055 00056 typedef struct t38_terminal_state_s t38_terminal_state_t; 00057 00058 #if defined(__cplusplus) 00059 extern "C" 00060 { 00061 #endif 00062 00063 SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples); 00064 00065 /*! Set configuration options. 00066 \brief Set configuration options. 00067 \param s The T.38 context. 00068 \param config A combinations of T38_TERMINAL_OPTION_* bits. 00069 */ 00070 SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int config); 00071 00072 /*! Select whether the time for talker echo protection tone will be allowed for when sending. 00073 \brief Select whether TEP time will be allowed for. 00074 \param s The T.38 context. 00075 \param use_tep TRUE if TEP should be allowed for. 00076 */ 00077 SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep); 00078 00079 /*! Select whether non-ECM fill bits are to be removed during transmission. 00080 \brief Select whether non-ECM fill bits are to be removed during transmission. 00081 \param s The T.38 context. 00082 \param remove TRUE if fill bits are to be removed. 00083 */ 00084 SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove); 00085 00086 /*! Get a pointer to the T.30 engine associated with a termination mode T.38 context. 00087 \brief Get a pointer to the T.30 engine associated with a T.38 context. 00088 \param s The T.38 context. 00089 \return A pointer to the T.30 context, or NULL. 00090 */ 00091 SPAN_DECLARE(t30_state_t *) t38_terminal_get_t30_state(t38_terminal_state_t *s); 00092 00093 /*! Get a pointer to the T.38 core IFP packet engine associated with a 00094 termination mode T.38 context. 00095 \brief Get a pointer to the T.38 core IFP packet engine associated 00096 with a T.38 context. 00097 \param s The T.38 context. 00098 \return A pointer to the T.38 core context, or NULL. 00099 */ 00100 SPAN_DECLARE(t38_core_state_t *) t38_terminal_get_t38_core_state(t38_terminal_state_t *s); 00101 00102 /*! Get a pointer to the logging context associated with a T.38 context. 00103 \brief Get a pointer to the logging context associated with a T.38 context. 00104 \param s The T.38 context. 00105 \return A pointer to the logging context, or NULL. 00106 */ 00107 SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_state_t *s); 00108 00109 /*! \brief Reinitialise a termination mode T.38 context. 00110 \param s The T.38 context. 00111 \param calling_party TRUE if the context is for a calling party. FALSE if the 00112 context is for an answering party. 00113 \return 0 for OK, else -1. */ 00114 SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s, 00115 int calling_party); 00116 00117 /*! \brief Initialise a termination mode T.38 context. 00118 \param s The T.38 context. 00119 \param calling_party TRUE if the context is for a calling party. FALSE if the 00120 context is for an answering party. 00121 \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets. 00122 \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine. 00123 \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */ 00124 SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s, 00125 int calling_party, 00126 t38_tx_packet_handler_t tx_packet_handler, 00127 void *tx_packet_user_data); 00128 00129 /*! Release a termination mode T.38 context. 00130 \brief Release a T.38 context. 00131 \param s The T.38 context. 00132 \return 0 for OK, else -1. */ 00133 SPAN_DECLARE(int) t38_terminal_release(t38_terminal_state_t *s); 00134 00135 /*! Free a a termination mode T.38 context. 00136 \brief Free a T.38 context. 00137 \param s The T.38 context. 00138 \return 0 for OK, else -1. */ 00139 SPAN_DECLARE(int) t38_terminal_free(t38_terminal_state_t *s); 00140 00141 #if defined(__cplusplus) 00142 } 00143 #endif 00144 00145 #endif 00146 /*- End of file ------------------------------------------------------------*/
1.6.1