ROHC compression/decompression library
Functions
c_ip.h File Reference

ROHC compression context for the IP-only profile. More...

#include "c_generic.h"
Include dependency graph for c_ip.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int c_ip_check_context (const struct c_context *context, const struct ip_packet *ip)
 Check if an IP packet belongs to the context.
rohc_packet_t c_ip_decide_FO_packet (const struct c_context *context)
 Decide which packet to send when in First Order (FO) state.
rohc_packet_t c_ip_decide_SO_packet (const struct c_context *context)
 Decide which packet to send when in Second Order (SO) state.
uint32_t c_ip_get_next_sn (const struct c_context *context, const struct ip_packet *outer_ip, const struct ip_packet *inner_ip)
 Determine the SN value for the next packet.
int c_ip_code_ir_remainder (const struct c_context *context, unsigned char *const dest, int counter)
 Code the remainder header for the IR or IR-DYN packets.

Detailed Description

ROHC compression context for the IP-only profile.

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

Function Documentation

int c_ip_check_context ( const struct c_context context,
const struct ip_packet ip 
)

Check if an IP packet belongs to the context.

Conditions are:

  • the number of IP headers must be the same as in context
  • IP version of the two IP headers must be the same as in context
  • IP packets must not be fragmented
  • the source and destination addresses of the two IP headers must match the ones in the context
  • IPv6 only: the Flow Label of the two IP headers must match the ones the context

This function is one of the functions that must exist in one profile for the framework to work.

Parameters:
contextThe compression context
ipThe IP packet to check
Returns:
1 if the IP packet belongs to the context, 0 if it does not belong to the context and -1 if the profile cannot compress it or an error occurs

References ipv4_hdr::daddr, ip_header_info::info, c_generic_context::ip2_flags, ipv6_hdr::ip6_dst, ipv6_hdr::ip6_src, c_generic_context::ip_flags, ip_get_inner_packet(), ip_get_protocol(), ip_get_version(), IPV4, ipv4_get_daddr(), ipv4_get_saddr(), IPV6, IPV6_ADDR_CMP, ipv6_get_daddr(), IPV6_GET_FLOW_LABEL, ipv6_get_flow_label(), ipv6_get_saddr(), c_generic_context::is_ip2_initialized, c_generic_context::next_header_proto, ipv4_header_info::old_ip, ipv6_header_info::old_ip, rohc_debugf, ROHC_IPPROTO_IPIP, ROHC_IPPROTO_IPV6, ipv4_hdr::saddr, c_context::specific, ip_header_info::v4, ip_header_info::v6, version, and ip_header_info::version.

int c_ip_code_ir_remainder ( const struct c_context context,
unsigned char *const  dest,
int  counter 
)

Code the remainder header for the IR or IR-DYN packets.


 Remainder of IR/IR-DYN packet (5.7.7.1):

      0   1   2   3   4   5   6   7
    +---+---+---+---+---+---+---+---+
 1  |             SN                |  2 octets if not RTP
    +---+---+---+---+---+---+---+---+

Parameters:
contextThe compression context
destThe rohc-packet-under-build buffer
counterThe current position in the rohc-packet-under-build buffer
Returns:
The new position in the rohc-packet-under-build buffer

References rohc_debugf, sn, c_generic_context::sn, and c_context::specific.

Referenced by c_udp_create(), and c_udp_lite_create().

rohc_packet_t c_ip_decide_FO_packet ( const 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.

See also:
decide_packet
Parameters:
contextThe compression context
Returns:
The packet type among PACKET_IR_DYN and PACKET_UOR_2

References generic_tmp_vars::nr_of_ip_hdr, generic_tmp_vars::nr_sn_bits, PACKET_IR_DYN, PACKET_UOR_2, rohc_debugf, generic_tmp_vars::send_dynamic, generic_tmp_vars::send_static, c_context::specific, and c_generic_context::tmp.

Referenced by c_udp_create(), and c_udp_lite_create().

rohc_packet_t c_ip_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.

See also:
decide_packet
Parameters:
contextThe compression context
Returns:
The packet type among PACKET_UO_0, PACKET_UO_1 and PACKET_UOR_2

References ip_header_info::info, c_generic_context::ip2_flags, c_generic_context::ip_flags, IPV4, generic_tmp_vars::nr_ip_id_bits, generic_tmp_vars::nr_ip_id_bits2, generic_tmp_vars::nr_of_ip_hdr, generic_tmp_vars::nr_sn_bits, PACKET_IR_DYN, PACKET_UO_0, PACKET_UO_1, PACKET_UOR_2, ipv4_header_info::rnd, rohc_debugf, c_context::specific, c_generic_context::tmp, ip_header_info::v4, and ip_header_info::version.

Referenced by c_udp_create(), and c_udp_lite_create().

uint32_t c_ip_get_next_sn ( const struct c_context context,
const struct ip_packet outer_ip,
const struct ip_packet inner_ip 
)

Determine the SN value for the next packet.

Profile SN is an internal increasing 16-bit number.

Parameters:
contextThe compression context
outer_ipThe outer IP header
inner_ipThe inner IP header if it exists, NULL otherwise
Returns:
The SN

References c_generic_context::sn, and c_context::specific.

Referenced by c_udp_create(), and c_udp_lite_create().