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

ROHC compression routines. More...

#include "rohc_comp.h"
#include "rohc_comp_internals.h"
#include "rohc_packets.h"
#include "rohc_traces.h"
#include "rohc_traces_internal.h"
#include "rohc_time_internal.h"
#include "rohc_debug.h"
#include "rohc_utils.h"
#include "sdvl.h"
#include "rohc_add_cid.h"
#include "rohc_bit_ops.h"
#include "ip.h"
#include "crc.h"
#include "protocols/ip.h"
#include "schemes/ipv6_exts.h"
#include "protocols/udp.h"
#include "protocols/ip_numbers.h"
#include "c_tcp_opts_list.h"
#include "feedback_parse.h"
#include "hashtable.h"
#include "hashtable_cr.h"
#include "config.h"
#include <string.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
#include <stdarg.h>
Include dependency graph for rohc_comp.c:

Enumerations

enum  rohc_ctxt_affinity_t { ROHC_AFFINITY_NONE = 0, ROHC_AFFINITY_LOW = 1, ROHC_AFFINITY_MED = 2, ROHC_AFFINITY_HIGH = 3 }
 

Functions

static rohc_profile_t rohc_comp_get_profile (const struct rohc_comp *const comp, const struct rohc_buf *const packet, struct rohc_fingerprint *const fingerprint, struct rohc_pkt_hdrs *const pkt_hdrs)
 Get the best compression profile for the given network packet. More...
 
static bool rohc_comp_are_ip_hdrs_supported (const struct rohc_comp *const comp, const uint8_t *const packet, const size_t packet_len, struct rohc_fingerprint *const fingerprint, struct rohc_pkt_hdrs *const pkt_hdrs, size_t *const all_ip_hdrs_len, size_t *const all_ipv6_exts_len)
 Are the given IP headers supported? More...
 
static rohc_profile_t rohc_comp_get_profile_l4 (const struct rohc_comp *const comp, const struct rohc_buf *const packet, const rohc_profile_t l3_profile, const size_t all_ipv6_exts_len, const uint8_t l4_proto, const uint8_t *const l4_data, const size_t l4_len, struct rohc_fingerprint *const fingerprint, struct rohc_pkt_hdrs *const pkt_hdrs)
 Get the best compression profile for the given network packet. More...
 
static bool rohc_comp_is_tcp_hdr_supported (const struct rohc_comp *const comp, const uint8_t *const packet, const size_t packet_len, struct rohc_pkt_hdrs *const pkt_hdrs, size_t *const tcp_hdr_full_len)
 Is the given TCP header supported? More...
 
static bool rohc_comp_is_rtp_hdr_supported (const struct rohc_comp *const comp, const uint8_t *const packet, const size_t packet_len, struct rohc_pkt_hdrs *const pkt_hdrs)
 Is the given RTP header supported? More...
 
static bool rohc_comp_profile_enabled_nocheck (const struct rohc_comp *const comp, const rohc_profile_t profile)
 Is the given compression profile enabled for a compressor? More...
 
static bool c_create_contexts (struct rohc_comp *const comp)
 Create the array of compression contexts. More...
 
static void c_destroy_contexts (struct rohc_comp *const comp)
 Destroy all the compression contexts in the context array. More...
 
static struct rohc_comp_ctxtc_create_context (struct rohc_comp *const comp, const struct rohc_comp_profile *const profile, const struct rohc_fingerprint *const fingerprint, const struct rohc_pkt_hdrs *const pkt_hdrs, const struct rohc_ts pkt_time)
 Create a compression context. More...
 
static struct rohc_comp_ctxtrohc_comp_find_ctxt (struct rohc_comp *const comp, const struct rohc_comp_profile *const profile, const struct rohc_buf *const packet, const struct rohc_fingerprint *const pkt_fingerprint, const struct rohc_pkt_hdrs *const pkt_hdrs)
 Find a compression context given an IP packet. More...
 
static struct rohc_comp_ctxtc_get_context (struct rohc_comp *const comp, const rohc_cid_t cid)
 Find out a context given its CID. More...
 
static rohc_ctxt_affinity_t rohc_comp_get_ctxt_affinity (const struct rohc_comp_ctxt *const ctxt, const struct rohc_fingerprint *const pkt_fingerprint, const struct rohc_pkt_hdrs *const pkt_hdrs)
 Compute the affinity between the given packet and context. More...
 
static void rohc_comp_decide_state (struct rohc_comp_ctxt *const context, struct rohc_ts pkt_time)
 Decide the state that should be used for the next packet. More...
 
static void rohc_comp_periodic_down_transition (struct rohc_comp_ctxt *const context, const struct rohc_ts pkt_time)
 Periodically change the context state after a certain number of packets. More...
 
static bool __rohc_comp_deliver_feedback (struct rohc_comp *const comp, const uint8_t *const packet, const size_t size)
 Deliver a feedback packet to the compressor. More...
 
static bool rohc_comp_feedback_parse_cid (const struct rohc_comp *const comp, const uint8_t *const feedback, const size_t feedback_len, rohc_cid_t *const cid, size_t *const cid_len)
 Parse ROHC feedback CID. More...
 
static bool rohc_comp_feedback_parse_opt_sn (const struct rohc_comp_ctxt *const context, const uint8_t *const feedback_data, const size_t feedback_data_len, uint32_t *const sn_bits, size_t *const sn_bits_nr)
 Parse the FEEDBACK-2 SN option. More...
 
static bool rohc_comp_feedback_check_opts (const struct rohc_comp_ctxt *const context, const size_t opts_present[ROHC_FEEDBACK_OPT_MAX])
 Check FEEDBACK-2 options. More...
 
struct rohc_comprohc_comp_new2 (const rohc_cid_type_t cid_type, const rohc_cid_t max_cid, const rohc_comp_random_cb_t rand_cb, void *const rand_priv)
 Create a new ROHC compressor. More...
 
void rohc_comp_free (struct rohc_comp *const comp)
 Destroy the given ROHC compressor. More...
 
bool rohc_comp_set_traces_cb2 (struct rohc_comp *const comp, rohc_trace_callback2_t callback, void *const priv_ctxt)
 Set the callback function used to manage traces in compressor. More...
 
rohc_status_t rohc_compress4 (struct rohc_comp *const comp, const struct rohc_buf uncomp_packet, struct rohc_buf *const rohc_packet)
 Compress the given uncompressed packet into a ROHC packet. More...
 
rohc_status_t rohc_comp_pad (struct rohc_comp *const comp, struct rohc_buf *const rohc_pkt, const size_t min_pkt_len)
 Pad the given ROHC compressed packet. More...
 
rohc_status_t rohc_comp_get_segment2 (struct rohc_comp *const comp, struct rohc_buf *const segment)
 Get the next ROHC segment if any. More...
 
bool rohc_comp_force_contexts_reinit (struct rohc_comp *const comp)
 Force the compressor to re-initialize all its contexts. More...
 
bool rohc_comp_set_optimistic_approach (struct rohc_comp *const comp, const size_t repetitions_nr)
 Set the number of repetitions required to gain transmission confidence. More...
 
bool rohc_comp_set_wlsb_window_width (struct rohc_comp *const comp, const size_t width)
 Set the window width for the W-LSB encoding scheme. More...
 
bool rohc_comp_set_reorder_ratio (struct rohc_comp *const comp, const rohc_reordering_offset_t reorder_ratio)
 Set the reordering ratio for the W-LSB encoding scheme. More...
 
bool rohc_comp_set_periodic_refreshes (struct rohc_comp *const comp, const size_t ir_timeout, const size_t fo_timeout)
 Set the timeouts in packets for IR and FO periodic refreshes. More...
 
bool rohc_comp_set_periodic_refreshes_time (struct rohc_comp *const comp, const uint64_t ir_timeout, const uint64_t fo_timeout)
 Set the timeouts in ms for IR and FO periodic refreshes. More...
 
bool rohc_comp_set_list_trans_nr (struct rohc_comp *const comp, const size_t list_trans_nr)
 Set the number of uncompressed transmissions for list compression. More...
 
bool rohc_comp_set_rtp_detection_cb (struct rohc_comp *const comp, rohc_rtp_detection_callback_t callback, void *const rtp_private)
 Set the RTP detection callback function. More...
 
bool rohc_comp_profile_enabled (const struct rohc_comp *const comp, const rohc_profile_t profile)
 Is the given compression profile enabled for a compressor? More...
 
bool rohc_comp_enable_profile (struct rohc_comp *const comp, const rohc_profile_t profile)
 Enable a compression profile for a compressor. More...
 
bool rohc_comp_disable_profile (struct rohc_comp *const comp, const rohc_profile_t profile)
 Disable a compression profile for a compressor. More...
 
bool rohc_comp_enable_profiles (struct rohc_comp *const comp,...)
 Enable several compression profiles for a compressor. More...
 
bool rohc_comp_disable_profiles (struct rohc_comp *const comp,...)
 Disable several compression profiles for a compressor. More...
 
bool rohc_comp_set_mrru (struct rohc_comp *const comp, const size_t mrru)
 Set the Maximum Reconstructed Reception Unit (MRRU). More...
 
bool rohc_comp_get_mrru (const struct rohc_comp *const comp, size_t *const mrru)
 Get the Maximum Reconstructed Reception Unit (MRRU). More...
 
bool rohc_comp_get_max_cid (const struct rohc_comp *const comp, size_t *const max_cid)
 Get the maximal CID value the compressor uses. More...
 
bool rohc_comp_get_cid_type (const struct rohc_comp *const comp, rohc_cid_type_t *const cid_type)
 Get the CID type that the compressor uses. More...
 
bool rohc_comp_set_features (struct rohc_comp *const comp, const rohc_comp_features_t features)
 Enable/disable features for ROHC compressor. More...
 
bool rohc_comp_deliver_feedback2 (struct rohc_comp *const comp, const struct rohc_buf feedback)
 Deliver a feedback packet to the compressor. More...
 
bool rohc_comp_get_last_packet_info2 (const struct rohc_comp *const comp, rohc_comp_last_packet_info2_t *const info)
 Get some information about the last compressed packet. More...
 
bool rohc_comp_get_general_info (const struct rohc_comp *const comp, rohc_comp_general_info_t *const info)
 Get some general information about the compressor. More...
 
const char * rohc_comp_get_state_descr (const rohc_comp_state_t state)
 Give a description for the given ROHC compression context state. More...
 
void rohc_comp_change_mode (struct rohc_comp_ctxt *const context, const rohc_mode_t new_mode)
 Change the mode of the context. More...
 
void rohc_comp_change_state (struct rohc_comp_ctxt *const context, const rohc_comp_state_t new_state)
 Change the state of the context. More...
 
bool rohc_comp_reinit_context (struct rohc_comp_ctxt *const context)
 Re-initialize the given context. More...
 
bool rohc_comp_feedback_parse_opts (const struct rohc_comp_ctxt *const context, const uint8_t *const packet, const size_t packet_len, const uint8_t *const feedback_data, const size_t feedback_data_len, size_t opts_present[ROHC_FEEDBACK_OPT_MAX], uint32_t *const sn_bits, size_t *const sn_bits_nr, const rohc_feedback_crc_t crc_type, uint8_t crc_in_packet, size_t crc_pos_from_end)
 Parse FEEDBACK-2 options. More...
 

Variables

const struct rohc_comp_profile c_rtp_profile
 Define the compression part of the RTP profile as described in the RFC 3095. More...
 
const struct rohc_comp_profile c_udp_profile
 Define the compression part of the UDP profile as described in the RFC 3095. More...
 
const struct rohc_comp_profile c_esp_profile
 Define the compression part of the ESP profile as described in the RFC 3095. More...
 
const struct rohc_comp_profile c_tcp_profile
 Define the compression part of the TCP profile as described in the RFC 3095. More...
 
const struct rohc_comp_profile c_ip_profile
 Define the compression part of the IP-only profile as described in the RFC 3843. More...
 
const struct rohc_comp_profile c_uncompressed_profile
 Define the compression part of the Uncompressed profile as described in the RFC 3095. More...
 
const struct rohc_comp_profile rohc_comp_rfc5225_ip_profile
 Define the compression part of the ROHCv2 IP-only profile as described in the RFC 5225. More...
 
const struct rohc_comp_profile rohc_comp_rfc5225_ip_udp_profile
 Define the compression part of the ROHCv2 IP/UDP profile as described in the RFC 5225. More...
 
const struct rohc_comp_profile rohc_comp_rfc5225_ip_esp_profile
 Define the compression part of the ROHCv2 IP/ESP profile as described in the RFC 5225. More...
 
const struct rohc_comp_profile rohc_comp_rfc5225_ip_udp_rtp_profile
 Define the compression part of the ROHCv2 IP/UDP/RTP profile as described in the RFC 5225. More...
 
static const struct rohc_comp_profile *const rohc_comp_profiles [ROHC_PROFILE_ID_MAJOR_MAX+1][ROHC_PROFILE_ID_MINOR_MAX+1]
 

Detailed Description

ROHC compression routines.

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
David Moreau from TAS

Enumeration Type Documentation

◆ rohc_ctxt_affinity_t

The affinity between packet and context

Enumerator
ROHC_AFFINITY_NONE 
ROHC_AFFINITY_LOW 
ROHC_AFFINITY_MED 
ROHC_AFFINITY_HIGH 

Function Documentation

◆ __rohc_comp_deliver_feedback()

static bool __rohc_comp_deliver_feedback ( struct rohc_comp *const  comp,
const uint8_t *const  packet,
const size_t  size 
)
static

Deliver a feedback packet to the compressor.

When feedback is received by the decompressor, this function is called and delivers the feedback to the right profile/context of the compressor.

Parameters
compThe ROHC compressor
packetThe feedback data
sizeThe length of the feedback packet
Returns
true if the feedback was successfully taken into account, false if the feedback could not be taken into account

◆ c_create_context()

static struct rohc_comp_ctxt * c_create_context ( struct rohc_comp *const  comp,
const struct rohc_comp_profile *const  profile,
const struct rohc_fingerprint *const  fingerprint,
const struct rohc_pkt_hdrs *const  pkt_hdrs,
const struct rohc_ts  pkt_time 
)
static

Create a compression context.

Parameters
compThe ROHC compressor
profileThe profile to associate the context with
fingerprintThe packet/context fingerprint
pkt_hdrsThe information collected about packet headers
pkt_timeThe arrival time of the packet
Returns
The compression context if successful, NULL otherwise

◆ c_create_contexts()

static bool c_create_contexts ( struct rohc_comp *const  comp)
static

Create the array of compression contexts.

Parameters
compThe ROHC compressor
Returns
true if the creation is successful, false otherwise

◆ c_destroy_contexts()

static void c_destroy_contexts ( struct rohc_comp *const  comp)
static

Destroy all the compression contexts in the context array.

The profile-specific contexts are also destroyed.

Parameters
compThe ROHC compressor

◆ c_get_context()

static struct rohc_comp_ctxt * c_get_context ( struct rohc_comp *const  comp,
const rohc_cid_t  cid 
)
static

Find out a context given its CID.

Parameters
compThe ROHC compressor
cidThe CID of the context to find
Returns
The context with the given CID if found, NULL otherwise

◆ rohc_comp_are_ip_hdrs_supported()

static bool rohc_comp_are_ip_hdrs_supported ( const struct rohc_comp *const  comp,
const uint8_t *const  packet,
const size_t  packet_len,
struct rohc_fingerprint *const  fingerprint,
struct rohc_pkt_hdrs *const  pkt_hdrs,
size_t *const  all_ip_hdrs_len,
size_t *const  all_ipv6_exts_len 
)
static

Are the given IP headers supported?

Parameters
compThe ROHC compressor to compress the packet with
packetThe packet to search the best compression profile for
packet_lenThe length (in bytes) of the uncompressed packet
[out]fingerprintThe fingerprint computed on the packet to later help finding the best compression context
[out]pkt_hdrsThe information collected about the packet headers, may be used later during the detection of changes with the compression context, thus avoiding another packet parsing
[out]all_ip_hdrs_lenThe length (in bytes) of the parsed IP headers
[out]all_ipv6_exts_lenThe length (in bytes) of the parsed IP extension headers
Returns
The ID of the best compression profile to compress the packet

◆ rohc_comp_change_mode()

void rohc_comp_change_mode ( struct rohc_comp_ctxt *const  context,
const rohc_mode_t  new_mode 
)

Change the mode of the context.

Parameters
contextThe compression context
new_modeThe new mode the context must enter in

◆ rohc_comp_change_state()

void rohc_comp_change_state ( struct rohc_comp_ctxt *const  context,
const rohc_comp_state_t  new_state 
)

Change the state of the context.

Parameters
contextThe compression context
new_stateThe new state the context must enter in

◆ rohc_comp_decide_state()

static void rohc_comp_decide_state ( struct rohc_comp_ctxt *const  context,
struct rohc_ts  pkt_time 
)
static

Decide the state that should be used for the next packet.

The three states are:

  • Initialization and Refresh (IR),
  • First Order (FO),
  • Second Order (SO).
Parameters
contextThe compression context
pkt_timeThe time of packet arrival

◆ rohc_comp_feedback_check_opts()

static bool rohc_comp_feedback_check_opts ( const struct rohc_comp_ctxt *const  context,
const size_t  opts_present[ROHC_FEEDBACK_OPT_MAX] 
)
static

Check FEEDBACK-2 options.

sanity checks:

  • some profiles do not support all options
  • some options cannot be specified multiple times
  • some options cannot be specified without CRC
Parameters
contextThe ROHC decompression context
opts_presentWhether options are present or not
Returns
true if feedback options are valid, false if feedback options are not valid

◆ rohc_comp_feedback_parse_cid()

static bool rohc_comp_feedback_parse_cid ( const struct rohc_comp *const  comp,
const uint8_t *const  feedback,
const size_t  feedback_len,
rohc_cid_t *const  cid,
size_t *const  cid_len 
)
static

Parse ROHC feedback CID.

Parameters
compThe ROHC compressor
feedbackThe ROHC feedback data to parse
feedback_lenThe length of the ROHC feedback data
[out]cidThe CID of the ROHC feedback
[out]cid_lenThe length of the CID of the ROHC feedback
Returns
true if feedback CID was successfully parsed, false if feedback CID is malformed

◆ rohc_comp_feedback_parse_opt_sn()

static bool rohc_comp_feedback_parse_opt_sn ( const struct rohc_comp_ctxt *const  context,
const uint8_t *const  feedback_data,
const size_t  feedback_data_len,
uint32_t *const  sn_bits,
size_t *const  sn_bits_nr 
)
static

Parse the FEEDBACK-2 SN option.

Parameters
contextThe ROHC decompression context
feedback_dataThe feedback data without the CID bits
feedback_data_lenThe length of the feedback data without the CID bits
[out]sn_bitsin: the SN bits collected in base header out: the SN bits collected in base header and options
[out]sn_bits_nrin: the number of SN bits collected in base header out: the number of SN bits collected in base header and options
Returns
true if feedback options were successfully parsed, false if feedback options were malformed or CRC is wrong

◆ rohc_comp_feedback_parse_opts()

bool rohc_comp_feedback_parse_opts ( const struct rohc_comp_ctxt *const  context,
const uint8_t *const  packet,
const size_t  packet_len,
const uint8_t *const  feedback_data,
const size_t  feedback_data_len,
size_t  opts_present[ROHC_FEEDBACK_OPT_MAX],
uint32_t *const  sn_bits,
size_t *const  sn_bits_nr,
const rohc_feedback_crc_t  crc_type,
uint8_t  crc_in_packet,
size_t  crc_pos_from_end 
)

Parse FEEDBACK-2 options.

Parameters
contextThe ROHC decompression context
packetThe whole feedback packet with CID bits
packet_lenThe length of the whole feedback packet with CID bits
feedback_dataThe feedback data without the CID bits
feedback_data_lenThe length of the feedback data without the CID bits
[out]opts_presentWhether options are present or not
[out]sn_bitsin: the SN bits collected in base header out: the SN bits collected in base header and options
[out]sn_bits_nrin: the number of SN bits collected in base header out: the number of SN bits collected in base header and options
crc_typeWhether the CRC is present in base header or in option
crc_in_packetThe CRC of the feedback packet
crc_pos_from_endThe position of the CRC byte from the end of the feedback packet
Returns
true if feedback options were successfully parsed, false if feedback options were malformed or CRC is wrong

◆ rohc_comp_find_ctxt()

static struct rohc_comp_ctxt * rohc_comp_find_ctxt ( struct rohc_comp *const  comp,
const struct rohc_comp_profile *const  profile,
const struct rohc_buf *const  packet,
const struct rohc_fingerprint *const  pkt_fingerprint,
const struct rohc_pkt_hdrs *const  pkt_hdrs 
)
static

Find a compression context given an IP packet.

Parameters
compThe ROHC compressor
profileThe profile to use
packetThe packet to find a compression context for
pkt_fingerprintThe packet fingerprint
pkt_hdrsThe information collected about packet headers
Returns
The context if found or successfully created, NULL if not found

◆ rohc_comp_get_ctxt_affinity()

static rohc_ctxt_affinity_t rohc_comp_get_ctxt_affinity ( const struct rohc_comp_ctxt *const  ctxt,
const struct rohc_fingerprint *const  pkt_fingerprint,
const struct rohc_pkt_hdrs *const  pkt_hdrs 
)
static

Compute the affinity between the given packet and context.

Parameters
ctxtThe context to compute the affinity with
pkt_fingerprintThe fingerprint of the packet to compute the affinity with
pkt_hdrsThe information collected about packet headers
Returns
The affinity between the packet and context

◆ rohc_comp_get_profile()

static rohc_profile_t rohc_comp_get_profile ( const struct rohc_comp *const  comp,
const struct rohc_buf *const  packet,
struct rohc_fingerprint *const  fingerprint,
struct rohc_pkt_hdrs *const  pkt_hdrs 
)
static

Get the best compression profile for the given network packet.

Parameters
compThe ROHC compressor to compress the packet with
packetThe packet to search the best compression profile for
[out]fingerprintThe computed fingerprint of the packet to later help finding the best compression context
[out]pkt_hdrsThe information collected about the packet headers, may be used later during the detection of changes with the compression context, thus avoiding another packet parsing
Returns
The ID of the best compression profile to compress the packet

◆ rohc_comp_get_profile_l4()

static rohc_profile_t rohc_comp_get_profile_l4 ( const struct rohc_comp *const  comp,
const struct rohc_buf *const  packet,
const rohc_profile_t  l3_profile,
const size_t  all_ipv6_exts_len,
const uint8_t  l4_proto,
const uint8_t *const  l4_data,
const size_t  l4_len,
struct rohc_fingerprint *const  fingerprint,
struct rohc_pkt_hdrs *const  pkt_hdrs 
)
static

Get the best compression profile for the given network packet.

Parameters
compThe ROHC compressor to compress the packet with
packetThe packet to search the best compression profile for
l3_profileThe best ROHC profile identified for layer-3 headers
all_ipv6_exts_lenThe length of the IPv6 extension headers
l4_protoThe IP protocol type of the layer-4 header
l4_dataThe layer-4 header to search the best profile for
l4_lenThe length of the layer-4 header
[out]fingerprintThe computed fingerprint of the packet to later help finding the best compression context
[out]pkt_hdrsThe information collected about the packet headers, may be used later during the detection of changes with the compression context, thus avoiding another packet parsing
Returns
The ID of the best compression profile to compress the packet

◆ rohc_comp_is_rtp_hdr_supported()

static bool rohc_comp_is_rtp_hdr_supported ( const struct rohc_comp *const  comp,
const uint8_t *const  packet,
const size_t  packet_len,
struct rohc_pkt_hdrs *const  pkt_hdrs 
)
static

Is the given RTP header supported?

Parameters
compThe ROHC compressor to compress the packet with
packetThe uncompressed packet to search the best compression profile for
packet_lenThe length (in bytes) of the uncompressed packet
[out]pkt_hdrsThe information collected about the packet headers, may be used later during the detection of changes with the compression context, thus avoiding another packet parsing
Returns
The ID of the best compression profile to compress the packet

◆ rohc_comp_is_tcp_hdr_supported()

static bool rohc_comp_is_tcp_hdr_supported ( const struct rohc_comp *const  comp,
const uint8_t *const  packet,
const size_t  packet_len,
struct rohc_pkt_hdrs *const  pkt_hdrs,
size_t *const  tcp_hdr_full_len 
)
static

Is the given TCP header supported?

Parameters
compThe ROHC compressor to compress the packet with
packetThe TCP packet to search the best compression profile for
packet_lenThe length (in bytes) of the uncompressed packet
[out]pkt_hdrsThe information collected about the packet headers, may be used later during the detection of changes with the compression context, thus avoiding another packet parsing
[out]tcp_hdr_full_lenThe length of the TCP header including options
Returns
The ID of the best compression profile to compress the packet

◆ rohc_comp_periodic_down_transition()

static void rohc_comp_periodic_down_transition ( struct rohc_comp_ctxt *const  context,
const struct rohc_ts  pkt_time 
)
static

Periodically change the context state after a certain number of packets.

Parameters
contextThe compression context
pkt_timeThe time of packet arrival

◆ rohc_comp_profile_enabled_nocheck()

static bool rohc_comp_profile_enabled_nocheck ( const struct rohc_comp *const  comp,
const rohc_profile_t  profile 
)
static

Is the given compression profile enabled for a compressor?

Parameters
compThe ROHC compressor, shall be valid
profileThe profile to ask status for
Returns
Possible return values:
  • true if the profile exists and is enabled,
  • false if the profile does not exist,
  • false if the profile is disabled
See also
rohc_comp_profile_enabled

◆ rohc_comp_reinit_context()

bool rohc_comp_reinit_context ( struct rohc_comp_ctxt *const  context)

Re-initialize the given context.

Make the context restart its initialization with decompressor, ie. it goes in the lowest compression state.

Parameters
contextThe compression context to re-initialize
Returns
true in case of success, false otherwise

Variable Documentation

◆ c_esp_profile

const struct rohc_comp_profile c_esp_profile

Define the compression part of the ESP profile as described in the RFC 3095.

◆ c_ip_profile

const struct rohc_comp_profile c_ip_profile

Define the compression part of the IP-only profile as described in the RFC 3843.

◆ c_rtp_profile

const struct rohc_comp_profile c_rtp_profile

Define the compression part of the RTP profile as described in the RFC 3095.

◆ c_tcp_profile

const struct rohc_comp_profile c_tcp_profile

Define the compression part of the TCP profile as described in the RFC 3095.

◆ c_udp_profile

const struct rohc_comp_profile c_udp_profile

Define the compression part of the UDP profile as described in the RFC 3095.

◆ c_uncompressed_profile

const struct rohc_comp_profile c_uncompressed_profile

Define the compression part of the Uncompressed profile as described in the RFC 3095.

◆ rohc_comp_profiles

const struct rohc_comp_profile* const rohc_comp_profiles[ROHC_PROFILE_ID_MAJOR_MAX+1][ROHC_PROFILE_ID_MINOR_MAX+1]
static
Initial value:
=
{
[0] = {
[1] = &c_rtp_profile,
[2] = &c_udp_profile,
[3] = &c_esp_profile,
[4] = &c_ip_profile,
[5] = NULL,
[6] = &c_tcp_profile,
[7] = NULL,
[8] = NULL,
},
[1] = {
[0] = NULL,
[5] = NULL,
[6] = NULL,
[7] = NULL,
[8] = NULL,
},
}
const struct rohc_comp_profile rohc_comp_rfc5225_ip_esp_profile
Define the compression part of the ROHCv2 IP/ESP profile as described in the RFC 5225.
Definition: comp_rfc5225_ip_esp.c:3294
const struct rohc_comp_profile rohc_comp_rfc5225_ip_udp_profile
Define the compression part of the ROHCv2 IP/UDP profile as described in the RFC 5225.
Definition: comp_rfc5225_ip_udp.c:3297
const struct rohc_comp_profile rohc_comp_rfc5225_ip_profile
Define the compression part of the ROHCv2 IP-only profile as described in the RFC 5225...
Definition: comp_rfc5225_ip.c:3139
const struct rohc_comp_profile c_udp_profile
Define the compression part of the UDP profile as described in the RFC 3095.
Definition: c_udp.c:459
const struct rohc_comp_profile c_tcp_profile
Define the compression part of the TCP profile as described in the RFC 3095.
Definition: c_tcp.c:4757
const struct rohc_comp_profile rohc_comp_rfc5225_ip_udp_rtp_profile
Define the compression part of the ROHCv2 IP/UDP/RTP profile as described in the RFC 5225...
Definition: comp_rfc5225_ip_udp_rtp.c:2991
const struct rohc_comp_profile c_uncompressed_profile
Define the compression part of the Uncompressed profile as described in the RFC 3095.
Definition: c_uncompressed.c:479
const struct rohc_comp_profile c_rtp_profile
Define the compression part of the RTP profile as described in the RFC 3095.
Definition: c_rtp.c:1232
const struct rohc_comp_profile c_ip_profile
Define the compression part of the IP-only profile as described in the RFC 3843.
Definition: c_ip.c:399
const struct rohc_comp_profile c_esp_profile
Define the compression part of the ESP profile as described in the RFC 3095.
Definition: c_esp.c:217

The ROHC compression profiles

◆ rohc_comp_rfc5225_ip_esp_profile

const struct rohc_comp_profile rohc_comp_rfc5225_ip_esp_profile

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

◆ rohc_comp_rfc5225_ip_profile

const struct rohc_comp_profile rohc_comp_rfc5225_ip_profile

Define the compression part of the ROHCv2 IP-only profile as described in the RFC 5225.

◆ rohc_comp_rfc5225_ip_udp_profile

const struct rohc_comp_profile rohc_comp_rfc5225_ip_udp_profile

Define the compression part of the ROHCv2 IP/UDP profile as described in the RFC 5225.

◆ rohc_comp_rfc5225_ip_udp_rtp_profile

const struct rohc_comp_profile rohc_comp_rfc5225_ip_udp_rtp_profile

Define the compression part of the ROHCv2 IP/UDP/RTP profile as described in the RFC 5225.