Logo Search packages:      
Sourcecode: iaxmodem version File versions  Download package

t30.c File Reference


Detailed Description

Definition in file t30.c.

#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include <fcntl.h>
#include <time.h>
#include <tgmath.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"

Go to the source code of this file.

Classes

struct  value_string_t

Defines

#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 DISBIT1   0x01
#define DISBIT2   0x02
#define DISBIT3   0x04
#define DISBIT4   0x08
#define DISBIT5   0x10
#define DISBIT6   0x20
#define DISBIT7   0x40
#define DISBIT8   0x80
#define ENABLE_V17
#define MAX_MESSAGE_TRIES   3
#define ms_to_samples(t)   (((t)*SAMPLE_RATE)/1000)
#define T30_V17_FALLBACK_START   0
#define T30_V27TER_FALLBACK_START   6
#define T30_V29_FALLBACK_START   3

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, T30_STATE_F_POST_DOC_NON_ECM, T30_STATE_F_POST_DOC_ECM,
  T30_STATE_F_POST_RCP_MCF, T30_STATE_F_POST_RCP_PPR, 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_MODE_SEND_DOC = 1, T30_MODE_RECEIVE_DOC }
enum  { T30_COPY_QUALITY_GOOD = 0, T30_COPY_QUALITY_POOR, T30_COPY_QUALITY_BAD }

Functions

static int build_dcs (t30_state_t *s, const uint8_t *msg, int len)
static int build_dis_or_dtc (t30_state_t *s)
static int check_next_tx_step (t30_state_t *s)
static int check_rx_dcs (t30_state_t *s, const uint8_t *msg, int len)
static int check_rx_dis_dtc (t30_state_t *s, const uint8_t *msg, int len)
static int copy_quality (t30_state_t *s)
static void decode_20digit_msg (t30_state_t *s, char *msg, const uint8_t *pkt, int len)
static void decode_url_msg (t30_state_t *s, char *msg, const uint8_t *pkt, int len)
static void disconnect (t30_state_t *s)
static int get_partial_ecm_page (t30_state_t *s)
static void hdlc_accept_control_msg (t30_state_t *s, int ok, const uint8_t *msg, int len)
static void octet_bit_field (logging_state_t *log, const uint8_t *msg, int bit_no, const char *desc, const char *yeah, const char *neigh)
static void octet_field (logging_state_t *log, const uint8_t *msg, int start, int end, const char *desc, const value_string_t tags[])
static void octet_reserved_bit (logging_state_t *log, const uint8_t *msg, int bit_no, int expected)
static void print_frame (t30_state_t *s, const char *io, const uint8_t *fr, int frlen)
static void process_rx_cfr (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_crp (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_ctc (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_ctr (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_dcn (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_dcs (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_dis_or_dtc (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_eom (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_eop (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_eor (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_eos (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_err (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_fcd (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_fdm (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_fnv (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_ftt (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_mcf (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_mps (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_nss (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_pin (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_pip (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_ppr (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_pps (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_pri_eom (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_pri_eop (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_pri_mps (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_rcp (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_rnr (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_rr (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_rtn (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_rtp (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_tnr (t30_state_t *s, const uint8_t *msg, int len)
static void process_rx_tr (t30_state_t *s, const uint8_t *msg, int len)
static void queue_phase (t30_state_t *s, int phase)
static void repeat_last_command (t30_state_t *s)
static int restart_sending_document (t30_state_t *s)
static void rx_start_page (t30_state_t *s)
static void send_20digit_msg_frame (t30_state_t *s, int cmd, char *msg)
static void send_dcn (t30_state_t *s)
static void send_dcs_sequence (t30_state_t *s)
static void send_dis_or_dtc_sequence (t30_state_t *s)
static void send_frame (t30_state_t *s, const uint8_t *fr, int frlen)
static int send_ident_frame (t30_state_t *s, uint8_t cmd)
static int send_next_ecm_frame (t30_state_t *s)
static int send_nsf_frame (t30_state_t *s)
static int send_pps_frame (t30_state_t *s)
static int send_pw_frame (t30_state_t *s)
static void send_simple_frame (t30_state_t *s, int type)
static int send_sub_frame (t30_state_t *s)
static int set_dis_or_dtc (t30_state_t *s)
static void set_phase (t30_state_t *s, int phase)
static void set_state (t30_state_t *s, int state)
static int start_receiving_document (t30_state_t *s)
static int start_sending_document (t30_state_t *s)
const char * t30_completion_code_to_str (int result)
 Convert a phase E completion code to a short text description.
t30_state_tt30_create (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)
 Create and initialise a T.30 context.
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.
static int t30_ecm_commit_partial_page (t30_state_t *s)
const char * t30_frametype (uint8_t x)
 Return a text name for a T.30 frame type.
void t30_free (t30_state_t *s)
 Free 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.
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_model (t30_state_t *s)
 Get the name of the model 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.
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_ident (t30_state_t *s, char *id)
 Get the local identifier associated with a T.30 context.
size_t t30_get_sub_address (t30_state_t *s, char *sub_address)
 Get the sub-address 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_hdlc_accept (void *user_data, int ok, const uint8_t *msg, int len)
 Process a received HDLC frame.
int 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.
void t30_local_interrupt_request (t30_state_t *s, int state)
 Request a local interrupt of FAX exchange.
int t30_non_ecm_get_bit (void *user_data)
 Get a bit of received non-ECM image data.
void t30_non_ecm_put_bit (void *user_data, int bit)
 Process a bit of received non-ECM image data.
void t30_non_ecm_putbyte (void *user_data, int byte)
 Process a byte of received non-ECM image data.
void t30_receive_complete (void *user_data)
 Inform the T.30 engine the current receive has completed.
void t30_release (t30_state_t *s)
 Release a T.30 context.
int t30_restart (t30_state_t *s)
 Restart a T.30 context.
void t30_send_complete (void *user_data)
 Inform the T.30 engine the current transmission has completed.
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_ecm_capability (t30_state_t *s, int enabled)
 Select ECM capability.
int t30_set_header_info (t30_state_t *s, const char *info)
 Set the header information associated with a T.30 context.
void t30_set_iaf_mode (t30_state_t *s, int iaf)
 Set Internet aware FAX (IAF) mode.
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)
int t30_set_local_sub_address (t30_state_t *s, const char *sub_address)
 Set the sub-address associated with a T.30 context.
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_rx_file (t30_state_t *s, const char *file, int stop_page)
 Set next receive file name.
void t30_set_supported_compressions (t30_state_t *s, int supported_compressions)
 Specify supported compression types.
void t30_set_supported_image_sizes (t30_state_t *s, int supported_image_sizes)
 Specify supported image sizes.
void t30_set_supported_modems (t30_state_t *s, int supported_modems)
 Specify supported modems.
void t30_set_supported_resolutions (t30_state_t *s, int supported_resolutions)
 Specify 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.
void t30_terminate (t30_state_t *s)
 Cleanup a T.30 context if the call terminates.
void t30_timer_update (t30_state_t *s, int samples)
 Report the passage of time to the T.30 engine.
static void timer_t0_expired (t30_state_t *s)
static void timer_t1_expired (t30_state_t *s)
static void timer_t2_expired (t30_state_t *s)
static void timer_t3_expired (t30_state_t *s)
static void timer_t4_expired (t30_state_t *s)
static void timer_t5_expired (t30_state_t *s)
static void unexpected_final_frame (t30_state_t *s, const uint8_t *msg, int len)
static void unexpected_frame (t30_state_t *s, const uint8_t *msg, int len)
static void unexpected_frame_length (t30_state_t *s, const uint8_t *msg, int len)

Variables

struct {
   int   bit_rate
   uint8_t   dcs_code
   int   modem_type
fallback_sequence []
static const char * phase_names []


Generated by  Doxygen 1.6.0   Back to index