t38_core.h File Reference

Go to the source code of this file.

Classes

struct  t38_data_field_t

Defines

#define _SPANDSP_T38_CORE_H_
#define T38_RX_BUF_LEN   2048
#define T38_TX_BUF_LEN   16384

Typedefs

typedef struct t38_core_state_s t38_core_state_t
typedef int( t38_tx_packet_handler_t )(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
typedef int( t38_rx_indicator_handler_t )(t38_core_state_t *s, void *user_data, int indicator)
typedef int( t38_rx_data_handler_t )(t38_core_state_t *s, void *user_data, int data_type, int field_type, const uint8_t *buf, int len)
typedef int( t38_rx_missing_handler_t )(t38_core_state_t *s, void *user_data, int rx_seq_no, int expected_seq_no)

Enumerations

enum  t30_indicator_types_e {
  T38_IND_NO_SIGNAL = 0, T38_IND_CNG, T38_IND_CED, T38_IND_V21_PREAMBLE,
  T38_IND_V27TER_2400_TRAINING, T38_IND_V27TER_4800_TRAINING, T38_IND_V29_7200_TRAINING, T38_IND_V29_9600_TRAINING,
  T38_IND_V17_7200_SHORT_TRAINING, T38_IND_V17_7200_LONG_TRAINING, T38_IND_V17_9600_SHORT_TRAINING, T38_IND_V17_9600_LONG_TRAINING,
  T38_IND_V17_12000_SHORT_TRAINING, T38_IND_V17_12000_LONG_TRAINING, T38_IND_V17_14400_SHORT_TRAINING, T38_IND_V17_14400_LONG_TRAINING,
  T38_IND_V8_ANSAM, T38_IND_V8_SIGNAL, T38_IND_V34_CNTL_CHANNEL_1200, T38_IND_V34_PRI_CHANNEL,
  T38_IND_V34_CC_RETRAIN, T38_IND_V33_12000_TRAINING, T38_IND_V33_14400_TRAINING
}
enum  t38_data_types_e {
  T38_DATA_NONE = -1, T38_DATA_V21 = 0, T38_DATA_V27TER_2400, T38_DATA_V27TER_4800,
  T38_DATA_V29_7200, T38_DATA_V29_9600, T38_DATA_V17_7200, T38_DATA_V17_9600,
  T38_DATA_V17_12000, T38_DATA_V17_14400, T38_DATA_V8, T38_DATA_V34_PRI_RATE,
  T38_DATA_V34_CC_1200, T38_DATA_V34_PRI_CH, T38_DATA_V33_12000, T38_DATA_V33_14400
}
enum  t38_field_types_e {
  T38_FIELD_HDLC_DATA = 0, T38_FIELD_HDLC_SIG_END, T38_FIELD_HDLC_FCS_OK, T38_FIELD_HDLC_FCS_BAD,
  T38_FIELD_HDLC_FCS_OK_SIG_END, T38_FIELD_HDLC_FCS_BAD_SIG_END, T38_FIELD_T4_NON_ECM_DATA, T38_FIELD_T4_NON_ECM_SIG_END,
  T38_FIELD_CM_MESSAGE, T38_FIELD_JM_MESSAGE, T38_FIELD_CI_MESSAGE, T38_FIELD_V34RATE
}
enum  t38_field_classes_e { T38_FIELD_CLASS_NONE = 0, T38_FIELD_CLASS_HDLC, T38_FIELD_CLASS_NON_ECM }
enum  t38_message_types_e { T38_TYPE_OF_MSG_T30_INDICATOR = 0, T38_TYPE_OF_MSG_T30_DATA }
enum  t38_transport_types_e { T38_TRANSPORT_UDPTL = 0, T38_TRANSPORT_RTP, T38_TRANSPORT_TCP }
enum  t38_data_rate_management_types_e { T38_DATA_RATE_MANAGEMENT_LOCAL_TCF = 1, T38_DATA_RATE_MANAGEMENT_TRANSFERRED_TCF = 2 }

Functions

const char * t38_indicator_to_str (int indicator)
 Convert the code for an indicator to a short text name.
const char * t38_data_type_to_str (int data_type)
 Convert the code for a type of data to a short text name.
const char * t38_field_type_to_str (int field_type)
 Convert the code for a type of data field to a short text name.
const char * t38_cm_profile_to_str (int profile)
 Convert the code for a CM profile code to text description.
const char * t38_jm_to_str (const uint8_t *data, int len)
 Convert a JM message code to text description.
int t38_v34rate_to_bps (const uint8_t *data, int len)
 Convert a V34rate message to an actual bit rate.
int t38_core_send_indicator (t38_core_state_t *s, int indicator, int count)
 Send an indicator packet.
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.
int t38_core_send_data (t38_core_state_t *s, int data_type, int field_type, const uint8_t field[], int field_len, int count)
 Send a data packet.
int t38_core_send_data_multi_field (t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int count)
 Send a data packet.
int t38_core_rx_ifp_packet (t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no)
 Process a received T.38 IFP packet.
void t38_set_data_rate_management_method (t38_core_state_t *s, int method)
void t38_set_data_transport_protocol (t38_core_state_t *s, int data_transport_protocol)
void t38_set_fill_bit_removal (t38_core_state_t *s, int fill_bit_removal)
void t38_set_mmr_transcoding (t38_core_state_t *s, int mmr_transcoding)
void t38_set_jbig_transcoding (t38_core_state_t *s, int jbig_transcoding)
void t38_set_max_buffer_size (t38_core_state_t *s, int max_buffer_size)
void t38_set_max_datagram_size (t38_core_state_t *s, int max_datagram_size)
int t38_get_fastest_image_data_rate (t38_core_state_t *s)
void t38_set_t38_version (t38_core_state_t *s, int t38_version)
void t38_set_sequence_number_handling (t38_core_state_t *s, int check)
void t38_set_tep_handling (t38_core_state_t *s, int allow_for_tep)
logging_state_t * t38_core_get_logging_state (t38_core_state_t *s)
 Get a pointer to the logging context associated with a T.38 context.
t38_core_state_tt38_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.
int t38_core_release (t38_core_state_t *s)
 Release a signaling tone transmitter context.
int t38_core_free (t38_core_state_t *s)
 Free a signaling tone transmitter context.

Detailed Description


Typedef Documentation

Core T.38 state, common to all modes of T.38.


Enumeration Type Documentation

T.38 indicator types

T.38 TCF management types

T.38 data types

T.38 field classes

T.38 data field types

T.38 message types

T.38 transport types


Function Documentation

const char* t38_cm_profile_to_str ( int  profile  ) 

Convert the code for a CM profile code to text description.

Parameters:
profile The profile code from a CM message.
Returns:
A pointer to a short text description of the profile.
int t38_core_free ( t38_core_state_t s  ) 

Free a signaling tone transmitter context.

Free a signaling tone transmitter context.

Parameters:
s The T.38 context.
Returns:
0 for OK
logging_state_t* t38_core_get_logging_state ( t38_core_state_t s  ) 

Get a pointer to the logging context associated with a T.38 context.

Get a pointer to the logging context associated with a T.38 context.

Parameters:
s The T.38 context.
Returns:
A pointer to the logging context, or NULL.
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.

Initialise a T.38 core context.

Parameters:
s The T.38 context.
rx_indicator_handler Receive indicator handling routine.
rx_data_handler Receive data packet handling routine.
rx_rx_missing_handler Missing receive packet handling routine.
rx_packet_user_data An opaque pointer passed to the rx packet handling routines.
tx_packet_handler Packet transmit handling routine.
tx_packet_user_data An opaque pointer passed to the tx_packet_handler.
Returns:
A pointer to the T.38 context, or NULL if there was a problem.
int t38_core_release ( t38_core_state_t s  ) 

Release a signaling tone transmitter context.

Release a signaling tone transmitter context.

Parameters:
s The T.38 context.
Returns:
0 for OK
int t38_core_rx_ifp_packet ( t38_core_state_t s,
const uint8_t *  buf,
int  len,
uint16_t  seq_no 
)

Process a received T.38 IFP packet.

Parameters:
s The T.38 context.
buf The packet contents.
len The length of the packet contents.
seq_no The packet sequence number.
Returns:
0 for OK, else -1.

References t38_data_type_to_str(), t38_field_type_to_str(), and t38_indicator_to_str().

int t38_core_send_data ( t38_core_state_t s,
int  data_type,
int  field_type,
const uint8_t  field[],
int  field_len,
int  count 
)

Send a data packet.

Parameters:
s The T.38 context.
data_type The packet's data type.
field_type The packet's field type.
field The message data content for the packet.
field_len The length of the message data, in bytes.
count The number of copies of the packet to send.
Returns:
???

References t38_data_field_t::field, t38_data_field_t::field_len, and t38_data_field_t::field_type.

int t38_core_send_data_multi_field ( t38_core_state_t s,
int  data_type,
const t38_data_field_t  field[],
int  fields,
int  count 
)

Send a data packet.

Parameters:
s The T.38 context.
data_type The packet's data type.
field The list of fields.
fields The number of fields in the list.
count The number of copies of the packet to send.
Returns:
???
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.

Parameters:
s The T.38 context.
indicator The indicator to send.
Returns:
The delay to allow for initial HDLC flags after this indicator is sent.
int t38_core_send_indicator ( t38_core_state_t s,
int  indicator,
int  count 
)

Send an indicator packet.

Parameters:
s The T.38 context.
indicator The indicator to send.
count The number of copies of the packet to send.
Returns:
The delay to allow after this indicator is sent.

References t38_indicator_to_str().

const char* t38_data_type_to_str ( int  data_type  ) 

Convert the code for a type of data to a short text name.

Parameters:
data_type The data type.
Returns:
A pointer to a short text name for the data type.

Referenced by t38_core_rx_ifp_packet().

const char* t38_field_type_to_str ( int  field_type  ) 

Convert the code for a type of data field to a short text name.

Parameters:
field_type The field type.
Returns:
A pointer to a short text name for the field type.

Referenced by t38_core_rx_ifp_packet().

const char* t38_indicator_to_str ( int  indicator  ) 

Convert the code for an indicator to a short text name.

Parameters:
indicator The type of indicator.
Returns:
A pointer to a short text name for the indicator.

Referenced by t38_core_rx_ifp_packet(), and t38_core_send_indicator().

const char* t38_jm_to_str ( const uint8_t *  data,
int  len 
)

Convert a JM message code to text description.

Parameters:
data The data field of the message.
len The length of the data field.
Returns:
A pointer to a short text description of the profile.
void t38_set_data_rate_management_method ( t38_core_state_t s,
int  method 
)

Set the method to be used for data rate management, as per the T.38 spec.

Parameters:
s The T.38 context.
method 1 for pass TCF across the T.38 link, 2 for handle TCF locally.
void t38_set_data_transport_protocol ( t38_core_state_t s,
int  data_transport_protocol 
)

Set the data transport protocol.

Parameters:
s The T.38 context.
data_transport_protocol UDPTL, RTP or TPKT.
void t38_set_fill_bit_removal ( t38_core_state_t s,
int  fill_bit_removal 
)

Set the non-ECM fill bit removal mode.

Parameters:
s The T.38 context.
fill_bit_removal TRUE to remove fill bits across the T.38 link, else FALSE.
void t38_set_jbig_transcoding ( t38_core_state_t s,
int  jbig_transcoding 
)

Set the JBIG transcoding mode.

Parameters:
s The T.38 context.
jbig_transcoding TRUE to transcode to JBIG across the T.38 link, else FALSE.
void t38_set_mmr_transcoding ( t38_core_state_t s,
int  mmr_transcoding 
)

Set the MMR transcoding mode.

Parameters:
s The T.38 context.
mmr_transcoding TRUE to transcode to MMR across the T.38 link, else FALSE.
void t38_set_sequence_number_handling ( t38_core_state_t s,
int  check 
)

Set the sequence number handling option.

Parameters:
s The T.38 context.
check TRUE to check sequence numbers, and handle gaps reasonably. FALSE for no sequence number processing (e.g. for TPKT over TCP transport).
void t38_set_t38_version ( t38_core_state_t s,
int  t38_version 
)

Set the T.38 version to be emulated.

Parameters:
s The T.38 context.
t38_version Version number, as in the T.38 spec.
void t38_set_tep_handling ( t38_core_state_t s,
int  allow_for_tep 
)

Set the TEP handling option.

Parameters:
s The T.38 context.
allow_for_tep TRUE to allow for TEP playout, else FALSE.

Referenced by t38_terminal_set_tep_mode().

int t38_v34rate_to_bps ( const uint8_t *  data,
int  len 
)

Convert a V34rate message to an actual bit rate.

Parameters:
data The data field of the message.
len The length of the data field.
Returns:
The bit rate, or -1 for a bad message.

Generated by  doxygen 1.6.2