t30_api.c File Reference
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <inttypes.h>`
`#include <string.h>`
`#include <fcntl.h>`
`#include <time.h>`
`#include "floating_fudge.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/v29rx.h"`
`#include "spandsp/v29tx.h"`
`#include "spandsp/v27ter_rx.h"`
`#include "spandsp/v27ter_tx.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/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 "t30_local.h"`

## Functions

int | t30_set_tx_ident (t30_state_t *s, const char *id)
| Set the transmitted identifier associated with a T.30 context.
const char * | t30_get_tx_ident (t30_state_t *s)
| Set the transmitted identifier associated with a T.30 context.
const char * | t30_get_rx_ident (t30_state_t *s)
| Set the transmitted identifier associated with a T.30 context.
int | t30_set_tx_sub_address (t30_state_t *s, const char *sub_address)
| Set the transmitted sub-address associated with a T.30 context.
const char * | t30_get_tx_sub_address (t30_state_t *s)
| Get the received sub-address associated with a T.30 context.
const char * | t30_get_rx_sub_address (t30_state_t *s)
| Get the received sub-address associated with a T.30 context.
int | t30_set_tx_selective_polling_address (t30_state_t *s, const char *selective_polling_address)
| Set the transmitted selective polling address associated with a T.30 context.
const char * | t30_get_tx_selective_polling_address (t30_state_t *s)
| Get the received selective polling address associated with a T.30 context.
const char * | t30_get_rx_selective_polling_address (t30_state_t *s)
| Get the received selective polling address associated with a T.30 context.
int | t30_set_tx_polled_sub_address (t30_state_t *s, const char *polled_sub_address)
| Set the transmitted polled sub-address associated with a T.30 context.
const char * | t30_get_tx_polled_sub_address (t30_state_t *s)
| Get the received polled sub-address associated with a T.30 context.
const char * | t30_get_rx_polled_sub_address (t30_state_t *s)
| Get the received polled sub-address associated with a T.30 context.
int | t30_set_tx_sender_ident (t30_state_t *s, const char *sender_ident)
| Set the transmitted sender ident associated with a T.30 context.
const char * | t30_get_tx_sender_ident (t30_state_t *s)
| Get the received sender ident associated with a T.30 context.
const char * | t30_get_rx_sender_ident (t30_state_t *s)
| Get the received sender ident associated with a T.30 context.
int | t30_set_tx_password (t30_state_t *s, const char *password)
| Set the transmitted password associated with a T.30 context.
const char * | t30_get_tx_password (t30_state_t *s)
| Get the received password associated with a T.30 context.
const char * | t30_get_rx_password (t30_state_t *s)
| Get the received password associated with a T.30 context.
int | t30_set_tx_nsf (t30_state_t *s, const uint8_t *nsf, int len)
| Set the transmitted NSF frame to be associated with a T.30 context.
size_t | t30_get_tx_nsf (t30_state_t *s, const uint8_t *nsf[])
| Set an NSF frame to be associated with a T.30 context.
size_t | t30_get_rx_nsf (t30_state_t *s, const uint8_t *nsf[])
| Set an NSF frame to be associated with a T.30 context.
int | t30_set_tx_nsc (t30_state_t *s, const uint8_t *nsc, int len)
| Set the transmitted NSC frame to be associated with a T.30 context.
size_t | t30_get_tx_nsc (t30_state_t *s, const uint8_t *nsc[])
| Set an NSC frame to be associated with a T.30 context.
size_t | t30_get_rx_nsc (t30_state_t *s, const uint8_t *nsc[])
| Set an NSC frame to be associated with a T.30 context.
int | t30_set_tx_nss (t30_state_t *s, const uint8_t *nss, int len)
| Set the transmitted NSS frame to be associated with a T.30 context.
size_t | t30_get_tx_nss (t30_state_t *s, const uint8_t *nss[])
| Set an NSS frame to be associated with a T.30 context.
size_t | t30_get_rx_nss (t30_state_t *s, const uint8_t *nss[])
| Set an NSS frame to be associated with a T.30 context.
int | t30_set_tx_tsa (t30_state_t *s, int type, const char *address, int len)
| Set the transmitted TSA associated with a T.30 context.
size_t | t30_get_tx_tsa (t30_state_t *s, int *type, const char *address[])
| Get the received TSA associated with a T.30 context.
size_t | t30_get_rx_tsa (t30_state_t *s, int *type, const char *address[])
| Get the received TSA associated with a T.30 context.
int | t30_set_tx_ira (t30_state_t *s, int type, const char *address, int len)
| Set the transmitted IRA associated with a T.30 context.
size_t | t30_get_tx_ira (t30_state_t *s, int *type, const char *address[])
| Get the received IRA associated with a T.30 context.
size_t | t30_get_rx_ira (t30_state_t *s, int *type, const char *address[])
| Get the received IRA associated with a T.30 context.
int | t30_set_tx_cia (t30_state_t *s, int type, const char *address, int len)
| Set the transmitted CIA associated with a T.30 context.
size_t | t30_get_tx_cia (t30_state_t *s, int *type, const char *address[])
| Get the received CIA associated with a T.30 context.
size_t | t30_get_rx_cia (t30_state_t *s, int *type, const char *address[])
| Get the received CIA associated with a T.30 context.
int | t30_set_tx_isp (t30_state_t *s, int type, const char *address, int len)
| Set the transmitted ISP associated with a T.30 context.
size_t | t30_get_tx_isp (t30_state_t *s, int *type, const char *address[])
| Get the received ISP associated with a T.30 context.
size_t | t30_get_rx_isp (t30_state_t *s, int *type, const char *address[])
| Get the received ISP associated with a T.30 context.
int | t30_set_tx_csa (t30_state_t *s, int type, const char *address, int len)
| Set the transmitted CSA associated with a T.30 context.
size_t | t30_get_tx_csa (t30_state_t *s, int *type, const char *address[])
| Get the received CSA associated with a T.30 context.
size_t | t30_get_rx_csa (t30_state_t *s, int *type, const char *address[])
| Get the received CSA associated with a T.30 context.
int | t30_set_tx_page_header_overlays_image (t30_state_t *s, int header_overlays_image)
| Set page header overlay mode.
int | t30_set_tx_page_header_info (t30_state_t *s, const char *info)
| Set the transmitted header information associated with a T.30 context.
size_t | t30_get_tx_page_header_info (t30_state_t *s, char *info)
| Get the header information associated with a T.30 context.
int | t30_set_tx_page_header_tz (t30_state_t *s, const char *tzstring)
| Set the transmitted header timestamp timezone associated with a T.30 context.
const char * | t30_get_rx_country (t30_state_t *s)
| Get the country of origin of the remote FAX machine associated with a T.30 context.
const char * | t30_get_rx_vendor (t30_state_t *s)
| Get the name of the vendor of the remote FAX machine associated with a T.30 context.
const char * | t30_get_rx_model (t30_state_t *s)
| Get the name of the model of the remote FAX machine associated with a T.30 context.
void | t30_set_rx_file (t30_state_t *s, const char *file, int stop_page)
| Set next receive file name.
void | t30_set_tx_file (t30_state_t *s, const char *file, int start_page, int stop_page)
| Set next transmit file name.
void | t30_set_iaf_mode (t30_state_t *s, int iaf)
| Set Internet aware FAX (IAF) mode.
int | t30_set_ecm_capability (t30_state_t *s, int enabled)
| Select ECM capability.
int | t30_set_rx_encoding (t30_state_t *s, int encoding)
| Specify the output encoding for TIFF files created during FAX reception.
int | t30_set_minimum_scan_line_time (t30_state_t *s, int min_time)
| Specify minimum scan line time.
int | t30_set_supported_modems (t30_state_t *s, int supported_modems)
| Specify supported modems.
int | t30_set_supported_compressions (t30_state_t *s, int supported_compressions)
| Specify supported compression types.
int | t30_set_supported_resolutions (t30_state_t *s, int supported_resolutions)
| Specify supported resolutions.
int | t30_set_supported_image_sizes (t30_state_t *s, int supported_image_sizes)
| Specify supported image sizes.
int | t30_set_supported_t30_features (t30_state_t *s, int supported_t30_features)
| Specify supported T.30 features.
void | t30_set_status (t30_state_t *s, int status)
| Set T.30 status.
int | t30_set_receiver_not_ready (t30_state_t *s, int count)
| Specify a period of responding with receiver not ready.
void | t30_set_phase_b_handler (t30_state_t *s, t30_phase_b_handler_t *handler, void *user_data)
| Set a callback function for T.30 phase B handling.
void | t30_set_phase_d_handler (t30_state_t *s, t30_phase_d_handler_t *handler, void *user_data)
| Set a callback function for T.30 phase D handling.
void | t30_set_phase_e_handler (t30_state_t *s, t30_phase_e_handler_t *handler, void *user_data)
| Set a callback function for T.30 phase E handling.
void | t30_set_document_handler (t30_state_t *s, t30_document_handler_t *handler, void *user_data)
| Set a callback function for T.30 end of document handling.
void | t30_set_real_time_frame_handler (t30_state_t *s, t30_real_time_frame_handler_t *handler, void *user_data)
| Set a callback function for T.30 frame exchange monitoring.
logging_state_t * | t30_get_logging_state (t30_state_t *s)
| Get a pointer to the logging context associated with a T.30 context.

## Function Documentation

## t30_get_logging_state()

logging_state_t * t30_get_logging_state | ( | t30_state_t * | s | ) |

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

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

Parameters

  s | The T.30 context.

Returns
  A pointer to the logging context, or NULL.

References t30_state_s::logging.

## t30_get_rx_cia()

size_t t30_get_rx_cia | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received CIA associated with a T.30 context.

Get the received CIA associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::cia_type, and t30_state_s::rx_info.

## t30_get_rx_country()

const char * t30_get_rx_country | ( | t30_state_t * | s | ) |

Get the country of origin of the remote FAX machine associated with a T.30 context.

Get the country of origin of the remote FAX machine associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  a pointer to the country name, or NULL if the country is not known.

References t30_state_s::country.

## t30_get_rx_csa()

size_t t30_get_rx_csa | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received CSA associated with a T.30 context.

Get the received CSA associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::csa_type, and t30_state_s::rx_info.

## t30_get_rx_ident()

const char * t30_get_rx_ident | ( | t30_state_t * | s | ) |

Set the transmitted identifier associated with a T.30 context.

Get the transmitted identifier associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the identifier.

References t30_exchanged_info_t::ident, and t30_state_s::rx_info.

## t30_get_rx_ira()

size_t t30_get_rx_ira | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received IRA associated with a T.30 context.

Get the received IRA associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  The length of the address.

References t30_exchanged_info_t::ira_type, and t30_state_s::rx_info.

## t30_get_rx_isp()

size_t t30_get_rx_isp | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received ISP associated with a T.30 context.

Get the received ISP associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::isp_type, and t30_state_s::rx_info.

## t30_get_rx_model()

const char * t30_get_rx_model | ( | t30_state_t * | s | ) |

Get the name of the model of the remote FAX machine associated with a T.30 context.

Get the name of the model of the remote FAX machine associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  a pointer to the model name, or NULL if the model is not known.

References t30_state_s::model.

## t30_get_rx_nsc()

size_t t30_get_rx_nsc | ( | t30_state_t * | s,
|  | const uint8_t * | nsc[] )

Set an NSC frame to be associated with a T.30 context.

Get an NSC frame to be associated with a T.30 context.

Parameters

  s | The T.30 context.
  nsc | A pointer to the frame.

Returns
  the length of the NSC message.

References t30_exchanged_info_t::nsc, and t30_state_s::rx_info.

## t30_get_rx_nsf()

size_t t30_get_rx_nsf | ( | t30_state_t * | s,
|  | const uint8_t * | nsf[] )

Set an NSF frame to be associated with a T.30 context.

Get an NSF frame to be associated with a T.30 context.

Parameters

  s | The T.30 context.
  nsf | A pointer to the frame.

Returns
  the length of the NSF message.

References t30_exchanged_info_t::nsf, and t30_state_s::rx_info.

## t30_get_rx_nss()

size_t t30_get_rx_nss | ( | t30_state_t * | s,
|  | const uint8_t * | nss[] )

Set an NSS frame to be associated with a T.30 context.

Get an NSS frame to be associated with a T.30 context.

Parameters

  s | The T.30 context.
  nss | A pointer to the frame.

Returns
  the length of the NSS message.

References t30_exchanged_info_t::nss, and t30_state_s::rx_info.

## t30_get_rx_password()

const char * t30_get_rx_password | ( | t30_state_t * | s | ) |

Get the received password associated with a T.30 context.

Get the received password (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the password.

References t30_exchanged_info_t::password, and t30_state_s::rx_info.

## t30_get_rx_polled_sub_address()

const char * t30_get_rx_polled_sub_address | ( | t30_state_t * | s | ) |

Get the received polled sub-address associated with a T.30 context.

Get the received polled sub-address (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the polled sub-address.

References t30_exchanged_info_t::polled_sub_address, and t30_state_s::rx_info.

## t30_get_rx_selective_polling_address()

const char * t30_get_rx_selective_polling_address | ( | t30_state_t * | s | ) |

Get the received selective polling address associated with a T.30 context.

Get the received selective polling address (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the selective polling address.

References t30_state_s::rx_info, and t30_exchanged_info_t::selective_polling_address.

## t30_get_rx_sender_ident()

const char * t30_get_rx_sender_ident | ( | t30_state_t * | s | ) |

Get the received sender ident associated with a T.30 context.

Get the received sender ident (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the sender ident.

References t30_state_s::rx_info, and t30_exchanged_info_t::sender_ident.

## t30_get_rx_sub_address()

const char * t30_get_rx_sub_address | ( | t30_state_t * | s | ) |

Get the received sub-address associated with a T.30 context.

Get the received sub-address associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the sub-address.

References t30_state_s::rx_info, and t30_exchanged_info_t::sub_address.

## t30_get_rx_tsa()

size_t t30_get_rx_tsa | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received TSA associated with a T.30 context.

Get the received TSA associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  The length of the address.

References t30_state_s::rx_info, and t30_exchanged_info_t::tsa_type.

## t30_get_rx_vendor()

const char * t30_get_rx_vendor | ( | t30_state_t * | s | ) |

Get the name of the vendor of the remote FAX machine associated with a T.30 context.

Get the name of the vendor of the remote FAX machine associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  a pointer to the vendor name, or NULL if the vendor is not known.

References t30_state_s::vendor.

## t30_get_tx_cia()

size_t t30_get_tx_cia | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received CIA associated with a T.30 context.

Get the transmitted CIA (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  The length of the address.

References t30_exchanged_info_t::cia_type, and t30_state_s::tx_info.

## t30_get_tx_csa()

size_t t30_get_tx_csa | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received CSA associated with a T.30 context.

Get the transmitted CSA (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  The length of the address.

References t30_exchanged_info_t::csa_type, and t30_state_s::tx_info.

## t30_get_tx_ident()

const char * t30_get_tx_ident | ( | t30_state_t * | s | ) |

Set the transmitted identifier associated with a T.30 context.

Get the transmitted identifier associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the identifier.

References t30_exchanged_info_t::ident, and t30_state_s::tx_info.

## t30_get_tx_ira()

size_t t30_get_tx_ira | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received IRA associated with a T.30 context.

Get the transmitted IRA (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  The length of the address.

References t30_exchanged_info_t::ira_type, and t30_state_s::tx_info.

## t30_get_tx_isp()

size_t t30_get_tx_isp | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received ISP associated with a T.30 context.

Get the transmitted ISP (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::isp_type, and t30_state_s::tx_info.

## t30_get_tx_nsc()

size_t t30_get_tx_nsc | ( | t30_state_t * | s,
|  | const uint8_t * | nsc[] )

Set an NSC frame to be associated with a T.30 context.

Get an NSC frame to be associated with a T.30 context.

Parameters

  s | The T.30 context.
  nsc | A pointer to the frame.

Returns
  the length of the NSC message.

References t30_exchanged_info_t::nsc, and t30_state_s::tx_info.

## t30_get_tx_nsf()

size_t t30_get_tx_nsf | ( | t30_state_t * | s,
|  | const uint8_t * | nsf[] )

Set an NSF frame to be associated with a T.30 context.

Get an NSF frame to be associated with a T.30 context.

Parameters

  s | The T.30 context.
  nsf | A pointer to the frame.

Returns
  the length of the NSF message.

References t30_exchanged_info_t::nsf, and t30_state_s::tx_info.

## t30_get_tx_nss()

size_t t30_get_tx_nss | ( | t30_state_t * | s,
|  | const uint8_t * | nss[] )

Set an NSS frame to be associated with a T.30 context.

Get an NSS frame to be associated with a T.30 context.

Parameters

  s | The T.30 context.
  nss | A pointer to the frame.

Returns
  the length of the NSS message.

References t30_exchanged_info_t::nss, and t30_state_s::tx_info.

## t30_get_tx_page_header_info()

size_t t30_get_tx_page_header_info | ( | t30_state_t * | s,
|  | char * | info )

Get the header information associated with a T.30 context.

Get the header information associated with a T.30 context.

Parameters

  s | The T.30 context.
  info | A pointer to a buffer for the header information. The buffer should be at least 51 bytes long.

Returns
  the length of the string.

References t30_state_s::header_info.

## t30_get_tx_password()

const char * t30_get_tx_password | ( | t30_state_t * | s | ) |

Get the received password associated with a T.30 context.

Get the received password (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the password.

References t30_exchanged_info_t::password, and t30_state_s::tx_info.

## t30_get_tx_polled_sub_address()

const char * t30_get_tx_polled_sub_address | ( | t30_state_t * | s | ) |

Get the received polled sub-address associated with a T.30 context.

Get the received polled sub-address (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the polled sub-address.

References t30_exchanged_info_t::polled_sub_address, and t30_state_s::tx_info.

## t30_get_tx_selective_polling_address()

const char * t30_get_tx_selective_polling_address | ( | t30_state_t * | s | ) |

Get the received selective polling address associated with a T.30 context.

Get the received selective polling address (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the selective polling address.

References t30_exchanged_info_t::selective_polling_address, and t30_state_s::tx_info.

## t30_get_tx_sender_ident()

const char * t30_get_tx_sender_ident | ( | t30_state_t * | s | ) |

Get the received sender ident associated with a T.30 context.

Get the received sender ident (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the sender ident.

References t30_exchanged_info_t::sender_ident, and t30_state_s::tx_info.

## t30_get_tx_sub_address()

const char * t30_get_tx_sub_address | ( | t30_state_t * | s | ) |

Get the received sub-address associated with a T.30 context.

Get the received sub-address associated with a T.30 context.

Parameters

  s | The T.30 context.

Returns
  A pointer to the sub-address.

References t30_exchanged_info_t::sub_address, and t30_state_s::tx_info.

## t30_get_tx_tsa()

size_t t30_get_tx_tsa | ( | t30_state_t * | s,
|  | int * | type,
|  | const char * | address[] )

Get the received TSA associated with a T.30 context.

Get the transmitted TSA (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.

Returns
  The length of the address.

References t30_exchanged_info_t::tsa_type, and t30_state_s::tx_info.

## t30_set_document_handler()

void t30_set_document_handler | ( | t30_state_t * | s,
|  | t30_document_handler_t * | handler,
|  | void * | user_data )

Set a callback function for T.30 end of document handling.

Set a callback function for T.30 end of document handling.

Parameters

  s | The T.30 context.
  handler | The callback function.
  user_data | An opaque pointer passed to the callback function.

References t30_state_s::document_handler, and t30_state_s::document_user_data.

## t30_set_ecm_capability()

int t30_set_ecm_capability | ( | t30_state_t * | s,
|  | int | enabled )

Select ECM capability.

Specify if error correction mode (ECM) is allowed by a T.30 context.

Parameters

  s | The T.30 context.
  enabled | TRUE for ECM capable, FALSE for not ECM capable.

Returns
  0 if OK, else -1.

References t30_state_s::ecm_allowed.

## t30_set_iaf_mode()

void t30_set_iaf_mode | ( | t30_state_t * | s,
|  | int | iaf )

Set Internet aware FAX (IAF) mode.

Set Internet aware FAX (IAF) mode.

Parameters

  s | The T.30 context.
  iaf | TRUE for IAF, or FALSE for non-IAF.

References t30_state_s::iaf.

Referenced by t38_terminal_init(), and t38_terminal_set_fill_bit_removal().

## t30_set_minimum_scan_line_time()

int t30_set_minimum_scan_line_time | ( | t30_state_t * | s,
|  | int | min_time )

Specify minimum scan line time.

Specify the minimum scan line time supported by a T.30 context.

Parameters

  s | The T.30 context.
  min_time | The minimum permitted scan line time, in milliseconds.

Returns
  0 if OK, else -1.

References t30_state_s::local_min_scan_time_code.

## t30_set_phase_b_handler()

void t30_set_phase_b_handler | ( | t30_state_t * | s,
|  | t30_phase_b_handler_t * | handler,
|  | void * | user_data )

Set a callback function for T.30 phase B handling.

Set a callback function for T.30 phase B handling.

Parameters

  s | The T.30 context.
  handler | The callback function.
  user_data | An opaque pointer passed to the callback function.

References t30_state_s::phase_b_handler, and t30_state_s::phase_b_user_data.

## t30_set_phase_d_handler()

void t30_set_phase_d_handler | ( | t30_state_t * | s,
|  | t30_phase_d_handler_t * | handler,
|  | void * | user_data )

Set a callback function for T.30 phase D handling.

Set a callback function for T.30 phase D handling.

Parameters

  s | The T.30 context.
  handler | The callback function.
  user_data | An opaque pointer passed to the callback function.

References t30_state_s::phase_d_handler, and t30_state_s::phase_d_user_data.

## t30_set_phase_e_handler()

void t30_set_phase_e_handler | ( | t30_state_t * | s,
|  | t30_phase_e_handler_t * | handler,
|  | void * | user_data )

Set a callback function for T.30 phase E handling.

Set a callback function for T.30 phase E handling.

Parameters

  s | The T.30 context.
  handler | The callback function.
  user_data | An opaque pointer passed to the callback function.

References t30_state_s::phase_e_handler, and t30_state_s::phase_e_user_data.

## t30_set_real_time_frame_handler()

void t30_set_real_time_frame_handler | ( | t30_state_t * | s,
|  | t30_real_time_frame_handler_t * | handler,
|  | void * | user_data )

Set a callback function for T.30 frame exchange monitoring.

Set a callback function for T.30 frame exchange monitoring. This is called from the heart of the signal processing, so don't take too long in the handler routine.

Parameters

  s | The T.30 context.
  handler | The callback function.
  user_data | An opaque pointer passed to the callback function.

References t30_state_s::real_time_frame_handler, and t30_state_s::real_time_frame_user_data.

## t30_set_receiver_not_ready()

int t30_set_receiver_not_ready | ( | t30_state_t * | s,
|  | int | count )

Specify a period of responding with receiver not ready.

Specify a period of responding with receiver not ready.

Parameters

  s | The T.30 context.
  count | The number of times to report receiver not ready.

Returns
  0 if OK, else -1.

References t30_state_s::receiver_not_ready_count.

## t30_set_rx_encoding()

int t30_set_rx_encoding | ( | t30_state_t * | s,
|  | int | encoding )

Specify the output encoding for TIFF files created during FAX reception.

Specify the output encoding for TIFF files created during FAX reception.

Parameters

  s | The T.30 context.
  encoding | The coding required. The options are T4_COMPRESSION_ITU_T4_1D, T4_COMPRESSION_ITU_T4_2D, T4_COMPRESSION_ITU_T6. T6 is usually the densest option, but support for it is broken in a number of software packages.

Returns
  0 if OK, else -1.

References t30_state_s::output_encoding, T4_COMPRESSION_ITU_T4_1D, T4_COMPRESSION_ITU_T4_2D, and T4_COMPRESSION_ITU_T6.

## t30_set_rx_file()

void t30_set_rx_file | ( | t30_state_t * | s,
|  | const char * | file,
|  | int | stop_page )

Set next receive file name.

Specify the file name of the next TIFF file to be received by a T.30 context.

Parameters

  s | The T.30 context.
  file | The file name
  stop_page | The maximum page to receive. -1 for no restriction.

References t30_state_s::rx_file, and t30_state_s::rx_stop_page.

## t30_set_status()

void t30_set_status | ( | t30_state_t * | s,
|  | int | status )

Set T.30 status.

Set T.30 status. This may be used to adjust the status from within the phase B and phase D callbacks.

Parameters

  s | The T.30 context.
  status | The new status.

References t30_state_s::current_status, t30_state_s::logging, span_log(), and t30_completion_code_to_str().

Referenced by t30_terminate().

## t30_set_supported_compressions()

int t30_set_supported_compressions | ( | t30_state_t * | s,
|  | int | supported_compressions )

Specify supported compression types.

Specify which compression types are supported by a T.30 context.

Parameters

  s | The T.30 context.
  supported_compressions | Bit field list of the supported compression types.

Returns
  0 if OK, else -1.

References t30_state_s::supported_compressions, T30_SUPPORT_T4_1D_COMPRESSION, T30_SUPPORT_T4_2D_COMPRESSION, T30_SUPPORT_T6_COMPRESSION, T30_SUPPORT_T85_COMPRESSION, and T30_SUPPORT_T85_L0_COMPRESSION.

## t30_set_supported_image_sizes()

int t30_set_supported_image_sizes | ( | t30_state_t * | s,
|  | int | supported_image_sizes )

Specify supported image sizes.

Specify which images sizes are supported by a T.30 context.

Parameters

  s | The T.30 context.
  supported_image_sizes | Bit field list of the supported widths and lengths.

Returns
  0 if OK, else -1.

References t30_state_s::supported_image_sizes.

## t30_set_supported_modems()

int t30_set_supported_modems | ( | t30_state_t * | s,
|  | int | supported_modems )

Specify supported modems.

Specify which modem types are supported by a T.30 context.

Parameters

  s | The T.30 context.
  supported_modems | Bit field list of the supported modems.

Returns
  0 if OK, else -1.

References t30_state_s::supported_modems.

Referenced by fax_init(), and t38_terminal_init().

## t30_set_supported_resolutions()

int t30_set_supported_resolutions | ( | t30_state_t * | s,
|  | int | supported_resolutions )

Specify supported resolutions.

Specify which resolutions are supported by a T.30 context.

Parameters

  s | The T.30 context.
  supported_resolutions | Bit field list of the supported resolutions.

Returns
  0 if OK, else -1.

References t30_state_s::supported_resolutions.

## t30_set_supported_t30_features()

int t30_set_supported_t30_features | ( | t30_state_t * | s,
|  | int | supported_t30_features )

Specify supported T.30 features.

Specify which special T.30 features are supported by a T.30 context.

Parameters

  s | The T.30 context.
  supported_t30_features | Bit field list of the supported features.

Returns
  0 if OK, else -1.

References t30_state_s::supported_t30_features.

## t30_set_tx_cia()

int t30_set_tx_cia | ( | t30_state_t * | s,
|  | int | type,
|  | const char * | address,
|  | int | len )

Set the transmitted CIA associated with a T.30 context.

Set the transmitted CIA (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.
  len | The length of the address.

Returns
  0 for OK, else -1.

References t30_state_s::tx_info.

## t30_set_tx_csa()

int t30_set_tx_csa | ( | t30_state_t * | s,
|  | int | type,
|  | const char * | address,
|  | int | len )

Set the transmitted CSA associated with a T.30 context.

Set the transmitted CSA (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.
  len | The length of the address.

Returns
  0 for OK, else -1.

References t30_state_s::tx_info.

## t30_set_tx_file()

void t30_set_tx_file | ( | t30_state_t * | s,
|  | const char * | file,
|  | int | start_page,
|  | int | stop_page )

Set next transmit file name.

Specify the file name of the next TIFF file to be transmitted by a T.30 context.

Parameters

  s | The T.30 context.
  file | The file name
  start_page | The first page to send. -1 for no restriction.
  stop_page | The last page to send. -1 for no restriction.

References t30_state_s::tx_file, t30_state_s::tx_start_page, and t30_state_s::tx_stop_page.

## t30_set_tx_ident()

int t30_set_tx_ident | ( | t30_state_t * | s,
|  | const char * | id )

Set the transmitted identifier associated with a T.30 context.

Set the transmitted identifier associated with a T.30 context.

Parameters

  s | The T.30 context.
  id | A pointer to the identifier.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::ident, T30_MAX_IDENT_LEN, t30_state_s::t4, t4_tx_set_local_ident(), and t30_state_s::tx_info.

## t30_set_tx_ira()

int t30_set_tx_ira | ( | t30_state_t * | s,
|  | int | type,
|  | const char * | address,
|  | int | len )

Set the transmitted IRA associated with a T.30 context.

Set the transmitted IRA (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.
  len | The length of the address.

Returns
  0 for OK, else -1.

References t30_state_s::tx_info.

## t30_set_tx_isp()

int t30_set_tx_isp | ( | t30_state_t * | s,
|  | int | type,
|  | const char * | address,
|  | int | len )

Set the transmitted ISP associated with a T.30 context.

Set the transmitted ISP (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.
  len | The length of the address.

Returns
  0 for OK, else -1.

References t30_state_s::tx_info.

## t30_set_tx_nsc()

int t30_set_tx_nsc | ( | t30_state_t * | s,
|  | const uint8_t * | nsc,
|  | int | len )

Set the transmitted NSC frame to be associated with a T.30 context.

Set the transmitted NSC frame to be associated with a T.30 context.

Parameters

  s | The T.30 context.
  nsc | A pointer to the frame.
  len | The length of the frame.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::nsc, and t30_state_s::tx_info.

## t30_set_tx_nsf()

int t30_set_tx_nsf | ( | t30_state_t * | s,
|  | const uint8_t * | nsf,
|  | int | len )

Set the transmitted NSF frame to be associated with a T.30 context.

Set the transmitted NSF frame to be associated with a T.30 context.

Parameters

  s | The T.30 context.
  nsf | A pointer to the frame.
  len | The length of the frame.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::nsf, and t30_state_s::tx_info.

## t30_set_tx_nss()

int t30_set_tx_nss | ( | t30_state_t * | s,
|  | const uint8_t * | nss,
|  | int | len )

Set the transmitted NSS frame to be associated with a T.30 context.

Set the transmitted NSS frame to be associated with a T.30 context.

Parameters

  s | The T.30 context.
  nss | A pointer to the frame.
  len | The length of the frame.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::nss, and t30_state_s::tx_info.

## t30_set_tx_page_header_info()

int t30_set_tx_page_header_info | ( | t30_state_t * | s,
|  | const char * | info )

Set the transmitted header information associated with a T.30 context.

Set the transmitted header information associated with a T.30 context.

Parameters

  s | The T.30 context.
  info | A pointer to the information string.

Returns
  0 for OK, else -1.

References t30_state_s::header_info, T30_MAX_PAGE_HEADER_INFO, t30_state_s::t4, and t4_tx_set_header_info().

## t30_set_tx_page_header_overlays_image()

int t30_set_tx_page_header_overlays_image | ( | t30_state_t * | s,
|  | int | header_overlays_image )

Set page header overlay mode.

Set page header extends or overlays the image mode.

Parameters

  s | The T.30 context.
  header_overlays_image | TRUE for overlay, or FALSE for extend the page.

References t30_state_s::header_overlays_image, and t30_state_s::t4.

## t30_set_tx_page_header_tz()

int t30_set_tx_page_header_tz | ( | t30_state_t * | s,
|  | const char * | tzstring )

Set the transmitted header timestamp timezone associated with a T.30 context.

Set the transmitted header timestamp timezone associated with a T.30 context.

Parameters

  s | The T.30 context.
  info | A pointer to the POSIZ timezone string.

Returns
  0 for OK, else -1.

References t30_state_s::t4, t4_tx_set_header_tz(), t30_state_s::tz, and t30_state_s::use_own_tz.

## t30_set_tx_password()

int t30_set_tx_password | ( | t30_state_t * | s,
|  | const char * | password )

Set the transmitted password associated with a T.30 context.

Set the transmitted password (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  password | A pointer to the password.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::password, T30_MAX_IDENT_LEN, and t30_state_s::tx_info.

## t30_set_tx_polled_sub_address()

int t30_set_tx_polled_sub_address | ( | t30_state_t * | s,
|  | const char * | polled_sub_address )

Set the transmitted polled sub-address associated with a T.30 context.

Set the transmitted polled sub-address (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  polled_sub_address | A pointer to the polled sub-address.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::polled_sub_address, T30_MAX_IDENT_LEN, and t30_state_s::tx_info.

## t30_set_tx_selective_polling_address()

int t30_set_tx_selective_polling_address | ( | t30_state_t * | s,
|  | const char * | selective_polling_address )

Set the transmitted selective polling address associated with a T.30 context.

Set the transmitted selective polling address (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  selective_polling_address | A pointer to the selective polling address.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::selective_polling_address, T30_MAX_IDENT_LEN, and t30_state_s::tx_info.

## t30_set_tx_sender_ident()

int t30_set_tx_sender_ident | ( | t30_state_t * | s,
|  | const char * | sender_ident )

Set the transmitted sender ident associated with a T.30 context.

Set the transmitted sender ident (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  sender_ident | A pointer to the sender ident.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::sender_ident, T30_MAX_IDENT_LEN, and t30_state_s::tx_info.

## t30_set_tx_sub_address()

int t30_set_tx_sub_address | ( | t30_state_t * | s,
|  | const char * | sub_address )

Set the transmitted sub-address associated with a T.30 context.

Set the transmitted sub-address associated with a T.30 context.

Parameters

  s | The T.30 context.
  sub_address | A pointer to the sub-address.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::sub_address, T30_MAX_IDENT_LEN, and t30_state_s::tx_info.

## t30_set_tx_tsa()

int t30_set_tx_tsa | ( | t30_state_t * | s,
|  | int | type,
|  | const char * | address,
|  | int | len )

Set the transmitted TSA associated with a T.30 context.

Set the transmitted TSA (i.e. the one we will send to the far end) associated with a T.30 context.

Parameters

  s | The T.30 context.
  type | The type of address.
  address | A pointer to the address.
  len | The length of the address.

Returns
  0 for OK, else -1.

References t30_exchanged_info_t::tsa_type, and t30_state_s::tx_info.