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 #include <stdbool.h>
00034 
00035 
00036 /* The definition of the Least Significant Bits decoding object is private */
00037 struct rohc_lsb_decode;
00038 
00039 
00040 /*
00041  * Function prototypes
00042  */
00043 
00044 struct rohc_lsb_decode * ROHC_EXPORT rohc_lsb_new(const rohc_lsb_shift_t p);
00045 
00046 void ROHC_EXPORT rohc_lsb_free(struct rohc_lsb_decode *const lsb)
00047         __attribute__((nonnull(1)));
00048 
00049 bool ROHC_EXPORT rohc_lsb_decode32(const struct rohc_lsb_decode *const lsb,
00050                                    const uint32_t m,
00051                                    const size_t k,
00052                                    uint32_t *const decoded)
00053         __attribute__((nonnull(1, 4)));
00054 
00055 bool ROHC_EXPORT rohc_lsb_decode16(const struct rohc_lsb_decode *const lsb,
00056                                    const uint16_t m,
00057                                    const size_t k,
00058                                    uint16_t *const decoded)
00059         __attribute__((nonnull(1, 4), warn_unused_result));
00060 
00061 void ROHC_EXPORT rohc_lsb_set_ref(struct rohc_lsb_decode *const lsb,
00062                                   const uint32_t v_ref_d)
00063         __attribute__((nonnull(1)));
00064 
00065 uint32_t ROHC_EXPORT rohc_lsb_get_ref(struct rohc_lsb_decode *const lsb)
00066         __attribute__((nonnull(1)));
00067 
00068 #endif
00069