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

ROHC compression routines. More...

#include "rohc.h"
#include "rohc_packets.h"
#include <stdlib.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

Defines

#define ROHC_EXPORT

Typedefs

typedef int(* rohc_comp_random_cb_t )(const struct rohc_comp *const comp, void *const user_context) __attribute__((nonnull(1)))

Enumerations

enum  rohc_c_state { IR = 1, FO = 2, SO = 3 }
 The different ROHC compressor states. 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.
bool ROHC_EXPORT rohc_comp_set_random_cb (struct rohc_comp *const comp, rohc_comp_random_cb_t callback, void *const user_context) __attribute__((nonnull(1
bool ROHC_EXPORT int ROHC_EXPORT rohc_compress (struct rohc_comp *comp, unsigned char *ibuf, int isize, unsigned char *obuf, int osize)
 Compress a ROHC packet.
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.
void ROHC_EXPORT rohc_activate_profile (struct rohc_comp *comp, int profile)
 Activate a profile 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). The MRRU is ignored for the moment.
void ROHC_EXPORT rohc_c_set_max_cid (struct rohc_comp *compressor, int value)
 Set the maximal CID value the compressor should use.
void ROHC_EXPORT rohc_c_set_large_cid (struct rohc_comp *compressor, int value)
 Tell the compressor to use large CIDs.
void ROHC_EXPORT rohc_c_set_enable (struct rohc_comp *compressor, int value)
 Enable the 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)
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.
int ROHC_EXPORT rohc_feedback_flush (struct rohc_comp *comp, unsigned char *obuf, int osize)
 Send as much feedback data as possible.
bool rohc_comp_set_wlsb_window_width (struct rohc_comp *const comp, const size_t width) __attribute__((nonnull(1)
bool rohc_comp_set_periodic_refreshes (struct rohc_comp *const comp, const size_t ir_timeout, const size_t fo_timeout) __attribute__((nonnull(1)
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.
const char *ROHC_EXPORT rohc_comp_get_state_descr (const rohc_c_state state)
 Give a description for the given ROHC compression context state.

Variables

bool warn_unused_result

Detailed Description

ROHC compression routines.

Author:
Didier Barvaux <didier.barvaux@toulouse.viveris.com>
The hackers from ROHC for Linux

Define Documentation

#define ROHC_EXPORT

Macro that handles DLL export declarations gracefully


Typedef Documentation

typedef int(* rohc_comp_random_cb_t)(const struct rohc_comp *const comp, void *const user_context) __attribute__((nonnull(1)))

The prototype of the callback for random numbers


Enumeration Type Documentation

The different ROHC compressor states.

See 4.3.1 in the RFC 3095.

If you add a new compressor state, please also add the corresponding textual description in rohc_comp_get_state_descr.

Enumerator:
IR 

The Initialization and Refresh (IR) state

FO 

The First Order (FO) state

SO 

The Second Order (SO) state


Function Documentation

void ROHC_EXPORT c_deliver_feedback ( struct rohc_comp comp,
unsigned char *  packet,
int  size 
)

Callback called by a decompressor to 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

References c_feedback::acktype, c_feedback::cid, medium::cid_type, d_decode_add_cid(), d_is_add_cid(), c_feedback::data, c_profile::feedback, rohc_comp::medium, c_context::num_recv_feedbacks, c_context::profile, rohc_debugf, ROHC_LARGE_CID, sdvl_decode(), c_feedback::size, c_feedback::specific_offset, c_feedback::specific_size, c_feedback::type, and zfree.

void ROHC_EXPORT c_piggyback_feedback ( struct rohc_comp comp,
unsigned char *  feedback,
int  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

References rohc_feedback::data, FEEDBACK_RING_SIZE, rohc_comp::feedbacks, rohc_comp::feedbacks_first, rohc_comp::feedbacks_next, rohc_feedback::length, and rohc_debugf.

Referenced by d_change_mode_feedback(), and d_optimistic_feedback().

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.

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

References c_mean_wlsb(), c_sum_wlsb(), c_context::cid, rohc_comp::contexts, c_profile::description, c_context::first_used, c_context::header_16_compressed, c_context::header_16_uncompressed, c_context::header_compressed_size, c_context::header_uncompressed_size, c_context::latest_used, c_context::mode, rohc_comp::num_contexts, c_context::num_recv_feedbacks, c_context::num_sent_ir, c_context::num_sent_ir_dyn, c_context::num_sent_packets, c_context::profile, rohc_comp_get_state_descr(), rohc_get_mode_descr(), c_context::state, c_context::total_16_compressed, c_context::total_16_uncompressed, c_context::total_compressed_size, c_context::total_uncompressed_size, and c_context::used.

Referenced by rohc_c_statistics().

bool rohc_comp_set_periodic_refreshes ( struct rohc_comp *const  comp,
const size_t  ir_timeout,
const size_t  fo_timeout 
)
bool ROHC_EXPORT rohc_comp_set_random_cb ( struct rohc_comp *const  comp,
rohc_comp_random_cb_t  callback,
void *const  user_context 
)
bool rohc_comp_set_wlsb_window_width ( struct rohc_comp *const  comp,
const size_t  width 
)

Variable Documentation