spandsp 0.0.6

t38_terminal.c File Reference
`#include <inttypes.h>`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <fcntl.h>`
`#include <time.h>`
`#include <string.h>`
`#include "floating_fudge.h"`
`#include <assert.h>`
`#include <tiffio.h>`
`#include "spandsp/telephony.h"`
`#include "spandsp/logging.h"`
`#include "spandsp/bit_operations.h"`
`#include "spandsp/queue.h"`
`#include "spandsp/power_meter.h"`
`#include "spandsp/complex.h"`
`#include "spandsp/tone_generate.h"`
`#include "spandsp/async.h"`
`#include "spandsp/hdlc.h"`
`#include "spandsp/fsk.h"`
`#include "spandsp/v29tx.h"`
`#include "spandsp/v29rx.h"`
`#include "spandsp/v27ter_tx.h"`
`#include "spandsp/v27ter_rx.h"`
`#include "spandsp/v17tx.h"`
`#include "spandsp/v17rx.h"`
`#include "spandsp/timezone.h"`
`#include "spandsp/t4_rx.h"`
`#include "spandsp/t4_tx.h"`
`#include "spandsp/t4_t6_decode.h"`
`#include "spandsp/t4_t6_encode.h"`
`#include "spandsp/t30_fcf.h"`
`#include "spandsp/t35.h"`
`#include "spandsp/t30.h"`
`#include "spandsp/t30_api.h"`
`#include "spandsp/t30_logging.h"`
`#include "spandsp/t38_core.h"`
`#include "spandsp/t38_terminal.h"`
`#include "spandsp/private/logging.h"`
`#include "spandsp/private/timezone.h"`
`#include "spandsp/private/t4_t6_decode.h"`
`#include "spandsp/private/t4_t6_encode.h"`
`#include "spandsp/private/t4_rx.h"`
`#include "spandsp/private/t4_tx.h"`
`#include "spandsp/private/t30.h"`
`#include "spandsp/private/t38_core.h"`
`#include "spandsp/private/t38_terminal.h"`

## Macros
#define | DEFAULT_US_PER_TX_CHUNK 30000
#define | INDICATOR_TX_COUNT 3
#define | DATA_TX_COUNT 1
#define | DATA_END_TX_COUNT 3
#define | MAX_OCTETS_PER_UNPACED_CHUNK 300
#define | MID_RX_TIMEOUT 15000

## Enumerations
enum | { T38_CHUNKING_MERGE_FCS_WITH_DATA = 0x0001 , T38_CHUNKING_WHOLE_FRAMES = 0x0002 , T38_CHUNKING_ALLOW_TEP_TIME = 0x0004 , T38_CHUNKING_SEND_REGULAR_INDICATORS = 0x0008 , T38_CHUNKING_SEND_2S_REGULAR_INDICATORS = 0x0010 }
enum | { T38_TIMED_STEP_NONE = 0 , T38_TIMED_STEP_NON_ECM_MODEM = 0x10 , T38_TIMED_STEP_NON_ECM_MODEM_2 = 0x11 , T38_TIMED_STEP_NON_ECM_MODEM_3 = 0x12 , T38_TIMED_STEP_NON_ECM_MODEM_4 = 0x13 , T38_TIMED_STEP_NON_ECM_MODEM_5 = 0x14 , T38_TIMED_STEP_HDLC_MODEM = 0x20 , T38_TIMED_STEP_HDLC_MODEM_2 = 0x21 , T38_TIMED_STEP_HDLC_MODEM_3 = 0x22 , T38_TIMED_STEP_HDLC_MODEM_4 = 0x23 , T38_TIMED_STEP_HDLC_MODEM_5 = 0x24 , T38_TIMED_STEP_CED = 0x30 , T38_TIMED_STEP_CED_2 = 0x31 , T38_TIMED_STEP_CED_3 = 0x32 , T38_TIMED_STEP_CNG = 0x40 , T38_TIMED_STEP_CNG_2 = 0x41 , T38_TIMED_STEP_PAUSE = 0x50 , T38_TIMED_STEP_NO_SIGNAL = 0x60 }

## Functions
int | t38_terminal_send_timeout (t38_terminal_state_t *s, int samples)
void | t38_terminal_set_config (t38_terminal_state_t *s, int config)
| Set configuration options.
void | t38_terminal_set_tep_mode (t38_terminal_state_t *s, int use_tep)
| Select whether TEP time will be allowed for.
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.
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.
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.
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.
int | t38_terminal_restart (t38_terminal_state_t *s, int calling_party)
| Reinitialise a termination mode T.38 context.
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.
int | t38_terminal_release (t38_terminal_state_t *s)
| Release a T.38 context.
int | t38_terminal_free (t38_terminal_state_t *s)
| Free a T.38 context.

## Function Documentation

## ◆ t38_terminal_free()

int t38_terminal_free | ( | t38_terminal_state_t * | s | ) |

Free a T.38 context.

Free a a termination mode T.38 context.

Parameters

  s | The T.38 context.

Returns
  0 for OK, else -1.

References t38_terminal_release().

## ◆ 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.

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.

References t38_terminal_state_s::logging.

## ◆ 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.

Get a pointer to the T.30 engine associated with a termination mode T.38 context.

Parameters

  s | The T.38 context.

Returns
  A pointer to the T.30 context, or NULL.

References t38_terminal_state_s::t30.

## ◆ 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.

Get a pointer to the T.38 core IFP packet engine associated with a termination mode T.38 context.

Parameters

  s | The T.38 context.

Returns
  A pointer to the T.38 core context, or NULL.

References t38_terminal_front_end_state_t::t38, and t38_terminal_state_s::t38_fe.

## ◆ 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.

Parameters

  s | The T.38 context.
  calling_party | TRUE if the context is for a calling party. FALSE if the context is for an answering party.
  tx_packet_handler | A callback routine to encapsulate and transmit T.38 packets.
  tx_packet_user_data | An opaque pointer passed to the tx_packet_handler routine.

Returns
  A pointer to the termination mode T.38 context, or NULL if there was a problem.

References t38_terminal_front_end_state_t::iaf, t38_terminal_state_s::logging, t38_terminal_state_s::t30, t30_init(), t30_restart(), t30_set_iaf_mode(), t30_set_supported_modems(), T30_SUPPORT_IAF, T30_SUPPORT_V17, T30_SUPPORT_V27TER, T30_SUPPORT_V29, t38_terminal_state_s::t38_fe, and t38_terminal_set_config().

## ◆ t38_terminal_release()

int t38_terminal_release | ( | t38_terminal_state_t * | s | ) |

Release a T.38 context.

Release a termination mode T.38 context.

Parameters

  s | The T.38 context.

Returns
  0 for OK, else -1.

References t38_terminal_state_s::t30, and t30_release().

Referenced by t38_terminal_free().

## ◆ t38_terminal_restart()

int t38_terminal_restart | ( | t38_terminal_state_t * | s,
|  | int | calling_party )

Reinitialise a termination mode T.38 context.

Parameters

  s | The T.38 context.
  calling_party | TRUE if the context is for a calling party. FALSE if the context is for an answering party.

Returns
  0 for OK, else -1.

References t38_terminal_state_s::t30, and t30_restart().

## ◆ t38_terminal_set_config()

void t38_terminal_set_config | ( | t38_terminal_state_t * | s,
|  | int | config )

Set configuration options.

Set configuration options.

Parameters

  s | The T.38 context.
  config | A combinations of T38_TERMINAL_OPTION_* bits.

References t38_terminal_front_end_state_t::chunking_modes, DATA_END_TX_COUNT, DATA_TX_COUNT, t38_terminal_front_end_state_t::extra_bits, INDICATOR_TX_COUNT, t38_terminal_front_end_state_t::t38, t38_terminal_state_s::t38_fe, T38_PACKET_CATEGORY_CONTROL_DATA, T38_PACKET_CATEGORY_CONTROL_DATA_END, T38_PACKET_CATEGORY_IMAGE_DATA, T38_PACKET_CATEGORY_IMAGE_DATA_END, T38_PACKET_CATEGORY_INDICATOR, t38_set_redundancy_control(), T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS, T38_TERMINAL_OPTION_NO_INDICATORS, T38_TERMINAL_OPTION_NO_PACING, T38_TERMINAL_OPTION_REGULAR_INDICATORS, and t38_terminal_front_end_state_t::us_per_tx_chunk.

Referenced by t38_terminal_init().

## ◆ 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.

Select whether non-ECM fill bits are to be removed during transmission.

Parameters

  s | The T.38 context.
  remove | TRUE if fill bits are to be removed.

References t38_terminal_front_end_state_t::iaf, t38_terminal_state_s::t30, T30_IAF_MODE_NO_FILL_BITS, t30_set_iaf_mode(), and t38_terminal_state_s::t38_fe.

## ◆ 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.

Select whether the time for talker echo protection tone will be allowed for when sending.

Parameters

  s | The T.38 context.
  use_tep | TRUE if TEP should be allowed for.

References t38_terminal_front_end_state_t::chunking_modes, t38_terminal_front_end_state_t::t38, t38_terminal_state_s::t38_fe, and t38_set_tep_handling().