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

ROHC ESP decompression profile. More...

#include "rohc_decomp_rfc3095.h"
#include "d_ip.h"
#include "rohc_traces_internal.h"
#include "rohc_debug.h"
#include "rohc_utils.h"
#include "crc.h"
#include "protocols/esp.h"
#include "schemes/decomp_wlsb.h"
#include <stdint.h>
#include <string.h>
#include <assert.h>
Include dependency graph for d_esp.c:

Data Structures

struct  d_esp_context
 Define the ESP part of the decompression profile context. More...
 

Functions

static bool d_esp_create (const struct rohc_decomp_ctxt *const context, struct rohc_decomp_rfc3095_ctxt **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Create the ESP decompression context. More...
 
static void d_esp_destroy (struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Destroy the context. More...
 
static int esp_parse_static_esp (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, size_t length, struct rohc_extr_bits *const bits)
 Parse the ESP static part of the ROHC packet. More...
 
static int esp_parse_dynamic_esp (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, const size_t length, struct rohc_extr_bits *const bits)
 Parse the ESP dynamic part of the ROHC packet. More...
 
static bool esp_decode_values_from_bits (const struct rohc_decomp_ctxt *context, const struct rohc_extr_bits *const bits, struct rohc_decoded_values *const decoded)
 Decode ESP values from extracted bits. More...
 
static int esp_build_uncomp_esp (const struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded, uint8_t *const dest, const unsigned int payload_len)
 Build an uncompressed ESP header. More...
 
static void esp_update_context (struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded)
 Update context with decoded ESP values. More...
 

Variables

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

Detailed Description

ROHC ESP decompression profile.

Author
FWX rohc_.nosp@m.team.nosp@m.@dial.nosp@m.ine..nosp@m.fr
Didier Barvaux didie.nosp@m.r@ba.nosp@m.rvaux.nosp@m..org

Function Documentation

static bool d_esp_create ( const struct rohc_decomp_ctxt *const  context,
struct rohc_decomp_rfc3095_ctxt **const  persist_ctxt,
struct rohc_decomp_volat_ctxt *const  volat_ctxt 
)
static

Create the ESP decompression 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 ESP context was successfully created, false if a problem occurred
static void d_esp_destroy ( struct rohc_decomp_rfc3095_ctxt *const  rfc3095_ctxt,
const struct rohc_decomp_volat_ctxt *const  volat_ctxt 
)
static

Destroy the context.

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

Parameters
rfc3095_ctxtThe persistent decompression context for the RFC3095 profiles
volat_ctxtThe volatile decompression context
static int esp_build_uncomp_esp ( const struct rohc_decomp_ctxt *const  context,
const struct rohc_decoded_values *const  decoded,
uint8_t *const  dest,
const unsigned int  payload_len 
)
static

Build an uncompressed ESP header.

Parameters
contextThe decompression context
decodedThe values decoded from the ROHC header
destThe buffer to store the ESP header (MUST be at least of sizeof(struct esphdr) length)
payload_lenThe length of the ESP payload
Returns
The length of the next header (ie. the ESP header), -1 in case of error
static bool esp_decode_values_from_bits ( const struct rohc_decomp_ctxt context,
const struct rohc_extr_bits *const  bits,
struct rohc_decoded_values *const  decoded 
)
static

Decode ESP values from extracted bits.

The following values are decoded:

  • ESP SPI
Parameters
contextThe decompression context
bitsThe extracted bits
decodedOUT: The corresponding decoded values
Returns
true if decoding is successful, false otherwise
static int esp_parse_dynamic_esp ( const struct rohc_decomp_ctxt *const  context,
const uint8_t *  packet,
const size_t  length,
struct rohc_extr_bits *const  bits 
)
static

Parse the ESP dynamic part of the ROHC packet.

Parameters
contextThe decompression context
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
bitsOUT: The bits extracted from the ROHC header
Returns
The number of bytes read in the ROHC packet, -1 in case of failure
static int esp_parse_static_esp ( const struct rohc_decomp_ctxt *const  context,
const uint8_t *  packet,
size_t  length,
struct rohc_extr_bits *const  bits 
)
static

Parse the ESP static part of the ROHC packet.

Parameters
contextThe decompression context
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
bitsOUT: The bits extracted from the ROHC header
Returns
The number of bytes read in the ROHC packet, -1 in case of failure
static void esp_update_context ( struct rohc_decomp_ctxt *const  context,
const struct rohc_decoded_values *const  decoded 
)
static

Update context with decoded ESP values.

The following decoded values are updated in context:

  • ESP SPI
Parameters
contextThe decompression context
decodedThe decoded values to update in the context

Variable Documentation

const struct rohc_decomp_profile d_esp_profile
Initial value:
=
{
.msn_max_bits = 32,
.detect_pkt_type = ip_detect_packet_type,
}
static void d_esp_destroy(struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
Destroy the context.
Definition: d_esp.c:221
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.
Definition: rohc_decomp_rfc3095.c:5604
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.
Definition: rohc_decomp_rfc3095.c:5407
uint32_t rohc_decomp_rfc3095_get_sn(const struct rohc_decomp_ctxt *const context)
Get the reference SN value of the context.
Definition: rohc_decomp_rfc3095.c:1354
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
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 d_esp_create(const struct rohc_decomp_ctxt *const context, struct rohc_decomp_rfc3095_ctxt **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt)
Create the ESP decompression context.
Definition: d_esp.c:115
bool(* rohc_decomp_new_context_t)(const struct rohc_decomp_ctxt *const context, void **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt)
Definition: rohc_decomp_internals.h:340
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.
Definition: rohc_decomp_rfc3095.c:536
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.
Definition: rohc_decomp_rfc3095.c:6110
void(* rohc_decomp_free_context_t)(void *const persist_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
Definition: rohc_decomp_internals.h:345
rohc_packet_t ip_detect_packet_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 IP-based non-RTP profiles.
Definition: d_ip.c:137
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
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.
Definition: rohc_decomp_rfc3095.c:4961
Definition: rohc.h:221
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 ESP profile as described in the RFC 3095.