ROHC compression/decompression library
|
ROHC generic compression context for IP-only, UDP and UDP Lite profiles. More...
#include "c_generic.h"
#include "c_rtp.h"
#include "config.h"
#include "rohc_traces.h"
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <math.h>
#include <assert.h>
Functions | |
int | code_packet (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, const unsigned char *next_header, unsigned char *dest) |
Build the ROHC packet to send. | |
int | code_IR_packet (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, const unsigned char *next_header, unsigned char *dest) |
Build the IR packet. | |
int | code_IR_DYN_packet (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, const unsigned char *next_header, unsigned char *dest) |
Build the IR-DYN packet. | |
int | code_generic_static_part (struct c_context *context, struct ip_header_info *header_info, const struct ip_packet ip, unsigned char *dest, int counter) |
Build the static part of the IR and IR-DYN packets. | |
int | code_ipv4_static_part (struct c_context *context, struct ip_header_info *header_info, const struct ip_packet ip, unsigned char *dest, int counter) |
Build the IPv4 static part of the IR and IR-DYN packets. | |
int | code_ipv6_static_part (struct c_context *context, struct ip_header_info *header_info, struct ip_packet ip, unsigned char *dest, int counter) |
Build the IPv6 static part of the IR and IR-DYN packets. | |
int | code_generic_dynamic_part (struct c_context *context, struct ip_header_info *header_info, const struct ip_packet ip, unsigned char *dest, int counter) |
Build the dynamic part of the IR and IR-DYN packets. | |
int | code_ipv4_dynamic_part (struct c_context *context, struct ip_header_info *header_info, const struct ip_packet ip, unsigned char *dest, int counter) |
Build the IPv4 dynamic part of the IR and IR-DYN packets. | |
int | code_ipv6_dynamic_part (struct c_context *context, struct ip_header_info *header_info, const struct ip_packet ip, unsigned char *dest, int counter) |
Build the IPv6 dynamic part of the IR and IR-DYN packets. | |
int | code_UO_packet_tail (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, const unsigned char *next_header, unsigned char *dest, int counter) |
Build the tail of the UO packet. | |
int | code_UO0_packet (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, const unsigned char *next_header, unsigned char *dest) |
Build the UO-0 packet. | |
int | code_UO1_packet (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, const unsigned char *next_header, unsigned char *dest) |
Build the UO-1 packet. | |
int | code_UO2_packet (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, const unsigned char *next_header, unsigned char *dest) |
Build the UO-2 packet. | |
int | code_UOR2_bytes (struct c_context *context, int extension, unsigned char *f_byte, unsigned char *s_byte, unsigned char *t_byte) |
Code some fields of the UOR-2 packet. | |
int | code_UOR2_RTP_bytes (struct c_context *context, int extension, unsigned char *f_byte, unsigned char *s_byte, unsigned char *t_byte) |
Code some fields of the UOR-2-RTP packet. | |
int | code_UOR2_TS_bytes (struct c_context *context, int extension, unsigned char *f_byte, unsigned char *s_byte, unsigned char *t_byte) |
Code some fields of the UOR-2-TS packet. | |
int | code_UOR2_ID_bytes (struct c_context *context, int extension, unsigned char *f_byte, unsigned char *s_byte, unsigned char *t_byte) |
Code some fields of the UOR-2-ID packet. | |
int | code_EXT0_packet (struct c_context *context, unsigned char *dest, int counter) |
Build the extension 0 of the UO-2 packet. | |
int | code_EXT1_packet (struct c_context *context, unsigned char *dest, int counter) |
Build the extension 1 of the UO-2 packet. | |
int | code_EXT2_packet (struct c_context *context, unsigned char *dest, int counter) |
Build the extension 2 of the UO-2 packet. | |
int | code_EXT3_packet (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, unsigned char *dest, int counter) |
Build the extension 3 of the UO-2 packet. | |
void | create_ipv6_item (unsigned char *ext, int index_table, int size, struct list_comp *comp) |
Update an IPv6 item with the extension. | |
unsigned char * | get_ipv6_extension (const struct ip_packet ip, int index) |
Extract the Nth IP extension of the IP packet. | |
int | ipv6_compare (unsigned char *ext, struct list_comp *comp, int size, int index_table) |
Ipv6 extension comparison. | |
int | get_index_ipv6_table (const struct ip_packet ip, int index) |
Return the based table index for the Nth IP extension of the IP packet. | |
int | get_ipv6_ext_size (unsigned char *ext) |
Get the size of the IPv6 extension. | |
void | decide_state (struct c_context *context) |
Decide the state that should be used for the next packet. | |
int | decide_packet (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, int size_data) |
Decide which packet to send when in the different states. | |
void | update_variables (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2) |
Update some context variables. | |
int | decide_extension (struct c_context *context) |
Decide what extension shall be used in the UO-2 packet. | |
int | rtp_header_flags_and_fields (struct c_context *context, unsigned short changed_f, const struct ip_packet ip, unsigned char *dest, int counter) |
int | header_flags (struct c_context *context, struct ip_header_info *header_info, unsigned short changed_f, const struct ip_packet ip, boolean is_outer, int nr_ip_id_bits, unsigned char *dest, int counter) |
Build inner or outer IP header flags. | |
int | header_fields (struct c_context *context, struct ip_header_info *header_info, unsigned short changed_f, const struct ip_packet ip, boolean is_outer, int nr_ip_id_bits, unsigned char *dest, int counter) |
Build inner or outer IP header fields. | |
int | changed_static_both_hdr (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2) |
Check if the static parts of the context changed in any of the two IP headers. | |
int | changed_static_one_hdr (unsigned short changed_fields, struct ip_header_info *header_info, const struct ip_packet ip, struct c_context *context) |
Check if the static part of the context changed in the new IP packet. | |
int | changed_dynamic_both_hdr (struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2) |
Check if the dynamic parts of the context changed in any of the two IP headers. | |
int | changed_dynamic_one_hdr (unsigned short changed_fields, struct ip_header_info *header_info, const struct ip_packet ip, struct c_context *context) |
Check if the dynamic part of the context changed in the IP packet. | |
unsigned short | changed_fields (struct ip_header_info *header_info, const struct ip_packet ip) |
Find the IP fields that changed between the profile and a new IP packet. | |
void | check_ip_identification (struct ip_header_info *header_info, const struct ip_packet ip) |
Determine whether the IPv4 Identification field of one IPv4 header is random and/or in Network Bit Order (NBO). | |
int | c_assessment_size (struct rohc_comp *comp, struct c_context *context, const struct ip_packet ip, int packet, int size_data, int original) |
Make an assessment of the size in byte of the paquet which will be sent. | |
int | decide_algo (struct rohc_comp *comp, struct c_context *context, const struct ip_packet ip, const struct ip_packet ip2, int packet, int size_data) |
boolean | is_changed (unsigned short changed_fields, unsigned short check_field) |
Check if a specified IP field has changed. | |
void | ip6_c_init_table (struct list_comp *comp) |
Initialize the tables IPv6 extension in compressor. | |
int | c_init_header_info (struct ip_header_info *header_info, const struct ip_packet ip) |
Initialize the inner or outer IP header info stored in the context. | |
void | c_init_tmp_variables (struct generic_tmp_variables *tmp_variables) |
Initialize all temporary variables stored in the context. | |
int | c_generic_create (struct c_context *context, const struct ip_packet ip) |
Create a new context and initialize it thanks to the given IP packet. | |
void | c_generic_destroy (struct c_context *context) |
Destroy the context. | |
void | change_mode (struct c_context *context, rohc_mode new_mode) |
Change the mode of the context. | |
void | change_state (struct c_context *context, rohc_c_state new_state) |
Change the state of the context. | |
int | c_generic_encode (struct c_context *context, const struct ip_packet ip, int packet_size, unsigned char *dest, int dest_size, int *payload_offset) |
Encode an IP packet according to a pattern decided by several different factors. | |
int | c_algo_list_compress (struct list_comp *comp, const struct ip_packet ip) |
Algorithm of compression list. | |
int | c_create_current_list (int index, struct list_comp *comp, unsigned char *ext, int index_table) |
Create the current list. | |
int | decide_type (struct list_comp *comp) |
Decide the encoding type for compression list. | |
int | encode_list (struct list_comp *comp, unsigned char *dest, int counter, int ps, int size) |
Generique encoding of compressed list. | |
int | encode_type_0 (struct list_comp *comp, unsigned char *dest, int counter, int ps) |
build Encoding type 0 | |
int | encode_type_1 (struct list_comp *comp, unsigned char *dest, int counter, int ps) |
build Encoding type 1 | |
int | encode_type_2 (struct list_comp *comp, unsigned char *dest, int counter, int ps) |
build Encoding type 2 | |
int | encode_type_3 (struct list_comp *comp, unsigned char *dest, int counter, int ps) |
build Encoding type 3 | |
void | c_generic_feedback (struct c_context *context, struct c_feedback *feedback) |
Update the profile when feedback arrives. | |
void | periodic_down_transition (struct c_context *context) |
Periodically change the context state after a certain number of packets. | |
int | decide_FO_packet (struct c_context *context) |
Decide which packet to send when in First Order (FO) state. | |
int | decide_SO_packet (const struct c_context *context) |
Decide which packet to send when in Second Order (SO) state. | |
Variables | |
const char * | generic_packet_types [] |
The description of the different ROHC packets. | |
const char * | generic_extension_types [] |
The description of the different extensions for the UO-2 packet. |
ROHC generic compression context for IP-only, UDP and UDP Lite profiles.
int c_algo_list_compress | ( | struct list_comp * | comp, |
const struct ip_packet | ip | ||
) |
Algorithm of compression list.
This function compress a generic extension list
comp | The list compressor which is specific to the extension type |
ip | The ip packet to compress |
References c_create_current_list(), c_translation::counter, list_comp::counter, list_comp::curr_list, ip_packet::data, delete_elt(), empty_list(), c_list::gen_id, get_elt(), list_comp::get_extension, list_comp::get_index_table, list_elt::index_table, insert_elt(), list_comp::islist, list_elt::item, c_translation::known, L, MAX_ITEM, list_comp::ref_list, rohc_debugf, size_list(), list_comp::trans_table, item::type, and list_comp::update_done.
Referenced by code_ipv6_dynamic_part(), and decide_packet().
int c_assessment_size | ( | struct rohc_comp * | comp, |
struct c_context * | context, | ||
const struct ip_packet | ip, | ||
int | packet, | ||
int | size_data, | ||
int | original | ||
) |
Make an assessment of the size in byte of the paquet which will be sent.
comp | The rohc compressor |
context | The context used for the compression |
ip | The packet which will be compressed |
packet | The type of the packet which will be compressed |
size_data | The size of the data in bytes |
original | Indicate if the specified packet is the original ROHC packet |
References medium::cid_type, c_profile::id, ip_get_protocol(), ip_get_version(), IPV4, rohc_comp::medium, PACKET_IR, PACKET_IR_DYN, PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, c_context::profile, rohc_debugf, ROHC_PROFILE_IP, ROHC_PROFILE_RTP, ROHC_PROFILE_UDP, and ROHC_PROFILE_UDPLITE.
Referenced by decide_algo().
int c_create_current_list | ( | int | index, |
struct list_comp * | comp, | ||
unsigned char * | ext, | ||
int | index_table | ||
) |
Create the current list.
index | the number of the extension |
comp | The list compressor which is specific to the extension type |
ext | The extension |
index_table | The index of the item in the based table |
References list_comp::based_table, list_comp::compare, c_translation::counter, list_comp::counter, list_comp::create_item, list_comp::curr_list, delete_elt(), elt_index(), get_elt(), list_comp::get_size, list_elt::index_table, insert_elt(), list_elt::item, c_translation::known, item::length, push_back(), rohc_debugf, list_comp::trans_table, and item::type.
Referenced by c_algo_list_compress().
int c_generic_create | ( | struct c_context * | context, |
const struct ip_packet | ip | ||
) |
Create a new context and initialize it thanks to the given IP packet.
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
ip | The IP packet given to initialize the new context |
References c_create_wlsb(), c_generic_destroy(), c_init_header_info(), c_init_tmp_variables(), C_WINDOW_WIDTH, c_generic_context::code_dynamic_part, c_generic_context::code_static_part, c_generic_context::code_UO_packet_head, c_generic_context::code_UO_packet_tail, c_generic_context::compute_crc_dynamic, compute_crc_dynamic(), compute_crc_static(), c_generic_context::compute_crc_static, decide_state(), c_generic_context::decide_state, c_generic_context::fo_count, c_generic_context::go_back_fo_count, c_generic_context::go_back_ir_count, c_profile::id, c_generic_context::init_at_IR, c_generic_context::ip_flags, ip_get_inner_packet(), ip_get_protocol(), c_generic_context::ir_count, c_generic_context::ir_dyn_count, c_generic_context::is_ip2_initialized, c_generic_context::next_header_len, c_generic_context::next_header_proto, c_context::profile, rohc_debugf, ROHC_PROFILE_IP, ROHC_PROFILE_RTP, ROHC_PROFILE_UDP, ROHC_PROFILE_UDPLITE, ROHC_PROFILE_UNCOMPRESSED, c_generic_context::sn, c_generic_context::sn_window, c_generic_context::so_count, c_context::specific, c_generic_context::specific, and c_generic_context::tmp_variables.
Referenced by c_rtp_create(), c_udp_create(), and c_udp_lite_create().
void c_generic_destroy | ( | struct c_context * | context | ) |
Destroy the context.
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
References c_destroy_wlsb(), list_comp::curr_list, destroy_list(), ipv6_header_info::ext_comp, ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, ipv4_header_info::ip_id_window, IPV4, IPV6, c_generic_context::is_ip2_initialized, list_comp::ref_list, c_generic_context::sn_window, c_context::specific, c_generic_context::specific, ip_header_info::v4, ip_header_info::v6, ip_header_info::version, and zfree.
Referenced by c_generic_create(), c_rtp_create(), c_rtp_destroy(), c_udp_create(), and c_udp_lite_create().
int c_generic_encode | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
int | packet_size, | ||
unsigned char * | dest, | ||
int | dest_size, | ||
int * | payload_offset | ||
) |
Encode an IP packet according to a pattern decided by several different factors.
1. Check if we have double IP headers.
2. Check if the IP-ID fields are random and if they are in NBO.
3. Decide in which state to go (IR, FO or SO).
4. Decide how many bits are needed to send the IP-ID and SN fields and more important update the sliding windows.
5. Decide which packet type to send.
6. Code the packet.
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
ip | The IP packet to encode |
packet_size | The length of the IP packet to encode |
dest | The rohc-packet-under-build buffer |
dest_size | The length of the rohc-packet-under-build buffer |
payload_offset | The offset for the payload in the IP packet |
References c_add_ts(), c_init_header_info(), changed_dynamic_both_hdr(), generic_tmp_variables::changed_fields, changed_fields(), generic_tmp_variables::changed_fields2, changed_static_both_hdr(), check_ip_identification(), code_packet(), decide_packet(), c_generic_context::decide_state, c_profile::id, ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, ip_get_hdrlen(), ip_get_inner_packet(), ip_get_next_layer(), ip_get_protocol(), ip_get_total_extension_size(), ip_get_version(), ip_is_fragment(), IPV4, ipv4_get_header(), ipv4_get_id(), ipv6_get_header(), c_generic_context::is_ip2_initialized, generic_tmp_variables::max_size, ipv4_header_info::nbo, c_generic_context::next_header_len, c_generic_context::next_header_proto, generic_tmp_variables::nr_ip_id_bits2, generic_tmp_variables::nr_of_ip_hdr, c_context::num_sent_ir, c_context::num_sent_ir_dyn, ipv4_header_info::old_ip, ipv6_header_info::old_ip, ipv4_header_info::old_nbo, ipv4_header_info::old_rnd, PACKET_IR, PACKET_IR_DYN, generic_tmp_variables::packet_type, c_context::profile, ipv4_header_info::rnd, rohc_debugf, ROHC_PROFILE_RTP, generic_tmp_variables::send_dynamic, generic_tmp_variables::send_static, ip_packet::size, rtphdr::sn, c_generic_context::sn, c_context::specific, c_generic_context::specific, rtp_tmp_variables::timestamp, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, sc_rtp_context::ts_sc, update_variables(), ip_header_info::v4, and ip_header_info::v6.
Referenced by c_rtp_encode(), c_udp_encode(), and c_udp_lite_encode().
void c_generic_feedback | ( | struct c_context * | context, |
struct c_feedback * | feedback | ||
) |
Update the profile when feedback arrives.
This function is one of the functions that must exist in one profile for the framework to work.
context | The compression context |
feedback | The feedback information including the whole feedback packet |
References c_feedback::acktype, c_ack_sn_wlsb(), change_mode(), change_state(), crc_calculate(), CRC_INIT_8, CRC_TYPE_8, c_feedback::data, FO, ip_header_info::info, c_generic_context::ip_flags, ipv4_header_info::ip_id_window, IPV4, IR, c_generic_context::ir_dyn_count, rohc_debugf, c_feedback::size, sn, c_generic_context::sn_window, SO, c_context::specific, c_feedback::specific_offset, c_feedback::specific_size, c_context::state, c_feedback::type, ip_header_info::v4, and ip_header_info::version.
int c_init_header_info | ( | struct ip_header_info * | header_info, |
const struct ip_packet | ip | ||
) |
Initialize the inner or outer IP header info stored in the context.
header_info | The inner or outer IP header info to initialize |
ip | The inner or outer IP header |
References c_create_wlsb(), C_WINDOW_WIDTH, list_comp::compare, list_comp::counter, create_ipv6_item(), list_comp::create_item, list_comp::curr_list, ipv4_header_info::df_count, ipv6_header_info::ext_comp, c_list::first_elt, list_comp::free_table, c_list::gen_id, list_comp::get_extension, get_index_ipv6_table(), list_comp::get_index_table, get_ipv6_ext_size(), get_ipv6_extension(), list_comp::get_size, ip_header_info::info, ip6_c_init_table(), ip_get_version(), ipv4_header_info::ip_id_window, IPV4, ipv4_get_header(), ipv6_compare(), ipv6_get_header(), list_comp::list_compress, MAX_FO_COUNT, ipv4_header_info::nbo, ipv4_header_info::nbo_count, ipv4_header_info::old_ip, ipv6_header_info::old_ip, ipv4_header_info::old_nbo, ipv4_header_info::old_rnd, ip_header_info::protocol_count, list_comp::ref_list, ipv4_header_info::rnd, ipv4_header_info::rnd_count, rohc_debugf, ip_header_info::tos_count, ip_header_info::ttl_count, list_comp::update_done, ip_header_info::v4, ip_header_info::v6, and ip_header_info::version.
Referenced by c_generic_create(), and c_generic_encode().
void c_init_tmp_variables | ( | struct generic_tmp_variables * | tmp_variables | ) |
Initialize all temporary variables stored in the context.
tmp_variables | The temporary variables to initialize |
References generic_tmp_variables::changed_fields, generic_tmp_variables::changed_fields2, generic_tmp_variables::max_size, generic_tmp_variables::nr_ip_id_bits, generic_tmp_variables::nr_ip_id_bits2, generic_tmp_variables::nr_of_ip_hdr, generic_tmp_variables::nr_sn_bits, generic_tmp_variables::packet_type, generic_tmp_variables::send_dynamic, and generic_tmp_variables::send_static.
Referenced by c_generic_create().
void change_mode | ( | struct c_context * | context, |
rohc_mode | new_mode | ||
) |
Change the mode of the context.
context | The compression context |
new_mode | The new mode the context must enter in |
References change_state(), IR, c_context::mode, and rohc_debugf.
Referenced by c_generic_feedback().
void change_state | ( | struct c_context * | context, |
rohc_c_state | new_state | ||
) |
Change the state of the context.
context | The compression context |
new_state | The new state the context must enter in |
References c_generic_context::fo_count, c_generic_context::ir_count, rohc_debugf, c_generic_context::so_count, c_context::specific, and c_context::state.
Referenced by c_generic_feedback(), change_mode(), decide_state(), periodic_down_transition(), rtp_decide_state(), and udp_decide_state().
int changed_dynamic_both_hdr | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2 | ||
) |
Check if the dynamic parts of the context changed in any of the two IP headers.
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
References changed_dynamic_one_hdr(), generic_tmp_variables::changed_fields, changed_fields(), generic_tmp_variables::changed_fields2, c_generic_context::ip2_flags, c_generic_context::ip_flags, generic_tmp_variables::nr_of_ip_hdr, rohc_debugf, c_context::specific, and c_generic_context::tmp_variables.
Referenced by c_generic_encode().
int changed_dynamic_one_hdr | ( | unsigned short | changed_fields, |
struct ip_header_info * | header_info, | ||
const struct ip_packet | ip, | ||
struct c_context * | context | ||
) |
Check if the dynamic part of the context changed in the IP packet.
The fields classified as CHANGING by RFC need to be checked for change. The fields are:
The IP-ID changes are managed outside of this function.
Althought classified as STATIC, the IPv4 Don't Fragment flag is not part of the static initialization, but of the dynamic initialization. It needs to be checked for change.
Other flags are checked for change for IPv4. There are IP-ID related flags:
changed_fields | The fields that changed, created by the function changed_fields |
header_info | The header info stored in the profile |
ip | The header of the new IP packet |
context | The compression context |
References ipv4_header_info::df_count, c_generic_context::fo_count, ip_header_info::info, ip_get_version(), IPV4, IPV4_GET_DF, ipv4_get_df(), is_changed(), MAX_FO_COUNT, MOD_TOS, MOD_TTL, ipv4_header_info::nbo, ipv4_header_info::nbo_count, ipv4_header_info::old_ip, ipv4_header_info::old_nbo, ipv4_header_info::old_rnd, ipv4_header_info::rnd, ipv4_header_info::rnd_count, rohc_debugf, c_context::specific, ip_header_info::tos_count, ip_header_info::ttl_count, and ip_header_info::v4.
Referenced by changed_dynamic_both_hdr(), and code_EXT3_packet().
unsigned short changed_fields | ( | struct ip_header_info * | header_info, |
const struct ip_packet | ip | ||
) |
Find the IP fields that changed between the profile and a new IP packet.
Only some fields are checked for change in the compression process, so only check these ones to avoid useless work. The fields to check are: TOS/TC, TTL/HL and Protocol/Next Header.
header_info | The header info stored in the profile |
ip | The header of the new IP packet |
References ip_header_info::info, ip_get_protocol(), ip_get_tos(), ip_get_ttl(), ip_get_version(), IPV4, IPV6_GET_TC, MOD_PROTOCOL, MOD_TOS, MOD_TTL, ipv4_header_info::old_ip, ipv6_header_info::old_ip, ip_header_info::v4, and ip_header_info::v6.
Referenced by c_generic_encode(), changed_dynamic_both_hdr(), and changed_static_both_hdr().
int changed_static_both_hdr | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2 | ||
) |
Check if the static parts of the context changed in any of the two IP headers.
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
References generic_tmp_variables::changed_fields, changed_fields(), generic_tmp_variables::changed_fields2, changed_static_one_hdr(), c_generic_context::ip2_flags, c_generic_context::ip_flags, generic_tmp_variables::nr_of_ip_hdr, c_context::specific, and c_generic_context::tmp_variables.
Referenced by c_generic_encode().
int changed_static_one_hdr | ( | unsigned short | changed_fields, |
struct ip_header_info * | header_info, | ||
const struct ip_packet | ip, | ||
struct c_context * | context | ||
) |
Check if the static part of the context changed in the new IP packet.
The fields classified as STATIC-DEF by RFC do not need to be checked for change. These fields are constant for all packets in a stream (ie. a profile context). So, the Source Address and Destination Address fields are not checked for change for both IPv4 and IPv6. The Flow Label is not checked for IPv6.
Althought not classified as STATIC-DEF, the Version field is the same for all packets in a stream (ie. a profile context) and therefore does not need to be checked for change neither for IPv4 nor IPv6.
Althought classified as STATIC, the IPv4 Don't Fragment flag is not part of the static initialization, but of the dynamic initialization.
Summary:
changed_fields | The fields that changed, created by the function changed_fields |
header_info | The header info stored in the profile |
ip | The header of the new IP packet |
context | The compression context |
References c_generic_context::fo_count, is_changed(), MAX_FO_COUNT, MOD_PROTOCOL, ip_header_info::protocol_count, rohc_debugf, and c_context::specific.
Referenced by changed_static_both_hdr(), and code_EXT3_packet().
void check_ip_identification | ( | struct ip_header_info * | header_info, |
const struct ip_packet | ip | ||
) |
Determine whether the IPv4 Identification field of one IPv4 header is random and/or in Network Bit Order (NBO).
header_info | The header info stored in the profile |
ip | One IPv4 header |
References ip_header_info::info, ip_get_version(), IPID_MAX_DELTA, IPV4, ipv4_get_id(), ipv4_header_info::nbo, ipv4_header_info::old_ip, ipv4_header_info::rnd, rohc_debugf, and ip_header_info::v4.
Referenced by c_generic_encode().
int code_EXT0_packet | ( | struct c_context * | context, |
unsigned char * | dest, | ||
int | counter | ||
) |
Build the extension 0 of the UO-2 packet.
Extension 0 for non-RTP profiles (5.11.4): +---+---+---+---+---+---+---+---+ 1 | 0 0 | SN | IP-ID | +---+---+---+---+---+---+---+---+ Extension 0 for RTP profile (5.7.5): +---+---+---+---+---+---+---+---+ 1 | 0 0 | SN | +T | +---+---+---+---+---+---+---+---+ if T = 0 -> +T = IP-ID -> -T = TS if T = 1 -> +T = TS -> -T = IP-ID no T bit -> +T = -T = TS
context | The compression context |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References ipv4_header_info::id_delta, ip_header_info::info, c_generic_context::ip_flags, IPV4, generic_tmp_variables::packet_type, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, rohc_debugf, c_generic_context::sn, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, rtp_tmp_variables::ts_send, ip_header_info::v4, and ip_header_info::version.
Referenced by code_UO2_packet().
int code_EXT1_packet | ( | struct c_context * | context, |
unsigned char * | dest, | ||
int | counter | ||
) |
Build the extension 1 of the UO-2 packet.
Extension 1 for non-RTP profiles (5.11.4): +---+---+---+---+---+---+---+---+ 1 | 0 1 | SN | IP-ID | +---+---+---+---+---+---+---+---+ 2 | IP-ID | +---+---+---+---+---+---+---+---+ Extension 1 for RTP profile (5.7.5): +---+---+---+---+---+---+---+---+ 1 | 0 1 | SN | +T | +---+---+---+---+---+---+---+---+ 2 | -T | +---+---+---+---+---+---+---+---+ if T = 0 -> +T = IP-ID -> -T = TS if T = 1 -> +T = TS -> -T = IP-ID no T bit -> +T = -T = TS
context | The compression context |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References ipv4_header_info::id_delta, ip_header_info::info, c_generic_context::ip_flags, IPV4, generic_tmp_variables::packet_type, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, rohc_debugf, c_generic_context::sn, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, rtp_tmp_variables::ts_send, ip_header_info::v4, and ip_header_info::version.
Referenced by code_UO2_packet().
int code_EXT2_packet | ( | struct c_context * | context, |
unsigned char * | dest, | ||
int | counter | ||
) |
Build the extension 2 of the UO-2 packet.
Extension 2 for non-RTP profiles (5.11.4): +---+---+---+---+---+---+---+---+ 1 | 1 0 | SN | IP-ID2 | +---+---+---+---+---+---+---+---+ 2 | IP-ID2 | +---+---+---+---+---+---+---+---+ 3 | IP-ID | +---+---+---+---+---+---+---+---+ IP-ID2 is for outer IP-ID field Extension 2 for RTP profile (5.7.5): +---+---+---+---+---+---+---+---+ 1 | 1 0 | SN | +T | +---+---+---+---+---+---+---+---+ 2 | +T | +---+---+---+---+---+---+---+---+ 3 | -T | +---+---+---+---+---+---+---+---+ if T = 0 -> +T = IP-ID -> -T = TS if T = 1 -> +T = TS -> -T = IP-ID no T bit -> +T = -T = TS
context | The compression context |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References ipv4_header_info::id_delta, ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, IPV4, generic_tmp_variables::packet_type, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, rohc_debugf, c_generic_context::sn, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, rtp_tmp_variables::ts_send, ip_header_info::v4, and ip_header_info::version.
Referenced by code_UO2_packet().
int code_EXT3_packet | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build the extension 3 of the UO-2 packet.
Extension 3 for non-RTP profiles (5.7.5 & 5.11.4): 0 1 2 3 4 5 6 7 +-----+-----+-----+-----+-----+-----+-----+-----+ 1 | 1 1 | S | Mode | I | ip | ip2 | +-----+-----+-----+-----+-----+-----+-----+-----+ 2 | Inner IP header flags | | if ip = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ 3 | Outer IP header flags | +-----+-----+-----+-----+-----+-----+-----+-----+ 4 | SN | if S = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ | | 5 / Inner IP header fields / variable, | | +-----+-----+-----+-----+-----+-----+-----+-----+ 6 | IP-ID | 2 octets, if I = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ | | 7 / Outer IP header fields / variable, | | +-----+-----+-----+-----+-----+-----+-----+-----+ Extension 3 for RTP profile (5.7.5): 0 1 2 3 4 5 6 7 +-----+-----+-----+-----+-----+-----+-----+-----+ 1 | 1 1 | S |R-TS | Tsc | I | ip | rtp | +-----+-----+-----+-----+-----+-----+-----+-----+ 2 | Inner IP header flags | ip2 | if ip = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ 3 | Outer IP header flags | +-----+-----+-----+-----+-----+-----+-----+-----+ 4 | SN | if S = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ | | 4.1 / TS / 1-4octets, if R-TS = 1 | | +-----+-----+-----+-----+-----+-----+-----+-----+ | | 5 / Inner IP header fields / variable, | | if ip = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ 6 | IP-ID | 2 octets, if I = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ | | 7 / Outer IP header fields / variable, | | if ip2 = 1 +-----+-----+-----+-----+-----+-----+-----+-----+ | | variable, 8 / RTP Header flags and fields / if rtp = 1 | | +-----+-----+-----+-----+-----+-----+-----+-----+
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References c_bytesSdvl(), c_encodeSdvl(), changed_dynamic_one_hdr(), generic_tmp_variables::changed_fields, generic_tmp_variables::changed_fields2, changed_static_one_hdr(), header_fields(), header_flags(), c_profile::id, ip_header_info::info, INIT_STRIDE, c_generic_context::ip2_flags, c_generic_context::ip_flags, ip_get_version(), IPV4, ipv4_get_id_nbo(), is_deductible(), is_ts_constant(), MAX_FO_COUNT, c_context::mode, ipv4_header_info::nbo, generic_tmp_variables::nr_ip_id_bits, generic_tmp_variables::nr_ip_id_bits2, generic_tmp_variables::nr_of_ip_hdr, generic_tmp_variables::nr_sn_bits, rtp_tmp_variables::nr_ts_bits, rtp_tmp_variables::nr_ts_bits_ext3, generic_tmp_variables::packet_type, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, c_context::profile, ipv4_header_info::rnd, ipv4_header_info::rnd_count, rohc_debugf, ROHC_PROFILE_RTP, rtp_header_flags_and_fields(), sc_rtp_context::rtp_pt_change_count, rtp_tmp_variables::rtp_pt_changed, SEND_SCALED, c_generic_context::sn, c_context::specific, c_generic_context::specific, ts_sc_comp::state, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, sc_rtp_context::ts_sc, rtp_tmp_variables::ts_send, and ip_header_info::v4.
Referenced by code_UO2_packet().
int code_generic_dynamic_part | ( | struct c_context * | context, |
struct ip_header_info * | header_info, | ||
const struct ip_packet | ip, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build the dynamic part of the IR and IR-DYN packets.
context | The compression context |
header_info | The IP header info stored in the profile |
ip | The IP header the dynamic part is built for |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References code_ipv4_dynamic_part(), code_ipv6_dynamic_part(), ip_get_version(), and IPV4.
Referenced by code_IR_DYN_packet(), and code_IR_packet().
int code_generic_static_part | ( | struct c_context * | context, |
struct ip_header_info * | header_info, | ||
const struct ip_packet | ip, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build the static part of the IR and IR-DYN packets.
context | The compression context |
header_info | The IP header info stored in the profile |
ip | The IP header the static part is built for |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References code_ipv4_static_part(), code_ipv6_static_part(), ip_get_version(), and IPV4.
Referenced by code_IR_packet().
int code_ipv4_dynamic_part | ( | struct c_context * | context, |
struct ip_header_info * | header_info, | ||
const struct ip_packet | ip, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build the IPv4 dynamic part of the IR and IR-DYN packets.
Dynamic part IPv4 (5.7.7.4): +---+---+---+---+---+---+---+---+ 1 | Type of Service | +---+---+---+---+---+---+---+---+ 2 | Time to Live | +---+---+---+---+---+---+---+---+ 3 / Identification / 2 octets +---+---+---+---+---+---+---+---+ 4 | DF|RND|NBO| 0 | +---+---+---+---+---+---+---+---+ 5 / Generic extension header list / variable length +---+---+---+---+---+---+---+---+
context | The compression context |
header_info | The IP header info stored in the profile |
ip | The IPv4 header the dynamic part is built for |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References ipv4_header_info::df_count, ip_header_info::info, ip_get_tos(), ip_get_ttl(), ipv4_get_df(), ipv4_get_id_nbo(), ipv4_header_info::nbo, ipv4_header_info::nbo_count, ipv4_header_info::rnd, ipv4_header_info::rnd_count, rohc_debugf, ip_header_info::tos_count, ip_header_info::ttl_count, and ip_header_info::v4.
Referenced by code_generic_dynamic_part().
int code_ipv4_static_part | ( | struct c_context * | context, |
struct ip_header_info * | header_info, | ||
const struct ip_packet | ip, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build the IPv4 static part of the IR and IR-DYN packets.
Static part IPv4 (5.7.7.4): +---+---+---+---+---+---+---+---+ 1 | Version = 4 | 0 | +---+---+---+---+---+---+---+---+ 2 | Protocol | +---+---+---+---+---+---+---+---+ 3 / Source Address / 4 octets +---+---+---+---+---+---+---+---+ 4 / Destination Address / 4 octets +---+---+---+---+---+---+---+---+
context | The compression context |
header_info | The IP header info stored in the profile |
ip | The IPv4 header the static part is built for |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References ip_get_protocol(), ipv4_get_daddr(), ipv4_get_saddr(), ip_header_info::protocol_count, and rohc_debugf.
Referenced by code_generic_static_part().
int code_ipv6_dynamic_part | ( | struct c_context * | context, |
struct ip_header_info * | header_info, | ||
const struct ip_packet | ip, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build the IPv6 dynamic part of the IR and IR-DYN packets.
Dynamic part IPv6 (5.7.7.3): +---+---+---+---+---+---+---+---+ 1 | Traffic Class | 1 octet +---+---+---+---+---+---+---+---+ 2 | Hop Limit | 1 octet +---+---+---+---+---+---+---+---+ 3 / Generic extension header list / variable length +---+---+---+---+---+---+---+---+
context | The compression context |
header_info | The IP header info stored in the profile |
ip | The IPv6 header the dynamic part is built for |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References c_algo_list_compress(), list_comp::curr_list, encode_list(), ipv6_header_info::ext_comp, ip_header_info::info, ip_get_tos(), ip_get_ttl(), list_comp::islist, list_comp::list_compress, list_comp::ref_list, rohc_debugf, size_list(), ip_header_info::tos_count, ip_header_info::ttl_count, list_comp::update_done, and ip_header_info::v6.
Referenced by code_generic_dynamic_part().
int code_ipv6_static_part | ( | struct c_context * | context, |
struct ip_header_info * | header_info, | ||
struct ip_packet | ip, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build the IPv6 static part of the IR and IR-DYN packets.
Static part IPv6 (5.7.7.3): +---+---+---+---+---+---+---+---+ 1 | Version = 6 |Flow Label(msb)| 1 octet +---+---+---+---+---+---+---+---+ 2 / Flow Label (lsb) / 2 octets +---+---+---+---+---+---+---+---+ 3 | Next Header | 1 octet +---+---+---+---+---+---+---+---+ 4 / Source Address / 16 octets +---+---+---+---+---+---+---+---+ 5 / Destination Address / 16 octets +---+---+---+---+---+---+---+---+
context | The compression context |
header_info | The IP header info stored in the profile |
ip | The IPv6 header the static part is built for |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References ip_get_protocol(), IPV6_ADDR, IPV6_ADDR_FORMAT, ipv6_get_daddr(), ipv6_get_flow_label(), ipv6_get_saddr(), ip_header_info::protocol_count, and rohc_debugf.
Referenced by code_generic_static_part().
int code_IR_DYN_packet | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
const unsigned char * | next_header, | ||
unsigned char * | dest | ||
) |
Build the IR-DYN packet.
IR-DYN packet (5.7.7.2): 0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- 1 : Add-CID octet : if for small CIDs and CID != 0 +---+---+---+---+---+---+---+---+ 2 | 1 1 1 1 1 0 0 0 | IR-DYN packet type +---+---+---+---+---+---+---+---+ : : 3 / 0-2 octets of CID info / 1-2 octets if for large CIDs : : +---+---+---+---+---+---+---+---+ 4 | Profile | 1 octet +---+---+---+---+---+---+---+---+ 5 | CRC | 1 octet +---+---+---+---+---+---+---+---+ | | 6 / Dynamic chain / variable length | | +---+---+---+---+---+---+---+---+ 7 | SN | 2 octets if not RTP +---+---+---+---+---+---+---+---+ : : / Payload / variable length : : - - - - - - - - - - - - - - - -
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
next_header | The next header data used to code the dynamic part of the next header for some profiles such as UDP, UDP-Lite, etc. |
dest | The rohc-packet-under-build buffer |
References c_context::cid, code_cid_values(), c_generic_context::code_dynamic_part, code_generic_dynamic_part(), crc_calculate(), CRC_INIT_8, CRC_TYPE_8, c_profile::id, c_generic_context::init_at_IR, c_generic_context::ip2_flags, c_generic_context::ip_flags, generic_tmp_variables::max_size, generic_tmp_variables::nr_of_ip_hdr, c_context::profile, rohc_debugf, ROHC_PROFILE_RTP, c_generic_context::sn, c_context::specific, and c_generic_context::tmp_variables.
Referenced by code_packet().
int code_IR_packet | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
const unsigned char * | next_header, | ||
unsigned char * | dest | ||
) |
Build the IR packet.
IR packet (5.7.7.1): 0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- 1 | Add-CID octet | if for small CIDs and CID != 0 +---+---+---+---+---+---+---+---+ 2 | 1 1 1 1 1 1 0 | D | +---+---+---+---+---+---+---+---+ | | 3 / 0-2 octets of CID info / 1-2 octets if for large CIDs | | +---+---+---+---+---+---+---+---+ 4 | Profile | 1 octet +---+---+---+---+---+---+---+---+ 5 | CRC | 1 octet +---+---+---+---+---+---+---+---+ | | 6 | Static chain | variable length | | +---+---+---+---+---+---+---+---+ | | 7 | Dynamic chain | present if D = 1, variable length | | +---+---+---+---+---+---+---+---+ 8 | SN | 2 octets if not RTP +---+---+---+---+---+---+---+---+ | | | Payload | variable length | | - - - - - - - - - - - - - - - -
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
next_header | The next header data used to code the static and dynamic parts of the next header for some profiles such as UDP, UDP-Lite, and so on. |
dest | The rohc-packet-under-build buffer |
References c_context::cid, code_cid_values(), c_generic_context::code_dynamic_part, code_generic_dynamic_part(), code_generic_static_part(), c_generic_context::code_static_part, crc_calculate(), CRC_INIT_8, CRC_TYPE_8, c_profile::id, c_generic_context::init_at_IR, c_generic_context::ip2_flags, c_generic_context::ip_flags, generic_tmp_variables::max_size, generic_tmp_variables::nr_of_ip_hdr, c_context::profile, rohc_debugf, ROHC_PROFILE_RTP, sn, c_generic_context::sn, c_context::specific, and c_generic_context::tmp_variables.
Referenced by code_packet().
int code_packet | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
const unsigned char * | next_header, | ||
unsigned char * | dest | ||
) |
Build the ROHC packet to send.
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
next_header | The next header such as UDP or UDP-Lite |
dest | The rohc-packet-under-build buffer |
References code_IR_DYN_packet(), code_IR_packet(), code_UO0_packet(), code_UO1_packet(), code_UO2_packet(), PACKET_IR, PACKET_IR_DYN, generic_tmp_variables::packet_type, PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, rohc_debugf, c_context::specific, and c_generic_context::tmp_variables.
Referenced by c_generic_encode(), and uncompressed_code_packet().
int code_UO0_packet | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
const unsigned char * | next_header, | ||
unsigned char * | dest | ||
) |
Build the UO-0 packet.
0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- 1 : Add-CID octet : +---+---+---+---+---+---+---+---+ 2 | first octet of base header | +---+---+---+---+---+---+---+---+ : : 3 / 0, 1, or 2 octets of CID / : : +---+---+---+---+---+---+---+---+ UO-0 (5.7.1) 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 0 | SN | CRC | +===+===+===+===+===+===+===+===+
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
next_header | The next header such as UDP or UDP-Lite |
dest | The rohc-packet-under-build buffer |
References c_context::cid, code_cid_values(), c_generic_context::code_UO_packet_head, code_UO_packet_tail(), c_generic_context::compute_crc_dynamic, c_generic_context::compute_crc_static, CRC_INIT_3, CRC_TYPE_3, ip_packet::data, generic_tmp_variables::max_size, generic_tmp_variables::nr_of_ip_hdr, rohc_debugf, c_generic_context::sn, c_context::specific, and c_generic_context::tmp_variables.
Referenced by code_packet().
int code_UO1_packet | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
const unsigned char * | next_header, | ||
unsigned char * | dest | ||
) |
Build the UO-1 packet.
UO-1 and UO-1-ID cannot be used if there is no IPv4 header in the context or if value(RND) and value(RND2) are both 1.
0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- 1 : Add-CID octet : +---+---+---+---+---+---+---+---+ 2 | first octet of base header | +---+---+---+---+---+---+---+---+ : : 3 / 0, 1, or 2 octets of CID / : : +---+---+---+---+---+---+---+---+ UO-1 (5.11.3): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 0 | IP-ID | +===+===+===+===+===+===+===+===+ 4 | SN | CRC | +---+---+---+---+---+---+---+---+ UO-1-RTP (5.7.3): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 0 | TS | +===+===+===+===+===+===+===+===+ 4 | M | SN | CRC | +---+---+---+---+---+---+---+---+ UO-1-ID (5.7.3): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 0 |T=0| IP-ID | +===+===+===+===+===+===+===+===+ 4 | M | SN | CRC | +---+---+---+---+---+---+---+---+ UO-1-TS (5.7.3): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 0 |T=1| TS | +===+===+===+===+===+===+===+===+ 4 | M | SN | CRC | +---+---+---+---+---+---+---+---+
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
next_header | The next header such as UDP or UDP-Lite |
dest | The rohc-packet-under-build buffer |
References c_context::cid, code_cid_values(), c_generic_context::code_UO_packet_head, code_UO_packet_tail(), c_generic_context::compute_crc_dynamic, c_generic_context::compute_crc_static, CRC_INIT_3, CRC_TYPE_3, ip_packet::data, c_profile::id, ipv4_header_info::id_delta, ip_header_info::info, c_generic_context::ip_flags, IPV4, rtp_tmp_variables::m_set, generic_tmp_variables::max_size, generic_tmp_variables::nr_of_ip_hdr, generic_tmp_variables::packet_type, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, c_context::profile, rohc_debugf, ROHC_PROFILE_RTP, c_generic_context::sn, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, rtp_tmp_variables::ts_send, ip_header_info::v4, and ip_header_info::version.
Referenced by code_packet().
int code_UO2_packet | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
const unsigned char * | next_header, | ||
unsigned char * | dest | ||
) |
Build the UO-2 packet.
0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- 1 : Add-CID octet : +---+---+---+---+---+---+---+---+ 2 | first octet of base header | +---+---+---+---+---+---+---+---+ : : 3 / 0, 1, or 2 octets of CID / : : +---+---+---+---+---+---+---+---+ UOR-2 (5.11.3): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 1 0 | SN | +===+===+===+===+===+===+===+===+ 5 | X | CRC | +---+---+---+---+---+---+---+---+ UOR-2-RTP (5.7.4): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 1 0 | TS | +===+===+===+===+===+===+===+===+ 4 | TS| M | SN | +---+---+---+---+---+---+---+---+ 5 | X | CRC | +---+---+---+---+---+---+---+---+ UOR-2-TS (5.7.4): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 1 0 | TS | +===+===+===+===+===+===+===+===+ 4 |T=1| M | SN | +---+---+---+---+---+---+---+---+ 5 | X | CRC | +---+---+---+---+---+---+---+---+ UOR-2-ID (5.7.4): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 1 0 | IP-ID | +===+===+===+===+===+===+===+===+ 4 |T=0| M | SN | +---+---+---+---+---+---+---+---+ 5 | X | CRC | +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+ : : 6 / Extension / : : --- --- --- --- --- --- --- ---
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
next_header | The next header such as UDP or UDP-Lite |
dest | The rohc-packet-under-build buffer |
References c_context::cid, code_cid_values(), code_EXT0_packet(), code_EXT1_packet(), code_EXT2_packet(), code_EXT3_packet(), c_generic_context::code_UO_packet_head, code_UO_packet_tail(), code_UOR2_bytes(), code_UOR2_ID_bytes(), code_UOR2_RTP_bytes(), code_UOR2_TS_bytes(), c_generic_context::compute_crc_dynamic, c_generic_context::compute_crc_static, CRC_INIT_6, CRC_INIT_7, CRC_TYPE_6, CRC_TYPE_7, ip_packet::data, decide_extension(), extension, c_profile::id, generic_tmp_variables::max_size, generic_tmp_variables::nr_of_ip_hdr, PACKET_EXT_0, PACKET_EXT_1, PACKET_EXT_2, PACKET_EXT_3, PACKET_NOEXT, generic_tmp_variables::packet_type, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, c_context::profile, rohc_debugf, ROHC_PROFILE_RTP, c_context::specific, and c_generic_context::tmp_variables.
Referenced by code_packet().
int code_UO_packet_tail | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
const unsigned char * | next_header, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build the tail of the UO packet.
The general format for the UO packets is: 0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- 1 : Add-CID octet : | +---+---+---+---+---+---+---+---+ | 2 | first octet of base header | | +---+---+---+---+---+---+---+---+ | : : | 3 / 0, 1, or 2 octets of CID / | : : | +---+---+---+---+---+---+---+---+ | 4 / remainder of base header / | +---+---+---+---+---+---+---+---+ | : : | 5 / Extension / | : : | --- --- --- --- --- --- --- --- | : : | 6 + IP-ID of outer IPv4 header + : : (see section 5.7 or [RFC-3095]) --- --- --- --- --- --- --- --- 7 / AH data for outer list / | --- --- --- --- --- --- --- --- | : : | 8 + GRE checksum + | : : | --- --- --- --- --- --- --- --- | : : | 9 + IP-ID of inner IPv4 header + | : : | --- --- --- --- --- --- --- --- | 10 / AH data for inner list / | --- --- --- --- --- --- --- --- | : : | 11 + GRE checksum + | : : | --- --- --- --- --- --- --- --- : List of : 12 / Dynamic chains / variable, given by static chain : for additional IP headers : (includes no SN) --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- : : RTP/UDP profiles only [RFC-3095] 13 + UDP Checksum + 2 octets, : : if context(UDP Checksum) != 0 --- --- --- --- --- --- --- ---
Parts 7, 8, 10, 11 and 12 are not supported. Parts 1, 2, 3, 4 and 5 are built in packet-specific functions. Parts 6 and 9 are built in this function. Part 13 is built in profile-specific function.
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
next_header | The next header such as UDP or UDP-Lite |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References c_generic_context::code_UO_packet_tail, ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, ip_get_version(), IPV4, ipv4_get_id(), generic_tmp_variables::nr_of_ip_hdr, ipv4_header_info::rnd, rohc_debugf, c_context::specific, c_generic_context::tmp_variables, and ip_header_info::v4.
Referenced by code_UO0_packet(), code_UO1_packet(), and code_UO2_packet().
int code_UOR2_bytes | ( | struct c_context * | context, |
int | extension, | ||
unsigned char * | f_byte, | ||
unsigned char * | s_byte, | ||
unsigned char * | t_byte | ||
) |
Code some fields of the UOR-2 packet.
This function is called by code_UO2_packet. It should not be called directly.
UOR-2 (5.11.3): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 1 0 | SN | +===+===+===+===+===+===+===+===+ 5 | X | CRC | +---+---+---+---+---+---+---+---+
context | The compression context |
extension | The extension that will be appended to the packet |
f_byte | IN/OUT: The first byte of the UOR-2 packet |
s_byte | IN/OUT: Not used by the UOR-2 packet |
t_byte | IN/OUT: The second byte of the UOR-2 packet |
References generic_tmp_variables::nr_sn_bits, PACKET_EXT_0, PACKET_EXT_1, PACKET_EXT_2, PACKET_EXT_3, PACKET_NOEXT, rohc_debugf, c_generic_context::sn, c_context::specific, and c_generic_context::tmp_variables.
Referenced by code_UO2_packet().
int code_UOR2_ID_bytes | ( | struct c_context * | context, |
int | extension, | ||
unsigned char * | f_byte, | ||
unsigned char * | s_byte, | ||
unsigned char * | t_byte | ||
) |
Code some fields of the UOR-2-ID packet.
This function is called by code_UO2_packet. It should not be called directly.
UOR-2-ID (5.7.4): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 1 0 | IP-ID | +===+===+===+===+===+===+===+===+ 4 |T=0| M | SN | +---+---+---+---+---+---+---+---+ 5 | X | CRC | +---+---+---+---+---+---+---+---+
context | The compression context |
extension | The extension that will be appended to the packet |
f_byte | IN/OUT: The first byte of the UOR-2-ID packet |
s_byte | IN/OUT: The second byte of the UOR-2-ID packet |
t_byte | IN/OUT: The third byte of the UOR-2-ID packet |
References ipv4_header_info::id_delta, ip_header_info::info, c_generic_context::ip_flags, is_deductible(), m, rtp_tmp_variables::m_set, MAX_BITS_IN_4_BYTE_SDVL, generic_tmp_variables::nr_ip_id_bits, generic_tmp_variables::nr_sn_bits, rtp_tmp_variables::nr_ts_bits, rtp_tmp_variables::nr_ts_bits_ext3, PACKET_EXT_0, PACKET_EXT_1, PACKET_EXT_2, PACKET_EXT_3, PACKET_NOEXT, rohc_debugf, c_generic_context::sn, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, sc_rtp_context::ts_sc, rtp_tmp_variables::ts_send, and ip_header_info::v4.
Referenced by code_UO2_packet().
int code_UOR2_RTP_bytes | ( | struct c_context * | context, |
int | extension, | ||
unsigned char * | f_byte, | ||
unsigned char * | s_byte, | ||
unsigned char * | t_byte | ||
) |
Code some fields of the UOR-2-RTP packet.
This function is called by code_UO2_packet. It should not be called directly.
UOR-2-RTP (5.7.4): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 1 0 | TS | +===+===+===+===+===+===+===+===+ 4 | TS| M | SN | +---+---+---+---+---+---+---+---+ 5 | X | CRC | +---+---+---+---+---+---+---+---+
context | The compression context |
extension | The extension that will be appended to the packet |
f_byte | IN/OUT: The first byte of the UOR-2-RTP packet |
s_byte | IN/OUT: The second byte of the UOR-2-RTP packet |
t_byte | IN/OUT: The third byte of the UOR-2-RTP packet |
References m, rtp_tmp_variables::m_set, MAX_BITS_IN_4_BYTE_SDVL, generic_tmp_variables::nr_sn_bits, rtp_tmp_variables::nr_ts_bits, rtp_tmp_variables::nr_ts_bits_ext3, PACKET_EXT_0, PACKET_EXT_1, PACKET_EXT_2, PACKET_EXT_3, PACKET_NOEXT, rohc_debugf, c_generic_context::sn, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, and rtp_tmp_variables::ts_send.
Referenced by code_UO2_packet().
int code_UOR2_TS_bytes | ( | struct c_context * | context, |
int | extension, | ||
unsigned char * | f_byte, | ||
unsigned char * | s_byte, | ||
unsigned char * | t_byte | ||
) |
Code some fields of the UOR-2-TS packet.
This function is called by code_UO2_packet. It should not be called directly.
UOR-2-TS (5.7.4): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ 2 | 1 1 0 | TS | +===+===+===+===+===+===+===+===+ 4 |T=1| M | SN | +---+---+---+---+---+---+---+---+ 5 | X | CRC | +---+---+---+---+---+---+---+---+
context | The compression context |
extension | The extension that will be appended to the packet |
f_byte | IN/OUT: The first byte of the UOR-2-TS packet |
s_byte | IN/OUT: The second byte of the UOR-2-TS packet |
t_byte | IN/OUT: The third byte of the UOR-2-TS packet |
References m, rtp_tmp_variables::m_set, MAX_BITS_IN_4_BYTE_SDVL, generic_tmp_variables::nr_sn_bits, rtp_tmp_variables::nr_ts_bits, rtp_tmp_variables::nr_ts_bits_ext3, PACKET_EXT_0, PACKET_EXT_1, PACKET_EXT_2, PACKET_EXT_3, PACKET_NOEXT, rohc_debugf, c_generic_context::sn, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, and rtp_tmp_variables::ts_send.
Referenced by code_UO2_packet().
void create_ipv6_item | ( | unsigned char * | ext, |
int | index_table, | ||
int | size, | ||
struct list_comp * | comp | ||
) |
Update an IPv6 item with the extension.
ext | the extension |
index_table | The index of this item in the based table |
size | The size of the data |
comp | The list compressor |
References item::ahhdr, list_comp::based_table, item::data, item::dest, item::hbh, item::header, list_elt::index_table, ip6_ahhdr::ip6ah_len, ip6_ahhdr::ip6ah_nxt, item::length, rohc_debugf, item::rthdr, and zfree.
Referenced by c_init_header_info().
int decide_algo | ( | struct rohc_comp * | comp, |
struct c_context * | context, | ||
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
int | packet, | ||
int | size_data | ||
) |
Decision Algorithm which returns the type of the packet to send when the jamming option is activated. It is an optimisation of the use of the encapsulation packets.
comp | The rohc compressor |
context | The context used for the compression |
ip | The packet to compress |
ip2 | The inner ip packet |
packet | The type of the original ROHC packet |
size_data | The size of the data to send in bytes |
References rohc_comp::adapt_size, c_assessment_size(), c_context::compressor, rohc_comp::encap_size, ip_packet::header, c_profile::id, ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, ip_get_version(), IPV4, IPV6, IPV6_EXT_AUTH, IPV6_EXT_DESTINATION, IPV6_EXT_HOP_BY_HOP, IPV6_EXT_ROUTING, generic_tmp_variables::nr_of_ip_hdr, PACKET_IR, PACKET_IR_DYN, PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, c_context::profile, ipv4_header_info::rnd, rohc_debugf, ROHC_PROFILE_RTP, c_context::specific, c_generic_context::tmp_variables, ip_header_info::v4, ip_packet::v6, and ip_header_info::version.
Referenced by decide_packet().
int decide_extension | ( | struct c_context * | context | ) |
Decide what extension shall be used in the UO-2 packet.
Extentions 0, 1 & 2 are IPv4 only because of the IP-ID.
context | The compression context |
References c_profile::id, ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, IPV4, is_deductible(), generic_tmp_variables::nr_ip_id_bits, generic_tmp_variables::nr_ip_id_bits2, generic_tmp_variables::nr_of_ip_hdr, generic_tmp_variables::nr_sn_bits, rtp_tmp_variables::nr_ts_bits, PACKET_EXT_0, PACKET_EXT_1, PACKET_EXT_2, PACKET_EXT_3, PACKET_NOEXT, generic_tmp_variables::packet_type, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, c_context::profile, ipv4_header_info::rnd, rohc_debugf, ROHC_PROFILE_RTP, generic_tmp_variables::send_dynamic, rtp_tmp_variables::send_rtp_dynamic, generic_tmp_variables::send_static, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, sc_rtp_context::ts_sc, ip_header_info::v4, and ip_header_info::version.
Referenced by code_UO2_packet().
int decide_FO_packet | ( | struct c_context * | context | ) |
Decide which packet to send when in First Order (FO) state.
Packets that can be used are the IR-DYN and UO-2 packets.
context | The compression context |
References c_profile::id, ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, IPV4, c_generic_context::ir_dyn_count, MAX_BITS_IN_4_BYTE_SDVL, MAX_FO_COUNT, generic_tmp_variables::nr_ip_id_bits, generic_tmp_variables::nr_ip_id_bits2, generic_tmp_variables::nr_of_ip_hdr, generic_tmp_variables::nr_sn_bits, rtp_tmp_variables::nr_ts_bits, PACKET_IR_DYN, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, c_context::profile, ipv4_header_info::rnd, ROHC_PROFILE_RTP, generic_tmp_variables::send_dynamic, generic_tmp_variables::send_static, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, ip_header_info::v4, and ip_header_info::version.
Referenced by decide_packet().
int decide_packet | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2, | ||
int | size_data | ||
) |
Decide which packet to send when in the different states.
In IR state, IR packets are used. In FO and SO, the decide_FO_packet and decide_SO_packet are used to decide which packet to send.
context | The compression context |
ip | The ip packet to compress |
ip2 | The inner ip packet |
size_data | The size of the data in bytes |
References c_algo_list_compress(), c_context::compressor, decide_algo(), decide_FO_packet(), decide_SO_packet(), ipv6_header_info::ext_comp, FO, c_generic_context::fo_count, ip_packet::header, ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, IPV6, IPV6_EXT_AUTH, IPV6_EXT_DESTINATION, IPV6_EXT_HOP_BY_HOP, IPV6_EXT_ROUTING, IR, c_generic_context::ir_count, rohc_comp::jam_use, list_comp::list_compress, generic_tmp_variables::nr_of_ip_hdr, PACKET_IR, PACKET_IR_DYN, rohc_debugf, SO, c_generic_context::so_count, c_context::specific, c_context::state, c_generic_context::tmp_variables, list_comp::update_done, ip_packet::v6, ip_header_info::v6, and ip_header_info::version.
Referenced by c_generic_encode().
int decide_SO_packet | ( | const struct c_context * | context | ) |
Decide which packet to send when in Second Order (SO) state.
Packets that can be used are the UO-0, UO-1 and UO-2 (with or without extensions) packets.
context | The compression context |
References c_profile::id, ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, IPV4, is_deductible(), rtp_tmp_variables::m_set, MAX_BITS_IN_4_BYTE_SDVL, generic_tmp_variables::nr_ip_id_bits, generic_tmp_variables::nr_ip_id_bits2, generic_tmp_variables::nr_of_ip_hdr, generic_tmp_variables::nr_sn_bits, rtp_tmp_variables::nr_ts_bits, PACKET_UO_0, PACKET_UO_1, PACKET_UO_1_ID, PACKET_UO_1_RTP, PACKET_UO_1_TS, PACKET_UOR_2, PACKET_UOR_2_ID, PACKET_UOR_2_RTP, PACKET_UOR_2_TS, c_context::profile, ipv4_header_info::rnd, rohc_debugf, ROHC_PROFILE_RTP, c_context::specific, c_generic_context::specific, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, sc_rtp_context::ts_sc, ip_header_info::v4, and ip_header_info::version.
Referenced by decide_packet().
void decide_state | ( | struct c_context * | context | ) |
Decide the state that should be used for the next packet.
The three states are:
context | The compression context |
References change_state(), FO, c_generic_context::fo_count, IR, c_generic_context::ir_count, MAX_FO_COUNT, MAX_IR_COUNT, c_context::mode, periodic_down_transition(), generic_tmp_variables::send_dynamic, generic_tmp_variables::send_static, SO, c_context::specific, c_context::state, c_generic_context::tmp_variables, and U_MODE.
Referenced by c_generic_create(), c_udp_lite_create(), rtp_decide_state(), and udp_decide_state().
int decide_type | ( | struct list_comp * | comp | ) |
Decide the encoding type for compression list.
comp | The list compressor |
References list_comp::curr_list, get_elt(), list_elt::index_table, list_elt::item, c_translation::known, list_comp::ref_list, size_list(), list_comp::trans_table, and type_is_present().
Referenced by encode_list().
int encode_list | ( | struct list_comp * | comp, |
unsigned char * | dest, | ||
int | counter, | ||
int | ps, | ||
int | size | ||
) |
Generique encoding of compressed list.
comp | the list compressor |
dest | The ROHC packet under build |
counter | The current position in the rohc-packet-under-build buffer |
ps | the size of the index |
size | The number of element in current list |
References list_comp::curr_list, decide_type(), encode_type_0(), encode_type_1(), encode_type_2(), encode_type_3(), c_list::first_elt, c_list::gen_id, get_elt(), list_elt::index_table, list_comp::islist, list_comp::list_compress, list_comp::ref_list, and rohc_debugf.
Referenced by code_ipv6_dynamic_part().
int encode_type_0 | ( | struct list_comp * | comp, |
unsigned char * | dest, | ||
int | counter, | ||
int | ps | ||
) |
build Encoding type 0
Encoding type 0 (5.8.6.1): 0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- | ET = 0| GP| PS| CC = m | +---+---+---+---+---+---+---+---+ | gen_id | +---+---+---+---+---+---+---+---+ | XI 1, ..., XI m | m octets, or m * 4 bits / --- --- --- --- / | : Padding : if PS = 0 and m is odd +---+---+---+---+---+---+---+---+ | | / item 1, ..., item n / variable length | | +---+---+---+---+---+---+---+---+
comp | the list compressor |
dest | The ROHC packet under build |
counter | The current position in the rohc-packet-under-build buffer |
ps | the size of the index |
References list_comp::curr_list, item::data, c_list::gen_id, get_elt(), list_elt::index_table, list_elt::item, c_translation::known, item::length, rohc_debugf, size_list(), and list_comp::trans_table.
Referenced by encode_list().
int encode_type_1 | ( | struct list_comp * | comp, |
unsigned char * | dest, | ||
int | counter, | ||
int | ps | ||
) |
build Encoding type 1
Encoding type 1 (5.8.6.2): 0 1 2 3 4 5 6 7 --- --- --- --- --- --- --- --- | ET = 1| GP| PS| XI 1 | +---+---+---+---+---+---+---+---+ | gen_id | +---+---+---+---+---+---+---+---+ | ref_id | +---+---+---+---+---+---+---+---+ / insertion bit mask / +---+---+---+---+---+---+---+---+ | XI list | k octets, or (k-1)*4 bits / --- --- --- --- / | : Padding : if PS = 0 and k is even +---+---+---+---+---+---+---+---+ | | / item 1, ..., item n / variable length | | +---+---+---+---+---+---+---+---+
comp | the list compressor |
dest | The ROHC packet under build |
counter | The current position in the rohc-packet-under-build buffer |
ps | the size of the index |
References list_comp::curr_list, item::data, get_elt(), list_elt::index_table, list_elt::item, c_translation::known, item::length, list_comp::ref_list, size_list(), list_comp::trans_table, and type_is_present().
Referenced by encode_list().
int encode_type_2 | ( | struct list_comp * | comp, |
unsigned char * | dest, | ||
int | counter, | ||
int | ps | ||
) |
build Encoding type 2
Encoding type 2 (5.8.6.3): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ | ET = 2| GP| PS| Counter | +---+---+---+---+---+---+---+---+ | gen_id | +---+---+---+---+---+---+---+---+ | ref_id | +---+---+---+---+---+---+---+---+ / removal bit mask / +---+---+---+---+---+---+---+---+
comp | the list compressor |
dest | The ROHC packet under build |
counter | The current position in the rohc-packet-under-build buffer |
ps | the size of the index |
References list_comp::curr_list, get_elt(), list_elt::item, list_comp::ref_list, rohc_debugf, size_list(), and type_is_present().
Referenced by encode_list().
int encode_type_3 | ( | struct list_comp * | comp, |
unsigned char * | dest, | ||
int | counter, | ||
int | ps | ||
) |
build Encoding type 3
Encoding type 3 (5.8.6.4): 0 1 2 3 4 5 6 7 +---+---+---+---+---+---+---+---+ | ET = 2| GP| PS| XI 1 | +---+---+---+---+---+---+---+---+ | gen_id | +---+---+---+---+---+---+---+---+ | ref_id | +---+---+---+---+---+---+---+---+ / removal bit mask / +---+---+---+---+---+---+---+---+ / insertion bit mask / +---+---+---+---+---+---+---+---+ | XI list | k octets, or (k-1)*4 bits / --- --- --- --- / | : Padding : if PS = 0 and k is even +---+---+---+---+---+---+---+---+ | | / item 1, ..., item n / variable length | | +---+---+---+---+---+---+---+---+
comp | the list compressor |
dest | The ROHC packet under build |
counter | The current position in the rohc-packet-under-build buffer |
ps | the size of the index |
References list_comp::curr_list, item::data, GET_BIT_0_2, GET_BIT_3, get_elt(), GET_REAL, list_elt::index_table, list_elt::item, c_translation::known, item::length, list_comp::ref_list, rohc_debugf, size_list(), list_comp::trans_table, and type_is_present().
Referenced by encode_list().
int get_index_ipv6_table | ( | const struct ip_packet | ip, |
int | index | ||
) |
Return the based table index for the Nth IP extension of the IP packet.
ip | The IP packet to analyse |
index | The index of the extension to retrieve in the IP packet |
References list_elt::index_table, ip_get_next_ext_header_from_ext(), ip_get_next_ext_header_from_ip(), IPV6_EXT_AUTH, IPV6_EXT_DESTINATION, IPV6_EXT_HOP_BY_HOP, and IPV6_EXT_ROUTING.
Referenced by c_init_header_info().
int get_ipv6_ext_size | ( | unsigned char * | ext | ) |
Get the size of the IPv6 extension.
ext | The extension |
Referenced by c_init_header_info().
unsigned char * get_ipv6_extension | ( | const struct ip_packet | ip, |
int | index | ||
) |
Extract the Nth IP extension of the IP packet.
Extract the IP extension at the given index.
ip | The IP packet to analyse |
index | The index of the extension to retrieve in the IP packet |
References ip_get_next_ext_header_from_ext(), and ip_get_next_ext_header_from_ip().
Referenced by c_init_header_info().
int header_fields | ( | struct c_context * | context, |
struct ip_header_info * | header_info, | ||
unsigned short | changed_f, | ||
const struct ip_packet | ip, | ||
boolean | is_outer, | ||
int | nr_ip_id_bits, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build inner or outer IP header fields.
This function is used to code the IP header fields of the extension 3 of the UO-2 packet. The function is called twice (one for inner IP header and one for outer IP header) with different arguments.
+-----+-----+-----+-----+-----+-----+-----+-----+ 1 | Type of Service/Traffic Class | if TOS = 1 ..... ..... ..... ..... ..... ..... ..... ..... 2 | Time to Live/Hop Limit | if TTL = 1 ..... ..... ..... ..... ..... ..... ..... ..... 3 | Protocol/Next Header | if PR = 1 ..... ..... ..... ..... ..... ..... ..... ..... 4 / IP extension headers / variable, if IPX = 1 ..... ..... ..... ..... ..... ..... ..... ..... IP-ID is coded here for outer header fields although it doesn't look that way in the extension 3 picture in 5.7.5 and 5.11.4 of RFC 3095. +-----+-----+-----+-----+-----+-----+-----+-----+ 5 | IP-ID | 2 octets, if I = 1 +-----+-----+-----+-----+-----+-----+-----+-----+
Part 4 is not supported.
context | The compression context |
header_info | The header info stored in the profile |
changed_f | The fields that changed, created by the function changed_fields |
ip | One inner or outer IP header |
is_outer | Whether the IP header is the outer header or not |
nr_ip_id_bits | The number of bits needed to transmit the IP-ID field |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References ip_header_info::info, ip_get_protocol(), ip_get_tos(), ip_get_ttl(), IPV4, ipv4_get_id_nbo(), is_changed(), MAX_FO_COUNT, MOD_PROTOCOL, MOD_TOS, MOD_TTL, ipv4_header_info::nbo, ip_header_info::protocol_count, ipv4_header_info::rnd, ipv4_header_info::rnd_count, rohc_debugf, ip_header_info::tos_count, ip_header_info::ttl_count, ip_header_info::v4, and ip_header_info::version.
Referenced by code_EXT3_packet().
int header_flags | ( | struct c_context * | context, |
struct ip_header_info * | header_info, | ||
unsigned short | changed_f, | ||
const struct ip_packet | ip, | ||
boolean | is_outer, | ||
int | nr_ip_id_bits, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
Build inner or outer IP header flags.
This function is used to code the IP header fields of the extension 3 of the UO-2 packet. The function is called twice (one for inner IP header and one for outer IP header) with different arguments.
Header flags for IP and UDP profiles (5.11.4): For inner flags: +-----+-----+-----+-----+-----+-----+-----+-----+ 1 | Inner IP header flags | | if ip = 1 | TOS | TTL | DF | PR | IPX | NBO | RND | 0** | 0** reserved +-----+-----+-----+-----+-----+-----+-----+-----+ or for outer flags: +-----+-----+-----+-----+-----+-----+-----+-----+ 2 | Outer IP header flags | | TOS2| TTL2| DF2 | PR2 |IPX2 |NBO2 |RND2 | I2 | if ip2 = 1 +-----+-----+-----+-----+-----+-----+-----+-----+
context | The compression context |
header_info | The header info stored in the profile |
changed_f | The fields that changed, created by the function changed_fields |
ip | One inner or outer IP header |
is_outer | Whether the IP header is the outer header or not |
nr_ip_id_bits | The number of bits needed to transmit the IP-ID field |
dest | The rohc-packet-under-build buffer |
counter | The current position in the rohc-packet-under-build buffer |
References ipv4_header_info::df_count, ip_header_info::info, IPV4, ipv4_get_df(), is_changed(), MAX_FO_COUNT, MOD_PROTOCOL, MOD_TOS, MOD_TTL, ipv4_header_info::nbo, ipv4_header_info::nbo_count, ip_header_info::protocol_count, ipv4_header_info::rnd, ipv4_header_info::rnd_count, rohc_debugf, ip_header_info::tos_count, ip_header_info::ttl_count, ip_header_info::v4, and ip_header_info::version.
Referenced by code_EXT3_packet().
void ip6_c_init_table | ( | struct list_comp * | comp | ) |
Initialize the tables IPv6 extension in compressor.
comp | The list compressor |
References AH, item::ahhdr, list_comp::based_table, c_translation::counter, item::data, DEST, item::dest, HBH, item::hbh, item::header, c_translation::item, c_translation::known, item::length, RTHDR, item::rthdr, list_comp::trans_table, and item::type.
Referenced by c_init_header_info().
int ipv6_compare | ( | unsigned char * | ext, |
struct list_comp * | comp, | ||
int | size, | ||
int | index_table | ||
) |
Ipv6 extension comparison.
ext | The extensiom |
comp | the list compressor |
size | The size to compare |
index_table | The index in based table |
References list_comp::based_table, and item::data.
Referenced by c_init_header_info().
boolean is_changed | ( | unsigned short | changed_fields, |
unsigned short | check_field | ||
) | [inline] |
Check if a specified IP field has changed.
changed_fields | The fields that changed, created by the function changed_fields |
check_field | The field for which to check a change |
Referenced by changed_dynamic_one_hdr(), changed_static_one_hdr(), header_fields(), and header_flags().
void periodic_down_transition | ( | struct c_context * | context | ) |
Periodically change the context state after a certain number of packets.
context | The compression context |
References change_state(), CHANGE_TO_FO_COUNT, CHANGE_TO_IR_COUNT, FO, c_generic_context::go_back_fo_count, c_generic_context::go_back_ir_count, IR, c_generic_context::ir_dyn_count, rohc_debugf, SO, c_context::specific, and c_context::state.
Referenced by decide_state().
int rtp_header_flags_and_fields | ( | struct c_context * | context, |
unsigned short | changed_f, | ||
const struct ip_packet | ip, | ||
unsigned char * | dest, | ||
int | counter | ||
) |
References c_bytesSdvl(), c_encodeSdvl(), rtphdr::extension, get_ts_stride(), INIT_STRIDE, ip_get_next_layer(), rtphdr::m, MAX_IR_COUNT, c_context::mode, rtphdr::padding, rtphdr::pt, rohc_debugf, sc_rtp_context::rtp_pt_change_count, rtp_tmp_variables::rtp_pt_changed, SEND_SCALED, c_context::specific, c_generic_context::specific, ts_sc_comp::state, sc_rtp_context::tmp_variables, and sc_rtp_context::ts_sc.
Referenced by code_EXT3_packet().
void update_variables | ( | struct c_context * | context, |
const struct ip_packet | ip, | ||
const struct ip_packet | ip2 | ||
) |
Update some context variables.
This function is only used in encode. Everything in this function could be in encode but to make it more readable we have it here instead.
context | The compression context |
ip | The outer IP header |
ip2 | The inner IP header |
References add_scaled(), c_add_wlsb(), c_get_k_wlsb(), get_ts_scaled(), c_profile::id, ipv4_header_info::id_delta, ip_header_info::info, INIT_STRIDE, c_generic_context::ip2_flags, c_generic_context::ip_flags, ip_get_next_layer(), ip_get_version(), ipv4_header_info::ip_id_window, IPV4, ipv4_get_id(), nb_bits_scaled(), ipv4_header_info::nbo, generic_tmp_variables::nr_ip_id_bits, generic_tmp_variables::nr_ip_id_bits2, generic_tmp_variables::nr_of_ip_hdr, generic_tmp_variables::nr_sn_bits, rtp_tmp_variables::nr_ts_bits, c_context::profile, rohc_debugf, ROHC_PROFILE_RTP, SEND_SCALED, c_generic_context::sn, c_generic_context::sn_window, c_context::specific, c_generic_context::specific, ts_sc_comp::state, rtphdr::timestamp, sc_rtp_context::tmp_variables, c_generic_context::tmp_variables, sc_rtp_context::ts_sc, rtp_tmp_variables::ts_send, and ip_header_info::v4.
Referenced by c_generic_encode().
const char* generic_extension_types[] |
{ "NOEXT", "EXT0", "EXT1", "EXT2", "EXT3", }
The description of the different extensions for the UO-2 packet.
const char* generic_packet_types[] |
{ "IR", "IRDYN", "OU-0", "OU-1", "OU-2", }
The description of the different ROHC packets.