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

ROHC decompression context for the ROHCv2 IP/ESP profile. More...

#include "rohc_decomp.h"
#include "rohc_decomp_internals.h"
#include "rohc_traces_internal.h"
#include "rohc_decomp_detect_packet.h"
#include "protocols/ip_numbers.h"
#include "protocols/ip.h"
#include "protocols/rfc5225.h"
#include "schemes/ip_ctxt.h"
#include "schemes/decomp_wlsb.h"
#include "schemes/decomp_crc.h"
#include "schemes/rfc4996.h"
#include "rohc_bit_ops.h"
#include "crc.h"
#include "rohc_debug.h"
#include "interval.h"
#include "sdvl.h"
#include <string.h>
Include dependency graph for decomp_rfc5225_ip_esp.c:

Data Structures

struct  rohc_decomp_rfc5225_ip_esp_ctxt
 
struct  rohc_rfc5225_ip_bits
 
struct  rohc_rfc5225_bits
 
struct  rohc_rfc5225_decoded_ip
 
struct  rohc_rfc5225_decoded
 

Functions

static bool decomp_rfc5225_ip_esp_new_context (const struct rohc_decomp_ctxt *const context, void **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Create the ROHCv2 IP/ESP volatile and persistent parts of the context. More...
 
static void decomp_rfc5225_ip_esp_free_context (struct rohc_decomp_rfc5225_ip_esp_ctxt *const rfc5225_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Destroy profile-specific data, nothing to destroy for the ROHCv2 IP/ESP profile. More...
 
static rohc_packet_t decomp_rfc5225_ip_esp_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 ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_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_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
 Parse one ROHC packet for the ROHCv2 IP/ESP profile. More...
 
static void decomp_rfc5225_ip_esp_reset_extr_bits (const struct rohc_decomp_ctxt *const ctxt, struct rohc_rfc5225_bits *const bits)
 Reset the extracted bits for next parsing. More...
 
static bool decomp_rfc5225_ip_esp_parse_ir (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_buf rohc_pkt, const size_t large_cid_len, struct rohc_decomp_crc *const extr_crc, struct rohc_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
 Parse one IR packet for the ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_parse_co_repair (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_buf rohc_pkt, const size_t large_cid_len, struct rohc_decomp_crc *const hdr_crc, struct rohc_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
 Parse one co_repair packet for the ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_parse_co (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_buf rohc_pkt, const size_t large_cid_len, const rohc_packet_t packet_type, struct rohc_decomp_crc *const extr_crc, struct rohc_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
 Parse CO packet for the ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_parse_pt_0_crc3 (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, struct rohc_decomp_crc *const extr_crc, struct rohc_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
 Parse one pt_0_crc3 packet for the ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_parse_pt_0_crc7 (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, struct rohc_decomp_crc *const extr_crc, struct rohc_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
 Parse one pt_0_crc7 packet for the ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_parse_pt_1_seq_id (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, struct rohc_decomp_crc *const extr_crc, struct rohc_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
 Parse one pt_1_seq_id packet for the ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_parse_pt_2_seq_id (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, struct rohc_decomp_crc *const extr_crc, struct rohc_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
 Parse one pt_2_seq_id packet for the ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_parse_co_common (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, struct rohc_decomp_crc *const extr_crc, struct rohc_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
 Parse one co_common packet for the ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_parse_static_chain (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, struct rohc_rfc5225_bits *const bits, size_t *const parsed_len)
 Parse the static chain of the IR packet. More...
 
static int decomp_rfc5225_ip_esp_parse_static_ip (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, struct rohc_rfc5225_ip_bits *const ip_bits, bool *const is_innermost)
 Decode the static IP header of the ROHC packet. More...
 
static int decomp_rfc5225_ip_esp_parse_static_esp (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *rohc_pkt, const size_t rohc_len, struct rohc_rfc5225_bits *const bits)
 Parse the ESP static part of the ROHC packet. More...
 
static bool decomp_rfc5225_ip_esp_parse_dyn_chain (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, struct rohc_rfc5225_bits *const bits, size_t *const parsed_len)
 Parse the dynamic chain of the IR packet. More...
 
static int decomp_rfc5225_ip_esp_parse_dyn_ip (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, struct rohc_rfc5225_ip_bits *const ip_bits)
 Decode the dynamic IP header of the ROHC packet. More...
 
static int decomp_rfc5225_ip_esp_parse_dyn_esp (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *rohc_pkt, const size_t rohc_len, struct rohc_rfc5225_bits *const bits)
 Parse the ESP dynamic part of the ROHC packet. More...
 
static bool decomp_rfc5225_ip_esp_parse_irreg_chain (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, const rohc_ip_id_behavior_t innermost_ip_id_behavior, struct rohc_rfc5225_bits *const bits, size_t *const parsed_len)
 Parse the irregular chain of the CO packet. More...
 
static int decomp_rfc5225_ip_esp_parse_irreg_ip (const struct rohc_decomp_ctxt *const ctxt, const uint8_t *const rohc_pkt, const size_t rohc_len, const bool is_innermost, const rohc_ip_id_behavior_t ip_id_behavior, const bool outer_ip_flag, struct rohc_rfc5225_ip_bits *const ip_bits)
 Decode the irregular IP header of the ROHC packet. More...
 
static rohc_status_t decomp_rfc5225_ip_esp_decode_bits (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_bits *const bits, const size_t payload_len, struct rohc_rfc5225_decoded *const decoded)
 Decode values from extracted bits for the ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_decode_bits_ip_hdrs (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_bits *const bits, struct rohc_rfc5225_decoded *const decoded)
 Decode values for all IP headers from extracted bits. More...
 
static bool decomp_rfc5225_ip_esp_decode_bits_ip_hdr (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_ip_bits *const ip_bits, const ip_context_t *const ip_ctxt, const uint32_t decoded_msn, struct rohc_rfc5225_decoded_ip *const ip_decoded)
 Decode values for one IP header from extracted bits. More...
 
static rohc_status_t decomp_rfc5225_ip_esp_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_rfc5225_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 ROHCv2 IP/ESP profile. More...
 
static bool decomp_rfc5225_ip_esp_build_ip_hdrs (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_decoded *const decoded, struct rohc_buf *const uncomp_pkt, size_t *const ip_hdrs_len)
 Build all of the uncompressed IP headers. More...
 
static bool decomp_rfc5225_ip_esp_build_ip_hdr (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_decoded_ip *const decoded, struct rohc_buf *const uncomp_pkt, size_t *const ip_hdr_len)
 Build one single uncompressed IP header. More...
 
static bool decomp_rfc5225_ip_esp_build_ipv4_hdr (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_decoded_ip *const decoded, struct rohc_buf *const uncomp_pkt, size_t *const ip_hdr_len)
 Build one single uncompressed IPv4 header. More...
 
static bool decomp_rfc5225_ip_esp_build_ipv6_hdr (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_decoded_ip *const decoded, struct rohc_buf *const uncomp_pkt, size_t *const ip_hdr_len)
 Build one single uncompressed IPv6 header. More...
 
static bool decomp_rfc5225_ip_esp_build_esp_hdr (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_decoded *const decoded, struct rohc_buf *const uncomp_pkt, size_t *const esp_hdr_len)
 Build the uncompressed ESP header. More...
 
static void decomp_rfc5225_ip_esp_update_ctxt (struct rohc_decomp_ctxt *const context, const struct rohc_rfc5225_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 decomp_rfc5225_ip_esp_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, void *const extr_bits)
 Attempt a packet/context repair upon CRC failure. More...
 
static uint32_t decomp_rfc5225_ip_esp_get_sn (const struct rohc_decomp_ctxt *const context)
 Get the reference SN value of the context. More...
 
static size_t sdvl_sn_lsb_decode (const uint8_t *const data, const size_t length, uint32_t *const sn, size_t *const sn_bits_nr)
 Decode a SN value using the sdvl_sn_lsb encoding. More...
 

Variables

const struct rohc_decomp_profile rohc_decomp_rfc5225_ip_esp_profile
 Define the decompression part of the ROHCv2 IP/ESP profile as described in the RFC 5225. More...
 

Detailed Description

ROHC decompression context for the ROHCv2 IP/ESP 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

◆ decomp_rfc5225_ip_esp_attempt_repair()

static bool decomp_rfc5225_ip_esp_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,
void *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

◆ decomp_rfc5225_ip_esp_build_esp_hdr()

static bool decomp_rfc5225_ip_esp_build_esp_hdr ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_rfc5225_decoded *const  decoded,
struct rohc_buf *const  uncomp_pkt,
size_t *const  esp_hdr_len 
)
static

Build the uncompressed ESP header.

Build the uncompressed ESP header from the context and packet information.

Parameters
ctxtThe decompression context
decodedThe values decoded from the ROHC packet
[out]uncomp_pktThe uncompressed packet being built
[out]esp_hdr_lenThe length of the ESP header (in bytes)
Returns
true if ESP header was successfully built, false if the output uncomp_packet was not large enough

◆ decomp_rfc5225_ip_esp_build_hdrs()

static rohc_status_t decomp_rfc5225_ip_esp_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_rfc5225_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 ROHCv2 IP/ESP 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

◆ decomp_rfc5225_ip_esp_build_ip_hdr()

static bool decomp_rfc5225_ip_esp_build_ip_hdr ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_rfc5225_decoded_ip *const  decoded,
struct rohc_buf *const  uncomp_pkt,
size_t *const  ip_hdr_len 
)
static

Build one single uncompressed IP header.

Build one single uncompressed IP header - IPv4 or IPv6 - from the context and packet information.

Parameters
ctxtThe decompression context
decodedThe values decoded from the ROHC packet
[out]uncomp_pktThe uncompressed packet being built
[out]ip_hdr_lenThe length of the IP header (in bytes)
Returns
true if IP header was successfully built, false if the output uncomp_packet was not large enough

◆ decomp_rfc5225_ip_esp_build_ip_hdrs()

static bool decomp_rfc5225_ip_esp_build_ip_hdrs ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_rfc5225_decoded *const  decoded,
struct rohc_buf *const  uncomp_pkt,
size_t *const  ip_hdrs_len 
)
static

Build all of the uncompressed IP headers.

Build all of the uncompressed IP headers - IPv4 or IPv6 - from the context and packet information.

Parameters
ctxtThe decompression context
decodedThe values decoded from the ROHC packet
[out]uncomp_pktThe uncompressed packet being built
[out]ip_hdrs_lenThe length of all the IP headers (in bytes)
Returns
true if IP headers were successfully built, false if the output uncomp_packet was not large enough

◆ decomp_rfc5225_ip_esp_build_ipv4_hdr()

static bool decomp_rfc5225_ip_esp_build_ipv4_hdr ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_rfc5225_decoded_ip *const  decoded,
struct rohc_buf *const  uncomp_pkt,
size_t *const  ip_hdr_len 
)
static

Build one single uncompressed IPv4 header.

Build one single uncompressed IPv4 header from the context and packet information.

Parameters
ctxtThe decompression context
decodedThe values decoded from the ROHC packet
[out]uncomp_pktThe uncompressed packet being built
[out]ip_hdr_lenThe length of the IPv4 header (in bytes)
Returns
true if IPv4 header was successfully built, false if the output uncomp_packet was not large enough

◆ decomp_rfc5225_ip_esp_build_ipv6_hdr()

static bool decomp_rfc5225_ip_esp_build_ipv6_hdr ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_rfc5225_decoded_ip *const  decoded,
struct rohc_buf *const  uncomp_pkt,
size_t *const  ip_hdr_len 
)
static

Build one single uncompressed IPv6 header.

Build one single uncompressed IPv6 header - including IPv6 extension headers - from the context and packet information.

Parameters
ctxtThe decompression context
decodedThe values decoded from the ROHC packet
[out]uncomp_pktThe uncompressed packet being built
[out]ip_hdr_lenThe length of the IPv6 header (in bytes)
Returns
true if IPv6 header was successfully built, false if the output uncomp_packet was not large enough

◆ decomp_rfc5225_ip_esp_decode_bits()

static rohc_status_t decomp_rfc5225_ip_esp_decode_bits ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_rfc5225_bits *const  bits,
const size_t  payload_len,
struct rohc_rfc5225_decoded *const  decoded 
)
static

Decode values from extracted bits for the ROHCv2 IP/ESP profile.

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

Parameters
ctxtThe decompression context
bitsThe bits extracted from the ROHC packet
payload_lenThe length of the packet payload (in bytes)
[out]decodedThe corresponding decoded values
Returns
ROHC_STATUS_OK if decoding is successful, ROHC_STATUS_BAD_CRC if control CRC is wrong, ROHC_STATUS_ERROR otherwise

◆ decomp_rfc5225_ip_esp_decode_bits_ip_hdr()

static bool decomp_rfc5225_ip_esp_decode_bits_ip_hdr ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_rfc5225_ip_bits *const  ip_bits,
const ip_context_t *const  ip_ctxt,
const uint32_t  decoded_msn,
struct rohc_rfc5225_decoded_ip *const  ip_decoded 
)
static

Decode values for one IP header from extracted bits.

Parameters
ctxtThe decompression context
ip_bitsThe IP bits extracted from the ROHC packet
ip_ctxtThe IP values recorded in context
decoded_msnThe decoded Master Sequence Number (MSN)
[out]ip_decodedThe corresponding decoded IP values
Returns
true if decoding is successful, false otherwise

TODO: factorize with TCP profile

◆ decomp_rfc5225_ip_esp_decode_bits_ip_hdrs()

static bool decomp_rfc5225_ip_esp_decode_bits_ip_hdrs ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_rfc5225_bits *const  bits,
struct rohc_rfc5225_decoded *const  decoded 
)
static

Decode values for all IP headers from extracted bits.

Parameters
ctxtThe decompression context
bitsThe bits extracted from the ROHC packet
[out]decodedThe corresponding decoded values
Returns
true if decoding is successful, false otherwise

◆ decomp_rfc5225_ip_esp_detect_pkt_type()

static rohc_packet_t decomp_rfc5225_ip_esp_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 ROHCv2 IP/ESP 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

◆ decomp_rfc5225_ip_esp_free_context()

static void decomp_rfc5225_ip_esp_free_context ( struct rohc_decomp_rfc5225_ip_esp_ctxt *const  rfc5225_ctxt,
const struct rohc_decomp_volat_ctxt *const  volat_ctxt 
)
static

Destroy profile-specific data, nothing to destroy for the ROHCv2 IP/ESP profile.

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

Parameters
rfc5225_ctxtThe persistent decompression context for the IP/ESP profile
volat_ctxtThe volatile part of the decompression context

◆ decomp_rfc5225_ip_esp_get_sn()

static uint32_t decomp_rfc5225_ip_esp_get_sn ( const struct rohc_decomp_ctxt *const  context)
static

Get the reference SN value of the context.

Always return 0 for the ROHCv2 IP/ESP 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

◆ decomp_rfc5225_ip_esp_new_context()

static bool decomp_rfc5225_ip_esp_new_context ( const struct rohc_decomp_ctxt *const  context,
void **const  persist_ctxt,
struct rohc_decomp_volat_ctxt *const  volat_ctxt 
)
static

Create the ROHCv2 IP/ESP 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 ROHCv2 IP/ESP context was successfully created, false if a problem occurred

◆ decomp_rfc5225_ip_esp_parse_co()

static bool decomp_rfc5225_ip_esp_parse_co ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_buf  rohc_pkt,
const size_t  large_cid_len,
const rohc_packet_t  packet_type,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_rfc5225_bits *const  bits,
size_t *const  rohc_hdr_len 
)
static

Parse CO packet for the ROHCv2 IP/ESP profile.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
large_cid_lenThe length of the optional large CID field
packet_typeThe type of the ROHC packet to parse
[out]extr_crcThe CRC extracted from the ROHC packet
[out]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

◆ decomp_rfc5225_ip_esp_parse_co_common()

static bool decomp_rfc5225_ip_esp_parse_co_common ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_rfc5225_bits *const  bits,
size_t *const  rohc_hdr_len 
)
static

Parse one co_common packet for the ROHCv2 IP/ESP profile.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
rohc_lenThe length (in bytes) of the ROHC packet
[out]extr_crcThe CRC extracted from the ROHC packet
[out]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

◆ decomp_rfc5225_ip_esp_parse_co_repair()

static bool decomp_rfc5225_ip_esp_parse_co_repair ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_buf  rohc_pkt,
const size_t  large_cid_len,
struct rohc_decomp_crc *const  hdr_crc,
struct rohc_rfc5225_bits *const  bits,
size_t *const  rohc_hdr_len 
)
static

Parse one co_repair packet for the ROHCv2 IP/ESP profile.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
large_cid_lenThe length of the optional large CID field
[out]hdr_crcThe CRC over uncomp headers extracted from ROHC packet
[out]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

◆ decomp_rfc5225_ip_esp_parse_dyn_chain()

static bool decomp_rfc5225_ip_esp_parse_dyn_chain ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
struct rohc_rfc5225_bits *const  bits,
size_t *const  parsed_len 
)
static

Parse the dynamic chain of the IR packet.

Parameters
ctxtThe decompression context
rohc_pktThe remaining part of the ROHC packet
rohc_lenThe remaining length (in bytes) of the ROHC packet
[out]parsed_lenThe length (in bytes) of static chain in case of success
[out]bitsThe bits extracted from the dynamic chain
Returns
true in the dynamic chain was successfully parsed, false if the ROHC packet was malformed

◆ decomp_rfc5225_ip_esp_parse_dyn_esp()

static int decomp_rfc5225_ip_esp_parse_dyn_esp ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *  rohc_pkt,
const size_t  rohc_len,
struct rohc_rfc5225_bits *const  bits 
)
static

Parse the ESP dynamic part of the ROHC packet.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
rohc_lenThe 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

◆ decomp_rfc5225_ip_esp_parse_dyn_ip()

static int decomp_rfc5225_ip_esp_parse_dyn_ip ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
struct rohc_rfc5225_ip_bits *const  ip_bits 
)
static

Decode the dynamic IP header of the ROHC packet.

Parameters
ctxtThe decompression context
rohc_pktThe remaining part of the ROHC packet
rohc_lenThe remaining length (in bytes) of the ROHC packet
[out]ip_bitsThe bits extracted from the IP part of the dynamic chain
Returns
The length of dynamic IP header in case of success, -1 if an error occurs

◆ decomp_rfc5225_ip_esp_parse_ir()

static bool decomp_rfc5225_ip_esp_parse_ir ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_buf  rohc_pkt,
const size_t  large_cid_len,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_rfc5225_bits *const  bits,
size_t *const  rohc_hdr_len 
)
static

Parse one IR packet for the ROHCv2 IP/ESP profile.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
large_cid_lenThe length of the optional large CID field
[out]extr_crcThe CRC extracted from the ROHC packet
[out]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

◆ decomp_rfc5225_ip_esp_parse_irreg_chain()

static bool decomp_rfc5225_ip_esp_parse_irreg_chain ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
const rohc_ip_id_behavior_t  innermost_ip_id_behavior,
struct rohc_rfc5225_bits *const  bits,
size_t *const  parsed_len 
)
static

Parse the irregular chain of the CO packet.

Parameters
ctxtThe decompression context
rohc_pktThe remaining part of the ROHC packet
rohc_lenThe remaining length (in bytes) of the ROHC packet
innermost_ip_id_behaviorThe behavior of the innermost IP-ID
[out]parsed_lenThe length (in bytes) of irregular chain in case of success
[out]bitsThe bits extracted from the irregular chain
Returns
true in the irregular chain was successfully parsed, false if the ROHC packet was malformed

◆ decomp_rfc5225_ip_esp_parse_irreg_ip()

static int decomp_rfc5225_ip_esp_parse_irreg_ip ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
const bool  is_innermost,
const rohc_ip_id_behavior_t  ip_id_behavior,
const bool  outer_ip_flag,
struct rohc_rfc5225_ip_bits *const  ip_bits 
)
static

Decode the irregular IP header of the ROHC packet.

Parameters
ctxtThe decompression context
rohc_pktThe remaining part of the ROHC packet
rohc_lenThe remaining length (in bytes) of the ROHC packet
is_innermostWhether the IP header is the innermost IP header or not
ip_id_behaviorThe IP-ID behavior of the IP header (may be different from the context)
outer_ip_flagWhether the TOS/TC or TTL/HL fields of outer IP headers are present or not
[out]ip_bitsThe bits extracted from the IP part of the irregular chain
Returns
The length of dynamic IP header in case of success, -1 if an error occurs

◆ decomp_rfc5225_ip_esp_parse_pkt()

static bool decomp_rfc5225_ip_esp_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_rfc5225_bits *const  bits,
size_t *const  rohc_hdr_len 
)
static

Parse one ROHC packet for the ROHCv2 IP/ESP 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]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

◆ decomp_rfc5225_ip_esp_parse_pt_0_crc3()

static bool decomp_rfc5225_ip_esp_parse_pt_0_crc3 ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_rfc5225_bits *const  bits,
size_t *const  rohc_hdr_len 
)
static

Parse one pt_0_crc3 packet for the ROHCv2 IP/ESP profile.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
rohc_lenThe length (in bytes) of the ROHC packet
[out]extr_crcThe CRC extracted from the ROHC packet
[out]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

◆ decomp_rfc5225_ip_esp_parse_pt_0_crc7()

static bool decomp_rfc5225_ip_esp_parse_pt_0_crc7 ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_rfc5225_bits *const  bits,
size_t *const  rohc_hdr_len 
)
static

Parse one pt_0_crc7 packet for the ROHCv2 IP/ESP profile.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
rohc_lenThe length (in bytes) of the ROHC packet
[out]extr_crcThe CRC extracted from the ROHC packet
[out]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

◆ decomp_rfc5225_ip_esp_parse_pt_1_seq_id()

static bool decomp_rfc5225_ip_esp_parse_pt_1_seq_id ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_rfc5225_bits *const  bits,
size_t *const  rohc_hdr_len 
)
static

Parse one pt_1_seq_id packet for the ROHCv2 IP/ESP profile.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
rohc_lenThe length (in bytes) of the ROHC packet
[out]extr_crcThe CRC extracted from the ROHC packet
[out]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

◆ decomp_rfc5225_ip_esp_parse_pt_2_seq_id()

static bool decomp_rfc5225_ip_esp_parse_pt_2_seq_id ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
struct rohc_decomp_crc *const  extr_crc,
struct rohc_rfc5225_bits *const  bits,
size_t *const  rohc_hdr_len 
)
static

Parse one pt_2_seq_id packet for the ROHCv2 IP/ESP profile.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
rohc_lenThe length (in bytes) of the ROHC packet
[out]extr_crcThe CRC extracted from the ROHC packet
[out]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

◆ decomp_rfc5225_ip_esp_parse_static_chain()

static bool decomp_rfc5225_ip_esp_parse_static_chain ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
struct rohc_rfc5225_bits *const  bits,
size_t *const  parsed_len 
)
static

Parse the static chain of the IR packet.

Parameters
ctxtThe decompression context
rohc_pktThe remaining part of the ROHC packet
rohc_lenThe remaining length (in bytes) of the ROHC packet
[out]bitsThe bits extracted from the static chain
[out]parsed_lenThe length (in bytes) of static chain in case of success
Returns
true in the static chain was successfully parsed, false if the ROHC packet was malformed

◆ decomp_rfc5225_ip_esp_parse_static_esp()

static int decomp_rfc5225_ip_esp_parse_static_esp ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *  rohc_pkt,
const size_t  rohc_len,
struct rohc_rfc5225_bits *const  bits 
)
static

Parse the ESP static part of the ROHC packet.

Parameters
ctxtThe decompression context
rohc_pktThe ROHC packet to decode
rohc_lenThe 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

◆ decomp_rfc5225_ip_esp_parse_static_ip()

static int decomp_rfc5225_ip_esp_parse_static_ip ( const struct rohc_decomp_ctxt *const  ctxt,
const uint8_t *const  rohc_pkt,
const size_t  rohc_len,
struct rohc_rfc5225_ip_bits *const  ip_bits,
bool *const  is_innermost 
)
static

Decode the static IP header of the ROHC packet.

Parameters
ctxtThe decompression context
rohc_pktThe remaining part of the ROHC packet
rohc_lenThe remaining length (in bytes) of the ROHC packet
[out]ip_bitsThe bits extracted from the IP part of the static chain
[out]is_innermostWhether the IP header is the innermost IP header
Returns
The length of static IP header in case of success, -1 if an error occurs

◆ decomp_rfc5225_ip_esp_reset_extr_bits()

static void decomp_rfc5225_ip_esp_reset_extr_bits ( const struct rohc_decomp_ctxt *const  ctxt,
struct rohc_rfc5225_bits *const  bits 
)
static

Reset the extracted bits for next parsing.

Parameters
ctxtThe decompression context
[out]bitsThe extracted bits to reset

◆ decomp_rfc5225_ip_esp_update_ctxt()

static void decomp_rfc5225_ip_esp_update_ctxt ( struct rohc_decomp_ctxt *const  context,
const struct rohc_rfc5225_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

◆ sdvl_sn_lsb_decode()

static size_t sdvl_sn_lsb_decode ( const uint8_t *const  data,
const size_t  length,
uint32_t *const  sn,
size_t *const  sn_bits_nr 
)
static

Decode a SN value using the sdvl_sn_lsb encoding.

See page 72 in the RFC 5525 for details about the sdvl_sn_lsb encoding.

Parameters
dataThe SDVL data to decode
lengthThe maximum data length available (in bytes)
[out]snThe decoded MSN value
[out]sn_bits_nrThe number of useful MSN bits
Returns
The number of bytes used by the SDVL field (value between 1 and 5) in case of success, 0 if ROHC packet is too small, 6 if SDVL discriminator is unknown

Variable Documentation

◆ rohc_decomp_rfc5225_ip_esp_profile

const struct rohc_decomp_profile rohc_decomp_rfc5225_ip_esp_profile
Initial value:
=
{
.msn_max_bits = 32,
}
static void decomp_rfc5225_ip_esp_update_ctxt(struct rohc_decomp_ctxt *const context, const struct rohc_rfc5225_decoded *const decoded, const size_t payload_len, bool *const do_change_mode)
Update the decompression context with the infos of current packet.
Definition: decomp_rfc5225_ip_esp.c:2951
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:395
static rohc_status_t decomp_rfc5225_ip_esp_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_rfc5225_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 ROHCv2 IP/ESP profile.
Definition: decomp_rfc5225_ip_esp.c:2547
static bool decomp_rfc5225_ip_esp_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, void *const extr_bits)
Attempt a packet/context repair upon CRC failure.
Definition: decomp_rfc5225_ip_esp.c:3037
static uint32_t decomp_rfc5225_ip_esp_get_sn(const struct rohc_decomp_ctxt *const context)
Get the reference SN value of the context.
Definition: decomp_rfc5225_ip_esp.c:3060
static bool decomp_rfc5225_ip_esp_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_rfc5225_bits *const bits, size_t *const rohc_hdr_len)
Parse one ROHC packet for the ROHCv2 IP/ESP profile.
Definition: decomp_rfc5225_ip_esp.c:558
void(* rohc_decomp_free_context_t)(void *const persist_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
Definition: rohc_decomp_internals.h:354
static bool decomp_rfc5225_ip_esp_new_context(const struct rohc_decomp_ctxt *const context, void **const persist_ctxt, struct rohc_decomp_volat_ctxt *const volat_ctxt)
Create the ROHCv2 IP/ESP volatile and persistent parts of the context.
Definition: decomp_rfc5225_ip_esp.c:403
static void decomp_rfc5225_ip_esp_free_context(struct rohc_decomp_rfc5225_ip_esp_ctxt *const rfc5225_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
Destroy profile-specific data, nothing to destroy for the ROHCv2 IP/ESP profile.
Definition: decomp_rfc5225_ip_esp.c:466
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:364
static rohc_packet_t decomp_rfc5225_ip_esp_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 ROHCv2 IP/ESP profile.
Definition: decomp_rfc5225_ip_esp.c:490
Definition: rohc_profiles.h:115
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:389
static rohc_status_t decomp_rfc5225_ip_esp_decode_bits(const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_bits *const bits, const size_t payload_len, struct rohc_rfc5225_decoded *const decoded)
Decode values from extracted bits for the ROHCv2 IP/ESP profile.
Definition: decomp_rfc5225_ip_esp.c:2100
rohc_status_t(* 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:373
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:379

Define the decompression part of the ROHCv2 IP/ESP profile as described in the RFC 5225.