ROHC compression/decompression library
|
00001 /* 00002 * Copyright 2012,2013,2014 Didier Barvaux 00003 * Copyright 2012 WBX 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 /** 00021 * @file decomp/schemes/rfc4996.h 00022 * @brief Library of decoding methods from RFC4997 and RFC4996 00023 * @author FWX <rohc_team@dialine.fr> 00024 * @author Didier Barvaux <didier@barvaux.org> 00025 */ 00026 00027 #ifndef ROHC_DECOMP_SCHEMES_RFC4996_H 00028 #define ROHC_DECOMP_SCHEMES_RFC4996_H 00029 00030 #include "protocols/tcp.h" 00031 #include "wlsb.h" 00032 00033 #include <stdint.h> 00034 00035 struct rohc_decomp_ctxt; 00036 00037 extern unsigned int lsb_xor_masks[]; 00038 00039 00040 // RFC4997 page 27 00041 uint32_t d_lsb(const struct rohc_decomp_ctxt *const context, 00042 int num_lsbs_param, 00043 int offset_param, 00044 unsigned int context_value, 00045 unsigned int value); 00046 00047 int d_static_or_irreg8(const uint8_t *rohc_data, 00048 const uint8_t context_value, 00049 const int indicator, 00050 uint8_t *const decoded_value) 00051 __attribute__((warn_unused_result, nonnull(1, 4))); 00052 00053 int d_static_or_irreg16(const uint8_t *rohc_data, 00054 const uint16_t context_value, 00055 const int indicator, 00056 uint16_t *const decoded_value) 00057 __attribute__((warn_unused_result, nonnull(1, 4))); 00058 00059 // RFC4996 page 46 00060 extern unsigned int variable_length_32_size[]; 00061 00062 int variable_length_32_dec(const struct rohc_lsb_decode *const lsb, 00063 const struct rohc_decomp_ctxt *const context, 00064 const uint8_t *rohc_data, 00065 const int indicator, 00066 uint32_t *const decoded_value) 00067 __attribute__((warn_unused_result, nonnull(1, 2, 3, 5))); 00068 00069 int d_optional32(const int flag, 00070 const uint8_t *const data, 00071 const size_t data_len, 00072 uint32_t context_value, 00073 uint32_t *const decoded_value) 00074 __attribute__((warn_unused_result, nonnull(2, 5))); 00075 00076 // RFC4996 page 49 00077 uint32_t d_field_scaling(const uint32_t stride_value, 00078 const uint32_t scaled_value, 00079 const uint32_t residue_field) 00080 __attribute__((warn_unused_result, const)); 00081 00082 // RFC4996 page 71 00083 unsigned int rsf_index_dec( unsigned int rsf_index ); 00084 00085 // RFC4996 page 75 00086 uint16_t d_ip_id_lsb(const struct rohc_decomp_ctxt *const context, 00087 const int behavior, 00088 const unsigned int k, 00089 const unsigned int p, 00090 const uint16_t context_ip_id, 00091 const uint16_t value, 00092 const uint16_t msn) 00093 __attribute__((warn_unused_result, nonnull(1))); 00094 00095 // RFC4996 page 76 00096 int d_optional_ip_id_lsb(const struct rohc_decomp_ctxt *const context, 00097 const uint8_t *const rohc_data, 00098 const int behavior, 00099 const int indicator, 00100 const uint16_t context_ip_id, 00101 uint16_t *const ip_id, 00102 const uint16_t msn) 00103 __attribute__((warn_unused_result, nonnull(1, 2, 6))); 00104 00105 int dscp_decode(const uint8_t *const rohc_data, 00106 const uint8_t context_value, 00107 const int indicator, 00108 uint8_t *const decoded_value) 00109 __attribute__((warn_unused_result, nonnull(1, 4))); 00110 00111 #endif /* ROHC_DECOMP_RFC4996_DECODING_H */ 00112