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

ROHC decompression context for the UDP-Lite profile. More...

#include "d_ip.h"
#include "d_udp.h"
#include "rohc_decomp_rfc3095.h"
#include "rohc_bit_ops.h"
#include "rohc_traces_internal.h"
#include "rohc_debug.h"
#include "rohc_utils.h"
#include "rohc_packets.h"
#include "crc.h"
#include "protocols/udp_lite.h"
#include <string.h>
Include dependency graph for d_udp_lite.c:

Data Structures

struct  d_udp_lite_context
 Define the UDP-Lite part of the decompression profile context. More...
 

Functions

static bool d_udp_lite_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 UDP-Lite decompression context. More...
 
static void d_udp_lite_destroy (struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
 Destroy the context. More...
 
static rohc_packet_t udp_lite_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 the UDP-Lite profile. More...
 
static bool d_udp_lite_parse (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)
 Decode one IR, IR-DYN or UO* packet for UDP-Lite profile. More...
 
static int udp_lite_parse_dynamic_udp (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, const size_t length, struct rohc_extr_bits *const bits)
 Parse the UDP-Lite dynamic part of the ROHC packet. More...
 
static int udp_lite_parse_uo_remainder (const struct rohc_decomp_ctxt *const context, const uint8_t *packet, unsigned int length, struct rohc_extr_bits *const bits)
 Parse the UDP-Lite remainder of the UO* ROHC packets. More...
 
static bool udp_lite_decode_values_from_bits (const struct rohc_decomp_ctxt *context, const struct rohc_extr_bits *const bits, struct rohc_decoded_values *const decoded)
 Decode UDP-Lite values from extracted bits. More...
 
static int udp_lite_build_uncomp_udp (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 UDP-Lite header. More...
 
static void udp_lite_update_context (struct rohc_decomp_ctxt *const context, const struct rohc_decoded_values *const decoded)
 Update context with decoded UDP-Lite values. More...
 

Variables

const struct rohc_decomp_profile d_udplite_profile
 Define the decompression part of the UDP-Lite profile as described in the RFC 4019. More...
 

Detailed Description

ROHC decompression context for the UDP-Lite 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_udp_lite_create()

static bool d_udp_lite_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 UDP-Lite decompression context.

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

Parameters
contextThe main 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-Lite context was successfully created, false if a problem occurred

◆ d_udp_lite_destroy()

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

◆ d_udp_lite_parse()

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

Decode one IR, IR-DYN or UO* packet for UDP-Lite 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 decode
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 header
[out]bitsThe bits extracted from the ROHC header
[out]rohc_hdr_lenThe length of the ROHC header (in bytes)
Returns
true if packet is successfully parsed, false otherwise

◆ udp_lite_build_uncomp_udp()

static int udp_lite_build_uncomp_udp ( 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 UDP-Lite header.

Todo:
check for dest size before writing into it
Parameters
contextThe decompression context
decodedThe values decoded from the ROHC header
destThe buffer to store the UDP-Lite header
payload_lenThe length of the UDP-Lite payload
Returns
The length of the next header (ie. the UDP-Lite header), -1 in case of error

◆ udp_lite_decode_values_from_bits()

static bool udp_lite_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 UDP-Lite values from extracted bits.

The following values are decoded:

  • UDP-Lite source port
  • UDP-Lite destination port
  • UDP-Lite checksum
  • UDP-Lite Checksum Coverage (CC)
Parameters
contextThe decompression context
bitsThe extracted bits
decodedOUT: The corresponding decoded values
Returns
true if decoding is successful, false otherwise

◆ udp_lite_detect_packet_type()

static rohc_packet_t udp_lite_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 
)
static

Detect the type of ROHC packet for the UDP-Lite profile.

Parse optional CCE packet type, then normal packet type.

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

◆ udp_lite_parse_dynamic_udp()

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

Parse the UDP-Lite 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

◆ udp_lite_parse_uo_remainder()

static int udp_lite_parse_uo_remainder ( const struct rohc_decomp_ctxt *const  context,
const uint8_t *  packet,
unsigned int  length,
struct rohc_extr_bits *const  bits 
)
static

Parse the UDP-Lite remainder of the UO* ROHC packets.

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

◆ udp_lite_update_context()

static void udp_lite_update_context ( struct rohc_decomp_ctxt *const  context,
const struct rohc_decoded_values *const  decoded 
)
static

Update context with decoded UDP-Lite values.

The following decoded values are updated in context:

  • UDP-Lite source port
  • UDP-Lite destination port
Parameters
contextThe decompression context
decodedThe decoded values to update in the context

Variable Documentation

◆ d_udplite_profile

const struct rohc_decomp_profile d_udplite_profile
Initial value:
=
{
.msn_max_bits = 16,
.detect_pkt_type = udp_lite_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
static rohc_packet_t udp_lite_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 the UDP-Lite profile.
Definition: d_udp_lite.c:262
static bool d_udp_lite_parse(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)
Decode one IR, IR-DYN or UO* packet for UDP-Lite profile.
Definition: d_udp_lite.c:337
static void d_udp_lite_destroy(struct rohc_decomp_rfc3095_ctxt *const rfc3095_ctxt, const struct rohc_decomp_volat_ctxt *const volat_ctxt)
Destroy the context.
Definition: d_udp_lite.c:237
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_udp_lite_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 UDP-Lite decompression context.
Definition: d_udp_lite.c:137
Definition: rohc.h:230
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
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
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 UDP-Lite profile as described in the RFC 4019.