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

ROHC decompression context for the ROHCv2 IP/UDP 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 <string.h>
Include dependency graph for decomp_rfc5225_ip_udp.c:

Data Structures

struct  rohc_decomp_rfc5225_ip_udp_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_udp_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/UDP volatile and persistent parts of the context. More...
 
static void decomp_rfc5225_ip_udp_free_context (struct rohc_decomp_rfc5225_ip_udp_ctxt *const rfc5225_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Destroy profile-specific data, nothing to destroy for the ROHCv2 IP/UDP profile. More...
 
static rohc_packet_t decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static void decomp_rfc5225_ip_udp_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_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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_udp_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_udp_parse_static_udp (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 UDP static part of the ROHC packet. More...
 
static bool decomp_rfc5225_ip_udp_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_udp_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_udp_parse_dyn_udp (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 UDP dynamic part of the ROHC packet. More...
 
static bool decomp_rfc5225_ip_udp_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_udp_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 int decomp_rfc5225_ip_udp_parse_irreg_udp (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 UDP dynamic part of the ROHC packet. More...
 
static rohc_status_t decomp_rfc5225_ip_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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_udp_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 uint16_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_udp_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/UDP profile. More...
 
static bool decomp_rfc5225_ip_udp_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_udp_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_udp_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_udp_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_udp_build_udp_hdr (const struct rohc_decomp_ctxt *const ctxt, const struct rohc_rfc5225_decoded *const decoded, const size_t payload_len, struct rohc_buf *const uncomp_pkt, size_t *const udp_hdr_len)
 Build the uncompressed UDP header. More...
 
static void decomp_rfc5225_ip_udp_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_udp_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_udp_get_sn (const struct rohc_decomp_ctxt *const context)
 Get the reference SN value of the context. More...
 

Variables

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

Detailed Description

ROHC decompression context for the ROHCv2 IP/UDP 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_udp_attempt_repair()

static bool decomp_rfc5225_ip_udp_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_udp_build_hdrs()

static rohc_status_t decomp_rfc5225_ip_udp_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/UDP 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_udp_build_ip_hdr()

static bool decomp_rfc5225_ip_udp_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_udp_build_ip_hdrs()

static bool decomp_rfc5225_ip_udp_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_udp_build_ipv4_hdr()

static bool decomp_rfc5225_ip_udp_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_udp_build_ipv6_hdr()

static bool decomp_rfc5225_ip_udp_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_udp_build_udp_hdr()

static bool decomp_rfc5225_ip_udp_build_udp_hdr ( const struct rohc_decomp_ctxt *const  ctxt,
const struct rohc_rfc5225_decoded *const  decoded,
const size_t  payload_len,
struct rohc_buf *const  uncomp_pkt,
size_t *const  udp_hdr_len 
)
static

Build the uncompressed UDP header.

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

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

◆ decomp_rfc5225_ip_udp_decode_bits()

static rohc_status_t decomp_rfc5225_ip_udp_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/UDP 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_udp_decode_bits_ip_hdr()

static bool decomp_rfc5225_ip_udp_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 uint16_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_udp_decode_bits_ip_hdrs()

static bool decomp_rfc5225_ip_udp_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_udp_detect_pkt_type()

static rohc_packet_t decomp_rfc5225_ip_udp_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/UDP 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_udp_free_context()

static void decomp_rfc5225_ip_udp_free_context ( struct rohc_decomp_rfc5225_ip_udp_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/UDP 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/UDP profile
volat_ctxtThe volatile part of the decompression context

◆ decomp_rfc5225_ip_udp_get_sn()

static uint32_t decomp_rfc5225_ip_udp_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/UDP 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_udp_new_context()

static bool decomp_rfc5225_ip_udp_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/UDP 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/UDP context was successfully created, false if a problem occurred

◆ decomp_rfc5225_ip_udp_parse_co()

static bool decomp_rfc5225_ip_udp_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/UDP 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_udp_parse_co_common()

static bool decomp_rfc5225_ip_udp_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/UDP 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_udp_parse_co_repair()

static bool decomp_rfc5225_ip_udp_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/UDP 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_udp_parse_dyn_chain()

static bool decomp_rfc5225_ip_udp_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_udp_parse_dyn_ip()

static int decomp_rfc5225_ip_udp_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_udp_parse_dyn_udp()

static int decomp_rfc5225_ip_udp_parse_dyn_udp ( 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 UDP 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_udp_parse_ir()

static bool decomp_rfc5225_ip_udp_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/UDP 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_udp_parse_irreg_chain()

static bool decomp_rfc5225_ip_udp_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_udp_parse_irreg_ip()

static int decomp_rfc5225_ip_udp_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_udp_parse_irreg_udp()

static int decomp_rfc5225_ip_udp_parse_irreg_udp ( 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 UDP 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_udp_parse_pkt()

static bool decomp_rfc5225_ip_udp_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/UDP 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_udp_parse_pt_0_crc3()

static bool decomp_rfc5225_ip_udp_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/UDP 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_udp_parse_pt_0_crc7()

static bool decomp_rfc5225_ip_udp_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/UDP 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_udp_parse_pt_1_seq_id()

static bool decomp_rfc5225_ip_udp_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/UDP 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_udp_parse_pt_2_seq_id()

static bool decomp_rfc5225_ip_udp_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/UDP 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_udp_parse_static_chain()

static bool decomp_rfc5225_ip_udp_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_udp_parse_static_ip()

static int decomp_rfc5225_ip_udp_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_udp_parse_static_udp()

static int decomp_rfc5225_ip_udp_parse_static_udp ( 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 UDP 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_udp_reset_extr_bits()

static void decomp_rfc5225_ip_udp_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_udp_update_ctxt()

static void decomp_rfc5225_ip_udp_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

Variable Documentation

◆ rohc_decomp_rfc5225_ip_udp_profile

const struct rohc_decomp_profile rohc_decomp_rfc5225_ip_udp_profile
Initial value:
=
{
.msn_max_bits = 16,
}
static bool decomp_rfc5225_ip_udp_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/UDP volatile and persistent parts of the context.
Definition: decomp_rfc5225_ip_udp.c:413
static bool decomp_rfc5225_ip_udp_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_udp.c:3171
static uint32_t decomp_rfc5225_ip_udp_get_sn(const struct rohc_decomp_ctxt *const context)
Get the reference SN value of the context.
Definition: decomp_rfc5225_ip_udp.c:3194
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_packet_t decomp_rfc5225_ip_udp_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/UDP profile.
Definition: decomp_rfc5225_ip_udp.c:500
Definition: rohc_profiles.h:113
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 rohc_status_t decomp_rfc5225_ip_udp_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/UDP profile.
Definition: decomp_rfc5225_ip_udp.c:2183
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 void decomp_rfc5225_ip_udp_free_context(struct rohc_decomp_rfc5225_ip_udp_ctxt *const rfc5225_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
Destroy profile-specific data, nothing to destroy for the ROHCv2 IP/UDP profile.
Definition: decomp_rfc5225_ip_udp.c:476
static void decomp_rfc5225_ip_udp_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_udp.c:3082
static rohc_status_t decomp_rfc5225_ip_udp_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/UDP profile.
Definition: decomp_rfc5225_ip_udp.c:2670
static bool decomp_rfc5225_ip_udp_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/UDP profile.
Definition: decomp_rfc5225_ip_udp.c:568
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
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/UDP profile as described in the RFC 5225.