|
ROHC compression/decompression library
|
Library of encoding methods from RFC4997 and RFC4996. More...
#include "rohc_comp_internals.h"#include "rohc_traces_internal.h"#include "rohc_debug.h"#include "rohc_bit_ops.h"#include "rohc_utils.h"#include "protocols/tcp.h"#include "rfc4996.h"#include "crc.h"#include <string.h>#include <assert.h>
Functions | |
| uint32_t | c_lsb (const struct rohc_comp_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. | |
| int | c_static_or_irreg8 (const uint8_t context_value, const uint8_t packet_value, uint8_t *const rohc_data, int *const indicator) |
| Compress the 8 bits given, depending of the context value. | |
| int | c_static_or_irreg16 (const uint16_t context_value, const uint16_t packet_value, uint8_t *const rohc_data, int *const indicator) |
| Compress the 16 bits given, depending of the context value. | |
| int | c_zero_or_irreg8 (const uint8_t packet_value, uint8_t *const rohc_data, int *const indicator) |
| Compress the 8 bits value, regarding if null or not. | |
| int | c_zero_or_irreg16 (const uint16_t packet_value, uint8_t *const rohc_data, int *const indicator) |
| Compress the 16 bits value, regarding if null or not. | |
| int | c_zero_or_irreg32 (const uint32_t packet_value, uint8_t *const rohc_data, int *const indicator) |
| Compress the 32 bits value, regarding if null or not. | |
| size_t | variable_length_32_enc (const uint32_t old_value, const uint32_t new_value, const size_t nr_bits_63, const size_t nr_bits_16383, uint8_t *const rohc_data, int *const indicator) |
| Compress the given 32-bit value. | |
| int | c_optional32 (const int indicator, const uint32_t packet_value, uint8_t *const rohc_data) |
| Compress a 32 bits value, regarding the context value. | |
| int | c_lsb_7_or_31 (const uint32_t context_value, const uint32_t packet_value, uint8_t *const rohc_data) |
| Compress a 32 bits value to 7 or 31 bits. | |
| void | c_field_scaling (uint32_t *const scaled_value, uint32_t *const residue_field, const uint32_t scaling_factor, const uint32_t unscaled_value) |
| Calculate the scaled and residue values from unscaled value and scaling factor. | |
| unsigned int | rsf_index_enc (const struct rohc_comp_ctxt *const context, unsigned int rsf_flags) |
| Calculate the rsf_index from the rsf flags. | |
| uint16_t | c_ip_id_lsb (const struct rohc_comp_ctxt *const context, const int behavior, const unsigned int k, const unsigned int p, const uint16_t context_ip_id, const uint16_t ip_id, const uint16_t msn) |
| Compress the lower bits of IP-ID. | |
| int | c_optional_ip_id_lsb (const struct rohc_comp_ctxt *const context, const int behavior, const uint16_t context_ip_id, const uint16_t ip_id, const uint16_t msn, uint8_t *const rohc_data, int *const indicator) |
| Compress or not the IP-ID. | |
| unsigned int | dscp_encode (multi_ptr_t *pmptr, const uint8_t context_value, const uint8_t packet_value) |
| Encode the DSCP field. | |
Variables | |
| static unsigned int | lsb_masks [] |
| Table of the mask for lsb() | |
Library of encoding methods from RFC4997 and RFC4996.
| void c_field_scaling | ( | uint32_t *const | scaled_value, |
| uint32_t *const | residue_field, | ||
| const uint32_t | scaling_factor, | ||
| const uint32_t | unscaled_value | ||
| ) |
Calculate the scaled and residue values from unscaled value and scaling factor.
See RFC4996 page 49
| scaled_value | TODO |
| residue_field | TODO |
| scaling_factor | TODO |
| unscaled_value | TODO |
| uint16_t c_ip_id_lsb | ( | const struct rohc_comp_ctxt *const | context, |
| const int | behavior, | ||
| const unsigned int | k, | ||
| const unsigned int | p, | ||
| const uint16_t | context_ip_id, | ||
| const uint16_t | ip_id, | ||
| const uint16_t | msn | ||
| ) |
Compress the lower bits of IP-ID.
See RFC4996 page 75
| context | The compressor context |
| behavior | The IP-ID behavior |
| k | The num_lsbs_param parameter for c_lsb() |
| p | The offset parameter for c_lsb() |
| context_ip_id | The context value of IP-ID |
| ip_id | The IP-ID value to compress |
| msn | The Master Sequence Number |
| uint32_t c_lsb | ( | const struct rohc_comp_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.
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 |
| int c_lsb_7_or_31 | ( | const uint32_t | context_value, |
| const uint32_t | packet_value, | ||
| uint8_t *const | rohc_data | ||
| ) |
Compress a 32 bits value to 7 or 31 bits.
See RFC4996 page 47
| context_value | The context value | |
| packet_value | The packet value | |
| [out] | rohc_data | The compressed value |
| int c_optional32 | ( | const int | indicator, |
| const uint32_t | packet_value, | ||
| uint8_t *const | rohc_data | ||
| ) |
Compress a 32 bits value, regarding the context value.
See RFC4996 page 47
| indicator | The indicator: 1 if present, 0 if not |
| packet_value | The packet value |
| rohc_data | The compressed value |
| int c_optional_ip_id_lsb | ( | const struct rohc_comp_ctxt *const | context, |
| const int | behavior, | ||
| const uint16_t | context_ip_id, | ||
| const uint16_t | ip_id, | ||
| const uint16_t | msn, | ||
| uint8_t *const | rohc_data, | ||
| int *const | indicator | ||
| ) |
Compress or not the IP-ID.
See RFC4996 page 76
| context | The compressor context | |
| behavior | The IP-ID behavior | |
| context_ip_id | The context value of IP-ID | |
| ip_id | The IP-ID value to compress | |
| msn | The Master Sequence Number | |
| [out] | rohc_data | The compressed value |
| [out] | indicator | The indicator: 0 if short, 1 if long |
| int c_static_or_irreg16 | ( | const uint16_t | context_value, |
| const uint16_t | packet_value, | ||
| uint8_t *const | rohc_data, | ||
| int *const | indicator | ||
| ) |
Compress the 16 bits given, depending of the context value.
| context_value | The context value | |
| packet_value | The packet value | |
| [out] | rohc_data | The compressed value |
| [out] | indicator | The indicator: 1 if present, 0 if not |
| int c_static_or_irreg8 | ( | const uint8_t | context_value, |
| const uint8_t | packet_value, | ||
| uint8_t *const | rohc_data, | ||
| int *const | indicator | ||
| ) |
Compress the 8 bits given, depending of the context value.
See RFC4996 page 46
| context_value | The context value | |
| packet_value | The packet value | |
| [out] | rohc_data | The compressed value |
| [out] | indicator | The indicator: 1 if present, 0 if not |
| int c_zero_or_irreg16 | ( | const uint16_t | packet_value, |
| uint8_t *const | rohc_data, | ||
| int *const | indicator | ||
| ) |
Compress the 16 bits value, regarding if null or not.
| packet_value | The packet value | |
| [out] | rohc_data | The compressed value |
| [out] | indicator | The indicator: 1 if present, 0 if not |
| int c_zero_or_irreg32 | ( | const uint32_t | packet_value, |
| uint8_t *const | rohc_data, | ||
| int *const | indicator | ||
| ) |
Compress the 32 bits value, regarding if null or not.
| packet_value | The packet value | |
| [out] | rohc_data | The compressed value |
| [out] | indicator | The indicator: 1 if present, 0 if not |
| int c_zero_or_irreg8 | ( | const uint8_t | packet_value, |
| uint8_t *const | rohc_data, | ||
| int *const | indicator | ||
| ) |
Compress the 8 bits value, regarding if null or not.
| packet_value | The packet value | |
| [out] | rohc_data | The compressed value |
| [out] | indicator | The indicator: 1 if present, 0 if not |
| unsigned int dscp_encode | ( | multi_ptr_t * | pmptr, |
| const uint8_t | context_value, | ||
| const uint8_t | packet_value | ||
| ) |
Encode the DSCP field.
See RFC4996 page 75
| pmptr | The destination for the compressed value |
| context_value | The DSCP value in the compression context |
| packet_value | The DSCP value in the packet to compress |
| unsigned int rsf_index_enc | ( | const struct rohc_comp_ctxt *const | context, |
| unsigned int | rsf_flags | ||
| ) |
Calculate the rsf_index from the rsf flags.
See RFC4996 page 71
| context | The compressor context |
| rsf_flags | The RSF flags |
| size_t variable_length_32_enc | ( | const uint32_t | old_value, |
| const uint32_t | new_value, | ||
| const size_t | nr_bits_63, | ||
| const size_t | nr_bits_16383, | ||
| uint8_t *const | rohc_data, | ||
| int *const | indicator | ||
| ) |
Compress the given 32-bit value.
See variable_length_32_enc in RFC4996 page 46.
| old_value | The previous 32-bit value | |
| new_value | The 32-bit value to compress | |
| nr_bits_63 | The number of bits required for W-LSB encoding with p = 63 | |
| nr_bits_16383 | The number of bits required for W-LSB encoding with p = 16383 | |
| [out] | rohc_data | The compressed value |
| [out] | indicator | The indicator for the compressed value |
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()
1.7.6.1