spandsp  0.0.6
private/t38_terminal.h
Go to the documentation of this file.
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/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_PRIVATE_T38_TERMINAL_H_)
29 #define _SPANDSP_PRIVATE_T38_TERMINAL_H_
30 
31 typedef struct
32 {
33  /*! \brief Internet Aware FAX mode bit mask. */
34  int iaf;
35  /*! \brief Required time between T.38 transmissions, in microseconds. */
37  /*! \brief Bit fields controlling the way data is packed into chunked for transmission. */
39 
40  /*! \brief Core T.38 IFP support */
42 
43  /*! \brief The current transmit step being timed */
45 
46  /*! \brief The timed step to go to when we reach idle from the current timed step */
48 
49  /*! \brief TRUE is there has been some T.38 data missed (i.e. lost packets) in the current
50  reception period. */
52 
53  /*! \brief The number of octets to send in each image packet (non-ECM or ECM) at the current
54  rate and the current specified packet interval. */
56 
57  struct
58  {
59  /*! \brief HDLC receive buffer */
60  uint8_t buf[T38_MAX_HDLC_LEN];
61  /*! \brief The length of the contents of the HDLC receive buffer */
62  int len;
63  } hdlc_rx;
64 
65  struct
66  {
67  /*! \brief HDLC transmit buffer */
68  uint8_t buf[T38_MAX_HDLC_LEN];
69  /*! \brief The length of the contents of the HDLC transmit buffer */
70  int len;
71  /*! \brief Current pointer within the contents of the HDLC transmit buffer */
72  int ptr;
73  /*! \brief The number of extra bits in a fully stuffed version of the
74  contents of the HDLC transmit buffer. This is needed to accurately
75  estimate the playout time for this frame, through an analogue modem. */
77  } hdlc_tx;
78 
79  /*! \brief Counter for trailing non-ECM bytes, used to flush out the far end's modem. */
81 
82  /*! \brief The next T.38 indicator queued for transmission. */
84  /*! \brief The current T.38 data type being transmitted. */
86 
87  /*! \brief TRUE if a carrier is present. Otherwise FALSE. */
89 
90  /*! \brief The current operating mode of the receiver. */
92  /*! \brief The current operating mode of the transmitter. */
94 
95  /*! \brief Current transmission bit rate. */
97  /*! \brief A "sample" count, used to time events. */
98  int32_t samples;
99  /*! \brief The value for samples at the next transmission point. */
101  /*! \brief The current transmit timeout. */
103  /*! \brief The current receive timeout. */
106 
107 /*!
108  T.38 terminal state.
109 */
111 {
112  /*! \brief The T.30 back-end */
114 
115  /*! \brief The T.38 front-end */
117 
118  /*! \brief Error and flow logging control */
120 };
121 
122 #endif
123 /*- End of file ------------------------------------------------------------*/
t38_data_field_t::field_type
int field_type
Definition: t38_core.h:192
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_cm_profile_to_str
const char * t38_cm_profile_to_str(int profile)
Convert the code for a CM profile code to text description.
Definition: t38_core.c:220
t38_terminal_front_end_state_t::rx_data_missing
int rx_data_missing
TRUE is there has been some T.38 data missed (i.e. lost packets) in the current reception period.
Definition: private/t38_terminal.h:51
t4_tx.h
tone_generate.h
T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS
@ T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS
Definition: t38_terminal.h:50
t38_core_state_s::v34_rate
int v34_rate
The bit rate for V.34 operation.
Definition: private/t38_core.h:125
t38_core_state_s::current_rx_field_type
int current_rx_field_type
The current receive field type - i.e. the last field_type received.
Definition: private/t38_core.h:121
t30_front_end_status
void t30_front_end_status(void *user_data, int status)
Inform the T.30 engine of a status change in the front end (end of tx, rx signal change,...
Definition: t30.c:5833
t38_terminal_front_end_state_t::timeout_rx_samples
int32_t timeout_rx_samples
The current receive timeout.
Definition: private/t38_terminal.h:104
T38_TERMINAL_OPTION_NO_PACING
@ T38_TERMINAL_OPTION_NO_PACING
Definition: t38_terminal.h:44
t38_terminal_free
int t38_terminal_free(t38_terminal_state_t *s)
Free a T.38 context.
Definition: t38_terminal.c:1556
t38_terminal_front_end_state_t::tx_bit_rate
int tx_bit_rate
Current transmission bit rate.
Definition: private/t38_terminal.h:96
T30_FRONT_END_RECEIVE_COMPLETE
@ T30_FRONT_END_RECEIVE_COMPLETE
Definition: t30.h:332
t30_set_iaf_mode
void t30_set_iaf_mode(t30_state_t *s, int iaf)
Set Internet aware FAX (IAF) mode.
Definition: t30_api.c:631
t30_logging.h
t38_core_send_data_multi_field
int t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int category)
Send a data packet.
Definition: t38_core.c:972
DATA_END_TX_COUNT
#define DATA_END_TX_COUNT
Definition: t31.c:121
t38_set_redundancy_control
void t38_set_redundancy_control(t38_core_state_t *s, int category, int setting)
Send a data packet.
Definition: t38_core.c:1058
async.h
hdlc.h
t38_core_send_training_delay
int t38_core_send_training_delay(t38_core_state_t *s, int indicator)
Find the delay to allow for modem training after sending an indicator.
Definition: t38_core.c:940
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
t30_non_ecm_get_chunk
int t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_len)
Get a bit of received non-ECM image data.
Definition: t30.c:5608
t30.h
t38_v34rate_to_bps
int t38_v34rate_to_bps(const uint8_t *data, int len)
Convert a V34rate message to an actual bit rate.
Definition: t38_core.c:272
t38_terminal_front_end_state_t
Definition: private/t38_terminal.h:32
t38_terminal.h
t30_release
int t30_release(t30_state_t *s)
Release a T.30 context.
Definition: t30.c:6368
t4_rx.h
t38_core_state_s
Definition: private/t38_core.h:33
t38_set_tep_handling
void t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep)
Definition: t38_core.c:1052
t38_terminal_front_end_state_t::rx_signal_present
int rx_signal_present
TRUE if a carrier is present. Otherwise FALSE.
Definition: private/t38_terminal.h:88
T38_PACKET_CATEGORY_CONTROL_DATA
@ T38_PACKET_CATEGORY_CONTROL_DATA
Control data packet.
Definition: t38_core.h:176
t38_terminal_front_end_state_t::octets_per_data_packet
int octets_per_data_packet
The number of octets to send in each image packet (non-ECM or ECM) at the current rate and the curren...
Definition: private/t38_terminal.h:55
t30_frametype
const char * t30_frametype(uint8_t x)
Return a text name for a T.30 frame type.
Definition: t30_logging.c:241
t38_terminal_front_end_state_t::us_per_tx_chunk
int us_per_tx_chunk
Required time between T.38 transmissions, in microseconds.
Definition: private/t38_terminal.h:36
v27ter_tx.h
T38_PACKET_CATEGORY_INDICATOR
@ T38_PACKET_CATEGORY_INDICATOR
Indicator packet.
Definition: t38_core.h:174
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_data_field_t
Definition: t38_core.h:190
t30_non_ecm_put_chunk
void t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], int len)
Process a chunk of received non-ECM image data.
Definition: t30.c:5498
t30.h
t38_terminal_state_s::logging
logging_state_t logging
Error and flow logging control.
Definition: private/t38_terminal.h:119
DATA_TX_COUNT
#define DATA_TX_COUNT
Definition: t31.c:119
timezone.h
v17rx.h
t38_non_ecm_buffer_state_s::bit_no
int bit_no
The current bit number in the current non-ECM octet.
Definition: private/t38_non_ecm_buffer.h:63
t38_terminal_front_end_state_t::current_tx_type
int current_tx_type
The current operating mode of the transmitter.
Definition: private/t38_terminal.h:93
t30_timer_update
void t30_timer_update(t30_state_t *s, int samples)
Report the passage of time to the T.30 engine.
Definition: t30.c:6127
t38_terminal_front_end_state_t::non_ecm_trailer_bytes
int non_ecm_trailer_bytes
Counter for trailing non-ECM bytes, used to flush out the far end's modem.
Definition: private/t38_terminal.h:80
t30_api.h
complex.h
t38_terminal_front_end_state_t::buf
uint8_t buf[T38_MAX_HDLC_LEN]
HDLC receive buffer.
Definition: private/t38_terminal.h:60
t38_core_state_s::current_tx_indicator
int current_tx_indicator
The current transmit indicator - i.e. the last indicator transmitted.
Definition: private/t38_core.h:123
T38_PACKET_CATEGORY_IMAGE_DATA
@ T38_PACKET_CATEGORY_IMAGE_DATA
Image data packet.
Definition: t38_core.h:180
t38_terminal_front_end_state_t::current_rx_type
int current_rx_type
The current operating mode of the receiver.
Definition: private/t38_terminal.h:91
t38_terminal_front_end_state_t::extra_bits
int extra_bits
The number of extra bits in a fully stuffed version of the contents of the HDLC transmit buffer....
Definition: private/t38_terminal.h:76
t38_terminal.h
T38_MAX_HDLC_LEN
#define T38_MAX_HDLC_LEN
Definition: t38_gateway.h:46
t38_core_state_s::current_rx_data_type
int current_rx_data_type
The current receive data type - i.e. the last data type received.
Definition: private/t38_core.h:119
t4_t6_encode.h
t38_terminal_front_end_state_t::current_tx_data_type
int current_tx_data_type
The current T.38 data type being transmitted.
Definition: private/t38_terminal.h:85
v27ter_rx.h
T30_SUPPORT_IAF
@ T30_SUPPORT_IAF
Definition: t30.h:350
t38_non_ecm_buffer_report_output_status
void t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging)
Report the output status of a T.38 rate adapting non-ECM buffer context to the specified logging cont...
Definition: t38_non_ecm_buffer.c:326
T30_SUPPORT_V29
@ T30_SUPPORT_V29
Definition: t30.h:344
t38_terminal_state_s::t38_fe
t38_terminal_front_end_state_t t38_fe
The T.38 front-end.
Definition: private/t38_terminal.h:116
SIG_STATUS_CARRIER_DOWN
@ SIG_STATUS_CARRIER_DOWN
The carrier signal has dropped.
Definition: async.h:54
t4_t6_decode.h
t38_core_send_flags_delay
int t38_core_send_flags_delay(t38_core_state_t *s, int indicator)
Find the delay to allow for HDLC flags after sending an indicator.
Definition: t38_core.c:932
t38_terminal_state_s
Definition: private/t38_terminal.h:111
v17tx.h
T30_SUPPORT_V27TER
@ T30_SUPPORT_V27TER
Definition: t30.h:342
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
bit_operations.h
t38_terminal_front_end_state_t::samples
int32_t samples
A "sample" count, used to time events.
Definition: private/t38_terminal.h:98
t38_core_state_s::current_rx_indicator
int current_rx_indicator
The current receive indicator - i.e. the last indicator received.
Definition: private/t38_core.h:117
queue.h
t30_terminate
void t30_terminate(t30_state_t *s)
Cleanup a T.30 context if the call terminates.
Definition: t30.c:6196
t38_core_send_data
int t38_core_send_data(t38_core_state_t *s, int data_type, int field_type, const uint8_t field[], int field_len, int category)
Send a data packet.
Definition: t38_core.c:948
T38_PACKET_CATEGORY_CONTROL_DATA_END
@ T38_PACKET_CATEGORY_CONTROL_DATA_END
Terminating control data packet.
Definition: t38_core.h:178
span_log
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
t38_terminal_front_end_state_t::len
int len
The length of the contents of the HDLC receive buffer.
Definition: private/t38_terminal.h:62
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_front_end_state_t::timed_step
int timed_step
The current transmit step being timed.
Definition: private/t38_terminal.h:44
v29rx.h
t38_jm_to_str
const char * t38_jm_to_str(const uint8_t *data, int len)
Convert a JM message code to text description.
Definition: t38_core.c:241
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
t38_terminal_front_end_state_t::queued_timed_step
int queued_timed_step
The timed step to go to when we reach idle from the current timed step.
Definition: private/t38_terminal.h:47
t30_state_s
Definition: private/t30.h:36
t38_core.h
T38_PACKET_CATEGORY_IMAGE_DATA_END
@ T38_PACKET_CATEGORY_IMAGE_DATA_END
Terminating image data packet.
Definition: t38_core.h:182
t38_non_ecm_buffer_inject
void t38_non_ecm_buffer_inject(t38_non_ecm_buffer_state_t *s, const uint8_t *buf, int len)
Inject data to T.38 rate adapting non-ECM buffer context.
Definition: t38_non_ecm_buffer.c:130
t38_non_ecm_buffer_init
t38_non_ecm_buffer_state_t * t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits)
Initialise a T.38 rate adapting non-ECM buffer context.
Definition: t38_non_ecm_buffer.c:350
t38_terminal_front_end_state_t::next_tx_samples
int32_t next_tx_samples
The value for samples at the next transmission point.
Definition: private/t38_terminal.h:100
t38_core_send_indicator
int t38_core_send_indicator(t38_core_state_t *s, int indicator)
Send an indicator packet.
Definition: t38_core.c:889
t38_terminal_front_end_state_t::timeout_tx_samples
int32_t timeout_tx_samples
The current transmit timeout.
Definition: private/t38_terminal.h:102
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
fsk.h
logging.h
t38_terminal_front_end_state_t::ptr
int ptr
Current pointer within the contents of the HDLC transmit buffer.
Definition: private/t38_terminal.h:72
t38_terminal_state_s::t30
t30_state_t t30
The T.30 back-end.
Definition: private/t38_terminal.h:113
t38_non_ecm_buffer_report_input_status
void t38_non_ecm_buffer_report_input_status(t38_non_ecm_buffer_state_t *s, logging_state_t *logging)
Report the input status of a T.38 rate adapting non-ECM buffer context to the specified logging conte...
Definition: t38_non_ecm_buffer.c:309
t38_core_restart
int t38_core_restart(t38_core_state_t *s)
Restart a T.38 core context.
Definition: t38_core.c:1082
v29tx.h
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
bit_reverse
void bit_reverse(uint8_t to[], const uint8_t from[], int len)
Bit reverse each byte in a buffer.
Definition: bit_operations.c:79
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
t30_set_supported_modems
int t30_set_supported_modems(t30_state_t *s, int supported_modems)
Specify supported modems.
Definition: t30_api.c:680
t38_non_ecm_buffer_state_s
A flow controlled non-ECM image data buffer, for buffering T.38 to analogue modem data.
Definition: private/t38_non_ecm_buffer.h:34
t38_core_init
t38_core_state_t * t38_core_init(t38_core_state_t *s, t38_rx_indicator_handler_t *rx_indicator_handler, t38_rx_data_handler_t *rx_data_handler, t38_rx_missing_handler_t *rx_missing_handler, void *rx_user_data, t38_tx_packet_handler_t *tx_packet_handler, void *tx_packet_user_data)
Initialise a T.38 core context.
Definition: t38_core.c:1102
t38_data_field_t::field
const uint8_t * field
Definition: t38_core.h:194
t38_data_field_t::field_len
int field_len
Definition: t38_core.h:196
t38_terminal_front_end_state_t::iaf
int iaf
Internet Aware FAX mode bit mask.
Definition: private/t38_terminal.h:34
t30_restart
int t30_restart(t30_state_t *s)
Restart a T.30 context.
Definition: t30.c:6287
T30_SUPPORT_V17
@ T30_SUPPORT_V17
Definition: t30.h:346
t30_fcf.h
INDICATOR_TX_COUNT
#define INDICATOR_TX_COUNT
Definition: t31.c:117
t38_non_ecm_buffer_push
void t38_non_ecm_buffer_push(t38_non_ecm_buffer_state_t *s)
Inform a T.38 rate adapting non-ECM buffer context that the incoming data has finished,...
Definition: t38_non_ecm_buffer.c:121
SIG_STATUS_TRAINING_SUCCEEDED
@ SIG_STATUS_TRAINING_SUCCEEDED
The modem has trained, and is ready for data exchange.
Definition: async.h:65
t38_terminal_release
int t38_terminal_release(t38_terminal_state_t *s)
Release a T.38 context.
Definition: t38_terminal.c:1549
T30_IAF_MODE_NO_FILL_BITS
@ T30_IAF_MODE_NO_FILL_BITS
Definition: t30.h:465
t35.h
logging_state_s
Definition: private/logging.h:34
t38_terminal_front_end_state_t::t38
t38_core_state_t t38
Core T.38 IFP support.
Definition: private/t38_terminal.h:41
t38_terminal_front_end_state_t::next_tx_indicator
int next_tx_indicator
The next T.38 indicator queued for transmission.
Definition: private/t38_terminal.h:83
SIG_STATUS_END_OF_DATA
@ SIG_STATUS_END_OF_DATA
The data stream has ended.
Definition: async.h:71
t30_init
t30_state_t * t30_init(t30_state_t *s, int calling_party, t30_set_handler_t *set_rx_type_handler, void *set_rx_type_user_data, t30_set_handler_t *set_tx_type_handler, void *set_tx_type_user_data, t30_send_hdlc_handler_t *send_hdlc_handler, void *send_hdlc_user_data)
Initialise a T.30 context.
Definition: t30.c:6327
t38_terminal_front_end_state_t::chunking_modes
int chunking_modes
Bit fields controlling the way data is packed into chunked for transmission.
Definition: private/t38_terminal.h:38