ROHC compression/decompression library
Functions | Variables
d_ip.c File Reference

ROHC decompression context for the IP-only profile. More...

#include "d_ip.h"
#include "rohc_traces_internal.h"
#include "rohc_bit_ops.h"
#include "rohc_packets.h"
#include "rohc_debug.h"
#include "rohc_utils.h"
#include "rohc_decomp_detect_packet.h"
#include <assert.h>
Include dependency graph for d_ip.c:

Functions

static bool d_ip_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 IP decompression context. More...
 
static void d_ip_destroy (struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Destroy the given IP-only context. More...
 
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. More...
 
int ip_parse_dynamic_ip (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, const size_t length, struct rohc_extr_bits *const bits)
 Parse the IP dynamic part of the ROHC packet. More...
 
int ip_parse_ext3 (const struct rohc_decomp_ctxt *const context, const uint8_t *const rohc_data, const size_t rohc_data_len, const rohc_packet_t packet_type, struct rohc_extr_bits *const bits)
 Parse the extension 3 of the UOR-2 packet. More...
 
int parse_inner_header_flags (const struct rohc_decomp_ctxt *const context, const uint8_t *const flags, const uint8_t *fields, const size_t length, struct rohc_extr_ip_bits *const bits)
 Parse the inner IP header flags and fields. More...
 
int parse_outer_header_flags (const struct rohc_decomp_ctxt *const context, const uint8_t *const flags, const uint8_t *fields, const size_t length, struct rohc_extr_ip_bits *const bits)
 Parse the outer IP header flags and fields. More...
 

Variables

const struct rohc_decomp_profile d_ip_profile
 Define the decompression part of the IP-only profile as described in the RFC 3843. More...
 

Detailed Description

ROHC decompression context for the IP-only 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

◆ d_ip_create()

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

◆ d_ip_destroy()

static void d_ip_destroy ( struct rohc_decomp_rfc3095_ctxt *const  rfc3095_ctxt,
const struct rohc_decomp_volat_ctxt *const  volat_ctxt 
)
static

Destroy the given IP-only 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

◆ ip_detect_packet_type()

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.

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

◆ ip_parse_dynamic_ip()

int ip_parse_dynamic_ip ( const struct rohc_decomp_ctxt *const  context,
const uint8_t *  packet,
const size_t  length,
struct rohc_extr_bits *const  bits 
)

Parse the IP dynamic part of the ROHC packet.

Parameters
contextThe decompression context
packetThe ROHC packet to parse
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

◆ ip_parse_ext3()

int ip_parse_ext3 ( const struct rohc_decomp_ctxt *const  context,
const uint8_t *const  rohc_data,
const size_t  rohc_data_len,
const rohc_packet_t  packet_type,
struct rohc_extr_bits *const  bits 
)

Parse the extension 3 of the UOR-2 packet.

 Extension 3 for non-RTP profiles (5.7.5 & 5.11.4):

       0     1     2     3     4     5     6     7
    +-----+-----+-----+-----+-----+-----+-----+-----+
 1  |  1     1  |  S  |   Mode    |  I  | ip  | ip2 |
    +-----+-----+-----+-----+-----+-----+-----+-----+
 2  |            Inner IP header flags        |     |  if ip = 1
    +-----+-----+-----+-----+-----+-----+-----+-----+
 3  |            Outer IP header flags              |  if ip2 = 1
    +-----+-----+-----+-----+-----+-----+-----+-----+
 4  |                      SN                       |  if S = 1
    +-----+-----+-----+-----+-----+-----+-----+-----+
    |                                               |
 5  /            Inner IP header fields             /  variable,
    |                                               |  if ip = 1
    +-----+-----+-----+-----+-----+-----+-----+-----+
 6  |                     IP-ID                     |  2 octets, if I = 1
    +-----+-----+-----+-----+-----+-----+-----+-----+
    |                                               |
 7  /            Outer IP header fields             /  variable,
    |                                               |  if ip2 = 1
    +-----+-----+-----+-----+-----+-----+-----+-----+
Parameters
contextThe decompression context
rohc_dataThe ROHC data to parse
rohc_data_lenThe length of the ROHC data to parse
packet_typeThe type of ROHC packet to parse
bitsIN: the bits already found in base header OUT: the bits found in the extension header 3
Returns
The data length read from the ROHC packet, -1 in case of error

◆ parse_inner_header_flags()

int parse_inner_header_flags ( const struct rohc_decomp_ctxt *const  context,
const uint8_t *const  flags,
const uint8_t *  fields,
const size_t  length,
struct rohc_extr_ip_bits *const  bits 
)

Parse the inner IP header flags and fields.

Store the values in an IP header info structure.

  Inner IP header flags (5.7.5):

       0     1     2     3     4     5     6     7
     ..... ..... ..... ..... ..... ..... ..... .....
    | TOS | TTL | DF  | PR  | IPX | NBO | RND | ip2 |  if ip = 1
     ..... ..... ..... ..... ..... ..... ..... .....

  Inner IP header fields (5.7.5):

    ..... ..... ..... ..... ..... ..... ..... .....
   |         Type of Service/Traffic Class         |  if TOS = 1
    ..... ..... ..... ..... ..... ..... ..... .....
   |         Time to Live/Hop Limit                |  if TTL = 1
    ..... ..... ..... ..... ..... ..... ..... .....
   |         Protocol/Next Header                  |  if PR = 1
    ..... ..... ..... ..... ..... ..... ..... .....
   /         IP extension headers                  /  variable,
    ..... ..... ..... ..... ..... ..... ..... .....   if IPX = 1
Parameters
contextThe decompression context
flagsThe ROHC flags that indicate which IP fields are present in the packet
fieldsThe ROHC packet part that contains some IP header fields
lengthThe length of the ROHC packet part that contains some IP header fields
bitsOUT: The bits extracted from extension 3
Returns
The data length read from the ROHC packet, -1 in case of error

◆ parse_outer_header_flags()

int parse_outer_header_flags ( const struct rohc_decomp_ctxt *const  context,
const uint8_t *const  flags,
const uint8_t *  fields,
const size_t  length,
struct rohc_extr_ip_bits *const  bits 
)

Parse the outer IP header flags and fields.

Store the values in an IP header info structure.

  Outer IP header flags (5.7.5):

       0     1     2     3     4     5     6     7
     ..... ..... ..... ..... ..... ..... ..... .....
    | TOS2| TTL2| DF2 | PR2 |IPX2 |NBO2 |RND2 |  I2 |  if ip2 = 1
     ..... ..... ..... ..... ..... ..... ..... .....

  Outer IP header fields

     ..... ..... ..... ..... ..... ..... ..... .....
    |      Type of Service/Traffic Class            |  if TOS2 = 1
     ..... ..... ..... ..... ..... ..... ..... .....
    |         Time to Live/Hop Limit                |  if TTL2 = 1
     ..... ..... ..... ..... ..... ..... ..... .....
    |         Protocol/Next Header                  |  if PR2 = 1
     ..... ..... ..... ..... ..... ..... ..... .....
    /         IP extension header(s)                /  variable,
     ..... ..... ..... ..... ..... ..... ..... .....    if IPX2 = 1
    |                  IP-ID                        |  2 octets,
     ..... ..... ..... ..... ..... ..... ..... .....    if I2 = 1
Parameters
contextThe decompression context
flagsThe ROHC flags that indicate which IP fields are present in the packet
fieldsThe ROHC packet part that contain some IP header fields
lengthThe length of the ROHC packet part that contains some IP header fields
bitsOUT: The bits extracted from extension 3
Returns
The data length read from the ROHC packet, -1 in case of error

Variable Documentation

◆ d_ip_profile

const struct rohc_decomp_profile d_ip_profile
Initial value:
=
{
.msn_max_bits = 16,
.detect_pkt_type = ip_detect_packet_type,
}
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:5635
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:5438
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:1327
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
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:373
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:349
static bool d_ip_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 IP decompression context.
Definition: d_ip.c:65
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:505
Definition: rohc.h:221
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:6141
static void d_ip_destroy(struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
Destroy the given IP-only context.
Definition: d_ip.c:112
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
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:128
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
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
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_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 IP-only profile as described in the RFC 3843.