ROHC compression/decompression library
Data Structures | Functions
rohc_decomp_rfc3095.h File Reference
#include "rohc_decomp.h"
#include "rohc_decomp_internals.h"
#include "rohc_packets.h"
#include "rohc_utils.h"
#include "schemes/decomp_wlsb.h"
#include "schemes/ip_id_offset.h"
#include "schemes/decomp_list.h"
#include "protocols/udp_lite.h"
#include "ip.h"
#include "crc.h"
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for rohc_decomp_rfc3095.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rohc_extr_ip_bits
 
struct  rohc_extr_bits
 The bits extracted from ROHC UO* base headers. More...
 
struct  rohc_decoded_ip_values
 
struct  rohc_decoded_values
 The values decoded from the bits extracted from ROHC header. More...
 
struct  rohc_decomp_rfc3095_changes
 Store information about an IP header between the different decompressions of IP packets. More...
 
struct  rohc_decomp_rfc3095_ctxt
 The generic decompression context for RFC3095-based profiles. More...
 

Functions

bool rohc_decomp_rfc3095_create (const struct rohc_decomp_ctxt *const context, struct rohc_decomp_rfc3095_ctxt **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt, rohc_trace_callback2_t trace_cb, void *const trace_cb_priv, const int profile_id)
 Create the RFC3095 volatile and persistent parts of the context. More...
 
void rohc_decomp_rfc3095_destroy (struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Destroy the context. More...
 
bool rfc3095_decomp_parse_pkt (const struct rohc_decomp_ctxt *const context, const struct rohc_buf rohc_packet, const size_t large_cid_len, rohc_packet_t *const packet_type, struct rohc_decomp_crc *const extr_crc, struct rohc_extr_bits *const bits, size_t *const rohc_hdr_len)
 Parse one IR, IR-DYN, UO-0, UO-1*, or UOR-2* packet. More...
 
rohc_status_t rfc3095_decomp_build_hdrs (const struct rohc_decomp *const decomp, const struct rohc_decomp_ctxt *const context, const rohc_packet_t packet_type, const struct rohc_decomp_crc *const extr_crc, const struct rohc_decoded_values *const decoded, const size_t payload_len, struct rohc_buf *const uncomp_hdrs, size_t *const uncomp_hdrs_len)
 Build the uncompressed headers. More...
 
bool rfc3095_decomp_decode_bits (const struct rohc_decomp_ctxt *const context, const struct rohc_extr_bits *const bits, const size_t payload_len, struct rohc_decoded_values *const decoded)
 Decode values from extracted bits. More...
 
void rfc3095_decomp_update_ctxt (struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded, const size_t payload_len, bool *const do_change_mode)
 Update context with decoded values. More...
 
bool rfc3095_decomp_attempt_repair (const struct rohc_decomp *const decomp, const struct rohc_decomp_ctxt *const context, const struct rohc_ts pkt_arrival_time, struct rohc_decomp_crc_corr_ctxt *const crc_corr, struct rohc_extr_bits *const extr_bits)
 Attempt a packet/context repair upon CRC failure. More...
 
uint32_t rohc_decomp_rfc3095_get_sn (const struct rohc_decomp_ctxt *const context)
 Get the reference SN value of the context. More...
 
static bool is_ipv4_pkt (const struct rohc_extr_ip_bits *const bits)
 Is the given IP header IPV4 wrt packet? More...
 
static bool is_ipv4_rnd_pkt (const struct rohc_extr_ip_bits *const bits)
 Is the given IP header IPv4 and its IP-ID random wrt packet? More...
 
static bool is_ipv4_non_rnd_pkt (const struct rohc_extr_ip_bits *const bits)
 Is the given IP header IPv4 and its IP-ID non-random wrt packet? More...
 

Function Documentation

static bool is_ipv4_non_rnd_pkt ( const struct rohc_extr_ip_bits *const  bits)
inlinestatic

Is the given IP header IPv4 and its IP-ID non-random wrt packet?

Parameters
bitsThe bits extracted from packet
Returns
true if IPv4 and non-random, false otherwise
static bool is_ipv4_pkt ( const struct rohc_extr_ip_bits *const  bits)
inlinestatic

Is the given IP header IPV4 wrt packet?

Parameters
bitsThe bits extracted from packet
Returns
true if IPv4, false if IPv6
static bool is_ipv4_rnd_pkt ( const struct rohc_extr_ip_bits *const  bits)
inlinestatic

Is the given IP header IPv4 and its IP-ID random wrt packet?

Parameters
bitsThe bits extracted from packet
Returns
true if IPv4 and random, false otherwise
bool rfc3095_decomp_attempt_repair ( const struct rohc_decomp *const  decomp,
const struct rohc_decomp_ctxt *const  context,
const struct rohc_ts  pkt_arrival_time,
struct rohc_decomp_crc_corr_ctxt *const  crc_corr,
struct rohc_extr_bits *const  extr_bits 
)

Attempt a packet/context repair upon CRC failure.

Parameters
decompThe ROHC decompressor
contextThe decompression context
pkt_arrival_timeThe arrival time of the ROHC packet that caused the CRC failure
[in,out]crc_corrThe context for corrections upon CRC failures
[in,out]extr_bitsThe bits extracted from the ROHC header
Returns
true if repair is possible, false if not
rohc_status_t rfc3095_decomp_build_hdrs ( const struct rohc_decomp *const  decomp,
const struct rohc_decomp_ctxt *const  context,
const rohc_packet_t  packet_type,
const struct rohc_decomp_crc *const  extr_crc,
const struct rohc_decoded_values *const  decoded,
const size_t  payload_len,
struct rohc_buf *const  uncomp_hdrs,
size_t *const  uncomp_hdrs_len 
)

Build the uncompressed headers.

Todo:
check for uncomp_hdrs size before writing into it
Parameters
decompThe ROHC decompressor
contextThe decompression context
packet_typeThe type of ROHC packet
extr_crcThe CRC bits extracted from the ROHC header
decodedThe values decoded from ROHC header
payload_lenThe length of the packet payload
[out]uncomp_hdrsThe buffer to store the uncompressed headers
[out]uncomp_hdrs_lenThe length of the uncompressed headers written into the buffer
Returns
Possible values:
  • ROHC_STATUS_OK if headers are built successfully,
  • ROHC_STATUS_BAD_CRC if headers do not match CRC,
  • ROHC_STATUS_OUTPUT_TOO_SMALL if the output buffer is too small
bool rfc3095_decomp_decode_bits ( const struct rohc_decomp_ctxt *const  context,
const struct rohc_extr_bits *const  bits,
const size_t  payload_len,
struct rohc_decoded_values *const  decoded 
)

Decode values from extracted bits.

The following values are decoded:

  • SN
  • fields related to the outer IP header
  • fields related to the inner IP header (if it exists)

Other fields may be decoded by the profile-specific callback named decode_values_from_bits.

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

Parameters
contextThe decompression context
bitsThe bits extracted from the ROHC packet
payload_lenThe length of the packet payload (in bytes)
[out]decodedThe corresponding decoded values
Returns
true if decoding is successful, false otherwise
bool rfc3095_decomp_parse_pkt ( const struct rohc_decomp_ctxt *const  context,
const struct rohc_buf  rohc_packet,
const size_t  large_cid_len,
rohc_packet_t *const  packet_type,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_extr_bits *const  bits,
size_t *const  rohc_hdr_len 
)

Parse one IR, IR-DYN, UO-0, UO-1*, or UOR-2* packet.

Parameters
contextThe decompression context
rohc_packetThe ROHC packet to decode
large_cid_lenThe length of the optional large CID field
[in,out]packet_typeIN: The type of the ROHC packet to parse OUT: The type of the parsed ROHC packet
[out]extr_crcThe CRC bits extracted from the ROHC header
[out]bitsThe bits extracted from the ROHC header
[out]rohc_hdr_lenThe length of the ROHC header (in bytes)
Returns
true if packet is successfully parsed, false otherwise
See also
parse_ir
parse_irdyn
parse_uo0
parse_uo1
parse_uo1rtp
parse_uo1id
parse_uo1ts
parse_uor2
parse_uor2rtp
parse_uor2id
parse_uor2ts
void rfc3095_decomp_update_ctxt ( struct rohc_decomp_ctxt *const  context,
const struct rohc_decoded_values *const  decoded,
const size_t  payload_len,
bool *const  do_change_mode 
)

Update context with decoded values.

The following decoded values are updated in context:

  • SN
  • static & dynamic fields of the outer IP header
  • static & dynamic fields of the inner IP header (if it exists)
  • fields for the next header (optional, depends on profile)

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

Parameters
contextThe decompression context
decodedThe decoded values to update in the context
payload_lenThe length of the packet payload
[out]do_change_modeWhether the profile context wants to change its operational mode or not
bool rohc_decomp_rfc3095_create ( const struct rohc_decomp_ctxt *const  context,
struct rohc_decomp_rfc3095_ctxt **const  persist_ctxt,
struct rohc_decomp_volat_ctxt *const  volat_ctxt,
rohc_trace_callback2_t  trace_cb,
void *const  trace_cb_priv,
const int  profile_id 
)

Create the RFC3095 volatile and persistent parts 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
[out]persist_ctxtThe persistent part of the decompression context
[out]volat_ctxtThe volatile part of the decompression context
trace_cbThe function to call for printing traces
trace_cb_privAn optional private context, may be NULL
profile_idThe ID of the associated decompression profile
Returns
true if the Uncompressed context was successfully created, false if a problem occurred
void rohc_decomp_rfc3095_destroy ( struct rohc_decomp_rfc3095_ctxt *const  rfc3095_ctxt,
const struct rohc_decomp_volat_ctxt *const  volat_ctxt 
)

Destroy the context.

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

Parameters
rfc3095_ctxtThe generic decompression context
volat_ctxtThe volatile part of the decompression context
uint32_t rohc_decomp_rfc3095_get_sn ( const struct rohc_decomp_ctxt *const  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