ROHC compression/decompression library
sdvl.h
Go to the documentation of this file.
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 
00030 
00031 /*
00032  * Constants related to fields length for SDVL-encoding
00033  */
00034 
00035 /** The maximum numbers of bits that can be SDVL-encoded in 1, 2, 3
00036  *  and 4 bytes */
00037 typedef enum
00038 {
00039         /** Maximum number of bits in 1 SDVL-encoded byte */
00040         ROHC_SDVL_MAX_BITS_IN_1_BYTE = 7U,
00041         /** Maximum number of bits in 2 SDVL-encoded byte */
00042         ROHC_SDVL_MAX_BITS_IN_2_BYTES = 14U,
00043         /** Maximum number of bits in 3 SDVL-encoded byte */
00044         ROHC_SDVL_MAX_BITS_IN_3_BYTES = 21U,
00045         /** Maximum number of bits in 4 SDVL-encoded byte */
00046         ROHC_SDVL_MAX_BITS_IN_4_BYTES = 29U,
00047 } rohc_sdvl_max_bits_t;
00048 
00049 
00050 /*
00051  * Function prototypes.
00052  */
00053 
00054 size_t c_bytesSdvl(uint32_t value, size_t length);
00055 
00056 int c_encodeSdvl(unsigned char *dest, uint32_t value, size_t length);
00057 
00058 int d_sdvalue_size(const unsigned char *data);
00059 
00060 int d_sdvalue_decode(const unsigned char *data);
00061 
00062 
00063 #endif
00064