ROHC compression/decompression library
|
Library of decoding methods from RFC4997 and RFC4996. More...
#include "rfc4996.h"
#include "rohc_bit_ops.h"
#include "rohc_traces_internal.h"
#include "rohc_decomp_internals.h"
#include "rohc_debug.h"
#include "rohc_utils.h"
#include "crc.h"
#include "protocols/tcp.h"
#include "rohc_packets.h"
#include "rohc_decomp.h"
#include <string.h>
#include <assert.h>
Functions | |
uint32_t | d_lsb (const struct rohc_decomp_ctxt *const context, int num_lsbs_param, int offset_param, unsigned int context_value, unsigned int value) |
Decompress the lower bits from the given value and the context value. | |
int | d_static_or_irreg8 (const uint8_t *rohc_data, const uint8_t context_value, const int indicator, uint8_t *const decoded_value) |
Decompress the 8-bit given value, according to the indicator. | |
int | d_static_or_irreg16 (const uint8_t *rohc_data, const uint16_t context_value, const int indicator, uint16_t *const decoded_value) |
Decompress the 16-bit given value, according to the indicator. | |
int | variable_length_32_dec (const struct rohc_lsb_decode *const lsb, const struct rohc_decomp_ctxt *const context, const uint8_t *rohc_data, const int indicator, uint32_t *const decoded_value) |
Decode the 32 bits value, according to the indicator. | |
int | d_optional32 (const int flag, const uint8_t *const data, const size_t data_len, uint32_t context_value, uint32_t *const decoded_value) |
Decode the 32 bits value, according to the indicator. | |
uint32_t | d_field_scaling (const uint32_t scaling_factor, const uint32_t scaled_value, const uint32_t residue_field) |
Calculate the value from the scaling factor, scaled value and residue. | |
unsigned int | rsf_index_dec (unsigned int rsf_index) |
Calculate the rsf flags from the rsf index. | |
static uint32_t | d_c_lsb (const struct rohc_decomp_ctxt *const context, int num_lsbs_param, unsigned int offset_param, unsigned int context_value, unsigned int original_value) |
Compress the lower bits of the given value. | |
uint16_t | d_ip_id_lsb (const struct rohc_decomp_ctxt *const context, const int behavior, const unsigned int k, const unsigned int p, const uint16_t context_ip_id, const uint16_t value, const uint16_t msn) |
Decompress the lower bits of IP-ID. | |
int | d_optional_ip_id_lsb (const struct rohc_decomp_ctxt *const context, const uint8_t *const rohc_data, const int behavior, const int indicator, const uint16_t context_ip_id, uint16_t *const ip_id, const uint16_t msn) |
Decompress the IP-ID. | |
int | dscp_decode (const uint8_t *const rohc_data, const uint8_t context_value, const int indicator, uint8_t *const decoded_value) |
Decode the DSCP field. | |
Variables | |
static unsigned int | lsb_masks [] |
Table of the mask for lsb() | |
unsigned int | lsb_xor_masks [] |
Table of the mask for lsb() | |
unsigned int | variable_length_32_size [4] |
Table of the size of the variable_length_32 encode value. |
Library of decoding methods from RFC4997 and RFC4996.
static uint32_t d_c_lsb | ( | const struct rohc_decomp_ctxt *const | context, |
int | num_lsbs_param, | ||
unsigned int | offset_param, | ||
unsigned int | context_value, | ||
unsigned int | original_value | ||
) | [static] |
Compress the lower bits of the given value.
See RFC4997 page 27
context | The compressor context |
num_lsbs_param | The number of bits |
offset_param | The offset |
context_value | The value of the context |
original_value | The value to compress |
uint32_t d_field_scaling | ( | const uint32_t | scaling_factor, |
const uint32_t | scaled_value, | ||
const uint32_t | residue_field | ||
) |
Calculate the value from the scaling factor, scaled value and residue.
See RFC4996 page 49
scaling_factor | The scaling factor |
scaled_value | The scaled value |
residue_field | The residue value |
uint16_t d_ip_id_lsb | ( | const struct rohc_decomp_ctxt *const | context, |
const int | behavior, | ||
const unsigned int | k, | ||
const unsigned int | p, | ||
const uint16_t | context_ip_id, | ||
const uint16_t | value, | ||
const uint16_t | msn | ||
) |
Decompress the lower bits of IP-ID.
See RFC4996 page 75
context | The decompression context |
behavior | The IP-ID behavior |
k | The num_lsbs_param parameter for d_lsb() |
p | The offset parameter for d_lsb() |
context_ip_id | The context IP-ID value |
value | The value to decompress |
msn | The Master Sequence Number |
uint32_t d_lsb | ( | const struct rohc_decomp_ctxt *const | context, |
int | num_lsbs_param, | ||
int | offset_param, | ||
unsigned int | context_value, | ||
unsigned int | value | ||
) |
Decompress the lower bits from the given value and the context value.
See RFC4997 page 27
context | The decompression context |
num_lsbs_param | The number of bits |
offset_param | The offset |
context_value | The value of the context |
value | The compressed value |
int d_optional32 | ( | const int | flag, |
const uint8_t *const | data, | ||
const size_t | data_len, | ||
uint32_t | context_value, | ||
uint32_t *const | decoded_value | ||
) |
Decode the 32 bits value, according to the indicator.
See RFC4996 page 47
flag | Flag of compression | |
data | The remaining part of the ROHC packet | |
data_len | The length of the remaining part of the packet | |
context_value | The context value | |
[out] | decoded_value | The uncompressed value |
int d_optional_ip_id_lsb | ( | const struct rohc_decomp_ctxt *const | context, |
const uint8_t *const | rohc_data, | ||
const int | behavior, | ||
const int | indicator, | ||
const uint16_t | context_ip_id, | ||
uint16_t *const | ip_id, | ||
const uint16_t | msn | ||
) |
Decompress the IP-ID.
See RFC4996 page 76
context | The decompression context |
rohc_data | The compressed value |
behavior | The IP-ID behavior |
indicator | The compression indicator |
context_ip_id | The context IP-ID value |
ip_id | Pointer to the uncompressed IP-ID |
msn | The Master Sequence Number |
int d_static_or_irreg16 | ( | const uint8_t * | rohc_data, |
const uint16_t | context_value, | ||
const int | indicator, | ||
uint16_t *const | decoded_value | ||
) |
Decompress the 16-bit given value, according to the indicator.
rohc_data | The packet value | |
context_value | The context value | |
indicator | The indicator of compression | |
[out] | decoded_value | The decoded value |
int d_static_or_irreg8 | ( | const uint8_t * | rohc_data, |
const uint8_t | context_value, | ||
const int | indicator, | ||
uint8_t *const | decoded_value | ||
) |
Decompress the 8-bit given value, according to the indicator.
rohc_data | The packet value | |
context_value | The context value | |
indicator | The indicator of compression | |
[out] | decoded_value | The decoded value |
int dscp_decode | ( | const uint8_t *const | rohc_data, |
const uint8_t | context_value, | ||
const int | indicator, | ||
uint8_t *const | decoded_value | ||
) |
Decode the DSCP field.
rohc_data | The compressed value | |
context_value | The context DSCP value | |
indicator | The indicator of the compression | |
[out] | decoded_value | The decoded value |
unsigned int rsf_index_dec | ( | unsigned int | rsf_index | ) |
Calculate the rsf flags from the rsf index.
See RFC4996 page 71
rsf_index | The rsf index |
int variable_length_32_dec | ( | const struct rohc_lsb_decode *const | lsb, |
const struct rohc_decomp_ctxt *const | context, | ||
const uint8_t * | rohc_data, | ||
const int | indicator, | ||
uint32_t *const | decoded_value | ||
) |
Decode the 32 bits value, according to the indicator.
See RFC4996 page 46
lsb | The WLSB decoding context | |
context | The decompression context | |
rohc_data | The compressed value | |
indicator | The indicator of compression | |
[out] | decoded_value | The decoded value (in NBO) |
unsigned int lsb_masks[] [static] |
{ 0x00000, 0x00001, 0x00003, 0x00007, 0x0000F, 0x0001F, 0x0003F, 0x0007F, 0x000FF, 0x001FF, 0x003FF, 0x007FF, 0x00FFF, 0x01FFF, 0x03FFF, 0x07FFF, 0x0FFFF, 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF }
Table of the mask for lsb()
unsigned int lsb_xor_masks[] |
{ 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFC, 0xFFFFFFF8, 0xFFFFFFF0, 0xFFFFFFE0, 0xFFFFFFC0, 0xFFFFFF80, 0xFFFFFF00, 0xFFFFFE00, 0xFFFFFC00, 0xFFFFF800, 0xFFFFF000, 0xFFFFE000, 0xFFFFC000, 0xFFFF8000, 0xFFFF0000, 0xFFFE0000, 0xFFFC0000, 0xFFF80000, 0xFFF00000 }
Table of the mask for lsb()
unsigned int variable_length_32_size[4] |
{ 0,1,2,4 }
Table of the size of the variable_length_32 encode value.