ROHC compression/decompression library
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 2 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * This program is distributed in the hope that it will be useful, 00008 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 * GNU General Public License for more details. 00011 * 00012 * You should have received a copy of the GNU General Public License 00013 * along with this program; if not, write to the Free Software 00014 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00015 */ 00016 00017 /** 00018 * @file sdvl.h 00019 * @brief Self-Describing Variable-Length (SDVL) encoding 00020 * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com> 00021 * @author The hackers from ROHC for Linux 00022 */ 00023 00024 #ifndef SDVL_H 00025 #define SDVL_H 00026 00027 #include <stdlib.h> 00028 #include <stdint.h> 00029 #include <stdbool.h> 00030 00031 00032 /* 00033 * Constants related to fields length for SDVL-encoding 00034 */ 00035 00036 /** The maximum numbers of bits that can be SDVL-encoded in 1, 2, 3 00037 * and 4 bytes */ 00038 typedef enum 00039 { 00040 /** Maximum number of bits in 1 SDVL-encoded byte */ 00041 ROHC_SDVL_MAX_BITS_IN_1_BYTE = 7U, 00042 /** Maximum number of bits in 2 SDVL-encoded byte */ 00043 ROHC_SDVL_MAX_BITS_IN_2_BYTES = 14U, 00044 /** Maximum number of bits in 3 SDVL-encoded byte */ 00045 ROHC_SDVL_MAX_BITS_IN_3_BYTES = 21U, 00046 /** Maximum number of bits in 4 SDVL-encoded byte */ 00047 ROHC_SDVL_MAX_BITS_IN_4_BYTES = 29U, 00048 } rohc_sdvl_max_bits_t; 00049 00050 00051 /* 00052 * Function prototypes. 00053 */ 00054 00055 bool sdvl_can_value_be_encoded(uint32_t value); 00056 00057 size_t c_bytesSdvl(uint32_t value, size_t length); 00058 00059 int c_encodeSdvl(unsigned char *dest, uint32_t value, size_t length); 00060 00061 int d_sdvalue_size(const unsigned char *data); 00062 00063 int d_sdvalue_decode(const unsigned char *data); 00064 00065 00066 #endif 00067