|
ROHC compression/decompression library
|
ROHC compression routines. More...
#include <netinet/ip.h>#include <netinet/udp.h>#include <string.h>#include <stdbool.h>#include "rohc.h"#include <stdlib.h>#include "cid.h"

Go to the source code of this file.
Classes | |
| struct | rohc_feedback |
| Information on ROHC feedback data. More... | |
| struct | rohc_comp |
| The ROHC compressor. More... | |
| struct | c_context |
| The ROHC compression context. More... | |
| struct | c_profile |
| The ROHC compression profile. More... | |
| struct | c_feedback |
| The feedback packet. More... | |
Defines | |
| #define | C_NUM_PROFILES 5 |
| The number of ROHC profiles ready to be used. | |
| #define | FEEDBACK_BUFFER_SIZE 10 |
| The maximal number of outgoing feedbacks that can be queued. | |
Enumerations | |
| enum | rohc_c_state { IR = 1, FO = 2, SO = 3 } |
| ROHC compressor states (see 4.3.1 in the RFC 3095) More... | |
Functions | |
| struct rohc_comp * | rohc_alloc_compressor (int max_cid, int jam_use, int adapt_size, int encap_size) |
| Create one ROHC compressor. | |
| void | rohc_free_compressor (struct rohc_comp *comp) |
| Destroy one ROHC compressor. | |
| int | rohc_compress (struct rohc_comp *comp, unsigned char *ibuf, int isize, unsigned char *obuf, int osize) |
| Compress a ROHC packet. | |
| int | rohc_c_info (char *buffer) |
| Get information about available compression profiles. | |
| int | rohc_c_statistics (struct rohc_comp *comp, unsigned int indent, char *buffer) |
| Get information about a ROHC compressor. | |
| int | rohc_c_context (struct rohc_comp *comp, int cid, unsigned int indent, char *buffer) |
| Get information about a compression context. | |
| int | rohc_c_is_enabled (struct rohc_comp *comp) |
| Whether the ROHC compressor is enabled or not. | |
| int | rohc_c_using_small_cid (struct rohc_comp *comp) |
| Whether the compressor uses small CID or not. | |
| struct c_context * | c_create_context (struct rohc_comp *, struct c_profile *profile, struct ip_packet ip) |
| Create a compression context. | |
| struct c_context * | c_find_context (struct rohc_comp *, struct c_profile *profile, struct ip_packet ip) |
| Find a compression context given a profile and an IP packet. | |
| struct c_context * | c_get_context (struct rohc_comp *, int cid) |
| Find out a context given its CID. | |
| struct c_profile * | c_get_profile_from_packet (struct rohc_comp *comp, struct ip_packet *outer_ip, struct ip_packet *inner_ip, int protocol) |
| Find out a ROHC profile given an IP protocol ID. | |
| struct c_profile * | c_get_profile_from_id (struct rohc_comp *comp, int profile_id) |
| Find out a ROHC profile given a profile ID. | |
| void | rohc_activate_profile (struct rohc_comp *comp, int profile) |
| Activate a profile for a compressor. | |
| void | c_piggyback_feedback (struct rohc_comp *comp, unsigned char *packet, int size) |
| Add a feedback packet to the next outgoing ROHC packet (piggybacking) | |
| void | 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_feedback_flush (struct rohc_comp *comp, unsigned char *obuf, int osize) |
| Send as much feedback data as possible. | |
| void | 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_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_c_set_max_cid (struct rohc_comp *compressor, int value) |
| Set the maximal CID value the compressor should use. | |
| void | rohc_c_set_large_cid (struct rohc_comp *compressor, int value) |
| Tell the compressor to use large CIDs. | |
| void | rohc_c_set_enable (struct rohc_comp *compressor, int value) |
| Enable the ROHC compressor. | |
ROHC compression routines.
| #define C_NUM_PROFILES 5 |
The number of ROHC profiles ready to be used.
Referenced by c_get_profile_from_id(), c_get_profile_from_packet(), rohc_activate_profile(), rohc_alloc_compressor(), rohc_c_info(), and rohc_c_statistics().
| #define FEEDBACK_BUFFER_SIZE 10 |
The maximal number of outgoing feedbacks that can be queued.
Referenced by c_piggyback_feedback(), and rohc_alloc_compressor().
| enum rohc_c_state |
| struct c_context* c_create_context | ( | struct rohc_comp * | comp, |
| struct c_profile * | profile, | ||
| struct ip_packet | ip | ||
| ) | [read] |
Create a compression context.
| comp | The ROHC compressor |
| profile | The profile to associate the context with |
| ip | The IP packet to initialize the context |
References c_alloc_contexts(), c_context::cid, c_context::compressor, rohc_comp::contexts, c_profile::create, c_profile::destroy, c_context::first_used, c_context::header_compressed_size, c_context::header_last_compressed_size, c_context::header_last_uncompressed_size, c_context::header_uncompressed_size, IR, c_context::latest_used, c_context::mode, rohc_comp::num_contexts, rohc_comp::num_contexts_used, 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_debugf, c_context::state, c_context::total_compressed_size, c_context::total_last_compressed_size, c_context::total_last_uncompressed_size, c_context::total_uncompressed_size, U_MODE, and c_context::used.
Referenced by rohc_compress().
| void 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.
| comp | The ROHC compressor |
| packet | The feedback data |
| size | The length of the feedback packet |
References c_feedback::acktype, c_get_context(), c_feedback::cid, medium::cid_type, d_decode_add_cid(), d_is_add_cid(), d_sdvalue_decode(), d_sdvalue_size(), c_feedback::data, c_profile::feedback, rohc_comp::medium, c_context::num_recv_feedbacks, c_context::profile, rohc_debugf, c_feedback::size, c_feedback::specific_offset, c_feedback::specific_size, c_feedback::type, and zfree.
| struct c_context* c_find_context | ( | struct rohc_comp * | comp, |
| struct c_profile * | profile, | ||
| struct ip_packet | ip | ||
| ) | [read] |
Find a compression context given a profile and an IP packet.
| comp | The ROHC compressor |
| profile | The profile the context must be associated with |
| ip | The IP packet that must be accepted by the context |
References c_profile::check_context, c_context::cid, rohc_comp::contexts, c_profile::id, rohc_comp::num_contexts, c_context::profile, rohc_debugf, and c_context::used.
Referenced by rohc_compress().
| struct c_context* c_get_context | ( | struct rohc_comp * | comp, |
| int | cid | ||
| ) | [read] |
Find out a context given its CID.
| comp | The ROHC compressor |
| cid | The CID of the context to find |
References c_context::cid, rohc_comp::contexts, rohc_comp::num_contexts, and c_context::used.
Referenced by c_deliver_feedback().
| struct c_profile* c_get_profile_from_id | ( | struct rohc_comp * | comp, |
| int | profile_id | ||
| ) | [read] |
Find out a ROHC profile given a profile ID.
| comp | The ROHC compressor |
| profile_id | The ID of the ROHC profile to find out |
References C_NUM_PROFILES, and rohc_comp::profiles.
Referenced by rohc_compress().
| struct c_profile* c_get_profile_from_packet | ( | struct rohc_comp * | comp, |
| struct ip_packet * | outer_ip, | ||
| struct ip_packet * | inner_ip, | ||
| int | protocol | ||
| ) | [read] |
Find out a ROHC profile given an IP protocol ID.
| comp | The ROHC compressor |
| outer_ip | The outer IP header of the network packet that will help choosing the best profile |
| inner_ip |
|
| protocol | The transport protocol of the network packet |
References c_is_in_list(), C_NUM_PROFILES, c_profile::description, ip_get_hdrlen(), ip_get_next_layer(), ip_get_plen(), ip_is_fragment(), IPV4, IPV6, rohc_comp::profiles, rohc_debugf, ROHC_PROFILE_RTP, ROHC_PROFILE_UNCOMPRESSED, and ip_packet::version.
Referenced by rohc_compress().
| void c_piggyback_feedback | ( | struct rohc_comp * | comp, |
| unsigned char * | feedback, | ||
| int | size | ||
| ) |
Add a feedback packet to the next outgoing ROHC packet (piggybacking)
| comp | The ROHC compressor |
| feedback | The feedback data |
| size | The length of the feedback packet |
References rohc_feedback::data, FEEDBACK_BUFFER_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_c_context | ( | struct rohc_comp * | comp, |
| int | cid, | ||
| unsigned int | indent, | ||
| char * | buffer | ||
| ) |
Get information about a compression context.
This function outputs XML.
| comp | The ROHC compressor |
| cid | The CID of the compressor context to output information about |
| indent | The indent level to beautify the XML output |
| buffer | The buffer where to store the information |
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, 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().
1.7.6.1