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 
00024 #ifndef SDVL_H
00025 #define SDVL_H
00026 
00027 #include "rohc.h"
00028 
00029 #include <stdbool.h>
00030 
00031 
00032 /*
00033  * Constants related to fields length for SDVL-encoding
00034  */
00035 
00037 #define MAX_BITS_IN_1_BYTE_SDVL 7
00038 
00039 #define MAX_BITS_IN_2_BYTE_SDVL 14
00040 
00041 #define MAX_BITS_IN_3_BYTE_SDVL 21
00042 
00043 #define MAX_BITS_IN_4_BYTE_SDVL 29
00044 
00045 /*
00046  * Function prototypes.
00047  */
00048 
00049 bool sdvl_can_value_be_encoded(uint32_t value);
00050 
00051 int c_bytesSdvl(int value, int length);
00052 
00053 boolean c_encodeSdvl(unsigned char *dest, int value, int length);
00054 
00055 int d_sdvalue_size(const unsigned char *data);
00056 
00057 int d_sdvalue_decode(const unsigned char *data);
00058 
00059 
00060 #endif
00061