00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * private/v42bis.h 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2005 Steve Underwood 00009 * 00010 * All rights reserved. 00011 * 00012 * This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 2.1, 00014 * as published by the Free Software Foundation. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 */ 00025 00026 #if !defined(_SPANDSP_PRIVATE_V42BIS_H_) 00027 #define _SPANDSP_PRIVATE_V42BIS_H_ 00028 00029 /*! 00030 V.42bis dictionary node. 00031 Note that 0 is not a valid node to point to (0 is always a control code), so 0 is used 00032 as a "no such value" marker in this structure. 00033 */ 00034 typedef struct 00035 { 00036 /*! \brief The value of the octet represented by the current dictionary node */ 00037 uint8_t node_octet; 00038 /*! \brief The parent of this node */ 00039 uint16_t parent; 00040 /*! \brief The first child of this node */ 00041 uint16_t child; 00042 /*! \brief The next node at the same depth */ 00043 uint16_t next; 00044 } v42bis_dict_node_t; 00045 00046 /*! 00047 V.42bis compression or decompression. This defines the working state for a single instance 00048 of V.42bis compression or decompression. 00049 */ 00050 typedef struct 00051 { 00052 /*! \brief Compression enabled. */ 00053 int v42bis_parm_p0; 00054 /*! \brief Compression mode. */ 00055 int compression_mode; 00056 /*! \brief Callback function to handle output data. */ 00057 put_msg_func_t handler; 00058 /*! \brief An opaque pointer passed in calls to the data handler. */ 00059 void *user_data; 00060 /*! \brief The maximum amount to be passed to the data handler. */ 00061 int max_output_len; 00062 00063 /*! \brief TRUE if we are in transparent (i.e. uncompressable) mode */ 00064 int transparent; 00065 /*! \brief Next empty dictionary entry */ 00066 uint16_t v42bis_parm_c1; 00067 /*! \brief Current codeword size */ 00068 uint16_t v42bis_parm_c2; 00069 /*! \brief Threshold for codeword size change */ 00070 uint16_t v42bis_parm_c3; 00071 /*! \brief The current update point in the dictionary */ 00072 uint16_t update_at; 00073 /*! \brief The last entry matched in the dictionary */ 00074 uint16_t last_matched; 00075 /*! \brief The last entry added to the dictionary */ 00076 uint16_t last_added; 00077 /*! \brief Total number of codewords in the dictionary */ 00078 int v42bis_parm_n2; 00079 /*! \brief Maximum permitted string length */ 00080 int v42bis_parm_n7; 00081 /*! \brief The dictionary */ 00082 v42bis_dict_node_t dict[V42BIS_MAX_CODEWORDS]; 00083 00084 /*! \brief The octet string in progress */ 00085 uint8_t string[V42BIS_MAX_STRING_SIZE]; 00086 /*! \brief The current length of the octet string in progress */ 00087 int string_length; 00088 /*! \brief The amount of the octet string in progress which has already 00089 been flushed out of the buffer */ 00090 int flushed_length; 00091 00092 /*! \brief Compression performance metric */ 00093 uint16_t compression_performance; 00094 00095 /*! \brief Outgoing bit buffer (compression), or incoming bit buffer (decompression) */ 00096 uint32_t bit_buffer; 00097 /*! \brief Outgoing bit count (compression), or incoming bit count (decompression) */ 00098 int bit_count; 00099 00100 /*! \brief The output composition buffer */ 00101 uint8_t output_buf[V42BIS_MAX_OUTPUT_LENGTH]; 00102 /*! \brief The length of the contents of the output composition buffer */ 00103 int output_octet_count; 00104 00105 /*! \brief The current value of the escape code */ 00106 uint8_t escape_code; 00107 /*! \brief TRUE if we just hit an escape code, and are waiting for the following octet */ 00108 int escaped; 00109 } v42bis_comp_state_t; 00110 00111 /*! 00112 V.42bis compression/decompression descriptor. This defines the working state for a 00113 single instance of V.42bis compress/decompression. 00114 */ 00115 struct v42bis_state_s 00116 { 00117 /*! \brief Compression state. */ 00118 v42bis_comp_state_t compress; 00119 /*! \brief Decompression state. */ 00120 v42bis_comp_state_t decompress; 00121 00122 /*! \brief Error and flow logging control */ 00123 logging_state_t logging; 00124 }; 00125 00126 #endif 00127 /*- End of file ------------------------------------------------------------*/
1.6.1