#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include <fcntl.h>
#include <time.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/t4.h"
#include "spandsp/t30_fcf.h"
#include "spandsp/t35.h"
#include "spandsp/t30.h"
Classes | |
struct | value_string_t |
Defines | |
#define | MAX_MESSAGE_TRIES 3 |
#define | ms_to_samples(t) (((t)*SAMPLE_RATE)/1000) |
#define | DEFAULT_TIMER_T0 60000 |
#define | DEFAULT_TIMER_T1 35000 |
#define | DEFAULT_TIMER_T2 7000 |
#define | DEFAULT_TIMER_T3 15000 |
#define | DEFAULT_TIMER_T4 3450 |
#define | DEFAULT_TIMER_T5 65000 |
#define | DEFAULT_TIMER_T6 5000 |
#define | DEFAULT_TIMER_T7 6000 |
#define | DEFAULT_TIMER_T8 10000 |
#define | FINAL_FLUSH_TIME 1000 |
#define | T30_V17_FALLBACK_START 0 |
#define | T30_V29_FALLBACK_START 3 |
#define | T30_V27TER_FALLBACK_START 6 |
#define | test_ctrl_bit(s, bit) ((s)[3 + ((bit - 1)/8)] & (1 << ((bit - 1)%8))) |
#define | set_ctrl_bit(s, bit) (s)[3 + ((bit - 1)/8)] |= (1 << ((bit - 1)%8)) |
#define | set_ctrl_bits(s, val, bit) (s)[3 + ((bit - 1)/8)] |= ((val) << ((bit - 1)%8)) |
#define | clr_ctrl_bit(s, bit) (s)[3 + ((bit - 1)/8)] &= ~(1 << ((bit - 1)%8)) |
Enumerations | |
enum | { T30_PHASE_IDLE = 0, T30_PHASE_A_CED, T30_PHASE_A_CNG, T30_PHASE_B_RX, T30_PHASE_B_TX, T30_PHASE_C_NON_ECM_RX, T30_PHASE_C_NON_ECM_TX, T30_PHASE_C_ECM_RX, T30_PHASE_C_ECM_TX, T30_PHASE_D_RX, T30_PHASE_D_TX, T30_PHASE_E, T30_PHASE_CALL_FINISHED } |
enum | { T30_STATE_ANSWERING = 1, T30_STATE_B, T30_STATE_C, T30_STATE_D, T30_STATE_D_TCF, T30_STATE_D_POST_TCF, T30_STATE_F_TCF, T30_STATE_F_CFR, T30_STATE_F_FTT, T30_STATE_F_DOC_NON_ECM, T30_STATE_F_POST_DOC_NON_ECM, T30_STATE_F_DOC_ECM, T30_STATE_F_POST_DOC_ECM, T30_STATE_F_POST_RCP_MCF, T30_STATE_F_POST_RCP_PPR, T30_STATE_F_POST_RCP_RNR, T30_STATE_R, T30_STATE_T, T30_STATE_I, T30_STATE_II, T30_STATE_II_Q, T30_STATE_III_Q_MCF, T30_STATE_III_Q_RTP, T30_STATE_III_Q_RTN, T30_STATE_IV, T30_STATE_IV_PPS_NULL, T30_STATE_IV_PPS_Q, T30_STATE_IV_PPS_RNR, T30_STATE_IV_CTC, T30_STATE_IV_EOR, T30_STATE_IV_EOR_RNR, T30_STATE_CALL_FINISHED } |
enum | { T30_MIN_SCAN_20MS = 0, T30_MIN_SCAN_5MS = 1, T30_MIN_SCAN_10MS = 2, T30_MIN_SCAN_40MS = 4, T30_MIN_SCAN_0MS = 7 } |
enum | { T30_MODE_SEND_DOC = 1, T30_MODE_RECEIVE_DOC } |
enum | { T30_COPY_QUALITY_GOOD = 0, T30_COPY_QUALITY_POOR, T30_COPY_QUALITY_BAD } |
enum | { DISBIT1 = 0x01, DISBIT2 = 0x02, DISBIT3 = 0x04, DISBIT4 = 0x08, DISBIT5 = 0x10, DISBIT6 = 0x20, DISBIT7 = 0x40, DISBIT8 = 0x80 } |
Functions | |
const char * | t30_completion_code_to_str (int result) |
Convert a phase E completion code to a short text description. | |
void | t30_non_ecm_put_bit (void *user_data, int bit) |
Process a bit of received non-ECM image data. | |
void | t30_non_ecm_put_byte (void *user_data, int byte) |
Process a byte of received non-ECM image data. | |
void | t30_non_ecm_put_chunk (void *user_data, const uint8_t buf[], int len) |
Process a chunk of received non-ECM image data. | |
int | t30_non_ecm_get_bit (void *user_data) |
Get a bit of received non-ECM image data. | |
int | t30_non_ecm_get_byte (void *user_data) |
Get a byte of received non-ECM image data. | |
int | t30_non_ecm_get_chunk (void *user_data, uint8_t buf[], int max_len) |
Get a bit of received non-ECM image data. | |
void | t30_hdlc_accept (void *user_data, const uint8_t *msg, int len, int ok) |
Process a received HDLC frame. | |
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, etc.). | |
void | t30_timer_update (t30_state_t *s, int samples) |
Report the passage of time to the T.30 engine. | |
const char * | t30_frametype (uint8_t x) |
Return a text name for a T.30 frame type. | |
void | t30_decode_dis_dtc_dcs (t30_state_t *s, const uint8_t *pkt, int len) |
Decode a DIS, DTC or DCS frame, and log the contents. | |
int | t30_restart (t30_state_t *s) |
Restart a T.30 context. | |
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. | |
int | t30_release (t30_state_t *s) |
Release a T.30 context. | |
int | t30_free (t30_state_t *s) |
Free a T.30 context. | |
void | t30_terminate (t30_state_t *s) |
Cleanup a T.30 context if the call terminates. | |
void | t30_set_iaf_mode (t30_state_t *s, int iaf) |
Set Internet aware FAX (IAF) mode. | |
int | t30_set_header_info (t30_state_t *s, const char *info) |
Set the header information associated with a T.30 context. | |
int | t30_set_local_ident (t30_state_t *s, const char *id) |
Set the local identifier associated with a T.30 context. | |
int | t30_set_local_nsf (t30_state_t *s, const uint8_t *nsf, int len) |
Set an NSF frame to be associated with a T.30 context. | |
int | t30_set_local_sub_address (t30_state_t *s, const char *sub_address) |
Set the sub-address associated with a T.30 context. | |
int | t30_set_local_password (t30_state_t *s, const char *password) |
Set the local password associated with a T.30 context. | |
int | t30_set_far_password (t30_state_t *s, const char *password) |
Set the far password associated with a T.30 context. | |
size_t | t30_get_header_info (t30_state_t *s, char *info) |
Get the header information associated with a T.30 context. | |
size_t | t30_get_local_sub_address (t30_state_t *s, char *sub_address) |
Get the local sub-address associated with a T.30 context. | |
size_t | t30_get_far_sub_address (t30_state_t *s, char *sub_address) |
Get the far sub-address associated with a T.30 context. | |
size_t | t30_get_local_password (t30_state_t *s, char *password) |
Get the local password associated with a T.30 context. | |
size_t | t30_get_far_password (t30_state_t *s, char *password) |
Get the far password associated with a T.30 context. | |
size_t | t30_get_received_password (t30_state_t *s, char *password) |
Get the received password associated with a T.30 context. | |
size_t | t30_get_local_ident (t30_state_t *s, char *id) |
Get the local identifier associated with a T.30 context. | |
size_t | t30_get_far_ident (t30_state_t *s, char *id) |
Get the remote identifier associated with a T.30 context. | |
const char * | t30_get_far_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_far_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_far_model (t30_state_t *s) |
Get the name of the model of the remote FAX machine associated with a T.30 context. | |
void | t30_get_transfer_statistics (t30_state_t *s, t30_stats_t *t) |
Get the current transfer statistics. | |
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_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. | |
int | t30_set_receiver_not_ready (t30_state_t *s, int count) |
Specify a period of responding with receiver not ready. | |
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_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. | |
void | t30_local_interrupt_request (t30_state_t *s, int state) |
Request a local interrupt of FAX exchange. |
const char* t30_completion_code_to_str | ( | int | result | ) |
Convert a phase E completion code to a short text description.
Convert a phase E completion code to a short text description.
result | The result code. |
References T30_ERR_BADDCSTX, T30_ERR_BADPAGE, T30_ERR_BADPGTX, T30_ERR_BADTAG, T30_ERR_BADTIFF, T30_ERR_BADTIFFHDR, T30_ERR_CALLDROPPED, T30_ERR_CANNOT_TRAIN, T30_ERR_CEDTONE, T30_ERR_DCNDATARX, T30_ERR_DCNFAXRX, T30_ERR_DCNNORTNRX, T30_ERR_DCNPHDRX, T30_ERR_DCNRRDRX, T30_ERR_DCNWHYRX, T30_ERR_ECMPHDRX, T30_ERR_ECMPHDTX, T30_ERR_FILEERROR, T30_ERR_GOTDCNTX, T30_ERR_GOTDCSRX, T30_ERR_HDLC_CARRIER, T30_ERR_INCOMPATIBLE, T30_ERR_INVALCMDRX, T30_ERR_INVALRSPTX, T30_ERR_NOCARRIERRX, T30_ERR_NODATA, T30_ERR_NODISTX, T30_ERR_NOEOLRX, T30_ERR_NOFAXRX, T30_ERR_NOMEM, T30_ERR_NOPAGE, T30_ERR_NOPOLL, T30_ERR_NORESSUPPORT, T30_ERR_NOSIZESUPPORT, T30_ERR_OPERINTFAIL, T30_ERR_PHBDEADTX, T30_ERR_PHDDEADTX, T30_ERR_RETRYDCN, T30_ERR_RX_INCAPABLE, T30_ERR_T0_EXPIRED, T30_ERR_T1_EXPIRED, T30_ERR_T2EXPDCNRX, T30_ERR_T2EXPDRX, T30_ERR_T2EXPFAXRX, T30_ERR_T2EXPMPSRX, T30_ERR_T2EXPRRRX, T30_ERR_T2EXPRX, T30_ERR_T3_EXPIRED, T30_ERR_T5_EXPIRED, T30_ERR_TX_INCAPABLE, and T30_ERR_UNEXPECTED.
void t30_decode_dis_dtc_dcs | ( | t30_state_t * | s, | |
const uint8_t * | dis, | |||
int | len | |||
) |
Decode a DIS, DTC or DCS frame, and log the contents.
Decode a DIS, DTC or DCS frame, and log the contents.
s | The T.30 context. | |
dis | A pointer to the frame to be decoded. | |
len | The length of the frame. |
References t30_state_s::logging, span_log(), span_log_test(), T30_DCS, and t30_frametype().
const char* t30_frametype | ( | uint8_t | x | ) |
Return a text name for a T.30 frame type.
Return a text name for a T.30 frame type.
x | The frametype octet. |
References T30_CFR, T30_CIA, T30_CIG, T30_CRP, T30_CSA, T30_CSI, T30_CTC, T30_CTR, T30_DCN, T30_DCS, T30_DIS, T30_DTC, T30_EOM, T30_EOP, T30_EOR, T30_EOS, T30_ERR, T30_FDM, T30_FNV, T30_FTT, T30_IRA, T30_ISP, T30_MCF, T30_MPS, T30_NSC, T30_NSF, T30_NSS, T30_NULL, T30_PID, T30_PIN, T30_PIP, T30_PPR, T30_PPS, T30_PRI_EOM, T30_PRI_EOP, T30_PRI_MPS, T30_PSA, T30_PWD, T30_RNR, T30_RR, T30_RTN, T30_RTP, T30_SEP, T30_SID, T30_SUB, T30_TNR, T30_TR, T30_TSA, T30_TSI, T4_FCD, and T4_RCP.
Referenced by t30_decode_dis_dtc_dcs().
int t30_free | ( | t30_state_t * | s | ) |
Free a T.30 context.
Free a T.30 context.
s | The T.30 context. |
References t30_release().
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, etc.).
Inform the T.30 engine of a status change in the front end (end of tx, rx signal change, etc.).
user_data | The T.30 context. | |
status | The type of status change which occured. |
References t30_state_s::current_status, t30_state_s::dcs_frame, t30_state_s::dcs_len, t30_state_s::dis_received, t30_state_s::error_correcting_mode, t30_state_s::iaf, t30_state_s::local_dis_dtc_frame, t30_state_s::local_dis_dtc_len, t30_state_s::logging, t30_state_s::next_rx_step, t30_state_s::next_tx_step, t30_state_s::phase, t30_state_s::phase_e_handler, t30_state_s::phase_e_user_data, PUTBIT_CARRIER_DOWN, PUTBIT_CARRIER_UP, PUTBIT_FRAMING_OK, t30_state_s::retries, t30_state_s::rx_signal_present, t30_state_s::send_hdlc_handler, t30_state_s::send_hdlc_user_data, t30_state_s::short_train, span_log(), t30_state_s::state, t30_state_s::step, T30_CSI, T30_EOM, T30_EOP, T30_FRONT_END_RECEIVE_COMPLETE, t30_hdlc_accept(), T30_IAF_MODE_NO_TCF, T30_MPS, t30_non_ecm_put_bit(), T30_NULL, T30_PRI_EOM, T30_PRI_EOP, T30_PRI_MPS, T30_TSI, t30_state_s::timer_is_t4, and t30_state_s::timer_t2_t4.
Referenced by fax_tx().
const char* t30_get_far_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.
s | The T.30 context. |
References t30_state_s::country.
size_t t30_get_far_ident | ( | t30_state_t * | s, | |
char * | id | |||
) |
Get the remote identifier associated with a T.30 context.
Get the remote FAX machine identifier associated with a T.30 context.
s | The T.30 context. | |
id | A pointer to a buffer for the identifier. The buffer should be at least 21 bytes long. |
References t30_state_s::far_ident.
const char* t30_get_far_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.
s | The T.30 context. |
References t30_state_s::model.
size_t t30_get_far_password | ( | t30_state_t * | s, | |
char * | password | |||
) |
Get the far password associated with a T.30 context.
Get the far password associated with a T.30 context.
s | The T.30 context. | |
password | A pointer to a buffer for the password. The buffer should be at least 21 bytes long. |
References t30_state_s::far_password.
size_t t30_get_far_sub_address | ( | t30_state_t * | s, | |
char * | sub_address | |||
) |
Get the far sub-address associated with a T.30 context.
Get the far sub-address associated with a T.30 context.
s | The T.30 context. | |
sub_address | A pointer to a buffer for the sub-address. The buffer should be at least 21 bytes long. |
References t30_state_s::far_sub_address.
const char* t30_get_far_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.
s | The T.30 context. |
References t30_state_s::vendor.
size_t t30_get_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.
s | The T.30 context. | |
info | A pointer to a buffer for the header information. The buffer should be at least 51 bytes long. |
References t30_state_s::header_info.
size_t t30_get_local_ident | ( | t30_state_t * | s, | |
char * | id | |||
) |
Get the local identifier associated with a T.30 context.
Get the local FAX machine identifier associated with a T.30 context.
s | The T.30 context. | |
id | A pointer to a buffer for the identifier. The buffer should be at least 21 bytes long. |
References t30_state_s::local_ident.
size_t t30_get_local_password | ( | t30_state_t * | s, | |
char * | password | |||
) |
Get the local password associated with a T.30 context.
Get the local password associated with a T.30 context.
s | The T.30 context. | |
password | A pointer to a buffer for the password. The buffer should be at least 21 bytes long. |
References t30_state_s::local_password.
size_t t30_get_local_sub_address | ( | t30_state_t * | s, | |
char * | sub_address | |||
) |
Get the local sub-address associated with a T.30 context.
Get the local sub-address associated with a T.30 context.
s | The T.30 context. | |
sub_address | A pointer to a buffer for the sub-address. The buffer should be at least 21 bytes long. |
References t30_state_s::local_sub_address.
size_t t30_get_received_password | ( | t30_state_t * | s, | |
char * | password | |||
) |
Get the received password associated with a T.30 context.
Get the received password associated with a T.30 context.
s | The T.30 context. | |
password | A pointer to a buffer for the password. The buffer should be at least 21 bytes long. |
References t30_state_s::received_password.
void t30_get_transfer_statistics | ( | t30_state_t * | s, | |
t30_stats_t * | t | |||
) |
Get the current transfer statistics.
Get the current transfer statistics for the file being sent or received.
s | The T.30 context. | |
t | A pointer to a buffer for the statistics. |
References t4_stats_t::bad_rows, t30_state_s::current_fallback, t30_state_s::current_status, t4_stats_t::encoding, t30_state_s::error_correcting_mode, t4_stats_t::image_size, t4_stats_t::length, t4_stats_t::longest_bad_row_run, t4_stats_t::pages_in_file, t4_stats_t::pages_transferred, t30_state_s::t4, t4_get_transfer_statistics(), t4_stats_t::width, t4_stats_t::x_resolution, and t4_stats_t::y_resolution.
void t30_hdlc_accept | ( | void * | user_data, | |
const uint8_t * | msg, | |||
int | len, | |||
int | ok | |||
) |
Process a received HDLC frame.
Process a received HDLC frame.
user_data | The T.30 context. | |
msg | The HDLC message. | |
len | The length of the message, in octets. | |
ok | TRUE if the frame was received without error. |
References t30_state_s::crp_enabled, t30_state_s::far_end_detected, t30_state_s::logging, t30_state_s::next_phase, t30_state_s::phase, PUTBIT_ABORT, PUTBIT_CARRIER_DOWN, PUTBIT_CARRIER_UP, PUTBIT_FRAMING_OK, PUTBIT_TRAINING_FAILED, PUTBIT_TRAINING_IN_PROGRESS, PUTBIT_TRAINING_SUCCEEDED, t30_state_s::rx_signal_present, t30_state_s::rx_trained, span_log(), t30_state_s::state, T30_CRP, t30_state_s::timer_is_t4, t30_state_s::timer_t0_t1, and t30_state_s::timer_t2_t4.
Referenced by fax_init(), and t30_front_end_status().
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.
Initialise a T.30 context.
s | The T.30 context. | |
calling_party | TRUE if the context is for a calling party. FALSE if the context is for an answering party. | |
set_rx_type_handler | ||
set_rx_type_user_data | ||
set_tx_type_handler | ||
set_tx_type_user_data | ||
send_hdlc_handler | ||
send_hdlc_user_data |
References t30_state_s::calling_party, t30_state_s::local_min_scan_time_code, t30_state_s::logging, t30_state_s::output_encoding, t30_state_s::send_hdlc_handler, t30_state_s::send_hdlc_user_data, t30_state_s::set_rx_type_handler, t30_state_s::set_rx_type_user_data, t30_state_s::set_tx_type_handler, t30_state_s::set_tx_type_user_data, t30_state_s::supported_compressions, t30_state_s::supported_image_sizes, t30_state_s::supported_modems, t30_state_s::supported_resolutions, and t30_restart().
Referenced by fax_init(), and t38_terminal_init().
void t30_local_interrupt_request | ( | t30_state_t * | s, | |
int | state | |||
) |
Request a local interrupt of FAX exchange.
Request a local interrupt of FAX exchange.
s | The T.30 context. | |
state | TRUE to enable interrupt request, else FALSE. |
References t30_state_s::local_interrupt_pending, T30_PIN, T30_PIP, and t30_state_s::timer_t3.
int t30_non_ecm_get_bit | ( | void * | user_data | ) |
Get a bit of received non-ECM image data.
Get a bit of received non-ECM image data.
user_data | An opaque pointer, which must point to the T.30 context. |
References t30_state_s::logging, PUTBIT_END_OF_DATA, span_log(), t30_state_s::state, t30_state_s::t4, t4_tx_get_bit(), and t30_state_s::training_test_bits.
Referenced by fax_init().
int t30_non_ecm_get_byte | ( | void * | user_data | ) |
Get a byte of received non-ECM image data.
Get a byte of received non-ECM image data.
user_data | An opaque pointer, which must point to the T.30 context. |
References t30_state_s::logging, span_log(), t30_state_s::state, t30_state_s::t4, t4_tx_get_byte(), and t30_state_s::training_test_bits.
int t30_non_ecm_get_chunk | ( | void * | user_data, | |
uint8_t | buf[], | |||
int | max_len | |||
) |
Get a bit of received non-ECM image data.
Get a chunk of received non-ECM image data.
user_data | An opaque pointer, which must point to the T.30 context. | |
buf | The buffer to contain the data. | |
max_len | The maximum length of the chunk. |
References t30_state_s::logging, span_log(), t30_state_s::state, t30_state_s::t4, t4_tx_get_chunk(), and t30_state_s::training_test_bits.
void t30_non_ecm_put_bit | ( | void * | user_data, | |
int | bit | |||
) |
Process a bit of received non-ECM image data.
Process a bit of received non-ECM image data.
user_data | An opaque pointer, which must point to the T.30 context. | |
bit | The received bit. |
References t30_state_s::current_fallback, t30_state_s::current_status, t30_state_s::in_message, t30_state_s::logging, t30_state_s::next_phase, PUTBIT_CARRIER_DOWN, PUTBIT_CARRIER_UP, PUTBIT_TRAINING_FAILED, PUTBIT_TRAINING_IN_PROGRESS, PUTBIT_TRAINING_SUCCEEDED, t30_state_s::rx_signal_present, t30_state_s::rx_trained, t30_state_s::short_train, span_log(), t30_state_s::state, T30_CFR, T30_ERR_NOCARRIERRX, T30_FTT, t30_state_s::t4, t4_rx_put_bit(), t30_state_s::timer_is_t4, t30_state_s::timer_t2_t4, t30_state_s::training_current_zeros, and t30_state_s::training_most_zeros.
Referenced by fax_init(), and t30_front_end_status().
void t30_non_ecm_put_byte | ( | void * | user_data, | |
int | byte | |||
) |
Process a byte of received non-ECM image data.
Process a byte of received non-ECM image data.
user_data | An opaque pointer, which must point to the T.30 context. | |
byte | The received byte. |
References t30_state_s::state, t30_state_s::t4, t4_rx_put_byte(), t30_state_s::timer_is_t4, t30_state_s::timer_t2_t4, t30_state_s::training_current_zeros, and t30_state_s::training_most_zeros.
void t30_non_ecm_put_chunk | ( | void * | user_data, | |
const uint8_t | buf[], | |||
int | len | |||
) |
Process a chunk of received non-ECM image data.
Process a chunk of received non-ECM image data.
user_data | An opaque pointer, which must point to the T.30 context. | |
buf | The buffer containing the received data. | |
len | The length of the data in buf. |
References t30_state_s::state, t30_state_s::t4, t4_rx_put_chunk(), t30_state_s::timer_is_t4, t30_state_s::timer_t2_t4, t30_state_s::training_current_zeros, and t30_state_s::training_most_zeros.
int t30_release | ( | t30_state_t * | s | ) |
Release a T.30 context.
Release a T.30 context.
s | The T.30 context. |
References t30_state_s::t4, t4_rx_end(), and t4_tx_end().
Referenced by fax_free(), fax_release(), t30_free(), t38_terminal_free(), and t38_terminal_release().
int t30_restart | ( | t30_state_t * | s | ) |
Restart a T.30 context.
Restart a T.30 context.
s | The T.30 context. |
References t30_state_s::calling_party, t30_state_s::current_fallback, t30_state_s::current_status, t30_state_s::ecm_progress, t30_state_s::far_dis_dtc_frame, t30_state_s::far_dis_dtc_len, t30_state_s::far_end_detected, t30_state_s::next_phase, t30_state_s::password_required, t30_state_s::phase, t30_state_s::ppr_count, t30_state_s::received_password, t30_state_s::receiver_not_ready_count, t30_state_s::rx_signal_present, t30_state_s::rx_trained, and t30_state_s::timer_t0_t1.
Referenced by fax_init(), t30_init(), and t38_terminal_init().
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.
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.
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.
s | The T.30 context. | |
enabled | TRUE for ECM capable, FALSE for not ECM capable. |
References t30_state_s::ecm_allowed.
int t30_set_far_password | ( | t30_state_t * | s, | |
const char * | password | |||
) |
Set the far password associated with a T.30 context.
Set the far password (i.e. the one we will send to the far end) associated with a T.30 context.
s | The T.30 context. | |
password | A pointer to the password. |
References t30_state_s::far_password.
int t30_set_header_info | ( | t30_state_t * | s, | |
const char * | info | |||
) |
Set the header information associated with a T.30 context.
Set the header information associated with a T.30 context.
s | The T.30 context. | |
info | A pointer to the information string. |
References t30_state_s::header_info, t30_state_s::t4, and t4_tx_set_header_info().
void t30_set_iaf_mode | ( | t30_state_t * | s, | |
int | iaf | |||
) |
Set Internet aware FAX (IAF) mode.
Set Internet aware FAX (IAF) mode.
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().
int t30_set_local_ident | ( | t30_state_t * | s, | |
const char * | id | |||
) |
Set the local identifier associated with a T.30 context.
Set the local identifier associated with a T.30 context.
s | The T.30 context. | |
id | A pointer to the identifier. |
References t30_state_s::local_ident, t30_state_s::t4, and t4_tx_set_local_ident().
int t30_set_local_nsf | ( | t30_state_t * | s, | |
const uint8_t * | nsf, | |||
int | len | |||
) |
Set an NSF frame to be associated with a T.30 context.
Set an NSF frame to be associated with a T.30 context.
s | The T.30 context. | |
nsf | A pointer to the frame. | |
len | The length of the frame. |
References t30_state_s::local_nsf, and t30_state_s::local_nsf_len.
int t30_set_local_password | ( | t30_state_t * | s, | |
const char * | password | |||
) |
Set the local password associated with a T.30 context.
Set the local password (i.e. the one we expect to be given by the far end) associated with a T.30 context.
s | The T.30 context. | |
password | A pointer to the password. |
References t30_state_s::local_password.
int t30_set_local_sub_address | ( | t30_state_t * | s, | |
const char * | sub_address | |||
) |
Set the sub-address associated with a T.30 context.
Set the sub-address associated with a T.30 context.
s | The T.30 context. | |
sub_address | A pointer to the sub-address. |
References t30_state_s::local_sub_address.
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.
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.
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.
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.
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.
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.
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.
s | The T.30 context. | |
count | The number of times to report receiver not ready. |
References t30_state_s::receiver_not_ready_count.
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.
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. |
References t30_state_s::output_encoding.
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.
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.
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.
s | The T.30 context. | |
supported_compressions | Bit field list of the supported compression types. |
References t30_state_s::supported_compressions.
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.
s | The T.30 context. | |
supported_image_sizes | Bit field list of the supported widths and lengths. |
References t30_state_s::supported_image_sizes.
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.
s | The T.30 context. | |
supported_modems | Bit field list of the supported modems. |
References t30_state_s::supported_modems.
Referenced by fax_init(), and t38_terminal_init().
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.
s | The T.30 context. | |
supported_resolutions | Bit field list of the supported resolutions. |
References t30_state_s::supported_resolutions.
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.
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.
void t30_terminate | ( | t30_state_t * | s | ) |
Cleanup a T.30 context if the call terminates.
Cleanup a T.30 context if the call terminates.
s | The T.30 context. |
References t30_state_s::current_status, t30_state_s::phase, t30_state_s::phase_e_handler, t30_state_s::phase_e_user_data, t30_state_s::state, and T30_ERR_CALLDROPPED.
void t30_timer_update | ( | t30_state_t * | s, | |
int | samples | |||
) |
Report the passage of time to the T.30 engine.
Report the passage of time to the T.30 engine.
s | The T.30 context. | |
samples | The time change in 1/8000th second steps. |
References t30_state_s::far_end_detected, t30_state_s::timer_is_t4, t30_state_s::timer_t0_t1, t30_state_s::timer_t2_t4, t30_state_s::timer_t3, and t30_state_s::timer_t5.
Referenced by fax_rx().