#include <stdlib.h>#include <inttypes.h>#include <string.h>#include <stdio.h>#include "spandsp/telephony.h"#include "spandsp/async.h"#include "spandsp/crc.h"#include "spandsp/bit_operations.h"#include "spandsp/hdlc.h"#include "spandsp/private/hdlc.h"Functions | |
| SPAN_DECLARE_NONSTD (void) | |
| void | hdlc_rx_set_max_frame_len (hdlc_rx_state_t *s, size_t max_len) |
| Set the maximum frame length for an HDLC receiver context. | |
| void | hdlc_rx_set_octet_counting_report_interval (hdlc_rx_state_t *s, int interval) |
| Set the octet counting report interval. | |
| hdlc_rx_state_t * | hdlc_rx_init (hdlc_rx_state_t *s, int crc32, int report_bad_frames, int framing_ok_threshold, hdlc_frame_handler_t handler, void *user_data) |
| Initialise an HDLC receiver context. | |
| void | hdlc_rx_set_frame_handler (hdlc_rx_state_t *s, hdlc_frame_handler_t handler, void *user_data) |
| Change the put_bit function associated with an HDLC receiver context. | |
| void | hdlc_rx_set_status_handler (hdlc_rx_state_t *s, modem_rx_status_func_t handler, void *user_data) |
| Change the status report function associated with an HDLC receiver context. | |
| int | hdlc_rx_release (hdlc_rx_state_t *s) |
| Release an HDLC receiver context. | |
| int | hdlc_rx_free (hdlc_rx_state_t *s) |
| Free an HDLC receiver context. | |
| int | hdlc_rx_get_stats (hdlc_rx_state_t *s, hdlc_rx_stats_t *t) |
| Get the current receive statistics. | |
| int | hdlc_tx_frame (hdlc_tx_state_t *s, const uint8_t *frame, size_t len) |
| Transmit a frame. | |
| int | hdlc_tx_flags (hdlc_tx_state_t *s, int len) |
| Transmit a specified quantity of flag octets, typically as a preamble. | |
| int | hdlc_tx_abort (hdlc_tx_state_t *s) |
| Send an abort. | |
| int | hdlc_tx_corrupt_frame (hdlc_tx_state_t *s) |
| Corrupt the frame currently being transmitted, by giving it the wrong CRC. | |
| SPAN_DECLARE_NONSTD (int) | |
| Get the next bit of a transmitted serial bit stream. | |
| void | hdlc_tx_set_max_frame_len (hdlc_tx_state_t *s, size_t max_len) |
| Set the maximum frame length for an HDLC transmitter context. | |
| hdlc_tx_state_t * | hdlc_tx_init (hdlc_tx_state_t *s, int crc32, int inter_frame_flags, int progressive, hdlc_underflow_handler_t handler, void *user_data) |
| Initialise an HDLC transmitter context. | |
| int | hdlc_tx_release (hdlc_tx_state_t *s) |
| int | hdlc_tx_free (hdlc_tx_state_t *s) |
| int hdlc_rx_free | ( | hdlc_rx_state_t * | s | ) |
Free an HDLC receiver context.
Free an HDLC receiver context.
| s | A pointer to an HDLC receiver context. |
| int hdlc_rx_get_stats | ( | hdlc_rx_state_t * | s, | |
| hdlc_rx_stats_t * | t | |||
| ) |
Get the current receive statistics.
| s | A pointer to an HDLC receiver context. | |
| t | A pointer to the buffer for the statistics. |
| hdlc_rx_state_t* hdlc_rx_init | ( | hdlc_rx_state_t * | s, | |
| int | crc32, | |||
| int | report_bad_frames, | |||
| int | framing_ok_threshold, | |||
| hdlc_frame_handler_t | handler, | |||
| void * | user_data | |||
| ) |
Initialise an HDLC receiver context.
| s | A pointer to an HDLC receiver context. | |
| crc32 | TRUE to use ITU CRC32. FALSE to use ITU CRC16. | |
| report_bad_frames | TRUE to request the reporting of bad frames. | |
| framing_ok_threshold | The number of back-to-back flags needed to start the framing OK condition. This may be used where a series of flag octets is used as a preamble, such as in the T.30 protocol. | |
| handler | The function to be called when a good HDLC frame is received. | |
| user_data | An opaque parameter for the callback routine. |
| int hdlc_rx_release | ( | hdlc_rx_state_t * | s | ) |
Release an HDLC receiver context.
Release an HDLC receiver context.
| s | A pointer to an HDLC receiver context. |
| void hdlc_rx_set_frame_handler | ( | hdlc_rx_state_t * | s, | |
| hdlc_frame_handler_t | handler, | |||
| void * | user_data | |||
| ) |
Change the put_bit function associated with an HDLC receiver context.
Change the put_bit function associated with an HDLC receiver context.
| s | A pointer to an HDLC receiver context. | |
| handler | The function to be called when a good HDLC frame is received. | |
| user_data | An opaque parameter for the callback routine. |
| void hdlc_rx_set_max_frame_len | ( | hdlc_rx_state_t * | s, | |
| size_t | max_len | |||
| ) |
Set the maximum frame length for an HDLC receiver context.
| s | A pointer to an HDLC receiver context. | |
| max_len | The maximum permitted length of a frame. |
| void hdlc_rx_set_octet_counting_report_interval | ( | hdlc_rx_state_t * | s, | |
| int | interval | |||
| ) |
Set the octet counting report interval.
| s | A pointer to an HDLC receiver context. | |
| interval | The interval, in octets. |
| void hdlc_rx_set_status_handler | ( | hdlc_rx_state_t * | s, | |
| modem_rx_status_func_t | handler, | |||
| void * | user_data | |||
| ) |
Change the status report function associated with an HDLC receiver context.
Change the status report function associated with an HDLC receiver context.
| s | A pointer to an HDLC receiver context. | |
| handler | The callback routine used to report status changes. | |
| user_data | An opaque parameter for the callback routine. |
| int hdlc_tx_abort | ( | hdlc_tx_state_t * | s | ) |
Send an abort.
| s | A pointer to an HDLC transmitter context. |
| int hdlc_tx_corrupt_frame | ( | hdlc_tx_state_t * | s | ) |
Corrupt the frame currently being transmitted, by giving it the wrong CRC.
| s | A pointer to an HDLC transmitter context. |
References HDLC_MAXFRAME_LEN.
| int hdlc_tx_flags | ( | hdlc_tx_state_t * | s, | |
| int | len | |||
| ) |
Transmit a specified quantity of flag octets, typically as a preamble.
| s | A pointer to an HDLC transmitter context. | |
| len | The length of the required period of flags, in flag octets. If len is zero this requests that HDLC transmission be terminated when the buffers have fully drained. |
| int hdlc_tx_frame | ( | hdlc_tx_state_t * | s, | |
| const uint8_t * | frame, | |||
| size_t | len | |||
| ) |
Transmit a frame.
| s | A pointer to an HDLC transmitter context. | |
| frame | A pointer to the frame to be transmitted. | |
| len | The length of the frame to be transmitted. |
References crc_itu16_calc(), crc_itu32_calc(), and HDLC_MAXFRAME_LEN.
| hdlc_tx_state_t* hdlc_tx_init | ( | hdlc_tx_state_t * | s, | |
| int | crc32, | |||
| int | inter_frame_flags, | |||
| int | progressive, | |||
| hdlc_underflow_handler_t | handler, | |||
| void * | user_data | |||
| ) |
Initialise an HDLC transmitter context.
| s | A pointer to an HDLC transmitter context. | |
| crc32 | TRUE to use ITU CRC32. FALSE to use ITU CRC16. | |
| inter_frame_flags | The minimum flag octets to insert between frames (usually one). | |
| progressive | TRUE if frame creation works in progressive mode. | |
| handler | The callback function called when the HDLC transmitter underflows. | |
| user_data | An opaque parameter for the callback routine. |
References HDLC_MAXFRAME_LEN.
| void hdlc_tx_set_max_frame_len | ( | hdlc_tx_state_t * | s, | |
| size_t | max_len | |||
| ) |
Set the maximum frame length for an HDLC transmitter context.
| s | A pointer to an HDLC transmitter context. | |
| max_len | The maximum length. |
References HDLC_MAXFRAME_LEN.
| SPAN_DECLARE_NONSTD | ( | int | ) |
Get the next bit of a transmitted serial bit stream.
Get the next bit of data from a T.38 rate adapting non-ECM buffer context.
Get a bit of received non-ECM image data.
Get the next bit of a transmitted serial bit stream.
| user_data | An opaque point which must point to a transmitter context. |
Get the next bit of a transmitted serial bit stream.
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.
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 when a block of audio samples is missing (e.g due to packet loss).
| s | The FAX context. | |
| len | The number of samples to fake. |
Apply T.30 transmit processing to generate a block of audio samples.
| s | The FAX context. | |
| amp | The audio sample buffer. | |
| max_len | The number of samples to be generated. |
Process a block of received FSK modem audio samples.
| s | The modem context. | |
| amp | The audio sample buffer. | |
| len | The number of samples in the buffer. |
Fake processing of a missing block of received FSK modem audio samples (e.g due to packet loss).
| s | The modem context. | |
| len | The number of samples to fake. |
| s | A pointer to an HDLC transmitter context. |
| s | A pointer to an HDLC transmitter context. | |
| buf | The buffer for the data. | |
| max_len | The number of bytes to get. |
| s | The context. | |
| amp | An array of signal samples. | |
| len | The number of samples in the array. |
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.
| user_data | The context. | |
| amp | The signal.buffer | |
| len | The length of the signal buffer |
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.
| user_data | The context. | |
| len | The length of the signal buffer |
Fake processing of a missing block of received T.31 modem audio samples (e.g due to packet loss).
| s | The T.31 modem context. | |
| len | The number of samples to fake. |
Generate a block of T.31 modem audio samples.
| s | The T.31 modem context. | |
| amp | The audio sample buffer. | |
| max_len | The number of samples to be generated. |
Apply fake processing when a block of audio samples is missing (e.g due to packet loss).
| s | The T.38 context. | |
| len | The number of samples to fake. |
Generate a block of FAX audio samples.
| s | The T.38 context. | |
| amp | The audio sample buffer. | |
| max_len | The number of samples to be generated. |
Fake processing of a missing block of received V.17 modem audio samples. (e.g due to packet loss).
| s | The modem context. | |
| len | The number of samples to fake. |
Process a block of received V.18 audio samples.
| s | The V.18 context. | |
| amp | The audio sample buffer. | |
| len | The 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).
| s | The modem context. | |
| len | The number of samples to fake. |
Generate a block of V.22bis modem audio samples.
| s | The modem context. | |
| amp | The audio sample buffer. | |
| len | The number of samples to be generated. |
Fake processing of a missing block of received V.27ter modem audio samples. (e.g due to packet loss).
| s | The modem context. | |
| len | The number of samples to fake. |
Fake processing of a missing block of received V.29 modem audio samples. (e.g due to packet loss).
| s | The modem context. | |
| len | The number of samples to fake. |
Process a block of received V.8 audio samples.
| s | The V.8 context. | |
| amp | The audio sample buffer. | |
| len | The number of samples in the buffer. |
References SIG_STATUS_END_OF_DATA.
1.6.1