ROHC compression/decompression library
Functions
list.c File Reference

ROHC generic list decompression. More...

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

Functions

static int rohc_list_decode (struct list_decomp *decomp, const unsigned char *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 unsigned char *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 unsigned char *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 unsigned char *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 unsigned char *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 uint8_t rohc_get_bit (const unsigned char 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 unsigned char *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:
decompThe context for list decompression
xi_indexThe XI index
xi_index_valueThe XI index value
rohc_packetThe beginning of the XI item in the ROHC header
rohc_max_lenThe remaining length (in bytes) of the ROHC header
[out]item_lengthThe 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 unsigned char  byte,
const size_t  pos 
) [static]

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

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

Decompress the compressed list in given packet.

Parameters:
decompThe list decompressor
packetThe ROHC packet to decompress
packet_lenThe 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
int rohc_list_decode_maybe ( struct list_decomp decomp,
const unsigned char *  packet,
size_t  packet_len 
)

Decompress the compressed list in given packet if present.

Parameters:
decompThe list decompressor
packetThe ROHC packet to decompress
packet_lenThe 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 unsigned char *  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:
decompThe list decompressor
packetThe ROHC packet to decompress
packet_lenThe length (in bytes) of the packet to decompress
gen_idThe id of the current list, maybe ROHC_LIST_GEN_ID_ANON if not defined
psThe ps field
mThe 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 unsigned char *  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:
decompThe list decompressor
packetThe ROHC packet to decompress
packet_lenThe length (in bytes) of the packet to decompress
gen_idThe id of the current list, maybe ROHC_LIST_GEN_ID_ANON if not defined
psThe ps field
xi_1The 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
Todo:
factorize some code with rohc_list_decode_type_3
static int rohc_list_decode_type_2 ( struct list_decomp *const  decomp,
const unsigned char *  packet,
size_t  packet_len,
const unsigned int  gen_id 
) [static]

Decode an extension list type 2.

Parameters:
decompThe list decompressor
packetThe ROHC packet to decompress
packet_lenThe length (in bytes) of the packet to decompress
gen_idThe 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
Todo:
factorize some code with rohc_list_decode_type_3
static int rohc_list_decode_type_3 ( struct list_decomp *const  decomp,
const unsigned char *  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:
decompThe list decompressor
packetThe ROHC packet to decompress
packet_lenThe length (in bytes) of the packet to decompress
gen_idThe id of the current list maybe ROHC_LIST_GEN_ID_ANON if not defined
psThe ps field
xi_1The 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
Todo:

factorize some code with rohc_list_decode_type_1

factorize some code with rohc_list_decode_type_2

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:
decompThe list decompressor
gen_idThe gen_id to check for
Returns:
true if successful, false otherwise