00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * t38_terminal.h - An implementation of T.38, 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 General Public License version 2, as 00014 * 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 General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 * 00025 * $Id: t38_terminal.h,v 1.18 2007/04/08 08:16:18 steveu Exp $ 00026 */ 00027 00028 /*! \file */ 00029 00030 #if !defined(_SPANDSP_T38_TERMINAL_H_) 00031 #define _SPANDSP_T38_TERMINAL_H_ 00032 00033 /*! \page t38_terminal_page T.38 real time FAX over IP termination 00034 \section t38_terminal_page_sec_1 What does it do? 00035 00036 \section t38_terminal_page_sec_2 How does it work? 00037 */ 00038 00039 /* Make sure the HDLC frame buffers are big enough for ECM frames. */ 00040 #define T38_MAX_HDLC_LEN 260 00041 00042 typedef struct 00043 { 00044 t38_core_state_t t38; 00045 00046 /*! \brief HDLC transmit buffer */ 00047 uint8_t tx_buf[T38_MAX_HDLC_LEN]; 00048 int tx_len; 00049 int tx_ptr; 00050 00051 /*! \brief HDLC receive buffer */ 00052 uint8_t rx_buf[T38_MAX_HDLC_LEN]; 00053 int rx_len; 00054 00055 /*! \brief The current transmit step being timed */ 00056 int timed_step; 00057 00058 /*! \brief The next queued tramsit indicator */ 00059 int next_tx_indicator; 00060 /*! \brief The current T.38 data type being transmitted */ 00061 int current_tx_data_type; 00062 00063 /*! \brief TRUE if a carrier is present. Otherwise FALSE. */ 00064 int rx_signal_present; 00065 00066 /*! \brief The T.30 back-end */ 00067 t30_state_t t30_state; 00068 00069 int current_rx_type; 00070 int current_tx_type; 00071 00072 /*! \brief TRUE is there has been some T.38 data missed (i.e. lost packets) */ 00073 int missing_data; 00074 00075 /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current 00076 rate and the current specified packet interval. */ 00077 int octets_per_data_packet; 00078 00079 int ms_per_tx_chunk; 00080 00081 /*! \brief The number of times an indicator packet will be sent. Numbers greater than one 00082 will increase reliability for UDP transmission. Zero is valid, to suppress all 00083 indicator packets for TCP transmission. */ 00084 int indicator_tx_count; 00085 00086 /*! \brief The number of times a data packet which ends transmission will be sent. Numbers 00087 greater than one will increase reliability for UDP transmission. Zero is not valid. */ 00088 int data_end_tx_count; 00089 00090 /*! \brief A "sample" count, used to time events */ 00091 int32_t samples; 00092 int32_t next_tx_samples; 00093 int32_t timeout_rx_samples; 00094 00095 logging_state_t logging; 00096 } t38_terminal_state_t; 00097 00098 #if defined(__cplusplus) 00099 extern "C" 00100 { 00101 #endif 00102 00103 int t38_terminal_send_timeout(t38_terminal_state_t *s, int samples); 00104 00105 void t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing); 00106 00107 /*! \brief Initialise a termination mode T.38 context. 00108 \param s The T.38 context. 00109 \param calling_party TRUE if the context is for a calling party. FALSE if the 00110 context is for an answering party. 00111 \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets. 00112 \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine. 00113 \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */ 00114 t38_terminal_state_t *t38_terminal_init(t38_terminal_state_t *s, 00115 int calling_party, 00116 t38_tx_packet_handler_t *tx_packet_handler, 00117 void *tx_packet_user_data); 00118 00119 #if defined(__cplusplus) 00120 } 00121 #endif 00122 00123 #endif 00124 /*- End of file ------------------------------------------------------------*/