ROHC compression/decompression library
Data Structures | Defines | Typedefs | Enumerations | Functions
rohc_comp.h File Reference

ROHC compression routines. More...

#include <rohc/rohc.h>
#include <rohc/rohc_packets.h>
#include <rohc/rohc_traces.h>
#include <rohc/rohc_time.h>
#include <rohc/rohc_buf.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
Include dependency graph for rohc_comp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rohc_comp_last_packet_info_t
 Some information about the last compressed packet. More...
struct  rohc_comp_last_packet_info2_t
 Some information about the last compressed packet. More...
struct  rohc_comp_general_info_t
 Some general information about the compressor. More...

Defines

#define ROHC_EXPORT

Typedefs

typedef bool(* rohc_rtp_detection_callback_t )(const unsigned char *const ip, const unsigned char *const udp, const unsigned char *const payload, const unsigned int payload_size, void *const rtp_private)
 The prototype of the RTP detection callback.
typedef int(* rohc_comp_random_cb_t )(const struct rohc_comp *const comp, void *const user_context)
 The prototype of the callback for random numbers.

Enumerations

enum  rohc_c_state { IR = 1, FO = 2, SO = 3 }
 The different ROHC compressor states. More...
enum  rohc_comp_state_t { ROHC_COMP_STATE_IR = 1, ROHC_COMP_STATE_FO = 2, ROHC_COMP_STATE_SO = 3 }
 The different ROHC compressor states. More...
enum  rohc_comp_features_t { ROHC_COMP_FEATURE_NONE = 0, ROHC_COMP_FEATURE_COMPAT_1_6_x = (1 << 0), ROHC_COMP_FEATURE_NO_IP_CHECKSUMS = (1 << 2) }
 The different features of the ROHC compressor. More...

Functions

struct rohc_comp *ROHC_EXPORT rohc_alloc_compressor (int max_cid, int jam_use, int adapt_size, int encap_size)
 Create one ROHC compressor.
void ROHC_EXPORT rohc_free_compressor (struct rohc_comp *comp)
 Destroy one ROHC compressor.
struct rohc_comp *ROHC_EXPORT rohc_comp_new (const rohc_cid_type_t cid_type, const rohc_cid_t max_cid)
 Create a new ROHC compressor.
struct rohc_comp *ROHC_EXPORT rohc_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.
void ROHC_EXPORT rohc_comp_free (struct rohc_comp *const comp)
 Destroy the given ROHC compressor.
bool ROHC_EXPORT rohc_comp_set_traces_cb (struct rohc_comp *const comp, rohc_trace_callback_t callback)
 Set the callback function used to manage traces in compressor.
bool ROHC_EXPORT 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.
bool ROHC_EXPORT rohc_comp_set_random_cb (struct rohc_comp *const comp, rohc_comp_random_cb_t callback, void *const user_context)
 Set the user-defined callback for random numbers.
int ROHC_EXPORT rohc_compress (struct rohc_comp *comp, unsigned char *ibuf, int isize, unsigned char *obuf, int osize)
 Compress the given uncompressed packet into a ROHC packet.
int ROHC_EXPORT rohc_compress2 (struct rohc_comp *const comp, const unsigned char *const uncomp_packet, const size_t uncomp_packet_len, unsigned char *const rohc_packet, const size_t rohc_packet_max_len, size_t *const rohc_packet_len)
 Compress the given uncompressed packet into a ROHC packet.
int ROHC_EXPORT rohc_compress3 (struct rohc_comp *const comp, const struct rohc_ts arrival_time, const unsigned char *const uncomp_packet, const size_t uncomp_packet_len, unsigned char *const rohc_packet, const size_t rohc_packet_max_len, size_t *const rohc_packet_len)
 Compress the given uncompressed packet into a ROHC packet.
rohc_status_t ROHC_EXPORT 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.
int ROHC_EXPORT rohc_comp_get_segment (struct rohc_comp *const comp, unsigned char *const segment, const size_t max_len, size_t *const len)
 Get the next ROHC segment if any.
rohc_status_t ROHC_EXPORT rohc_comp_get_segment2 (struct rohc_comp *const comp, struct rohc_buf *const segment)
 Get the next ROHC segment if any.
bool ROHC_EXPORT rohc_comp_force_contexts_reinit (struct rohc_comp *const comp)
 Force the compressor to re-initialize all its contexts.
int ROHC_EXPORT rohc_c_is_enabled (struct rohc_comp *comp)
 Whether the ROHC compressor is enabled or not.
int ROHC_EXPORT rohc_c_using_small_cid (struct rohc_comp *comp)
 Whether the compressor uses small CID or not.
bool ROHC_EXPORT rohc_comp_profile_enabled (const struct rohc_comp *const comp, const rohc_profile_t profile)
 Is the given compression profile enabled for a compressor?
void ROHC_EXPORT rohc_activate_profile (struct rohc_comp *comp, int profile)
 Activate a profile for a compressor.
bool ROHC_EXPORT rohc_comp_enable_profile (struct rohc_comp *const comp, const rohc_profile_t profile)
 Enable a compression profile for a compressor.
bool ROHC_EXPORT rohc_comp_disable_profile (struct rohc_comp *const comp, const rohc_profile_t profile)
 Disable a compression profile for a compressor.
bool ROHC_EXPORT rohc_comp_enable_profiles (struct rohc_comp *const comp,...)
 Enable several compression profiles for a compressor.
bool ROHC_EXPORT rohc_comp_disable_profiles (struct rohc_comp *const comp,...)
 Disable several compression profiles for a compressor.
void ROHC_EXPORT rohc_c_set_header (struct rohc_comp *compressor, int value)
 Set the maximal header size. The maximal header size is ignored for the moment.
void ROHC_EXPORT rohc_c_set_mrru (struct rohc_comp *compressor, int value)
 Set the Maximum Reconstructed Reception Unit (MRRU).
bool ROHC_EXPORT rohc_comp_set_mrru (struct rohc_comp *const comp, const size_t mrru)
 Set the Maximum Reconstructed Reception Unit (MRRU).
bool ROHC_EXPORT rohc_comp_get_mrru (const struct rohc_comp *const comp, size_t *const mrru)
 Get the Maximum Reconstructed Reception Unit (MRRU).
void ROHC_EXPORT rohc_c_set_max_cid (struct rohc_comp *compressor, int value)
 Set the maximal CID value the compressor should use.
bool ROHC_EXPORT rohc_comp_get_max_cid (const struct rohc_comp *const comp, size_t *const max_cid)
 Get the maximal CID value the compressor uses.
void ROHC_EXPORT rohc_c_set_large_cid (struct rohc_comp *compressor, int value)
 Tell the compressor to use large CIDs.
bool ROHC_EXPORT 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.
void ROHC_EXPORT rohc_c_set_enable (struct rohc_comp *compressor, int value)
 Enable the ROHC compressor.
bool ROHC_EXPORT rohc_comp_add_rtp_port (struct rohc_comp *const comp, const unsigned int port)
 Add a port to the list of UDP ports dedicated for RTP traffic.
bool ROHC_EXPORT rohc_comp_remove_rtp_port (struct rohc_comp *const comp, const unsigned int port)
 Remove a port from the list of UDP ports dedicated to RTP traffic.
bool ROHC_EXPORT rohc_comp_reset_rtp_ports (struct rohc_comp *const comp)
 Reset the list of dedicated RTP ports.
bool ROHC_EXPORT 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.
bool ROHC_EXPORT rohc_comp_set_features (struct rohc_comp *const comp, const rohc_comp_features_t features)
 Enable/disable features for ROHC compressor.
void ROHC_EXPORT c_piggyback_feedback (struct rohc_comp *comp, unsigned char *packet, int size)
 Add a feedback packet to the next outgoing ROHC packet (piggybacking)
bool ROHC_EXPORT __rohc_comp_piggyback_feedback (struct rohc_comp *const comp, const unsigned char *const feedback, const size_t size)
 Add a feedback packet to the next outgoing ROHC packet (piggybacking)
bool ROHC_EXPORT rohc_comp_piggyback_feedback (struct rohc_comp *const comp, const unsigned char *const feedback, const size_t size)
 Add a feedback packet to the next outgoing ROHC packet (piggybacking)
void ROHC_EXPORT c_deliver_feedback (struct rohc_comp *comp, unsigned char *feedback, int size)
 Callback called by a decompressor to deliver a feedback packet to the compressor.
bool ROHC_EXPORT __rohc_comp_deliver_feedback (struct rohc_comp *const comp, const uint8_t *const feedback, const size_t size)
 Deliver a feedback packet to the compressor.
bool ROHC_EXPORT rohc_comp_deliver_feedback (struct rohc_comp *const comp, const uint8_t *const feedback, const size_t size)
 Deliver a feedback packet to the compressor.
bool ROHC_EXPORT rohc_comp_deliver_feedback2 (struct rohc_comp *const comp, const struct rohc_buf feedback)
 Deliver a feedback packet to the compressor.
int ROHC_EXPORT rohc_feedback_flush (struct rohc_comp *comp, unsigned char *obuf, int osize)
 Send as much feedback data as possible.
size_t ROHC_EXPORT rohc_feedback_avail_bytes (const struct rohc_comp *const comp)
 How many bytes of unsent feedback data are available at compressor?
bool ROHC_EXPORT rohc_feedback_remove_locked (struct rohc_comp *const comp)
 Remove all feedbacks locked during the packet build.
bool ROHC_EXPORT rohc_feedback_unlock (struct rohc_comp *const comp)
 Unlock all feedbacks locked during the packet build.
bool ROHC_EXPORT 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.
bool ROHC_EXPORT rohc_comp_set_periodic_refreshes (struct rohc_comp *const comp, const size_t ir_timeout, const size_t fo_timeout)
 Set the timeout values for IR and FO periodic refreshes.
bool ROHC_EXPORT 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.
int ROHC_EXPORT rohc_c_info (char *buffer)
 Get information about available compression profiles.
int ROHC_EXPORT rohc_c_statistics (struct rohc_comp *comp, unsigned int indent, char *buffer)
 Get information about a ROHC compressor.
int ROHC_EXPORT rohc_c_context (struct rohc_comp *comp, int cid, unsigned int indent, char *buffer)
 Get information about a compression context.
int ROHC_EXPORT rohc_comp_get_last_packet_info (const struct rohc_comp *const comp, rohc_comp_last_packet_info_t *const info)
 Get some information about the last compressed packet.
bool ROHC_EXPORT 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.
bool ROHC_EXPORT 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.
const char *ROHC_EXPORT rohc_comp_get_state_descr (const rohc_comp_state_t state)
 Give a description for the given ROHC compression context state.

Detailed Description

ROHC compression routines.

Author:
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
Didier Barvaux <didier@barvaux.org>

Define Documentation

#define ROHC_EXPORT

Macro that handles DLL export declarations gracefully


Function Documentation

bool ROHC_EXPORT __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.

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
bool ROHC_EXPORT __rohc_comp_piggyback_feedback ( struct rohc_comp *const  comp,
const unsigned char *const  feedback,
const size_t  size 
)

Add a feedback packet to the next outgoing ROHC packet (piggybacking)

Parameters:
compThe ROHC compressor
feedbackThe feedback data
sizeThe length of the feedback packet
Returns:
true in case of success, false otherwise
int ROHC_EXPORT rohc_c_context ( struct rohc_comp comp,
int  cid,
unsigned int  indent,
char *  buffer 
)

Get information about a compression context.

This function outputs XML.

Deprecated:
do not use this function anymore, use rohc_comp_get_general_info() instead
Parameters:
compThe ROHC compressor
cidThe CID of the compressor context to output information about
indentThe indent level to beautify the XML output
bufferThe buffer where to store the information
Returns:
The length of the data stored in the buffer if successful, -2 if the given CID is too large, -1 if the given CID is unused or an error occurs