26 #if !defined(_SPANDSP_UDPTL_H_)
27 #define _SPANDSP_UDPTL_H_
29 #define LOCAL_FAX_MAX_DATAGRAM 400
30 #define LOCAL_FAX_MAX_FEC_PACKETS 5
32 #define UDPTL_BUF_MASK 15
34 typedef int (*udptl_rx_packet_handler_t) (
void *user_data,
const uint8_t msg[],
int len,
int seq_no);
39 uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
45 uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
46 int fec_len[LOCAL_FAX_MAX_FEC_PACKETS];
47 uint8_t fec[LOCAL_FAX_MAX_FEC_PACKETS][LOCAL_FAX_MAX_DATAGRAM];
54 udptl_rx_packet_handler_t rx_packet_handler;
81 int rx_expected_seq_no;
89 UDPTL_ERROR_CORRECTION_NONE,
90 UDPTL_ERROR_CORRECTION_FEC,
91 UDPTL_ERROR_CORRECTION_REDUNDANCY
96 #if defined(__cplusplus)
105 int udptl_rx_packet(
udptl_state_t *s,
const uint8_t buf[],
int len);
113 int udptl_build_packet(
udptl_state_t *s, uint8_t buf[],
const uint8_t msg[],
int msg_len);
121 int udptl_set_error_correction(
udptl_state_t *s,
int ec_scheme,
int span,
int entries);
129 int udptl_get_error_correction(
udptl_state_t *s,
int *ec_scheme,
int *span,
int *entries);
131 int udptl_set_local_max_datagram(
udptl_state_t *s,
int max_datagram);
135 int udptl_set_far_max_datagram(
udptl_state_t *s,
int max_datagram);
147 udptl_state_t *udptl_init(
udptl_state_t *s,
int ec_scheme,
int span,
int entries, udptl_rx_packet_handler_t rx_packet_handler,
void *user_data);
154 #if defined(__cplusplus)
void t30_set_rx_file(t30_state_t *s, const char *file, int stop_page)
Set next receive file name.
Definition: t30_api.c:614
@ T30_ERR_RX_T2EXPMPS
Definition: t30.h:269
logging_state_t logging
Error and flow logging control.
Definition: fax_tester.h:114
@ T30_ERR_CANNOT_TRAIN
Definition: t30.h:239
int error_correction_entries
Definition: udptl.h:63
@ T30_ERR_UNEXPECTED
Definition: t30.h:246
@ T30_ERR_TX_BADPG
Definition: t30.h:250
int faxtester_release(faxtester_state_t *s)
Release a FAX context.
Definition: fax_tester.c:715
int t4_tx_start_page(t4_tx_state_t *s)
Prepare to send the next page of the current document.
Definition: t4_tx.c:1221
@ T30_ERR_RX_NOFAX
Definition: t30.h:265
char sub_address[20+1]
The sub-address string (SUB).
Definition: t30.h:478
@ T30_ERR_RX_T2EXPRR
Definition: t30.h:270
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.
Definition: t30_api.c:271
@ T30_ERR_NOSIZESUPPORT
Definition: t30.h:245
@ T30_ERR_RETRYDCN
Definition: t30.h:289
@ T30_ERR_CEDTONE
Definition: t30.h:234
faxtester_state_t * faxtester_init(faxtester_state_t *s, int calling_party)
Initialise a FAX context.
Definition: fax_tester.c:696
@ T30_SUPPORT_T6_COMPRESSION
Definition: t30.h:362
int t30_call_active(t30_state_t *s)
Check if a T.30 call is still active.
Definition: t30.c:6385
int local_max_datagram_size
Definition: udptl.h:75
char ident[20+1]
The identifier string (CSI, TSI, CIG).
Definition: t30.h:476
Definition: fax_tester.h:62
logging_state_t logging
Error and flow logging control.
Definition: private/v29rx.h:197
int t4_tx_get_chunk(t4_tx_state_t *s, uint8_t buf[], int max_len)
Get the next chunk of the current document page. The document will be padded for the current minimum ...
Definition: t4_tx.c:1386
const char * t30_completion_code_to_str(int result)
Convert a phase E completion code to a short text description.
Definition: t30_logging.c:108
@ T30_SUPPORT_600_1200_RESOLUTION
Definition: t30.h:408
@ T30_SUPPORT_300_300_RESOLUTION
Definition: t30.h:396
@ T30_ERR_RX_DCNNORTN
Definition: t30.h:277
@ T30_ERR_CIA_UNACCEPTABLE
Definition: t30.h:302
void fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle)
Select whether silent audio will be sent when FAX transmit is idle.
Definition: fax.c:579
@ T30_ERR_RX_GOTDCS
Definition: t30.h:261
@ T30_ERR_RX_DCNRRD
Definition: t30.h:276
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.
Definition: t30_api.c:770
fax_state_t * fax_init(fax_state_t *s, int calling_party)
Initialise a FAX context.
Definition: fax.c:664
@ T30_ERR_TX_PHDDEAD
Definition: t30.h:256
int t30_set_supported_compressions(t30_state_t *s, int supported_compressions)
Specify supported compression types.
Definition: t30_api.c:688
@ T30_ERR_TSA_UNACCEPTABLE
Definition: t30.h:300
@ T30_ERR_TX_ECMPHD
Definition: t30.h:251
logging_state_t logging
Error and flow logging control.
Definition: private/v27ter_rx.h:192
v27ter_rx_state_t v27ter_rx
A V.27ter modem context used when receiving FAXes at 2400bps or 4800bps.
Definition: private/fax_modems.h:74
char sender_ident[20+1]
The sender identification (SID).
Definition: t30.h:484
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.
Definition: t30_api.c:777
int faxtester_tx(faxtester_state_t *s, int16_t *amp, int max_len)
Apply T.30 transmit processing to generate a block of audio samples.
Definition: fax_tester.c:406
@ T30_ERR_CSA_UNACCEPTABLE
Definition: t30.h:304
@ T30_ERR_TX_GOTDCN
Definition: t30.h:252
@ T4_COMPRESSION_ITU_T4_2D
Definition: t4_rx.h:56
const char * t30_frametype(uint8_t x)
Return a text name for a T.30 frame type.
Definition: t30_logging.c:241
@ T30_PIP
Definition: t30_fcf.h:87
@ T30_ERR_BADTAG
Definition: t30.h:284
void t4_tx_set_tx_encoding(t4_tx_state_t *s, int encoding)
Set the encoding for the encoded data.
Definition: t4_tx.c:1409
const char * t30_get_rx_sub_address(t30_state_t *s)
Get the received sub-address associated with a T.30 context.
Definition: t30_api.c:143
@ T30_ERR_NOMEM
Definition: t30.h:286
int t30_set_rx_encoding(t30_state_t *s, int encoding)
Specify the output encoding for TIFF files created during FAX reception.
Definition: t30_api.c:645
@ T30_SUPPORT_SUB_ADDRESSING
Definition: t30.h:435
const char * t30_get_rx_selective_polling_address(t30_state_t *s)
Get the received selective polling address associated with a T.30 context.
Definition: t30_api.c:173
@ T30_SUPPORT_SELECTIVE_POLLING
Definition: t30.h:429
@ T30_ERR_RX_T2EXPD
Definition: t30.h:267
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.
Definition: t30_api.c:121
@ T30_ERR_RX_INCAPABLE
Definition: t30.h:242
@ T30_ERR_TX_NODIS
Definition: t30.h:254
t4_tx_state_t * t4_tx_init(t4_tx_state_t *s, const char *file, int start_page, int stop_page)
Prepare for transmission of a document.
Definition: t4_tx.c:1493
const char * t30_get_rx_ident(t30_state_t *s)
Set the transmitted identifier associated with a T.30 context.
Definition: t30_api.c:113
v29_rx_state_t v29_rx
A V.29 modem context used when receiving FAXes at 7200bps or 9600bps.
Definition: private/fax_modems.h:68
void fax_set_tep_mode(fax_state_t *s, int use_tep)
Select whether TEP will be sent for the image modems.
Definition: fax.c:585
logging_state_t logging
Error and flow logging control.
Definition: private/v17rx.h:238
@ T30_ERR_INCOMPATIBLE
Definition: t30.h:241
@ T30_ERR_RX_DCNWHY
Definition: t30.h:272
Definition: private/t4_tx.h:35
@ T30_SUPPORT_600_600_RESOLUTION
Definition: t30.h:400
@ T30_PRI_EOM
Definition: t30_fcf.h:75
@ T30_SUPPORT_300_600_RESOLUTION
Definition: t30.h:404
@ T30_ERR_ISP_UNACCEPTABLE
Definition: t30.h:303
@ T30_SUPPORT_T4_2D_COMPRESSION
Definition: t30.h:360
@ T30_ERR_BADTIFFHDR
Definition: t30.h:285
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.
Definition: t30_api.c:211
@ T30_SUPPORT_V29
Definition: t30.h:344
@ T30_SUPPORT_400_400_RESOLUTION
Definition: t30.h:398
const char * t30_get_rx_polled_sub_address(t30_state_t *s)
Get the received polled sub-address associated with a T.30 context.
Definition: t30_api.c:203
const char * t30_get_rx_sender_ident(t30_state_t *s)
Get the received sender ident associated with a T.30 context.
Definition: t30_api.c:233
@ T30_ERR_OPER_INT_FAIL
Definition: t30.h:240
@ T30_ERR_TX_T5EXP
Definition: t30.h:257
@ T30_ERR_RX_DCNPHD
Definition: t30.h:275
@ T30_ERR_RX_NOEOL
Definition: t30.h:264
int t4_tx_release(t4_tx_state_t *s)
End the transmission of a document. Tidy up and close the file. This should be used to end T....
Definition: t4_tx.c:1574
int t30_set_supported_resolutions(t30_state_t *s, int supported_resolutions)
Specify supported resolutions.
Definition: t30_api.c:708
int faxtester_rx(faxtester_state_t *s, int16_t *amp, int len)
Apply T.30 receive processing to a block of audio samples.
Definition: fax_tester.c:386
logging_state_t * t30_get_logging_state(t30_state_t *s)
Get a pointer to the logging context associated with a T.30 context.
Definition: t30_api.c:784
@ T30_SUPPORT_V27TER
Definition: t30.h:342
@ T30_SUPPORT_R8_RESOLUTION
Definition: t30.h:391
@ T30_ERR_RX_DCNDATA
Definition: t30.h:273
@ T30_ERR_SEP_UNACCEPTABLE
Definition: t30.h:296
@ T30_ERR_T3_EXPIRED
Definition: t30.h:237
char password[20+1]
The password (PWD).
Definition: t30.h:486
void faxtester_set_transmit_on_idle(faxtester_state_t *s, int transmit_on_idle)
Select whether silent audio will be sent when FAX transmit is idle.
Definition: fax_tester.c:627
Definition: private/fax.h:35
int far_max_datagram_size
Definition: udptl.h:71
@ T30_ERR_SID_UNACCEPTABLE
Definition: t30.h:298
Definition: private/tone_generate.h:42
@ T30_ERR_CALLDROPPED
Definition: t30.h:290
@ T30_SUPPORT_R16_RESOLUTION
Definition: t30.h:393
void t30_terminate(t30_state_t *s)
Cleanup a T.30 context if the call terminates.
Definition: t30.c:6196
@ T30_PRI_MPS
Definition: t30_fcf.h:76
@ T30_ERR_SUB_UNACCEPTABLE
Definition: t30.h:295
int t30_set_supported_image_sizes(t30_state_t *s, int supported_image_sizes)
Specify supported image sizes.
Definition: t30_api.c:716
@ T30_ERR_T1_EXPIRED
Definition: t30.h:236
int error_correction_span
Definition: udptl.h:67
@ T30_SUPPORT_FINE_RESOLUTION
Definition: t30.h:384
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
@ T30_PRI_EOP
Definition: t30_fcf.h:77
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.
Definition: t30_api.c:151
@ T30_ERR_RX_NOCARRIER
Definition: t30.h:263
@ T4_COMPRESSION_ITU_T6
Definition: t4_rx.h:58
void t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t)
Get the current transfer statistics.
Definition: t30.c:6229
@ T30_ERR_FILEERROR
Definition: t30.h:280
@ T30_ERR_HDLC_CARRIER
Definition: t30.h:238
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.
Definition: t30_api.c:756
@ T30_ERR_RX_T2EXP
Definition: t30.h:271
@ T30_ERR_PSA_UNACCEPTABLE
Definition: t30.h:297
void t30_set_tx_file(t30_state_t *s, const char *file, int start_page, int stop_page)
Set next transmit file name.
Definition: t30_api.c:622
@ T30_SUPPORT_1200_1200_RESOLUTION
Definition: t30.h:402
Definition: private/t30.h:35
tone_gen_descriptor_t * tone_gen_descriptor_init(tone_gen_descriptor_t *s, int f1, int l1, int f2, int l2, int d1, int d2, int d3, int d4, int repeat)
Create a tone generator descriptor.
Definition: tone_generate.c:60
@ T30_ERR_RX_DCNFAX
Definition: t30.h:274
@ T30_ERR_TX_INVALRSP
Definition: t30.h:253
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.
Definition: t30_api.c:749
t30_state_t * fax_get_t30_state(fax_state_t *s)
Get a pointer to the T.30 engine associated with a FAX context.
Definition: fax.c:591
@ T30_PIN
Definition: t30_fcf.h:88
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.
Definition: t30_api.c:763
@ T30_ERR_RX_T2EXPDCN
Definition: t30.h:266
int current_status
Current status.
Definition: t30.h:549
@ T30_ERR_NORESSUPPORT
Definition: t30.h:244
int t30_set_supported_t30_features(t30_state_t *s, int supported_t30_features)
Specify supported T.30 features.
Definition: t30_api.c:724
@ T30_ERR_BADTIFF
Definition: t30.h:282
@ T30_ERR_RX_T2EXPFAX
Definition: t30.h:268
void t4_tx_set_header_info(t4_tx_state_t *s, const char *info)
Set the header info.
Definition: t4_tx.c:1429
@ T30_SUPPORT_SUPERFINE_RESOLUTION
Definition: t30.h:386
fax_modems_state_t modems
The analogue modem front-end.
Definition: private/fax.h:41
@ T30_ERR_IRA_UNACCEPTABLE
Definition: t30.h:301
int t30_set_receiver_not_ready(t30_state_t *s, int count)
Specify a period of responding with receiver not ready.
Definition: t30_api.c:742
int span_log_buf(logging_state_t *s, int level, const char *tag, const uint8_t *buf, int len)
Generate a log entry displaying the contents of a buffer.
Definition: logging.c:158
xmlNodePtr cur
Pointer to our current step in the test.
Definition: fax_tester.h:65
@ T30_SUPPORT_T4_1D_COMPRESSION
Definition: t30.h:358
@ T30_SUPPORT_STANDARD_RESOLUTION
Definition: t30.h:382
@ T30_SUPPORT_IDENTIFICATION
Definition: t30.h:427
void bit_reverse(uint8_t to[], const uint8_t from[], int len)
Bit reverse each byte in a buffer.
Definition: bit_operations.c:79
@ T30_ERR_IDENT_UNACCEPTABLE
Definition: t30.h:294
@ T30_ERR_TX_PHBDEAD
Definition: t30.h:255
int t30_set_supported_modems(t30_state_t *s, int supported_modems)
Specify supported modems.
Definition: t30_api.c:680
char selective_polling_address[20+1]
The selective polling sub-address (SEP).
Definition: t30.h:480
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.
Definition: t30_api.c:305
v17_rx_state_t v17_rx
A V.29 modem context used when receiving FAXes at 7200bps, 9600bps 12000bps or 14400bps.
Definition: private/fax_modems.h:62
@ T30_ERR_PWD_UNACCEPTABLE
Definition: t30.h:299
Definition: private/tone_generate.h:53
logging_state_t * fax_get_logging_state(fax_state_t *s)
Get a pointer to the logging context associated with a FAX context.
Definition: fax.c:597
char polled_sub_address[20+1]
The polled sub-address (PSA).
Definition: t30.h:482
@ T30_SUPPORT_V17
Definition: t30.h:346
void t4_tx_set_min_bits_per_row(t4_tx_state_t *s, int bits)
Set the minimum number of encoded bits per row. This allows the makes the encoding process to be set ...
Definition: t4_tx.c:1417
const char * t30_get_rx_password(t30_state_t *s)
Get the received password associated with a T.30 context.
Definition: t30_api.c:263
@ T30_ERR_NOPAGE
Definition: t30.h:281
@ T30_SUPPORT_400_800_RESOLUTION
Definition: t30.h:406
@ T4_COMPRESSION_ITU_T4_1D
Definition: t4_rx.h:54
int t30_set_tx_ident(t30_state_t *s, const char *id)
Set the transmitted identifier associated with a T.30 context.
Definition: t30_api.c:90
Definition: private/logging.h:33
@ T30_ERR_RX_INVALCMD
Definition: t30.h:262
@ T30_ERR_TX_INCAPABLE
Definition: t30.h:243
int t30_set_ecm_capability(t30_state_t *s, int enabled)
Select ECM capability.
Definition: t30_api.c:637
@ T30_ERR_BADPAGE
Definition: t30.h:283
@ T30_ERR_RX_ECMPHD
Definition: t30.h:260
@ T30_ERR_T0_EXPIRED
Definition: t30.h:235
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.
Definition: t30_api.c:181
void t30_local_interrupt_request(t30_state_t *s, int state)
Request a local interrupt of FAX exchange.
Definition: t30.c:6269
@ T30_ERR_NOPOLL
Definition: t30.h:293
int error_correction_scheme
Definition: udptl.h:59
int t30_set_tx_password(t30_state_t *s, const char *password)
Set the transmitted password associated with a T.30 context.
Definition: t30_api.c:241
@ T30_ERR_TX_BADDCS
Definition: t30.h:249