decomp_list.c File Reference

ROHC generic list decompression. More...

#include "schemes/decomp_list.h"
#include "rohc_bit_ops.h"
#include <string.h>
#include <assert.h>
Include dependency graph for decomp_list.c:

Functions

static int rohc_list_decode (struct list_decomp *decomp, const uint8_t *packet, size_t packet_len)
 Decompress the compressed list in given packet.
static int rohc_list_decode_type_0 (struct list_decomp *const decomp, const uint8_t *packet, size_t packet_len, const unsigned int gen_id, const int ps, const uint8_t m)
 Decode an extension list type 0.
static int rohc_list_decode_type_1 (struct list_decomp *const decomp, const uint8_t *packet, size_t packet_len, const unsigned int gen_id, const int ps, const int xi_1)
 Decode an extension list type 1.
static int rohc_list_decode_type_2 (struct list_decomp *const decomp, const uint8_t *packet, size_t packet_len, const unsigned int gen_id)
 Decode an extension list type 2.
static int rohc_list_decode_type_3 (struct list_decomp *const decomp, const uint8_t *packet, size_t packet_len, const unsigned int gen_id, const int ps, const int xi_1)
 Decode an extension list type 3.
static bool rohc_list_is_gen_id_known (const struct list_decomp *const decomp, const unsigned int gen_id)
 Check if the given gen_id is known, ie. present in list table.
static int rohc_list_parse_insertion_scheme (struct list_decomp *const decomp, const uint8_t *packet, size_t packet_len, const int ps, const int xi_1, const size_t items_nr, const struct rohc_list *const ref_list, struct rohc_list *const ins_list)
 Process the insertion scheme of the list compression.
static int rohc_list_parse_removal_scheme (struct list_decomp *const decomp, const uint8_t *packet, size_t packet_len, const struct rohc_list *const ref_list, struct rohc_list *const rem_list)
 Process the removal scheme of the list compression.
static int rohc_list_decode_mask (struct list_decomp *const decomp, const char *const descr, const uint8_t *const packet, const size_t packet_len, uint8_t mask[2], size_t *const mask_len)
 Determine the number of bits set to 1 in the insertion/removal bit mask.
static size_t rohc_list_get_xi_nr (const uint8_t ins_mask[2], const size_t ins_mask_len)
 Determine the number of indexes in the XI list.
static size_t rohc_list_get_xi_len (const size_t xi_nr, const int ps)
 Determine the length of the XI list.
static uint8_t rohc_list_get_xi_type_0 (const int ps, const size_t xi_index, const uint8_t *const data, bool *const is_item_present)
 Get the XI information, ie. the X bit and the index value.
static uint8_t rohc_list_get_xi_type_2or3 (const int ps, const size_t xi_index, const uint8_t xi_1, const uint8_t *const data, bool *const is_item_present)
 Get the XI information, ie. the X bit and the index value.
static uint8_t rohc_get_bit (const uint8_t byte, const size_t pos)
 Get the bit in the given byte at the given position.
int rohc_list_decode_maybe (struct list_decomp *decomp, const uint8_t *packet, size_t packet_len)
 Decompress the compressed list in given packet if present.
bool rohc_decomp_list_create_item (struct list_decomp *const decomp, const unsigned int xi_index, const unsigned int xi_index_value, const uint8_t *const rohc_packet, const size_t rohc_max_len, size_t *const item_length)
 Create a list item from a XI item.

Detailed Description

ROHC generic list decompression.

Author:
Didier Barvaux <didier@barvaux.org>

Function Documentation

bool rohc_decomp_list_create_item ( struct list_decomp *const   decomp,
const unsigned int  xi_index,
const unsigned int  xi_index_value,
const uint8_t *const   rohc_packet,
const size_t  rohc_max_len,
size_t *const   item_length 
)

Create a list item from a XI item.

Parameters:
decomp The context for list decompression
xi_index The XI index
xi_index_value The XI index value
rohc_packet The beginning of the XI item in the ROHC header
rohc_max_len The remaining length (in bytes) of the ROHC header
[out] item_length The length (in bytes) of the created item
Returns:
true if item was successfully created, false if a problem occurred
static uint8_t rohc_get_bit ( const uint8_t  byte,
const size_t  pos 
) [static]

Get the bit in the given byte at the given position.

Parameters:
byte The byte to analyse
pos The position between 0 and 7
Returns:
The requested bit
static int rohc_list_decode ( struct list_decomp decomp,
const uint8_t *  packet,
size_t  packet_len 
) [static]

Decompress the compressed list in given packet.

Parameters:
decomp The list decompressor
packet The ROHC packet to decompress
packet_len The remaining length of the packet to decode (in bytes)
Returns:
The size of the compressed list in packet in case of success, -1 in case of failure
static int rohc_list_decode_mask ( struct list_decomp *const   decomp,
const char *const   descr,
const uint8_t *const   packet,
const size_t  packet_len,
uint8_t  mask[2],
size_t *const   mask_len 
) [static]

Determine the number of bits set to 1 in the insertion/removal bit mask.

Parameters:
decomp The list decompressor
descr The name of bit mask being decoded
packet The ROHC packet to decompress
packet_len The length (in bytes) of the packet to decompress
[out] mask The insertion/removal bit mask on 1-2 bytes
[out] mask_len The length of the insertion/removal mask (in bits)
Returns:
  • In case of success, the number of bytes read in the given packet, ie. the length of the compressed list
  • -1 in case of failure
int rohc_list_decode_maybe ( struct list_decomp decomp,
const uint8_t *  packet,
size_t  packet_len 
)

Decompress the compressed list in given packet if present.

Parameters:
decomp The list decompressor
packet The ROHC packet to decompress
packet_len The remaining length of the packet to decode (in bytes)
Returns:
The size of the compressed list in packet in case of success, -1 in case of failure
static int rohc_list_decode_type_0 ( struct list_decomp *const   decomp,
const uint8_t *  packet,
size_t  packet_len,
const unsigned int  gen_id,
const int  ps,
const uint8_t  m 
) [static]

Decode an extension list type 0.

Parameters:
decomp The list decompressor
packet The ROHC packet to decompress
packet_len The length (in bytes) of the packet to decompress
gen_id The id of the current list, maybe ROHC_LIST_GEN_ID_ANON if not defined
ps The ps field
m The m field
Returns:
  • In case of success, the number of bytes read in the given packet, ie. the length of the compressed list
  • -1 in case of failure
static int rohc_list_decode_type_1 ( struct list_decomp *const   decomp,
const uint8_t *  packet,
size_t  packet_len,
const unsigned int  gen_id,
const int  ps,
const int  xi_1 
) [static]

Decode an extension list type 1.

Parameters:
decomp The list decompressor
packet The ROHC packet to decompress
packet_len The length (in bytes) of the packet to decompress
gen_id The id of the current list, maybe ROHC_LIST_GEN_ID_ANON if not defined
ps The ps field
xi_1 The XI 1 field if PS = 1 (4-bit XI)
Returns:
  • In case of success, the number of bytes read in the given packet, ie. the length of the compressed list
  • -1 in case of failure
static int rohc_list_decode_type_2 ( struct list_decomp *const   decomp,
const uint8_t *  packet,
size_t  packet_len,
const unsigned int  gen_id 
) [static]

Decode an extension list type 2.

Parameters:
decomp The list decompressor
packet The ROHC packet to decompress
packet_len The length (in bytes) of the packet to decompress
gen_id The id of the current list, maybe ROHC_LIST_GEN_ID_ANON if not defined
Returns:
  • In case of success, the number of bytes read in the given packet, ie. the length of the compressed list
  • -1 in case of failure
static int rohc_list_decode_type_3 ( struct list_decomp *const   decomp,
const uint8_t *  packet,
size_t  packet_len,
const unsigned int  gen_id,
const int  ps,
const int  xi_1 
) [static]

Decode an extension list type 3.

Parameters:
decomp The list decompressor
packet The ROHC packet to decompress
packet_len The length (in bytes) of the packet to decompress
gen_id The id of the current list maybe ROHC_LIST_GEN_ID_ANON if not defined
ps The ps field
xi_1 The XI 1 field if PS = 1 (4-bit XI)
Returns:
  • In case of success, the number of bytes read in the given packet, ie. the length of the compressed list
  • -1 in case of failure
static size_t rohc_list_get_xi_len ( const size_t  xi_nr,
const int  ps 
) [static]

Determine the length of the XI list.

Parameters:
xi_nr The number of indexes in the XI list
ps The PS bit
Returns:
The length of the XI list (in bytes)
static size_t rohc_list_get_xi_nr ( const uint8_t  ins_mask[2],
const size_t  ins_mask_len 
) [static]

Determine the number of indexes in the XI list.

Parameters:
ins_mask The insertion bit mask
ins_mask_len The length of the insertion bit mask (in bits)
Returns:
The number of indexes in the XI list
static uint8_t rohc_list_get_xi_type_0 ( const int  ps,
const size_t  xi_index,
const uint8_t *const   data,
bool *const   is_item_present 
) [static]

Get the XI information, ie. the X bit and the index value.

Parameters:
ps The PS bit
xi_index The index of the XI
data The data to parse
[out] is_item_present Whether the XI item shall be present or not
Returns:
The value of the XI index
static uint8_t rohc_list_get_xi_type_2or3 ( const int  ps,
const size_t  xi_index,
const uint8_t  xi_1,
const uint8_t *const   data,
bool *const   is_item_present 
) [static]

Get the XI information, ie. the X bit and the index value.

Parameters:
ps The PS bit
xi_index The index of the XI
xi_1 The XI 1 field if PS = 1 (4-bit XI)
data The data to parse
[out] is_item_present Whether the XI item shall be present or not
Returns:
The value of the XI index
static bool rohc_list_is_gen_id_known ( const struct list_decomp *const   decomp,
const unsigned int  gen_id 
) [static]

Check if the given gen_id is known, ie. present in list table.

Parameters:
decomp The list decompressor
gen_id The gen_id to check for
Returns:
true if successful, false otherwise
static int rohc_list_parse_insertion_scheme ( struct list_decomp *const   decomp,
const uint8_t *  packet,
size_t  packet_len,
const int  ps,
const int  xi_1,
const size_t  items_nr,
const struct rohc_list *const   ref_list,
struct rohc_list *const   ins_list 
) [static]

Process the insertion scheme of the list compression.

Parameters:
decomp The list decompressor
packet The ROHC packet to decompress
packet_len The length (in bytes) of the packet to decompress
ps The PS bit
xi_1 The XI 1 field if PS = 1 (4-bit XI)
items_nr The number of items in the initial list
ref_list The list to use as reference
[out] ins_list The list with new items added
Returns:
  • In case of success, the number of bytes read in the given packet, ie. the length of the insertion mask
  • -1 in case of failure
static int rohc_list_parse_removal_scheme ( struct list_decomp *const   decomp,
const uint8_t *  packet,
size_t  packet_len,
const struct rohc_list *const   ref_list,
struct rohc_list *const   rem_list 
) [static]

Process the removal scheme of the list compression.

Parameters:
decomp The list decompressor
packet The ROHC packet to decompress
packet_len The length (in bytes) of the packet to decompress
ref_list The list to use as reference
[in,out] rem_list in: the initial list, out: the list with superfluous items removed
Returns:
  • In case of success, the number of bytes read in the given packet, ie. the length of the removal mask
  • -1 in case of failure

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