|
spandsp
0.0.6
|
#include <stdio.h>#include <stdlib.h>#include <inttypes.h>#include <string.h>#include <errno.h>#include <fcntl.h>#include <ctype.h>#include <assert.h>#include "spandsp/telephony.h"#include "spandsp/logging.h"#include "spandsp/bit_operations.h"#include "spandsp/v42bis.h"#include "spandsp/private/logging.h"#include "spandsp/private/v42bis.h"Defines | |
| #define | V42BIS_N3 8 /* Character size (bits) */ |
| #define | V42BIS_N4 256 /* Number of characters in the alphabet */ |
| #define | V42BIS_N5 (V42BIS_N4 + V42BIS_N6) /* Index number of first dictionary entry used to store a string */ |
| #define | V42BIS_N6 3 /* Number of control codewords */ |
| #define | V42BIS_ESC_STEP 51 |
Enumerations | |
| enum | { V42BIS_ETM = 0, V42BIS_FLUSH = 1, V42BIS_STEPUP = 2 } |
| enum | { V42BIS_ECM = 0, V42BIS_EID = 1, V42BIS_RESET = 2 } |
Functions | |
| int | v42bis_compress (v42bis_state_t *s, const uint8_t *buf, int len) |
| int | v42bis_compress_flush (v42bis_state_t *s) |
| int | v42bis_decompress (v42bis_state_t *s, const uint8_t *buf, int len) |
| int | v42bis_decompress_flush (v42bis_state_t *s) |
| void | v42bis_compression_control (v42bis_state_t *s, int mode) |
| v42bis_state_t * | v42bis_init (v42bis_state_t *s, int negotiated_p0, int negotiated_p1, int negotiated_p2, v42bis_frame_handler_t frame_handler, void *frame_user_data, int max_frame_len, v42bis_data_handler_t data_handler, void *data_user_data, int max_data_len) |
| int | v42bis_release (v42bis_state_t *s) |
| int | v42bis_free (v42bis_state_t *s) |
| int v42bis_compress | ( | v42bis_state_t * | s, |
| const uint8_t * | buf, | ||
| int | len | ||
| ) |
Compress a block of octets.
| s | The V.42bis context. |
| buf | The data to be compressed. |
| len | The length of the data buffer. |
References v42bis_dict_node_t::children, v42bis_compress_state_t::compressibility_filter, v42bis_compress_state_t::compression_mode, v42bis_compress_state_t::first, v42bis_compress_state_t::handler, v42bis_dict_node_t::leaves, v42bis_compress_state_t::max_len, v42bis_dict_node_t::node_octet, v42bis_dict_node_t::parent_code, v42bis_compress_state_t::transparent, v42bis_compress_state_t::user_data, v42bis_compress_state_t::v42bis_parm_c1, v42bis_compress_state_t::v42bis_parm_c2, and v42bis_compress_state_t::v42bis_parm_c3.
| int v42bis_compress_flush | ( | v42bis_state_t * | s | ) |
Flush out any data remaining in a compression buffer.
| s | The V.42bis context. |
References v42bis_compress_state_t::handler, v42bis_compress_state_t::transparent, and v42bis_compress_state_t::user_data.
| void v42bis_compression_control | ( | v42bis_state_t * | s, |
| int | mode | ||
| ) |
Set the compression mode.
| s | The V.42bis context. |
| mode | One of the V.42bis compression modes - V42BIS_COMPRESSION_MODE_DYNAMIC, V42BIS_COMPRESSION_MODE_ALWAYS, V42BIS_COMPRESSION_MODE_NEVER |
| int v42bis_decompress | ( | v42bis_state_t * | s, |
| const uint8_t * | buf, | ||
| int | len | ||
| ) |
Decompress a block of octets.
| s | The V.42bis context. |
| buf | The data to be decompressed. |
| len | The length of the data buffer. |
References v42bis_decompress_state_t::first, v42bis_decompress_state_t::handler, v42bis_dict_node_t::leaves, v42bis_decompress_state_t::max_len, v42bis_dict_node_t::node_octet, v42bis_dict_node_t::parent_code, v42bis_decompress_state_t::transparent, v42bis_decompress_state_t::user_data, v42bis_decompress_flush(), v42bis_decompress_state_t::v42bis_parm_c1, v42bis_decompress_state_t::v42bis_parm_c2, and v42bis_decompress_state_t::v42bis_parm_c3.
| int v42bis_decompress_flush | ( | v42bis_state_t * | s | ) |
Flush out any data remaining in the decompression buffer.
| s | The V.42bis context. |
References v42bis_decompress_state_t::handler, and v42bis_decompress_state_t::user_data.
Referenced by v42bis_decompress().
| int v42bis_free | ( | v42bis_state_t * | s | ) |
Free a V.42bis context.
| s | The V.42bis context. |
| v42bis_state_t* v42bis_init | ( | v42bis_state_t * | s, |
| int | negotiated_p0, | ||
| int | negotiated_p1, | ||
| int | negotiated_p2, | ||
| v42bis_frame_handler_t | frame_handler, | ||
| void * | frame_user_data, | ||
| int | max_frame_len, | ||
| v42bis_data_handler_t | data_handler, | ||
| void * | data_user_data, | ||
| int | max_data_len | ||
| ) |
Initialise a V.42bis context.
| s | The V.42bis context. |
| negotiated_p0 | The negotiated P0 parameter, from the V.42bis spec. |
| negotiated_p1 | The negotiated P1 parameter, from the V.42bis spec. |
| negotiated_p2 | The negotiated P2 parameter, from the V.42bis spec. |
| frame_handler | Frame callback handler. |
| frame_user_data | An opaque pointer passed to the frame callback handler. |
| max_frame_len | The maximum length that should be passed to the frame handler. |
| data_handler | data callback handler. |
| data_user_data | An opaque pointer passed to the data callback handler. |
| max_data_len | The maximum length that should be passed to the data handler. |
| int v42bis_release | ( | v42bis_state_t * | s | ) |
Release a V.42bis context.
| s | The V.42bis context. |