ROHC compression/decompression library
Defines | Functions
d_generic.c File Reference

ROHC generic decompression context for IP-only, UDP and UDP Lite profiles. More...

#include "d_generic.h"
#include "d_rtp.h"
#include "config.h"
#include "rohc_traces.h"
#include <assert.h>
Include dependency graph for d_generic.c:

Defines

#define MIN(a, b)   ((a) < (b) ? (a) : (b))
#define IPV4_DYN_PART_SIZE   6
 The size (in bytes) of the IPv4 dynamic part.

Functions

int decode_irdyn (struct rohc_decomp *decomp, struct d_context *context, unsigned char *head, unsigned char *packet, unsigned char *dest, int plen)
 Decode one IR-DYN packet.
int decode_uo1 (struct rohc_decomp *decomp, struct d_context *context, unsigned char *head, unsigned char *packet, unsigned char *dest, int plen)
 Decode one UO-1 packet.
int decode_uo0 (struct rohc_decomp *decomp, struct d_context *context, unsigned char *head, unsigned char *packet, unsigned char *dest, int plen)
 Decode one UO-0 packet.
int do_decode_uo0_and_uo1 (struct d_context *context, const unsigned char *packet, unsigned char *dest, int *plen, int sn_bits, int nb_of_sn_bits, int *id, int nb_of_id_bits, int *id2, int *sn, int *calc_crc)
 Decode one UO-0 or UO-1 packet.
int decode_uor2 (struct rohc_decomp *decomp, struct d_context *context, unsigned char *head, unsigned char *packet, unsigned char *dest, int plen)
 Decode one UOR-2 packet.
int do_decode_uor2 (struct rohc_decomp *decomp, struct d_context *context, unsigned char *packet, unsigned char *dest, int *plen, int *id, int *id2, int *sn, int *sn_size, int sn_bits, int ext, int *calc_crc)
 Decode one UOR-2 packet.
int decode_extension0 (unsigned char *packet, unsigned int length, int packet_type, int *sn, int *ip_id, int *ts)
 Decode the extension 0 of the UOR-2 packet.
int decode_extension1 (unsigned char *packet, unsigned int length, int packet_type, int *sn, int *ip_id, int *ts)
 Decode the extension 1 of the UOR-2 packet.
int decode_extension2 (unsigned char *packet, unsigned int length, int packet_type, int *sn, int *ip_id, int *ip_id2, int *ts)
 Decode the extension 2 of the UOR-2 packet.
int decode_extension3 (struct rohc_decomp *decomp, struct d_context *context, unsigned char *packet, unsigned int length, int *sn, int *sn_size, int *is_id_updated, int *is_id2_updated, int *is_rtp_present, int *is_pt_updated)
 Decode the extension 3 of the UOR-2 packet.
int extension_type (const unsigned char *packet)
 Find out which extension is carried by the UOR-2 packet.
int d_decode_static_ip (const unsigned char *packet, const unsigned int length, struct d_generic_changes *info)
 Decode the IP static part of a ROHC packet.
int d_decode_static_ip4 (const unsigned char *packet, const unsigned int length, struct ip_packet *ip)
 Decode the IPv4 static part of a ROHC packet.
int d_decode_static_ip6 (const unsigned char *packet, const unsigned int length, struct ip_packet *ip)
 Decode the IPv6 static part of a ROHC packet.
int d_decode_dynamic_ip (const unsigned char *packet, unsigned int length, struct d_generic_changes *info, struct list_decomp *decomp)
 Decode the IP dynamic part of a ROHC packet.
int d_decode_dynamic_ip4 (const unsigned char *packet, unsigned int length, struct ip_packet *ip, int *rnd, int *nbo)
 Decode the IPv4 dynamic part of a ROHC packet.
int d_decode_dynamic_ip6 (const unsigned char *packet, unsigned int length, struct ip_packet *ip, struct list_decomp *decomp, struct d_generic_changes *info)
 Decode the IPv6 dynamic part of a ROHC packet.
int decode_outer_header_flags (struct d_context *context, unsigned char *flags, unsigned char *fields, unsigned int length, struct d_generic_changes *info, int *updated_id)
 Decode the outer IP header flags and fields.
int decode_inner_header_flags (struct d_context *context, unsigned char *flags, unsigned char *fields, unsigned int length, struct d_generic_changes *info)
 Decode the inner IP header flags and fields.
unsigned int build_uncompressed_ip (struct d_generic_changes *active, unsigned char *dest, unsigned int payload_size, struct list_decomp *decomp)
 Build an uncompressed IP header.
unsigned int build_uncompressed_ip4 (struct d_generic_changes *active, unsigned char *dest, unsigned int payload_size)
 Build an uncompressed IPv4 header.
unsigned int build_uncompressed_ip6 (struct d_generic_changes *active, unsigned char *dest, unsigned int payload_size, struct list_decomp *decomp)
 Build an uncompressed IPv6 header.
void copy_generic_changes (struct d_generic_changes *dst, struct d_generic_changes *src)
 Copy the header changes object into another one.
int cmp_generic_changes (struct d_generic_changes *first, struct d_generic_changes *second)
 Compare two header changes objects.
void sync_on_failure (struct d_generic_context *context)
 Replace the active header changes with the last ones.
void synchronize (struct d_generic_context *context)
 Replace last header changes with the active ones.
void update_inter_packet (struct d_generic_context *context)
 Update the inter-packet time, a sort of average over the last inter-packet times.
int act_on_crc_failure (struct rohc_decomp *decomp, struct d_context *context, unsigned char *packet, unsigned char *dest, int sn_size, int *sn, int sn_bits, int *payload_size, int *id, int id_size, int *id2, int *calc_crc, int real_crc, int ext)
 Try to repair the SN in one of two different ways.
int check_id (struct list_decomp *decomp, int gen_id)
 Check if the gen_id is present in list table.
int get_bit_index (unsigned char byte, int index)
 Get the bit in the byte at the specified index.
int check_ip6_index (struct list_decomp *decomp, int index)
 Check if the index is correct in IPv6 table.
int encode_ip6_extension (struct d_generic_changes *active, struct list_decomp *decomp, unsigned char *dest)
 Build an extension list in IPv6 header.
void create_ip6_item (const unsigned char *data, int length, int index, struct list_decomp *decomp)
 Create an IPv6 item extension list.
void ip6_d_init_table (struct list_decomp *decomp)
 Initialize the tables IPv6 extension in decompressor.
int get_ip6_ext_size (const unsigned char *ext)
 Get the size of the extension in bytes.
void * d_generic_create (void)
 Create the generic decompression context.
void d_generic_destroy (void *context)
 Destroy the context.
int d_algo_list_decompress (struct list_decomp *decomp, const unsigned char *packet)
 Algorithm of list decompression.
int decode_type_0 (struct list_decomp *decomp, const unsigned char *packet, int gen_id, int ps, int m)
 Decode an extension list type 0.
int decode_type_1 (struct list_decomp *decomp, const unsigned char *packet, int gen_id, int ps, int m, int ref_id)
 Decode an extension list type 1.
int decode_type_2 (struct list_decomp *decomp, const unsigned char *packet, int gen_id, int ps, int ref_id)
 Decode an extension list type 2.
int decode_type_3 (struct list_decomp *decomp, const unsigned char *packet, int gen_id, int ps, int m, int ref_id)
 Decode an extension list type 3.
int d_generic_decode_ir (struct rohc_decomp *decomp, struct d_context *context, unsigned char *packet, int plen, int large_cid_len, int is_addcid_used, unsigned char *dest)
 Decode one IR packet.
unsigned int d_generic_detect_ir_size (struct d_context *context, unsigned char *packet, unsigned int plen, unsigned int large_cid_len)
 Find the length of the IR header.
unsigned int d_generic_detect_ir_dyn_size (struct d_context *context, unsigned char *packet, unsigned int plen, unsigned int large_cid_len)
 Find the length of the IR-DYN header.
int d_generic_decode (struct rohc_decomp *decomp, struct d_context *context, unsigned char *packet, int size, int second_byte, unsigned char *dest)
 Decode one IR-DYN, UO-0, UO-1 or UOR-2 packet, but not IR packet.
int d_generic_get_sn (struct d_context *context)
 Get the reference SN value of the context.
int find_packet_type (struct rohc_decomp *decomp, struct d_context *context, const unsigned char *packet, int second_byte)
 Find out of which type is the ROHC packet.

Detailed Description

ROHC generic decompression context for IP-only, UDP and UDP Lite profiles.

Author:
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
The hackers from ROHC for Linux
David Moreau from TAS

Define Documentation

#define IPV4_DYN_PART_SIZE   6

The size (in bytes) of the IPv4 dynamic part.

According to RFC3095 section 5.7.7.4: 1 (TOS) + 1 (TTL) + 2 (IP-ID) + 1 (flags) + 1 (header list) = 6 bytes

The size of the generic extension header list field is considered constant because generic extension header list is not supported yet and thus 1 byte of zero is used.

Referenced by d_decode_dynamic_ip4(), d_generic_detect_ir_dyn_size(), and d_generic_detect_ir_size().

#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))

Get the minimum of two values

Referenced by decode_type_2(), and decode_type_3().


Function Documentation

int act_on_crc_failure ( struct rohc_decomp decomp,
struct d_context context,
unsigned char *  packet,
unsigned char *  dest,
int  sn_size,
int *  sn,
int  sn_bits,
int *  payload_size,
int *  id,
int  id_size,
int *  id2,
int *  calc_crc,
int  real_crc,
int  ext 
)

Try to repair the SN in one of two different ways.

TODO: check this function

Parameters:
decompThe ROHC decompressor
contextThe decompression context
packetThe ROHC packet with a wrong CRC
destThe decoded IP packet
sn_sizeThe number of bits used to code the SN
snOUT: The Sequence Number (SN) value
sn_bitsThe LSB part of the SN
payload_sizeOUT: The length of the ROHC payload
idOUT: The outer IP-ID
id_sizeThe number of bits used to code the IP-ID
id2OUT: The inner IP-ID
calc_crcOUT: The computed CRC
real_crcThe CRC transmitted in the ROHC packet
extWhether the UOR-2 packet owns an extension or not
Returns:
Always return ROHC_ERROR_CRC

References d_generic_context::counter, CRC_ACTION, d_generic_context::current_packet_time, d_get_lsb_old_ref(), d_get_lsb_ref(), d_ip_id_update(), d_lsb_decode(), d_lsb_sync_ref(), d_lsb_update(), do_decode_uo0_and_uo1(), do_decode_uor2(), d_generic_context::inter_arrival_time, d_generic_context::ip_id1, d_generic_context::ip_id2, d_generic_context::last_packet_time, d_generic_context::multiple_ip, d_generic_context::packet_type, PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, rohc_debugf, ROHC_ERROR_CRC, d_generic_context::sn, d_context::specific, sync_on_failure(), synchronize(), and update_inter_packet().

Referenced by decode_uo0(), decode_uo1(), and decode_uor2().

unsigned int build_uncompressed_ip ( struct d_generic_changes active,
unsigned char *  dest,
unsigned int  payload_size,
struct list_decomp decomp 
)

Build an uncompressed IP header.

Parameters:
activeThe IP header changes
destThe buffer to store the IP header (MUST be at least of sizeof(struct iphdr) or sizeof(struct ip6_hdr) bytes depending on the IP version)
payload_sizeThe length of the IP payload
decompThe list decompressor (IPv6 only)
Returns:
The length of the IP header

References build_uncompressed_ip4(), build_uncompressed_ip6(), d_generic_changes::ip, ip_get_version(), and IPV4.

Referenced by d_generic_decode_ir(), decode_irdyn(), do_decode_uo0_and_uo1(), and do_decode_uor2().

unsigned int build_uncompressed_ip4 ( struct d_generic_changes active,
unsigned char *  dest,
unsigned int  payload_size 
)

Build an uncompressed IPv4 header.

Parameters:
activeThe IPv4 header changes
destThe buffer to store the IPv4 header (MUST be at least of sizeof(struct iphdr) bytes)
payload_sizeThe length of the IPv4 payload
Returns:
The length of the IPv4 header

References ip_packet::header, d_generic_changes::ip, d_generic_changes::nbo, rohc_debugf, and ip_packet::v4.

Referenced by build_uncompressed_ip().

unsigned int build_uncompressed_ip6 ( struct d_generic_changes active,
unsigned char *  dest,
unsigned int  payload_size,
struct list_decomp decomp 
)

Build an uncompressed IPv6 header.

Parameters:
activeThe IPv6 header changes
destThe buffer to store the IPv6 header (MUST be at least of sizeof(struct ip6_hdr) bytes)
payload_sizeThe length of the IPv6 payload
decompThe list decompressor
Returns:
The length of the IPv6 header

References d_generic_changes::complist, list_decomp::counter_list, list_decomp::encode_extension, c_list::first_elt, ip_packet::header, d_generic_changes::ip, list_elt::item, list_decomp::list_decomp, list_decomp::list_table, rohc_debugf, d_generic_changes::size_list, size_list(), item::type, and ip_packet::v6.

Referenced by build_uncompressed_ip().

int check_id ( struct list_decomp decomp,
int  gen_id 
)

Check if the gen_id is present in list table.

Parameters:
decompThe list decompressor
gen_idThe specified id
Returns:
1 if successfull, 0 else

References c_list::gen_id, LIST_COMP_WINDOW, and list_decomp::list_table.

Referenced by decode_type_0(), decode_type_1(), decode_type_2(), and decode_type_3().

int check_ip6_index ( struct list_decomp decomp,
int  index 
)

Check if the index is correct in IPv6 table.

Parameters:
decompThe list decompressor
indexThe specified index
Returns:
1 if successfull, 0 else

References rohc_debugf.

Referenced by d_generic_create().

int cmp_generic_changes ( struct d_generic_changes first,
struct d_generic_changes second 
)

Compare two header changes objects.

Parameters:
firstOne header changes object
secondAnother header changes object
Returns:
1 if the two objects match, 0 otherwise

References d_generic_changes::ip, d_generic_changes::nbo, d_generic_changes::next_header, d_generic_changes::next_header_len, and d_generic_changes::rnd.

Referenced by d_generic_decode().

void copy_generic_changes ( struct d_generic_changes dst,
struct d_generic_changes src 
)

Copy the header changes object into another one.

Parameters:
dstThe destination header changes
srcThe source header changes

References d_generic_changes::ip, d_generic_changes::nbo, d_generic_changes::next_header, d_generic_changes::next_header_len, d_generic_changes::rnd, and rohc_debugf.

Referenced by sync_on_failure(), and synchronize().

void create_ip6_item ( const unsigned char *  data,
int  length,
int  index,
struct list_decomp decomp 
)

Create an IPv6 item extension list.

Parameters:
dataThe data in the item
lengthThe length of the item
indexThe index of the item in based table
decompThe list decompressor

References item::ahhdr, list_decomp::based_table, item::data, item::dest, item::hbh, item::header, ip6_ahhdr::ip6ah_len, ip6_ahhdr::ip6ah_nxt, d_translation::known, item::length, rohc_debugf, item::rthdr, list_decomp::trans_table, and zfree.

Referenced by d_generic_create().

int d_algo_list_decompress ( struct list_decomp decomp,
const unsigned char *  packet 
)

Algorithm of list decompression.

Parameters:
decompThe list decompressor
packetThe ROHC packet to decompress
Returns:
the size of the compressed list

References decode_type_0(), decode_type_1(), decode_type_2(), decode_type_3(), GET_BIT_0_3, GET_BIT_4, GET_BIT_6_7, GET_REAL, list_decomp::list_decomp, m, and rohc_debugf.

Referenced by d_generic_detect_ir_dyn_size(), and d_generic_detect_ir_size().

int d_decode_dynamic_ip ( const unsigned char *  packet,
unsigned int  length,
struct d_generic_changes info,
struct list_decomp decomp 
)

Decode the IP dynamic part of a ROHC packet.

See 5.7.7.3 and 5.7.7.4 in RFC 3095 for details.

Parameters:
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
infoThe decoded IP header information
decompThe list decompressor (only for IPv6)
Returns:
The number of bytes read in the ROHC packet, -1 in case of failure

References d_decode_dynamic_ip4(), d_decode_dynamic_ip6(), d_generic_changes::ip, ip_get_version(), IPV4, d_generic_changes::nbo, and d_generic_changes::rnd.

Referenced by d_generic_decode_ir(), and decode_irdyn().

int d_decode_dynamic_ip4 ( const unsigned char *  packet,
unsigned int  length,
struct ip_packet ip,
int *  rnd,
int *  nbo 
)

Decode the IPv4 dynamic part of a ROHC packet.

See 5.7.7.4 in RFC 3095 for details. Generic extension header list is not managed yet.

Parameters:
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
ipThe decoded IP packet
rndBoolean to store whether the IP-ID is random or not
nboBoolean to store whether the IP-ID is in NBO or not
Returns:
The number of bytes read in the ROHC packet, -1 in case of failure

References GET_BIT_0_7, GET_BIT_5, GET_BIT_6, GET_BIT_7, GET_NEXT_16_BITS, GET_REAL, ip_get_tos(), ip_get_ttl(), ip_set_tos(), ip_set_ttl(), IPV4_DYN_PART_SIZE, ipv4_get_df(), ipv4_get_id(), ipv4_set_df(), ipv4_set_id(), and rohc_debugf.

Referenced by d_decode_dynamic_ip().

int d_decode_dynamic_ip6 ( const unsigned char *  packet,
unsigned int  length,
struct ip_packet ip,
struct list_decomp decomp,
struct d_generic_changes info 
)

Decode the IPv6 dynamic part of a ROHC packet.

See 5.7.7.3 in RFC 3095 for details. Generic extension header list is not managed yet.

Parameters:
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
ipThe decoded IP packet
decompThe list decompressor
infoThe decoded IP header information
Returns:
The number of bytes read in the ROHC packet, -1 in case of failure

References list_decomp::counter_list, c_list::first_elt, GET_BIT_0_7, get_elt(), ip_get_tos(), ip_get_ttl(), ip_set_tos(), ip_set_ttl(), list_elt::item, item::length, list_decomp::list_decomp, list_decomp::list_table, list_decomp::ref_list, list_decomp::ref_ok, rohc_debugf, list_decomp::size_ext, d_generic_changes::size_list, and size_list().

Referenced by d_decode_dynamic_ip().

int d_decode_static_ip ( const unsigned char *  packet,
const unsigned int  length,
struct d_generic_changes info 
)

Decode the IP static part of a ROHC packet.

See 5.7.7.3 and 5.7.7.4 in RFC 3095 for details.

Parameters:
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
infoThe decoded IP header information
Returns:
The number of bytes read in the ROHC packet, -1 in case of failure

References d_decode_static_ip4(), d_decode_static_ip6(), GET_BIT_4_7, d_generic_changes::ip, ip_new(), IPV4, IPV6, and rohc_debugf.

Referenced by d_generic_decode_ir().

int d_decode_static_ip4 ( const unsigned char *  packet,
const unsigned int  length,
struct ip_packet ip 
)

Decode the IPv4 static part of a ROHC packet.

See 5.7.7.4 in RFC 3095 for details.

Parameters:
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
ipThe decoded IP packet
Returns:
The number of bytes read in the ROHC packet, -1 in case of failure

References GET_BIT_0_7, GET_BIT_4_7, ip_get_protocol(), ip_set_daddr(), ip_set_protocol(), ip_set_saddr(), IPV4, ipv4_get_daddr(), ipv4_get_saddr(), rohc_debugf, ip_packet::version, and version.

Referenced by d_decode_static_ip().

int d_decode_static_ip6 ( const unsigned char *  packet,
const unsigned int  length,
struct ip_packet ip 
)

Decode the IPv6 static part of a ROHC packet.

See 5.7.7.3 in RFC 3095 for details.

Parameters:
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
ipThe decoded IP packet
Returns:
The number of bytes read in the ROHC packet, -1 in case of failure

References GET_BIT_0_3, GET_BIT_0_7, GET_BIT_4_7, ip_packet::header, ip_set_daddr(), ip_set_protocol(), ip_set_saddr(), IPV6, IPV6_ADDR, IPV6_ADDR_FORMAT, ipv6_get_daddr(), ipv6_get_flow_label(), ipv6_get_saddr(), ipv6_set_flow_label(), rohc_debugf, ip_packet::v6, ip_packet::version, and version.

Referenced by d_decode_static_ip().

void* d_generic_create ( void  )
int d_generic_decode ( struct rohc_decomp decomp,
struct d_context context,
unsigned char *  packet,
int  size,
int  second_byte,
unsigned char *  dest 
)

Decode one IR-DYN, UO-0, UO-1 or UOR-2 packet, but not IR packet.

This function is one of the functions that must exist in one profile for the framework to work.

Parameters:
decompThe ROHC decompressor
contextThe decompression context
packetThe ROHC packet to decode
sizeThe length of the ROHC packet
second_byteThe offset for the second byte of the ROHC packet (depends on the CID encoding and the packet type)
destThe decoded IP packet
Returns:
The length of the uncompressed IP packet or ROHC_ERROR if an error occurs or ROHC_ERROR_CRC if a CRC error occurs

References d_generic_context::active1, d_generic_context::active2, cmp_generic_changes(), d_generic_context::current_packet_time, d_generic_decode(), decode_irdyn(), decode_uo0(), decode_uo1(), decode_uor2(), find_packet_type(), d_generic_changes::ip, ip_get_version(), IPV4, d_generic_context::last1, d_generic_context::last2, d_generic_context::multiple_ip, d_generic_changes::nbo, NO_CONTEXT, PACKET_IR_DYN, d_generic_context::packet_type, PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, d_generic_changes::rnd, rohc_debugf, ROHC_ERROR, ROHC_NEED_REPARSE, d_context::specific, d_context::state, STATIC_CONTEXT, and synchronize().

Referenced by d_generic_decode(), and d_udp_lite_decode().

int d_generic_decode_ir ( struct rohc_decomp decomp,
struct d_context context,
unsigned char *  packet,
int  plen,
int  large_cid_len,
int  is_addcid_used,
unsigned char *  dest 
)

Decode one IR packet.

This function is one of the functions that must exist in one profile for the framework to work.

Parameters:
decompThe ROHC decompressor
contextThe decompression context
packetThe ROHC packet to decode
plenThe length of the ROHC packet to decode
large_cid_lenThe length of the large CID field
is_addcid_usedWhether the add-CID field is present or not
destThe decoded IP packet
Returns:
The length of the uncompressed IP packet or ROHC_ERROR if an error occurs

References d_generic_context::active1, d_generic_context::active2, d_generic_context::build_next_header, build_uncompressed_ip(), c_add_wlsb(), d_generic_context::counter, d_generic_context::current_packet_time, d_decode_dynamic_ip(), d_decode_static_ip(), d_generic_context::decode_dynamic_next_header, d_generic_context::decode_static_next_header, d_generic_context::first_packet_processed, FULL_CONTEXT, GET_BIT_0, d_context::header_16_compressed, d_context::header_16_uncompressed, d_context::header_compressed_size, d_context::header_uncompressed_size, d_generic_changes::ip, ip_get_hdrlen(), ip_get_protocol(), ip_get_version(), d_generic_context::last1, d_generic_context::last2, d_generic_context::list_decomp1, d_generic_context::list_decomp2, d_generic_context::multiple_ip, d_generic_changes::next_header, d_generic_changes::next_header_len, d_generic_context::next_header_proto, PACKET_IR, d_generic_context::packet_type, rohc_debugf, ROHC_ERROR, d_generic_changes::size_list, d_context::specific, d_context::state, synchronize(), and update_inter_packet().

Referenced by d_udp_lite_decode_ir().

void d_generic_destroy ( void *  context)
unsigned int d_generic_detect_ir_dyn_size ( struct d_context context,
unsigned char *  packet,
unsigned int  plen,
unsigned int  large_cid_len 
)

Find the length of the IR-DYN header.

This function is one of the functions that must exist in one profile for the framework to work.


 Basic structure of the IR-DYN packet (5.7.7.2):

      0   1   2   3   4   5   6   7
     --- --- --- --- --- --- --- ---
 1  :         Add-CID octet         : if for small CIDs and CID != 0
    +---+---+---+---+---+---+---+---+
 2  | 1   1   1   1   1   0   0   0 | IR-DYN packet type
    +---+---+---+---+---+---+---+---+
    :                               :
 3  /     0-2 octets of CID info    / 1-2 octets if for large CIDs
    :                               :
    +---+---+---+---+---+---+---+---+
 4  |            Profile            | 1 octet
    +---+---+---+---+---+---+---+---+
 5  |              CRC              | 1 octet
    +---+---+---+---+---+---+---+---+
    |                               |
 6  /         Dynamic chain         / variable length
    |                               |
    +---+---+---+---+---+---+---+---+
 7  |             SN                | 2 octets if not RTP
    +---+---+---+---+---+---+---+---+
    :                               :
 8  /           Payload             / variable length
    :                               :
     - - - - - - - - - - - - - - - -

The function computes the length of the fields 2 + 4-7, ie. the first byte, the Profile and CRC fields and the dynamic chains (outer and inner IP headers).

Parameters:
contextThe decompression context
packetThe IR-DYN packet after the Add-CID byte if present (ie. field 2 in the figure)
plenThe length of the IR-DYN packet minus the Add-CID byte
large_cid_lenThe size of the large CID field (ie. field 3 in the figure)
Returns:
The length of the IR-DYN header, 0 if an error occurs

References d_generic_context::active1, d_generic_context::active2, d_algo_list_decompress(), d_generic_changes::ip, ip_get_protocol(), ip_get_version(), IPV4, IPV4_DYN_PART_SIZE, d_generic_context::list_decomp1, d_generic_context::list_decomp2, list_decomp::size_ext, d_context::specific, and version.

Referenced by ip_detect_ir_dyn_size(), and rtp_detect_ir_dyn_size().

unsigned int d_generic_detect_ir_size ( struct d_context context,
unsigned char *  packet,
unsigned int  plen,
unsigned int  large_cid_len 
)

Find the length of the IR header.

This function is one of the functions that must exist in one profile for the framework to work.


 Basic structure of the IR packet (5.7.7.1):

      0   1   2   3   4   5   6   7
     --- --- --- --- --- --- --- ---
 1  |         Add-CID octet         |  if for small CIDs and CID != 0
    +---+---+---+---+---+---+---+---+
 2  | 1   1   1   1   1   1   0 | D |
    +---+---+---+---+---+---+---+---+
    |                               |
 3  /    0-2 octets of CID info     /  1-2 octets if for large CIDs
    |                               |
    +---+---+---+---+---+---+---+---+
 4  |            Profile            |  1 octet
    +---+---+---+---+---+---+---+---+
 5  |              CRC              |  1 octet
    +---+---+---+---+---+---+---+---+
    |                               |
 6  |         Static chain          |  variable length
    |                               |
    +---+---+---+---+---+---+---+---+
    |                               |
 7  |         Dynamic chain         |  present if D = 1, variable length
    |                               |
    +---+---+---+---+---+---+---+---+
 8  |             SN                |  2 octets if not RTP
    +---+---+---+---+---+---+---+---+
    |                               |
 9  |           Payload             |  variable length
    |                               |
     - - - - - - - - - - - - - - - -

The function computes the length of the fields 2 + 4-7, ie. the first byte, the Profile and CRC fields and the static and dynamic chains (outer and inner IP headers).

Parameters:
contextThe decompression context
packetThe pointer on the IR packet minus the Add-CID byte (ie. the field 2 in the figure)
plenThe length of the IR packet minus the Add-CID byte
large_cid_lenThe size of the large CID field (ie. the field 3 in the figure)
Returns:
The length of the IR header, 0 if an error occurs

References d_algo_list_decompress(), GET_BIT_0, GET_REAL, d_profile::get_static_part, IPV4, IPV4_DYN_PART_SIZE, IPV6, d_generic_context::list_decomp1, d_generic_context::list_decomp2, d_context::profile, rohc_debugf, list_decomp::size_ext, and d_context::specific.

Referenced by ip_detect_ir_size(), and rtp_detect_ir_size().

int d_generic_get_sn ( struct d_context context)

Get the reference SN value of the context.

This function is one of the functions that must exist in one profile for the framework to work.

Parameters:
contextThe decompression context
Returns:
The reference SN value

References d_get_lsb_ref(), d_generic_context::sn, and d_context::specific.

int decode_extension0 ( unsigned char *  packet,
unsigned int  length,
int  packet_type,
int *  sn,
int *  ip_id,
int *  ts 
)

Decode the extension 0 of the UOR-2 packet.

Actions taken:

  • SN value is expanded with 3 lower bits
  • UOR-2: IP-ID is replaced with 3 bits
  • UOR-2-ID: IP-ID is expanded with 3 lower bits
  • UOR-2-RTP or UOR-2-TS: TS is expanded with 3 lower bits
Parameters:
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
packet_typeThe type of ROHC packet
snIN/OUT: The updated SN value
ip_idIN/OUT: The updated IP-ID value
tsOUT: The TS value
Returns:
The data length read from the ROHC packet, -1 in case of error

References GET_BIT_0_2, GET_BIT_3_5, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, and rohc_debugf.

Referenced by do_decode_uor2().

int decode_extension1 ( unsigned char *  packet,
unsigned int  length,
int  packet_type,
int *  sn,
int *  ip_id,
int *  ts 
)

Decode the extension 1 of the UOR-2 packet.

Actions taken:

  • SN value is expanded with 3 lower bits
  • UOR-2: IP-ID is replaced with 11 bits
  • UOR-2-RTP: TS is expanded with 11 lower bits
  • UOR-2-TS: TS is expanded with 3 lower bits, IP-ID replaced with 8 bits
  • UOR-2-ID: IP-ID is expanded with 3 lower bits, TS is replaced with 8 bits
Parameters:
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
packet_typeThe type of ROHC packet
snIN/OUT: The updated SN value
ip_idIN/OUT: The updated IP-ID value
tsOUT: The TS value
Returns:
The data length read from the ROHC packet, -1 in case of error

References GET_BIT_0_2, GET_BIT_3_5, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, and rohc_debugf.

Referenced by do_decode_uor2().

int decode_extension2 ( unsigned char *  packet,
unsigned int  length,
int  packet_type,
int *  sn,
int *  ip_id,
int *  ip_id2,
int *  ts 
)

Decode the extension 2 of the UOR-2 packet.

Actions taken:

  • SN value is expanded with 3 lower bits
  • UOR-2: outer IP-ID is replaced with 11 bits, inner IP-ID is replaced with 8 bits
  • UOR-2-RTP: TS is expanded with 19 lower bits
  • UOR-2-TS: TS is expanded with 11 lower bits, inner IP-ID is replaced with 8 bits
  • UOR-2-ID: TS is replaced with 8 bits, inner IP-ID is expanded with 11 lower bits
Parameters:
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
packet_typeThe type of ROHC packet
snIN/OUT: The updated SN value
ip_idIN/OUT: The updated inner IP-ID value
ip_id2OUT: The outer IP-ID value
tsOUT: The TS value
Returns:
The data length read from the ROHC packet, -1 in case of error

References GET_BIT_0_2, GET_BIT_3_5, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, and rohc_debugf.

Referenced by do_decode_uor2().

int decode_extension3 ( struct rohc_decomp decomp,
struct d_context context,
unsigned char *  packet,
unsigned int  length,
int *  sn,
int *  sn_size,
int *  is_id_updated,
int *  is_id2_updated,
int *  is_rtp_present,
int *  is_pt_updated 
)

Decode the extension 3 of the UOR-2 packet.

Actions taken:

  • update random fields in the header changes,
  • the SN is eventually expanded with 8 lower bits.
Parameters:
decompThe ROHC decompressor
contextThe decompression context
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
snIN/OUT: The updated SN value
sn_sizeIN/OUT: The new SN size
is_id_updatedOUT: Whether the outer IP-ID is updated by the extension or not
is_id2_updatedOUT: Whether the inner IP-ID is updated by the extension or not
is_rtp_presentOUT: Whether RTP flags & fields are present or not
is_pt_updatedOUT: Whether RTP PT is updated by the extension or not
Returns:
The data length read from the ROHC packet, -2 in case packet must be parsed again, -1 in case of error

References d_generic_context::active1, d_generic_context::active2, d_add_ts_stride(), d_change_mode_feedback(), d_decode_ts(), d_lsb_decode(), d_sdvalue_decode(), d_sdvalue_size(), decode_inner_header_flags(), decode_outer_header_flags(), GET_BIT_0, GET_BIT_1, GET_BIT_2, GET_BIT_3, GET_BIT_3_4, GET_BIT_4, GET_BIT_5, GET_BIT_6_7, GET_BIT_7, GET_NEXT_16_BITS, GET_REAL, d_profile::id, d_generic_changes::ip, ipv4_get_id(), ipv4_set_id(), d_rtp_context::m, MAX_BITS_IN_4_BYTE_SDVL, d_context::mode, d_generic_context::multiple_ip, d_generic_context::packet_type, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, d_context::profile, d_rtp_context::pt, rohc_debugf, ROHC_PROFILE_RTP, d_rtp_context::rp, d_rtp_context::rx, d_generic_context::sn, d_context::specific, d_generic_context::specific, d_rtp_context::timestamp, ts_deducted(), d_rtp_context::ts_received, d_rtp_context::ts_received_size, and d_rtp_context::ts_sc.

Referenced by do_decode_uor2().

int decode_inner_header_flags ( struct d_context context,
unsigned char *  flags,
unsigned char *  fields,
unsigned int  length,
struct d_generic_changes info 
)

Decode the inner IP header flags and fields.

Store the values in an IP header info structure.


  Inner IP header flags (5.7.5):

       0     1     2     3     4     5     6     7
     ..... ..... ..... ..... ..... ..... ..... .....
    | TOS | TTL | DF  | PR  | IPX | NBO | RND | ip2 |  if ip = 1
     ..... ..... ..... ..... ..... ..... ..... .....

  Inner IP header fields (5.7.5):

    ..... ..... ..... ..... ..... ..... ..... .....
   |         Type of Service/Traffic Class         |  if TOS = 1
    ..... ..... ..... ..... ..... ..... ..... .....
   |         Time to Live/Hop Limit                |  if TTL = 1
    ..... ..... ..... ..... ..... ..... ..... .....
   |         Protocol/Next Header                  |  if PR = 1
    ..... ..... ..... ..... ..... ..... ..... .....
   /         IP extension headers                  /  variable,
    ..... ..... ..... ..... ..... ..... ..... .....   if IPX = 1

Parameters:
contextThe decompression context
flagsThe ROHC flags that indicate which IP fields are present in the packet
fieldsThe ROHC packet part that contains some IP header fields
lengthThe length of the ROHC packet part that contains some IP header fields
infoThe IP header info to store the decoded values in
Returns:
The data length read from the ROHC packet, -2 in case packet must be parsed again, -1 in case of error

References GET_BIT_1, GET_BIT_2, GET_BIT_3, GET_BIT_4, GET_BIT_5, GET_BIT_6, GET_BIT_7, GET_REAL, d_profile::id, d_generic_changes::ip, ip_get_version(), ip_set_protocol(), ip_set_tos(), ip_set_ttl(), IPV4, ipv4_get_df(), ipv4_set_df(), d_generic_changes::nbo, d_context::profile, d_generic_changes::rnd, rohc_debugf, and ROHC_PROFILE_RTP.

Referenced by decode_extension3(), and decode_outer_header_flags().

int decode_irdyn ( struct rohc_decomp decomp,
struct d_context context,
unsigned char *  head,
unsigned char *  packet,
unsigned char *  dest,
int  plen 
)
int decode_outer_header_flags ( struct d_context context,
unsigned char *  flags,
unsigned char *  fields,
unsigned int  length,
struct d_generic_changes info,
int *  updated_id 
)

Decode the outer IP header flags and fields.

Store the values in an IP header info structure.


  Outer IP header flags (5.7.5):

       0     1     2     3     4     5     6     7
     ..... ..... ..... ..... ..... ..... ..... .....
    | TOS2| TTL2| DF2 | PR2 |IPX2 |NBO2 |RND2 |  I2 |  if ip2 = 1
     ..... ..... ..... ..... ..... ..... ..... .....

  Outer IP header fields

     ..... ..... ..... ..... ..... ..... ..... .....
    |      Type of Service/Traffic Class            |  if TOS2 = 1
     ..... ..... ..... ..... ..... ..... ..... .....
    |         Time to Live/Hop Limit                |  if TTL2 = 1
     ..... ..... ..... ..... ..... ..... ..... .....
    |         Protocol/Next Header                  |  if PR2 = 1
     ..... ..... ..... ..... ..... ..... ..... .....
    /         IP extension header(s)                /  variable,
     ..... ..... ..... ..... ..... ..... ..... .....    if IPX2 = 1
    |                  IP-ID                        |  2 octets,
     ..... ..... ..... ..... ..... ..... ..... .....    if I2 = 1

Parameters:
contextThe decompression context
flagsThe ROHC flags that indicate which IP fields are present in the packet
fieldsThe ROHC packet part that contain some IP header fields
lengthThe length of the ROHC packet part that contains some IP header fields
infoThe IP header info to store the decoded values in
updated_idThe boolean to store whether the IP-ID is updated or not
Returns:
The data length read from the ROHC packet, -1 in case of error

References decode_inner_header_flags(), GET_BIT_0, GET_NEXT_16_BITS, GET_REAL, d_generic_changes::ip, ip_get_version(), IPV4, ipv4_get_id(), ipv4_set_id(), and rohc_debugf.

Referenced by decode_extension3().

int decode_type_0 ( struct list_decomp decomp,
const unsigned char *  packet,
int  gen_id,
int  ps,
int  m 
)

Decode an extension list type 0.

Parameters:
decompThe list decompressor
packetThe ROHC packet to decompress
gen_idThe id of the current list
psThe ps field
mThe m fiel
Returns:
the size of the compressed list

References list_decomp::based_table, check_id(), list_decomp::counter, list_decomp::counter_list, list_decomp::create_item, empty_list(), c_list::first_elt, c_list::gen_id, GET_BIT_0_2, GET_BIT_0_6, GET_BIT_3, GET_BIT_4_6, GET_BIT_7, list_decomp::get_ext_size, insert_elt(), d_translation::known, L, LIST_COMP_WINDOW, list_decomp::list_table, m, list_decomp::ref_list, list_decomp::ref_ok, rohc_debugf, and list_decomp::trans_table.

Referenced by d_algo_list_decompress().

int decode_type_1 ( struct list_decomp decomp,
const unsigned char *  packet,
int  gen_id,
int  ps,
int  m,
int  ref_id 
)

Decode an extension list type 1.

Parameters:
decompThe list decompressor
packetThe ROHC packet to decompress
gen_idThe id of the current list
psThe ps field
mThe m fiel
ref_idThe id of the reference list
Returns:
the size of the compressed list

References list_decomp::based_table, check_id(), list_decomp::check_index, list_decomp::counter, list_decomp::counter_list, list_decomp::create_item, empty_list(), c_list::first_elt, c_list::gen_id, GET_BIT_0_2, GET_BIT_0_6, GET_BIT_3, GET_BIT_4_6, GET_BIT_7, get_bit_index(), get_elt(), list_decomp::get_ext_size, list_elt::index_table, insert_elt(), list_elt::item, d_translation::known, L, LIST_COMP_WINDOW, list_decomp::list_table, list_decomp::ref_list, list_decomp::ref_ok, rohc_debugf, size_list(), and list_decomp::trans_table.

Referenced by d_algo_list_decompress().

int decode_type_2 ( struct list_decomp decomp,
const unsigned char *  packet,
int  gen_id,
int  ps,
int  ref_id 
)

Decode an extension list type 2.

Parameters:
decompThe list decompressor
packetThe ROHC packet to decompress
gen_idThe id of the current list
psThe ps field
ref_idThe id of the reference list
Returns:
the size of the compressed list

References check_id(), list_decomp::counter, list_decomp::counter_list, empty_list(), c_list::first_elt, c_list::gen_id, get_bit_index(), get_elt(), list_elt::index_table, insert_elt(), list_elt::item, L, LIST_COMP_WINDOW, list_decomp::list_table, MIN, list_decomp::ref_list, list_decomp::ref_ok, rohc_debugf, and size_list().

Referenced by d_algo_list_decompress().

int decode_type_3 ( struct list_decomp decomp,
const unsigned char *  packet,
int  gen_id,
int  ps,
int  m,
int  ref_id 
)
int decode_uo0 ( struct rohc_decomp decomp,
struct d_context context,
unsigned char *  head,
unsigned char *  packet,
unsigned char *  dest,
int  plen 
)
int decode_uo1 ( struct rohc_decomp decomp,
struct d_context context,
unsigned char *  head,
unsigned char *  packet,
unsigned char *  dest,
int  plen 
)

Decode one UO-1 packet.

Parameters:
decompThe ROHC decompressor
contextThe decompression context
headThe first byte the the ROHC packet
packetThe end of the ROHC packet to decode
destThe decoded IP packet
plenThe length of the ROHC packet
Returns:
The length of the uncompressed IP packet or ROHC_ERROR if an error occurs or ROHC_ERROR_CRC if a CRC error occurs

References act_on_crc_failure(), d_generic_context::active1, d_generic_context::active2, c_add_wlsb(), d_generic_changes::complist, d_generic_context::counter, d_add_ts(), d_ip_id_update(), d_lsb_sync_ref(), d_lsb_update(), do_decode_uo0_and_uo1(), GET_BIT_0_2, GET_BIT_0_4, GET_BIT_0_5, GET_BIT_3_6, GET_BIT_3_7, GET_BIT_7, GET_REAL, d_context::header_16_compressed, d_context::header_16_uncompressed, d_context::header_compressed_size, d_context::header_uncompressed_size, d_profile::id, d_generic_changes::ip, ip_get_version(), d_generic_context::ip_id1, d_generic_context::ip_id2, IPV4, d_generic_context::list_decomp1, d_generic_context::list_decomp2, m, d_rtp_context::m, d_generic_context::multiple_ip, d_generic_context::packet_type, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, d_context::profile, list_decomp::ref_ok, rohc_debugf, rohc_debugf_, ROHC_ERROR, ROHC_ERROR_CRC, ROHC_PROFILE_RTP, sn, d_generic_context::sn, d_context::specific, d_generic_context::specific, synchronize(), d_rtp_context::timestamp, d_rtp_context::ts_received, d_rtp_context::ts_received_size, d_rtp_context::ts_sc, and update_inter_packet().

Referenced by d_generic_decode().

int decode_uor2 ( struct rohc_decomp decomp,
struct d_context context,
unsigned char *  head,
unsigned char *  packet,
unsigned char *  dest,
int  plen 
)

Decode one UOR-2 packet.

Parameters:
decompThe ROHC decompressor
contextThe decompression context
headThe first byte the the ROHC packet
packetThe end of the ROHC packet to decode
destThe decoded IP packet
plenThe length of the ROHC packet
Returns:
The length of the uncompressed IP packet or ROHC_ERROR if an error occurs or ROHC_ERROR_CRC if a CRC error occurs or ROHC_NEED_REPARSE if packet needs to be parsed again

References act_on_crc_failure(), d_generic_context::active1, d_generic_context::active2, c_add_wlsb(), d_generic_changes::complist, d_generic_context::counter, d_add_ts(), d_ip_id_update(), d_lsb_sync_ref(), d_lsb_update(), do_decode_uor2(), FULL_CONTEXT, GET_BIT_0_4, GET_BIT_0_5, GET_BIT_0_6, GET_BIT_6, GET_BIT_7, GET_REAL, d_context::header_16_compressed, d_context::header_16_uncompressed, d_context::header_compressed_size, d_context::header_uncompressed_size, d_profile::id, d_generic_changes::ip, ip_get_version(), d_generic_context::ip_id1, d_generic_context::ip_id2, IPV4, d_generic_context::list_decomp1, d_generic_context::list_decomp2, m, d_rtp_context::m, d_generic_context::multiple_ip, d_generic_context::packet_type, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, d_context::profile, list_decomp::ref_ok, rohc_debugf, rohc_debugf_, ROHC_ERROR, ROHC_ERROR_CRC, ROHC_NEED_REPARSE, ROHC_PROFILE_RTP, sn, d_generic_context::sn, d_context::specific, d_generic_context::specific, d_context::state, synchronize(), d_rtp_context::timestamp, d_rtp_context::ts_received, d_rtp_context::ts_received_size, d_rtp_context::ts_sc, and update_inter_packet().

Referenced by d_generic_decode().

int do_decode_uo0_and_uo1 ( struct d_context context,
const unsigned char *  packet,
unsigned char *  dest,
int *  plen,
int  sn_bits,
int  nb_of_sn_bits,
int *  id,
int  nb_of_id_bits,
int *  id2,
int *  sn,
int *  calc_crc 
)

Decode one UO-0 or UO-1 packet.

Parameters:
contextThe decompression context
packetThe ROHC packet to decode
destThe decoded IP packet
plenIN/OUT: The length of the ROHC packet
sn_bitsThe SN bits as they are transmitted in the ROHC packet
nb_of_sn_bitsThe number of bits that code the SN field
idThe outer IP-ID
nb_of_id_bitsThe number of bits that code the outer IP-ID field
id2The inner IP-ID
snThe SN value
calc_crcThe computed CRC
Returns:
The length of the uncompressed IP packet, -1 in case of error

References d_generic_context::active1, d_generic_context::active2, d_generic_context::build_next_header, build_uncompressed_ip(), d_generic_changes::complist, d_generic_context::compute_crc_dynamic, d_generic_context::compute_crc_static, CRC_INIT_3, CRC_TYPE_3, d_decode_ts(), d_ip_id_decode(), d_generic_context::decode_uo_tail, GET_NEXT_16_BITS, d_profile::id, d_generic_changes::ip, ip_get_hdrlen(), ip_get_version(), d_generic_context::ip_id1, d_generic_context::ip_id2, IPV4, ipv4_get_id(), ipv4_set_id(), d_generic_context::list_decomp1, d_generic_context::list_decomp2, d_rtp_context::m, d_generic_context::multiple_ip, d_generic_changes::next_header, d_generic_changes::next_header_len, d_generic_context::packet_type, PACKET_UO_0, d_context::profile, d_generic_changes::rnd, rohc_debugf, ROHC_PROFILE_RTP, d_generic_changes::size_list, size_list(), d_generic_context::sn, d_context::specific, d_generic_context::specific, d_rtp_context::timestamp, ts_deducted(), d_rtp_context::ts_received, d_rtp_context::ts_received_size, and d_rtp_context::ts_sc.

Referenced by act_on_crc_failure(), decode_uo0(), and decode_uo1().

int do_decode_uor2 ( struct rohc_decomp decomp,
struct d_context context,
unsigned char *  packet,
unsigned char *  dest,
int *  plen,
int *  id,
int *  id2,
int *  sn,
int *  sn_size,
int  sn_bits,
int  ext,
int *  calc_crc 
)

Decode one UOR-2 packet.

Parameters:
decompThe ROHC decompressor
contextThe decompression context
packetThe ROHC packet to decode
destThe decoded IP packet
plenIN/OUT: The length of the ROHC packet
idThe outer IP-ID
id2The inner IP-ID
snThe SN value
sn_sizeThe SN size
sn_bitsThe SN bits as they are transmitted in the ROHC packet
extWhether the UOR-2 packet owns an extension or not
calc_crcThe computed CRC
Returns:
The length of the uncompressed IP packet, -2 in case packet must be parsed again, -1 in case of error

References d_generic_context::active1, d_generic_context::active2, d_generic_context::build_next_header, build_uncompressed_ip(), d_generic_changes::complist, d_generic_context::compute_crc_dynamic, d_generic_context::compute_crc_static, CRC_INIT_6, CRC_INIT_7, CRC_TYPE_6, CRC_TYPE_7, d_decode_ts(), d_ip_id_decode(), d_lsb_decode(), decode_extension0(), decode_extension1(), decode_extension2(), decode_extension3(), d_generic_context::decode_uo_tail, extension_type(), GET_NEXT_16_BITS, d_profile::id, d_generic_changes::ip, ip_get_hdrlen(), ip_get_version(), d_generic_context::ip_id1, d_generic_context::ip_id2, IPV4, ipv4_get_id(), ipv4_set_id(), d_generic_context::list_decomp1, d_generic_context::list_decomp2, d_rtp_context::m, d_generic_context::multiple_ip, d_generic_changes::next_header, d_generic_changes::next_header_len, PACKET_EXT_0, PACKET_EXT_1, PACKET_EXT_2, PACKET_EXT_3, d_generic_context::packet_type, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, d_context::profile, d_rtp_context::pt, d_generic_changes::rnd, rohc_debugf, ROHC_PROFILE_RTP, d_rtp_context::rp, d_rtp_context::rx, d_generic_changes::size_list, size_list(), d_generic_context::sn, d_context::specific, d_generic_context::specific, d_rtp_context::timestamp, rtphdr::timestamp, ts_deducted(), d_rtp_context::ts_received, d_rtp_context::ts_received_size, and d_rtp_context::ts_sc.

Referenced by act_on_crc_failure(), and decode_uor2().

int encode_ip6_extension ( struct d_generic_changes active,
struct list_decomp decomp,
unsigned char *  dest 
)

Build an extension list in IPv6 header.

Parameters:
activeThe IPv6 header changes
decompThe list decompressor
destThe buffer to store the IPv6 header
Returns:
The size of the list

References list_decomp::counter_list, item::data, c_list::first_elt, get_elt(), ip_packet::header, d_generic_changes::ip, list_elt::item, item::length, list_decomp::list_table, list_elt::next_elt, list_decomp::ref_list, list_decomp::ref_ok, rohc_debugf, size_list(), item::type, and ip_packet::v6.

Referenced by d_generic_create().

int extension_type ( const unsigned char *  packet)

Find out which extension is carried by the UOR-2 packet.

Parameters:
packetThe ROHC UOR-2 packet
Returns:
The UOR-2 extension type among PACKET_EXT_0, PACKET_EXT_1, PACKET_EXT_2 or PACKET_EXT_3

References GET_BIT_6_7.

Referenced by do_decode_uor2().

int find_packet_type ( struct rohc_decomp decomp,
struct d_context context,
const unsigned char *  packet,
int  second_byte 
)

Find out of which type is the ROHC packet.

Parameters:
decompThe ROHC decompressor
contextThe decompression context
packetThe ROHC packet
second_byteThe offset for the second byte of the ROHC packet (depends on the CID encoding and the packet type)
Returns:
The packet type among PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UO_1_ID, PACKET_UOR_2, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, PACKET_UOR_2_ID, PACKET_IR_DYN, PACKET_IR or PACKET_UNKNOWN

References GET_BIT_5, GET_BIT_5_7, GET_BIT_6, GET_BIT_6_7, GET_BIT_7, d_profile::id, d_generic_changes::ip, ip_get_version(), IPV4, d_generic_context::last1, d_generic_context::last2, d_generic_context::multiple_ip, PACKET_IR, PACKET_IR_DYN, PACKET_UNKNOWN, PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, d_context::profile, d_generic_changes::rnd, ROHC_PROFILE_RTP, and d_context::specific.

Referenced by d_generic_decode(), and d_udp_lite_decode().

int get_bit_index ( unsigned char  byte,
int  index 
)

Get the bit in the byte at the specified index.

Parameters:
bytethe byte to analyse
indexthe specified index
Returns:
the bit

References GET_BIT_0, GET_BIT_1, GET_BIT_2, GET_BIT_3, GET_BIT_4, GET_BIT_5, GET_BIT_6, GET_BIT_7, and rohc_debugf.

Referenced by decode_type_1(), decode_type_2(), and decode_type_3().

int get_ip6_ext_size ( const unsigned char *  ext)

Get the size of the extension in bytes.

Parameters:
extThe extension
Returns:
The size

Referenced by d_generic_create().

void ip6_d_init_table ( struct list_decomp decomp)

Initialize the tables IPv6 extension in decompressor.

Parameters:
decompThe list decompressor

References AH, item::ahhdr, list_decomp::based_table, item::data, DEST, item::dest, HBH, item::hbh, item::header, d_translation::item, d_translation::known, item::length, RTHDR, item::rthdr, list_decomp::trans_table, and item::type.

Referenced by d_generic_create().

void sync_on_failure ( struct d_generic_context context)

Replace the active header changes with the last ones.

Parameters:
contextThe generic decompression context

References d_generic_context::active1, d_generic_context::active2, copy_generic_changes(), d_generic_context::last1, and d_generic_context::last2.

Referenced by act_on_crc_failure().

void synchronize ( struct d_generic_context context)

Replace last header changes with the active ones.

Parameters:
contextThe generic decompression context

References d_generic_context::active1, d_generic_context::active2, copy_generic_changes(), d_generic_context::last1, and d_generic_context::last2.

Referenced by act_on_crc_failure(), d_generic_decode(), d_generic_decode_ir(), decode_irdyn(), decode_uo0(), decode_uo1(), and decode_uor2().

void update_inter_packet ( struct d_generic_context context)

Update the inter-packet time, a sort of average over the last inter-packet times.

Parameters:
contextThe generic decompression context

References d_generic_context::current_packet_time, d_generic_context::inter_arrival_time, d_generic_context::last_packet_time, rohc_debugf, WEIGHT_NEW, and WEIGHT_OLD.

Referenced by act_on_crc_failure(), d_generic_decode_ir(), decode_irdyn(), decode_uo0(), decode_uo1(), and decode_uor2().