ROHC compression/decompression library
Data Structures | Functions | Variables
d_uncompressed.c File Reference

ROHC decompression context for the uncompressed profile. More...

#include "rohc_decomp.h"
#include "rohc_decomp_internals.h"
#include "rohc_bit_ops.h"
#include "rohc_traces_internal.h"
#include "crc.h"
#include "rohc_decomp_detect_packet.h"
#include <string.h>
Include dependency graph for d_uncompressed.c:

Data Structures

struct  rohc_uncomp_extr_bits
 
struct  rohc_uncomp_decoded
 

Functions

static bool uncomp_new_context (const struct rohc_decomp_ctxt *const context, void **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Create the Uncompressed volatile and persistent parts of the context. More...
 
static void uncomp_free_context (void *const persist_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Destroy profile-specific data, nothing to destroy for the uncompressed profile. More...
 
static rohc_packet_t uncomp_detect_pkt_type (const struct rohc_decomp_ctxt *const context, const uint8_t *const rohc_packet, const size_t rohc_length, const size_t large_cid_len)
 Detect the type of ROHC packet for the Uncompressed profile. More...
 
static bool uncomp_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_uncomp_extr_bits *const extr_bits, size_t *const rohc_hdr_len)
 Parse one IR or Normal packet for the Uncompressed profile. More...
 
static bool uncomp_parse_ir (const struct rohc_decomp_ctxt *const context, const struct rohc_buf rohc_packet, const size_t large_cid_len, struct rohc_decomp_crc *const extr_crc, struct rohc_uncomp_extr_bits *const extr_bits, size_t *const rohc_hdr_len)
 Parse one IR packet for the Uncompressed profile. More...
 
static bool uncomp_parse_normal (const struct rohc_decomp_ctxt *const context, const struct rohc_buf rohc_packet, const size_t large_cid_len, struct rohc_decomp_crc *const extr_crc, struct rohc_uncomp_extr_bits *const extr_bits, size_t *const rohc_hdr_len)
 Parse one Normal packet for the Uncompressed profile. More...
 
static bool uncomp_decode_bits (const struct rohc_decomp_ctxt *const context, const struct rohc_uncomp_extr_bits *const extr_bits, const size_t payload_len, struct rohc_uncomp_decoded *const decoded)
 Decode values from extracted bits for the Uncompressed profile. More...
 
static rohc_status_t uncomp_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_uncomp_decoded *const decoded, const size_t payload_len, struct rohc_buf *const uncomp_hdrs, size_t *const uncomp_hdrs_len)
 Build the uncompressed headers for the Uncompressed profile. More...
 
static void uncomp_update_ctxt (struct rohc_decomp_ctxt *const context, const struct rohc_uncomp_decoded *const decoded, const size_t payload_len, bool *const do_change_mode)
 Update the decompression context with the infos of current packet. More...
 
static bool uncomp_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_uncomp_extr_bits *const extr_bits)
 Attempt a packet/context repair upon CRC failure. More...
 
static uint32_t uncomp_get_sn (const struct rohc_decomp_ctxt *const context)
 Get the reference SN value of the context. Always return 0 for the uncompressed profile. More...
 

Variables

const struct rohc_decomp_profile d_uncomp_profile
 Define the decompression part of the Uncompressed profile as described in the RFC 3095. More...
 

Detailed Description

ROHC decompression context for the uncompressed profile.

Author
Didier Barvaux didie.nosp@m.r.ba.nosp@m.rvaux.nosp@m.@tou.nosp@m.louse.nosp@m..viv.nosp@m.eris..nosp@m.com
Didier Barvaux didie.nosp@m.r@ba.nosp@m.rvaux.nosp@m..org

Function Documentation

static bool uncomp_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_uncomp_extr_bits *const  extr_bits 
)
static

Attempt a packet/context repair upon CRC failure.

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
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
static rohc_status_t uncomp_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_uncomp_decoded *const  decoded,
const size_t  payload_len,
struct rohc_buf *const  uncomp_hdrs,
size_t *const  uncomp_hdrs_len 
)
static

Build the uncompressed headers for the Uncompressed profile.

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
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 (in bytes)
[out]uncomp_hdrsThe uncompressed headers being built
[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_OUTPUT_TOO_SMALL if uncomp_packet is too small
static bool uncomp_decode_bits ( const struct rohc_decomp_ctxt *const  context,
const struct rohc_uncomp_extr_bits *const  extr_bits,
const size_t  payload_len,
struct rohc_uncomp_decoded *const  decoded 
)
static

Decode values from extracted bits for the Uncompressed profile.

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

Parameters
contextThe decompression context
extr_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
static rohc_packet_t uncomp_detect_pkt_type ( const struct rohc_decomp_ctxt *const  context,
const uint8_t *const  rohc_packet,
const size_t  rohc_length,
const size_t  large_cid_len 
)
static

Detect the type of ROHC packet for the Uncompressed profile.

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

Parameters
contextThe decompression context
rohc_packetThe ROHC packet
rohc_lengthThe length of the ROHC packet
large_cid_lenThe length of the optional large CID field
Returns
The packet type
static void uncomp_free_context ( void *const  persist_ctxt,
const struct rohc_decomp_volat_ctxt *const  volat_ctxt 
)
static

Destroy profile-specific data, nothing to destroy for the uncompressed profile.

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

Parameters
persist_ctxtThe persistent part of the decompression context
volat_ctxtThe volatile part of the decompression context
static uint32_t uncomp_get_sn ( const struct rohc_decomp_ctxt *const  context)
static

Get the reference SN value of the context. Always return 0 for the uncompressed profile.

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
static bool uncomp_new_context ( const struct rohc_decomp_ctxt *const  context,
void **const  persist_ctxt,
struct rohc_decomp_volat_ctxt *const  volat_ctxt 
)
static

Create the Uncompressed 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
Returns
true if the Uncompressed context was successfully created, false if a problem occurred
static bool uncomp_parse_ir ( const struct rohc_decomp_ctxt *const  context,
const struct rohc_buf  rohc_packet,
const size_t  large_cid_len,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_uncomp_extr_bits *const  extr_bits,
size_t *const  rohc_hdr_len 
)
static

Parse one IR packet for the Uncompressed profile.

Parameters
contextThe decompression context
rohc_packetThe ROHC packet to decode
large_cid_lenThe length of the optional large CID field
[out]extr_crcThe CRC extracted from the ROHC packet
[out]extr_bitsThe bits extracted from the ROHC packet
[out]rohc_hdr_lenThe length of the ROHC header (in bytes)
Returns
true if parsing was successful, false if packet was malformed
static bool uncomp_parse_normal ( const struct rohc_decomp_ctxt *const  context,
const struct rohc_buf  rohc_packet,
const size_t  large_cid_len,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_uncomp_extr_bits *const  extr_bits,
size_t *const  rohc_hdr_len 
)
static

Parse one Normal packet for the Uncompressed profile.

Parameters
contextThe decompression context
rohc_packetThe ROHC packet to decode
large_cid_lenThe length of the optional large CID field
[out]extr_crcThe CRC extracted from the ROHC packet
[out]extr_bitsThe bits extracted from the ROHC packet
[out]rohc_hdr_lenThe length of the ROHC header (in bytes)
Returns
true if parsing was successful, false if packet was malformed
static bool uncomp_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_uncomp_extr_bits *const  extr_bits,
size_t *const  rohc_hdr_len 
)
static

Parse one IR or Normal packet for the Uncompressed profile.

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

Parameters
contextThe decompression context
rohc_packetThe ROHC packet to parse
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 packet
[out]extr_bitsThe bits extracted from the ROHC packet
[out]rohc_hdr_lenThe length of the ROHC header (in bytes)
Returns
true if parsing was successful, false if packet was malformed
static void uncomp_update_ctxt ( struct rohc_decomp_ctxt *const  context,
const struct rohc_uncomp_decoded *const  decoded,
const size_t  payload_len,
bool *const  do_change_mode 
)
static

Update the decompression context with the infos of current packet.

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 (in bytes)
[out]do_change_modeWhether the profile context wants to change its operational mode or not

Variable Documentation

const struct rohc_decomp_profile d_uncomp_profile
Initial value:
=
{
.msn_max_bits = 0,
.new_context = uncomp_new_context,
.free_context = uncomp_free_context,
.detect_pkt_type = uncomp_detect_pkt_type,
.get_sn = uncomp_get_sn,
}
static bool uncomp_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_uncomp_extr_bits *const extr_bits, size_t *const rohc_hdr_len)
Parse one IR or Normal packet for the Uncompressed profile.
Definition: d_uncompressed.c:256
bool(* rohc_decomp_attempt_repair_t)(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, void *const extr_bits)
Definition: rohc_decomp_internals.h:386
static bool uncomp_new_context(const struct rohc_decomp_ctxt *const context, void **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt)
Create the Uncompressed volatile and persistent parts of the context.
Definition: d_uncompressed.c:152
bool(* rohc_decomp_decode_bits_t)(const struct rohc_decomp_ctxt *const context, const void *const extr_bits, const size_t payload_len, void *const decoded_values)
Definition: rohc_decomp_internals.h:364
static bool uncomp_decode_bits(const struct rohc_decomp_ctxt *const context, const struct rohc_uncomp_extr_bits *const extr_bits, const size_t payload_len, struct rohc_uncomp_decoded *const decoded)
Decode values from extracted bits for the Uncompressed profile.
Definition: d_uncompressed.c:416
static void uncomp_free_context(void *const persist_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
Destroy profile-specific data, nothing to destroy for the uncompressed profile.
Definition: d_uncompressed.c:198
static uint32_t uncomp_get_sn(const struct rohc_decomp_ctxt *const context)
Get the reference SN value of the context. Always return 0 for the uncompressed profile.
Definition: d_uncompressed.c:543
static bool uncomp_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_uncomp_extr_bits *const extr_bits)
Attempt a packet/context repair upon CRC failure.
Definition: d_uncompressed.c:520
Definition: rohc.h:215
static rohc_packet_t uncomp_detect_pkt_type(const struct rohc_decomp_ctxt *const context, const uint8_t *const rohc_packet, const size_t rohc_length, const size_t large_cid_len)
Detect the type of ROHC packet for the Uncompressed profile.
Definition: d_uncompressed.c:219
bool(* rohc_decomp_parse_pkt_t)(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, void *const extr_bits, size_t *const rohc_hdr_len)
Definition: rohc_decomp_internals.h:355
static rohc_status_t uncomp_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_uncomp_decoded *const decoded, const size_t payload_len, struct rohc_buf *const uncomp_hdrs, size_t *const uncomp_hdrs_len)
Build the uncompressed headers for the Uncompressed profile.
Definition: d_uncompressed.c:451
static void uncomp_update_ctxt(struct rohc_decomp_ctxt *const context, const struct rohc_uncomp_decoded *const decoded, const size_t payload_len, bool *const do_change_mode)
Update the decompression context with the infos of current packet.
Definition: d_uncompressed.c:497
void(* rohc_decomp_update_ctxt_t)(struct rohc_decomp_ctxt *const context, const void *const decoded_values, const size_t payload_len, bool *const do_change_mode)
Definition: rohc_decomp_internals.h:380
rohc_status_t(* rohc_decomp_build_hdrs_t)(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 void *const decoded_values, const size_t payload_len, struct rohc_buf *const uncomp_hdrs, size_t *const uncomp_hdrs_len)
Definition: rohc_decomp_internals.h:370

Define the decompression part of the Uncompressed profile as described in the RFC 3095.