ROHC compression/decompression library
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 decode.h
00019  * @brief ROHC packet related routines
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 DECODE_H
00026 #define DECODE_H
00027 
00028 #include "dllexport.h"
00029 
00030 #include <stddef.h>
00031 #ifdef __KERNEL__
00032 #       include <linux/types.h>
00033 #else
00034 #       include <stdbool.h>
00035 #endif
00036 
00037 
00038 /// The magic bits to find out whether a field is a segment field or not
00039 #define D_SEGMENT        (0xfe >> 1)
00040 /// The magic byte to find out whether a field is a padding field or not
00041 #define D_PADDING        0xe0
00042 
00043 /// The magic bits to find out whether a ROHC packet is a Feedback packet or not
00044 #define D_FEEDBACK       (0xf0 >> 3)
00045 /// The magic bits to find out whether a ROHC packet is an IR packet or not
00046 #define D_IR_PACKET      (0xfc >> 1)
00047 /// The magic byte to find out whether a ROHC packet is an IR-DYN packet or not
00048 #define D_IR_DYN_PACKET  0xf8
00049 
00050 /// @brief The magic bits to find out whether a ROHC packet starts with an
00051 ///        add-CID byte or not
00052 #define D_ADD_CID        0xe
00053 
00054 
00055 /*
00056  * Function prototypes.
00057  */
00058 
00059 int ROHC_EXPORT d_is_segment(const unsigned char *);
00060 int ROHC_EXPORT d_is_padding(const unsigned char *);
00061 
00062 int ROHC_EXPORT d_is_feedback(const unsigned char *);
00063 int ROHC_EXPORT d_feedback_size(const unsigned char *);
00064 int ROHC_EXPORT d_feedback_headersize(const unsigned char *);
00065 
00066 bool ROHC_EXPORT d_is_ir(const unsigned char *data, const size_t len);
00067 bool ROHC_EXPORT d_is_irdyn(const unsigned char *data, const size_t len);
00068 bool ROHC_EXPORT d_is_uo0(const unsigned char *data, const size_t len);
00069 bool ROHC_EXPORT d_is_uo1(const unsigned char *data, const size_t len);
00070 bool ROHC_EXPORT d_is_uor2(const unsigned char *data, const size_t len);
00071 bool ROHC_EXPORT d_is_uor2_ts(const unsigned char *const data,
00072                               const size_t data_len,
00073                               const size_t large_cid_len);
00074 bool ROHC_EXPORT d_is_uor2_rtp(const unsigned char *const data,
00075                                const size_t data_len,
00076                                const size_t large_cid_len);
00077 
00078 int ROHC_EXPORT d_is_add_cid(const unsigned char *);
00079 int ROHC_EXPORT d_decode_add_cid(const unsigned char *);
00080 
00081 
00082 #endif
00083