ROHC compression/decompression library
Functions | Variables
rfc4996.h File Reference

Library of decoding methods from RFC4997 and RFC4996. More...

#include "protocols/tcp.h"
#include "wlsb.h"
#include <stdint.h>
Include dependency graph for decomp/schemes/rfc4996.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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 stride_value, 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.
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

unsigned int lsb_xor_masks []
 Table of the mask for lsb()
unsigned int variable_length_32_size []
 Table of the size of the variable_length_32 encode value.

Detailed Description

Library of decoding methods from RFC4997 and RFC4996.

Author:
FWX <rohc_team@dialine.fr>
Didier Barvaux <didier@barvaux.org>

Function Documentation

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

Parameters:
scaling_factorThe scaling factor
scaled_valueThe scaled value
residue_fieldThe residue value
Returns:
The unscaled 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

Parameters:
contextThe decompression context
behaviorThe IP-ID behavior
kThe num_lsbs_param parameter for d_lsb()
pThe offset parameter for d_lsb()
context_ip_idThe context IP-ID value
valueThe value to decompress
msnThe Master Sequence Number
Returns:
The IP-ID
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

Parameters:
contextThe decompression context
num_lsbs_paramThe number of bits
offset_paramThe offset
context_valueThe value of the context
valueThe compressed value
Returns:
The uncompressed 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

Parameters:
flagFlag of compression
dataThe remaining part of the ROHC packet
data_lenThe length of the remaining part of the packet
context_valueThe context value
[out]decoded_valueThe uncompressed value
Returns:
The number of ROHC bytes parsed, -1 if packet is malformed
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

Parameters:
contextThe decompression context
rohc_dataThe compressed value
behaviorThe IP-ID behavior
indicatorThe compression indicator
context_ip_idThe context IP-ID value
ip_idPointer to the uncompressed IP-ID
msnThe Master Sequence Number
Returns:
The length (in bytes) of the compressed value, -1 if ROHC data is malformed
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.

Parameters:
rohc_dataThe packet value
context_valueThe context value
indicatorThe indicator of compression
[out]decoded_valueThe decoded value
Returns:
The length (in bytes) of the compressed value, -1 if ROHC data is malformed
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.

Parameters:
rohc_dataThe packet value
context_valueThe context value
indicatorThe indicator of compression
[out]decoded_valueThe decoded value
Returns:
The length (in bytes) of the compressed value, -1 if ROHC data is malformed
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.

Parameters:
rohc_dataThe compressed value
context_valueThe context DSCP value
indicatorThe indicator of the compression
[out]decoded_valueThe decoded value
Returns:
The length (in bytes) of the compressed value, -1 if ROHC data is malformed
unsigned int rsf_index_dec ( unsigned int  rsf_index)

Calculate the rsf flags from the rsf index.

See RFC4996 page 71

Parameters:
rsf_indexThe rsf index
Returns:
The rsf flags
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

Parameters:
lsbThe WLSB decoding context
contextThe decompression context
rohc_dataThe compressed value
indicatorThe indicator of compression
[out]decoded_valueThe decoded value (in NBO)
Returns:
The length (in bytes) of the compressed value, -1 if ROHC data is malformed

Variable Documentation

unsigned int lsb_xor_masks[]

Table of the mask for lsb()

unsigned int variable_length_32_size[]

Table of the size of the variable_length_32 encode value.