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.19 2007/06/08 13:49:38 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 int merge_tx_fields; 00081 00082 /*! \brief The number of times an indicator packet will be sent. Numbers greater than one 00083 will increase reliability for UDP transmission. Zero is valid, to suppress all 00084 indicator packets for TCP transmission. */ 00085 int indicator_tx_count; 00086 00087 /*! \brief The number of times a data packet which ends transmission will be sent. Numbers 00088 greater than one will increase reliability for UDP transmission. Zero is not valid. */ 00089 int data_end_tx_count; 00090 00091 /*! \brief A "sample" count, used to time events */ 00092 int32_t samples; 00093 int32_t next_tx_samples; 00094 int32_t timeout_rx_samples; 00095 00096 logging_state_t logging; 00097 } t38_terminal_state_t; 00098 00099 #if defined(__cplusplus) 00100 extern "C" 00101 { 00102 #endif 00103 00104 int t38_terminal_send_timeout(t38_terminal_state_t *s, int samples); 00105 00106 void t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing); 00107 00108 /*! \brief Initialise a termination mode T.38 context. 00109 \param s The T.38 context. 00110 \param calling_party TRUE if the context is for a calling party. FALSE if the 00111 context is for an answering party. 00112 \param tx_packet_handler A callback routine to encapsulate and transmit T.38 packets. 00113 \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine. 00114 \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */ 00115 t38_terminal_state_t *t38_terminal_init(t38_terminal_state_t *s, 00116 int calling_party, 00117 t38_tx_packet_handler_t *tx_packet_handler, 00118 void *tx_packet_user_data); 00119 00120 #if defined(__cplusplus) 00121 } 00122 #endif 00123 00124 #endif 00125 /*- End of file ------------------------------------------------------------*/