spandsp 0.0.6
v18.h File Reference

Go to the source code of this file.

Typedefs

typedef struct v18_state_s v18_state_t

Enumerations

enum  {
  V18_MODE_NONE = 0 , V18_MODE_5BIT_45 = 1 , V18_MODE_5BIT_50 = 2 , V18_MODE_DTMF = 3 ,
  V18_MODE_EDT = 4 , V18_MODE_BELL103 = 5 , V18_MODE_V23VIDEOTEX = 6 , V18_MODE_V21TEXTPHONE = 7 ,
  V18_MODE_V18TEXTPHONE = 8
}

Functions

logging_state_tv18_get_logging_state (v18_state_t *s)
v18_state_t * v18_init (v18_state_t *s, int calling_party, int mode, put_msg_func_t put_msg, void *user_data)
 Initialise a V.18 context.
int v18_release (v18_state_t *s)
 Release a V.18 context.
int v18_free (v18_state_t *s)
 Release a V.18 context.
 SPAN_DECLARE_NONSTD (int) v18_tx(v18_state_t *s
 Generate a block of V.18 audio samples.
int v18_put (v18_state_t *s, const char msg[], int len)
 Put a string to a V.18 context's input buffer.
int v18_encode_dtmf (v18_state_t *s, char dtmf[], const char msg[])
 Convert a text string to a V.18 DTMF string.
int v18_decode_dtmf (v18_state_t *s, char msg[], const char dtmf[])
 Convert a V.18 DTMF string to a text string.
uint16_t v18_encode_baudot (v18_state_t *s, uint8_t ch)
uint8_t v18_decode_baudot (v18_state_t *s, uint8_t ch)
const char * v18_mode_to_str (int mode)
 Return a short name for an V.18 mode.

Variables

int16_t amp []
int16_t int max_len
const int16_t int len

Function Documentation

◆ SPAN_DECLARE_NONSTD()

SPAN_DECLARE_NONSTD ( int )

Generate a block of V.18 audio samples.

Get the next bit of a transmitted serial bit stream.

Process a block of received V.18 audio samples.

Generate a block of V.18 audio samples.

Parameters
sThe V.18 context.
ampThe audio sample buffer.
max_lenThe number of samples to be generated.
Returns
The number of samples actually generated.

Process a block of received V.18 audio samples.

Parameters
sThe V.18 context.
ampThe audio sample buffer.
lenThe number of samples in the buffer.

Apply T.30 receive processing to a block of audio samples.

Process a block of received V.8 audio samples.

Fake processing of a missing block of received V.29 modem audio samples.

Fake processing of a missing block of received V.27ter modem audio samples.

Generate a block of V.22bis modem audio samples.

Fake processing of a missing block of received V.22bis modem audio samples.

Process a block of received V.18 audio samples.

Fake processing of a missing block of received V.17 modem audio samples.

Generate a block of FAX audio samples.

Apply fake received audio processing.

Process a received T.38 IFP packet from a reliable stream (e.g. TCP).

Generate a block of T.31 modem audio samples.

Fake processing of a missing block of received T.31 modem audio samples.

Dummy receive fillin callback.

Dummy receive callback.

Process a block of samples through an instance of the modem connect tones detector.

Get the next sequence of bytes for transmission.

Get the next byte for transmission.

Fake processing of a missing block of received FSK modem audio samples.

Process a block of received FSK modem audio samples.

Apply T.30 transmit processing to generate a block of audio samples.

Apply fake T.30 receive processing.

Get the next bit of a transmitted serial bit stream.

Parameters
user_dataAn opaque point which must point to a transmitter context.
Returns
the next bit, or PUTBIT_END_OF_DATA to indicate the data stream has ended.

Apply fake T.30 receive processing when a block of audio samples is missing (e.g due to packet loss).

Parameters
sThe FAX context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed. This should only be non-zero if the software has reached the end of the FAX call.

Apply T.30 transmit processing to generate a block of audio samples.

Parameters
sThe FAX context.
ampThe audio sample buffer.
max_lenThe number of samples to be generated.
Returns
The number of samples actually generated. This will be zero when there is nothing to send.

Process a block of received FSK modem audio samples.

Parameters
sThe modem context.
ampThe audio sample buffer.
lenThe number of samples in the buffer.
Returns
The number of samples unprocessed.

Fake processing of a missing block of received FSK modem audio samples (e.g due to packet loss).

Parameters
sThe modem context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed.
Parameters
sA pointer to an HDLC transmitter context.
Returns
The next byte for transmission.
Parameters
sA pointer to an HDLC transmitter context.
bufThe buffer for the data.
max_lenThe number of bytes to get.
Returns
The number of bytes actually got.
Parameters
sThe context.
ampAn array of signal samples.
lenThe number of samples in the array.
Returns
The number of unprocessed samples.

A dummy routine to use as a receive callback, when we aren't really trying to process what is received. It just absorbs and ignores the data.

Parameters
user_dataThe context.
ampThe signal.buffer
lenThe length of the signal buffer
Returns
0.

A dummy routine to use as a receive fillin callback, when we aren't really trying to process what is received. It just absorbs and ignores the request.

Parameters
user_dataThe context.
lenThe length of the signal buffer
Returns
0.

Fake processing of a missing block of received T.31 modem audio samples (e.g due to packet loss).

Parameters
sThe T.31 modem context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed.

Generate a block of T.31 modem audio samples.

Parameters
sThe T.31 modem context.
ampThe audio sample buffer.
max_lenThe number of samples to be generated.
Returns
The number of samples actually generated.
Parameters
sThe T.38 context.
bufThe packet contents.
lenThe length of the packet contents.
seq_noThe packet sequence number, used for logging purposes.
Returns
The length of the packet processed, or -1 if there is an error in the packet, or too few bytes of data to complete it.

Apply fake processing when a block of audio samples is missing (e.g due to packet loss).

Parameters
sThe T.38 context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed. This should only be non-zero if the software has reached the end of the FAX call.

Generate a block of FAX audio samples.

Parameters
sThe T.38 context.
ampThe audio sample buffer.
max_lenThe number of samples to be generated.
Returns
The number of samples actually generated.

Fake processing of a missing block of received V.17 modem audio samples. (e.g due to packet loss).

Parameters
sThe modem context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed.

Process a block of received V.18 audio samples.

Parameters
sThe V.18 context.
ampThe audio sample buffer.
lenThe number of samples in the buffer.

Fake processing of a missing block of received V.22bis modem audio samples. (e.g due to packet loss).

Parameters
sThe modem context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed.

Generate a block of V.22bis modem audio samples.

Parameters
sThe modem context.
ampThe audio sample buffer.
lenThe number of samples to be generated.
Returns
The number of samples actually generated.

Fake processing of a missing block of received V.27ter modem audio samples. (e.g due to packet loss).

Parameters
sThe modem context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed.

Fake processing of a missing block of received V.29 modem audio samples. (e.g due to packet loss).

Parameters
sThe modem context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed.

Process a block of received V.8 audio samples.

Parameters
sThe V.8 context.
ampThe audio sample buffer.
lenThe number of samples in the buffer.

Get the next bit of a transmitted serial bit stream.

Apply T.30 transmit processing to generate a block of audio samples.

Apply fake T.30 receive processing.

Apply T.30 receive processing to a block of audio samples.

Parameters
sThe FAX context.
ampThe audio sample buffer.
lenThe number of samples in the buffer.
Returns
The number of samples unprocessed. This should only be non-zero if the software has reached the end of the FAX call.

Apply fake T.30 receive processing when a block of audio samples is missing (e.g due to packet loss).

Parameters
sThe FAX context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed. This should only be non-zero if the software has reached the end of the FAX call.

Apply T.30 transmit processing to generate a block of audio samples.

Parameters
sThe FAX context.
ampThe audio sample buffer.
max_lenThe number of samples to be generated.
Returns
The number of samples actually generated. This will be zero when there is nothing to send.

◆ v18_decode_dtmf()

int v18_decode_dtmf ( v18_state_t * s,
char msg[],
const char dtmf[] )

Convert a V.18 DTMF string to a text string.

Convert a V.18 DTMF string to a text string.

Parameters
sThe V.18 context.
msgThe resulting test string.
dtmfThe DTMF string to be converted.
Returns
The length of the text string.

◆ v18_encode_dtmf()

int v18_encode_dtmf ( v18_state_t * s,
char dtmf[],
const char msg[] )

Convert a text string to a V.18 DTMF string.

Convert a text string to a V.18 DTMF string.

Parameters
sThe V.18 context.
dtmfThe resulting DTMF string.
msgThe text string to be converted.
Returns
The length of the DTMF string.

◆ v18_free()

int v18_free ( v18_state_t * s)

Release a V.18 context.

Free a V.18 context.

Parameters
sThe V.18 context.
Returns
0 for OK.

◆ v18_init()

v18_state_t * v18_init ( v18_state_t * s,
int calling_party,
int mode,
put_msg_func_t put_msg,
void * user_data )

Initialise a V.18 context.

Initialise a V.18 context.

Parameters
sThe V.18 context.
calling_partyTRUE if caller mode, else answerer mode.
modeMode of operation.
put_msgA callback routine called to deliver the received text to the application.
user_dataAn opaque pointer for the callback routine.
Returns
A pointer to the V.18 context, or NULL if there was a problem.

References ASYNC_PARITY_EVEN, ASYNC_PARITY_NONE, async_tx_init(), v18_state_s::calling_party, dtmf_rx_init(), dtmf_tx_init(), fsk_rx_init(), fsk_tx_init(), queue_init(), QUEUE_READ_ATOMIC, and QUEUE_WRITE_ATOMIC.

◆ v18_mode_to_str()

const char * v18_mode_to_str ( int mode)

Return a short name for an V.18 mode.

Parameters
modeThe code for the V.18 mode.
Returns
A pointer to the name.

◆ v18_put()

int v18_put ( v18_state_t * s,
const char msg[],
int len )

Put a string to a V.18 context's input buffer.

Parameters
sThe V.18 context.
msgThe string to be added.
lenThe length of the string. If negative, the string is assumed to be a NULL terminated string.
Returns
The number of characters actually added. This may be less than the length of the digit string, if the buffer fills up. If the string is invalid, this function will return -1.

References queue_write().

◆ v18_release()

int v18_release ( v18_state_t * s)

Release a V.18 context.

Release a V.18 context.

Parameters
sThe V.18 context.
Returns
0 for OK.