ROHC compression/decompression library
lsb_decode.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   lsb_decode.h
00019  * @brief  Least Significant Bits (LSB) encoding
00020  * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
00021  * @author Didier Barvaux <didier@barvaux.org>
00022  * @author The hackers from ROHC for Linux
00023  */
00024 
00025 #ifndef LSB_H
00026 #define LSB_H
00027 
00028 #include "interval.h" /* for rohc_lsb_shift_t */
00029 #include "dllexport.h"
00030 
00031 #include <stdlib.h>
00032 #include <stdint.h>
00033 #ifdef __KERNEL__
00034 #       include <linux/types.h>
00035 #else
00036 #       include <stdbool.h>
00037 #endif
00038 
00039 
00040 /* The definition of the Least Significant Bits decoding object is private */
00041 struct rohc_lsb_decode;
00042 
00043 
00044 /*
00045  * Function prototypes
00046  */
00047 
00048 struct rohc_lsb_decode * ROHC_EXPORT rohc_lsb_new(const rohc_lsb_shift_t p,
00049                                                                                                                                   const size_t max_len);
00050 
00051 void ROHC_EXPORT rohc_lsb_free(struct rohc_lsb_decode *const lsb)
00052         __attribute__((nonnull(1)));
00053 
00054 bool ROHC_EXPORT rohc_lsb_decode(const struct rohc_lsb_decode *const lsb,
00055                                  const uint32_t m,
00056                                  const size_t k,
00057                                  uint32_t *const decoded)
00058         __attribute__((nonnull(1, 4)));
00059 
00060 void ROHC_EXPORT rohc_lsb_set_ref(struct rohc_lsb_decode *const lsb,
00061                                   const uint32_t v_ref_d)
00062         __attribute__((nonnull(1)));
00063 
00064 uint32_t ROHC_EXPORT rohc_lsb_get_ref(struct rohc_lsb_decode *const lsb)
00065         __attribute__((nonnull(1)));
00066 
00067 #endif
00068