rfc4996.h File Reference

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

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for comp/schemes/rfc4996.h:

Go to the source code of this file.

Functions

int c_static_or_irreg8 (const uint8_t context_value, const uint8_t packet_value, uint8_t *const rohc_data, const size_t rohc_max_len, int *const indicator)
 Compress the 8 bits given, depending of the context value.
int c_static_or_irreg16 (const uint16_t packet_value, const bool is_static, uint8_t *const rohc_data, const size_t rohc_max_len, int *const indicator)
 Compress the 16 bits given, depending of the context value.
int c_zero_or_irreg16 (const uint16_t packet_value, uint8_t *const rohc_data, const size_t rohc_max_len, 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, const size_t rohc_max_len, int *const indicator)
 Compress the 32 bits value, regarding if null or not.
int 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, const size_t rohc_max_len, int *const indicator)
 Compress the given 32-bit value.
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.
bool rsf_index_enc_possible (const uint8_t rsf_flags)
 Is is possible to use the rsf_index_enc encoding?
unsigned int rsf_index_enc (const uint8_t rsf_flags)
 Calculate the rsf_index from the rsf flags.
int c_optional_ip_id_lsb (const int behavior, const uint16_t ip_id_nbo, const uint16_t ip_id_offset, const size_t nr_bits_wlsb, uint8_t *const rohc_data, const size_t rohc_max_len, int *const indicator)
 Compress or not the IP-ID.
int dscp_encode (const uint8_t context_value, const uint8_t packet_value, uint8_t *const rohc_data, const size_t rohc_max_len, int *const indicator)
 Encode the DSCP field.

Detailed Description

Library of encoding methods from RFC4997 and RFC4996.

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

Function Documentation

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

Parameters:
scaled_value TODO
residue_field TODO
scaling_factor TODO
unscaled_value TODO
int c_optional_ip_id_lsb ( const int  behavior,
const uint16_t  ip_id_nbo,
const uint16_t  ip_id_offset,
const size_t  nr_bits_wlsb,
uint8_t *const   rohc_data,
const size_t  rohc_max_len,
int *const   indicator 
)

Compress or not the IP-ID.

See RFC4996 page 76

Parameters:
behavior The IP-ID behavior
ip_id_nbo The IP-ID value to compress (in NBO)
ip_id_offset The IP-ID offset value to compress (in HBO)
nr_bits_wlsb The number of IP-ID offset bits required for W-LSB
[out] rohc_data The compressed value
rohc_max_len The max remaining length in the ROHC buffer
[out] indicator The indicator: 0 if short, 1 if long
Returns:
The number of ROHC bytes written, -1 if a problem occurs
int c_static_or_irreg16 ( const uint16_t  packet_value,
const bool  is_static,
uint8_t *const   rohc_data,
const size_t  rohc_max_len,
int *const   indicator 
)

Compress the 16 bits given, depending of the context value.

Parameters:
packet_value The packet value
is_static Whether the value is static or not
[out] rohc_data The compressed value
rohc_max_len The max remaining length in the ROHC buffer
[out] indicator The indicator: 1 if present, 0 if not
Returns:
The number of ROHC bytes written, -1 if a problem occurs
int c_static_or_irreg8 ( const uint8_t  context_value,
const uint8_t  packet_value,
uint8_t *const   rohc_data,
const size_t  rohc_max_len,
int *const   indicator 
)

Compress the 8 bits given, depending of the context value.

See RFC4996 page 46

Parameters:
context_value The context value
packet_value The packet value
[out] rohc_data The compressed value
rohc_max_len The max remaining length in the ROHC buffer
[out] indicator The indicator: 1 if present, 0 if not
Returns:
The number of ROHC bytes written, -1 if a problem occurs
int c_zero_or_irreg16 ( const uint16_t  packet_value,
uint8_t *const   rohc_data,
const size_t  rohc_max_len,
int *const   indicator 
)

Compress the 16 bits value, regarding if null or not.

Parameters:
packet_value The packet value
[out] rohc_data The compressed value
rohc_max_len The max remaining length in the ROHC buffer
[out] indicator The indicator: 1 if present, 0 if not
Returns:
The number of ROHC bytes written, -1 if a problem occurs
int c_zero_or_irreg32 ( const uint32_t  packet_value,
uint8_t *const   rohc_data,
const size_t  rohc_max_len,
int *const   indicator 
)

Compress the 32 bits value, regarding if null or not.

Parameters:
packet_value The packet value
[out] rohc_data The compressed value
rohc_max_len The max remaining length in the ROHC buffer
[out] indicator The indicator: 1 if present, 0 if not
Returns:
The number of ROHC bytes written, -1 if a problem occurs
int dscp_encode ( const uint8_t  context_value,
const uint8_t  packet_value,
uint8_t *const   rohc_data,
const size_t  rohc_max_len,
int *const   indicator 
)

Encode the DSCP field.

See RFC4996 page 75

Parameters:
context_value The DSCP value in the compression context
packet_value The DSCP value in the packet to compress
[out] rohc_data The compressed value
rohc_max_len The max remaining length in the ROHC buffer
[out] indicator The indicator: 1 if present, 1 if not
Returns:
The number of ROHC bytes written, -1 if a problem occurs
unsigned int rsf_index_enc ( const uint8_t  rsf_flags  ) 

Calculate the rsf_index from the rsf flags.

See RFC4996 page 71

Parameters:
rsf_flags The RSF flags
Returns:
The rsf index
bool rsf_index_enc_possible ( const uint8_t  rsf_flags  ) 

Is is possible to use the rsf_index_enc encoding?

See RFC4996 page 71

Parameters:
rsf_flags The RSF flags
Returns:
true if the rsf_index_enc may be used, false if it cannot
int 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,
const size_t  rohc_max_len,
int *const   indicator 
)

Compress the given 32-bit value.

See variable_length_32_enc in RFC4996 page 46.

Parameters:
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
rohc_max_len The max remaining length in the ROHC buffer
[out] indicator The indicator for the compressed value
Returns:
The number of ROHC bytes written in case of success, -1 in case of error

Generated on 4 Jul 2018 for ROHC compression/decompression library by  doxygen 1.6.1