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 "rohc_time.h"
#include "rohc_debug.h"
#include "rohc_packets.h"
#include "rohc_bit_ops.h"
#include "wlsb.h"
#include "sdvl.h"
#include "crc.h"
#include <assert.h>
Include dependency graph for d_generic.c:

Defines

#define IPV4_DYN_PART_SIZE   6
 The size (in bytes) of the IPv4 dynamic part.
#define WEIGHT_OLD   1
#define WEIGHT_NEW   1
#define APPEND_BITS(field_descr, ext_no, field, field_nr, bits, bits_nr, max)
#define APPEND_SN_BITS(ext_no, base, bits, bits_nr)
#define APPEND_OUTER_IP_ID_BITS(ext_no, base, bits, bits_nr)
#define APPEND_INNER_IP_ID_BITS(ext_no, base, bits, bits_nr)
#define APPEND_TS_BITS(ext_no, base, bits, bits_nr)

Functions

void * d_generic_create (void)
 Create the generic decompression context.
void d_generic_destroy (void *context)
 Destroy the context.
int d_generic_decode (struct rohc_decomp *decomp, struct d_context *context, const unsigned char *const rohc_packet, const unsigned int rohc_length, const size_t add_cid_len, const size_t large_cid_len, unsigned char *dest)
 Decode one IR, IR-DYN or UO* packet.
int d_generic_get_sn (struct d_context *context)
 Get the reference SN value of the context.

Detailed Description

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

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

Define Documentation

#define APPEND_BITS (   field_descr,
  ext_no,
  field,
  field_nr,
  bits,
  bits_nr,
  max 
)

Append new LSB bits to already extracted bits

#define APPEND_INNER_IP_ID_BITS (   ext_no,
  base,
  bits,
  bits_nr 
)
Value:
APPEND_BITS(inner IP-ID, ext_no, \
                    (base)->inner_ip.id, (base)->inner_ip.id_nr, \
                    (bits), (bits_nr), 16)

Inner IP-ID: append new LSB bits to already extracted bits

#define APPEND_OUTER_IP_ID_BITS (   ext_no,
  base,
  bits,
  bits_nr 
)
Value:
APPEND_BITS(outer IP-ID, ext_no, \
                    (base)->outer_ip.id, (base)->outer_ip.id_nr, \
                    (bits), (bits_nr), 16)

Outer IP-ID: append new LSB bits to already extracted bits

#define APPEND_SN_BITS (   ext_no,
  base,
  bits,
  bits_nr 
)
Value:
APPEND_BITS(SN, ext_no, \
                    (base)->sn, (base)->sn_nr, \
                    (bits), (bits_nr), 32)

SN: append new LSB bits to already extracted bits

#define APPEND_TS_BITS (   ext_no,
  base,
  bits,
  bits_nr 
)
Value:
APPEND_BITS(TS, ext_no, \
                    (base)->ts, (base)->ts_nr, \
                    (bits), (bits_nr), 32)

TS: append new LSB bits to already extracted bits

#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.

#define WEIGHT_NEW   1

Constant to compute inter-arrival time between the received packets

#define WEIGHT_OLD   1

Constant to compute inter-arrival time between the received packets


Function Documentation

void* d_generic_create ( void  )
int d_generic_decode ( struct rohc_decomp decomp,
struct d_context context,
const unsigned char *const  rohc_packet,
const unsigned int  rohc_length,
const size_t  add_cid_len,
const size_t  large_cid_len,
unsigned char *  dest 
)

Decode one IR, IR-DYN or UO* 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
rohc_packetThe ROHC packet to decode
rohc_lengthThe length of the ROHC packet
add_cid_lenThe length of the optional Add-CID field
large_cid_lenThe length of the optional large CID field
destOUT: The 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::detect_packet_type, NO_CONTEXT, PACKET_IR, 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, rohc_debugf, ROHC_ERROR, rohc_get_packet_descr(), d_context::specific, d_context::state, and STATIC_CONTEXT.

Referenced by d_udp_lite_decode().

void d_generic_destroy ( void *  context)
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 rohc_lsb_get_ref(), d_generic_context::sn_lsb_ctxt, and d_context::specific.