ROHC compression/decompression library
Functions | Variables
d_ip.c File Reference

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

#include "d_ip.h"
#include "rohc_bit_ops.h"
#include "rohc_traces.h"
#include "rohc_packets.h"
Include dependency graph for d_ip.c:

Functions

void * d_ip_create (void)
 Create the IP decompression context.
int ip_get_static_part (void)
 Get the size of the static part of an IR packet (without IP)
int ip_decode_dynamic_ip (struct d_generic_context *context, const unsigned char *packet, unsigned int length, unsigned char *dest)
 Decode the IP dynamic part of the ROHC packet.
unsigned int ip_detect_ir_size (struct d_context *context, unsigned char *packet, unsigned int plen, unsigned int large_cid_len)
 Find the length of the IR header.
unsigned int ip_detect_ir_dyn_size (struct d_context *context, unsigned char *packet, unsigned int plen, unsigned int large_cid_len)
 Find the length of the IR-DYN header.

Variables

struct d_profile d_ip_profile
 Define the decompression part of the IP-only profile as described in the RFC 3843.

Detailed Description

ROHC decompression context for the IP-only profile.

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

Function Documentation

void* d_ip_create ( void  )

Create the IP decompression context.

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

Returns:
A fake IP decompression context

References d_generic_create(), d_generic_context::decode_dynamic_next_header, and ip_decode_dynamic_ip().

int ip_decode_dynamic_ip ( struct d_generic_context context,
const unsigned char *  packet,
unsigned int  length,
unsigned char *  dest 
)

Decode the IP dynamic part of the ROHC packet.

Parameters:
contextThe generic decompression context
packetThe ROHC packet to decode
lengthThe length of the ROHC packet
destNot used
Returns:
The number of bytes read in the ROHC packet, -1 in case of failure

References d_generic_context::active1, d_generic_context::active2, d_ip_id_init(), d_lsb_init(), GET_NEXT_16_BITS, d_generic_changes::ip, ip_get_version(), d_generic_context::ip_id1, d_generic_context::ip_id2, IPV4, ipv4_get_id(), d_generic_context::multiple_ip, PACKET_IR, PACKET_IR_DYN, d_generic_context::packet_type, rohc_debugf, sn, and d_generic_context::sn.

Referenced by d_ip_create(), udp_decode_dynamic_udp(), and udp_lite_decode_dynamic_udp().

unsigned int ip_detect_ir_dyn_size ( struct d_context context,
unsigned char *  packet,
unsigned int  plen,
unsigned int  large_cid_len 
)

Find the length of the IR-DYN header.

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


 Basic structure of the 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
    +---+---+---+---+---+---+---+---+
    :                               :
 8  /           Payload             / variable length
    :                               :
     - - - - - - - - - - - - - - - -

The function computes the length of the fields 2 + 4-7, ie. the first byte, the Profile and CRC fields, the dynamic chains (outer and inner IP headers) and the SN.

Parameters:
contextThe decompression context
packetThe IR-DYN packet after the Add-CID byte if present (ie. the field 2 in the figure)
plenThe length of the IR-DYN packet minus the Add-CID byte
large_cid_lenThe size of the large CID field (ie. field 3 in the figure)
Returns:
The length of the IR-DYN header, 0 if an error occurs

References d_generic_detect_ir_dyn_size().

Referenced by udp_detect_ir_dyn_size().

unsigned int ip_detect_ir_size ( struct d_context context,
unsigned char *  packet,
unsigned int  plen,
unsigned int  large_cid_len 
)

Find the length of the IR header.

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


 Basic structure of the 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
    +---+---+---+---+---+---+---+---+
    |                               |
 9  |           Payload             |  variable length
    |                               |
     - - - - - - - - - - - - - - - -

The function computes the length of the fields 2 + 4-8, ie. the first byte, the Profile and CRC fields, the static and dynamic chains (outer and inner IP headers) and the SN.

Parameters:
contextThe decompression context
packetThe pointer on the IR packet minus the Add-CID byte (ie. the field 2 in the figure)
plenThe length of the IR packet minus the Add-CID byte
large_cid_lenThe size of the large CID field (ie. field 3 in the figure)
Returns:
The length of the IR header, 0 if an error occurs

References d_generic_detect_ir_size().

Referenced by udp_detect_ir_size().

int ip_get_static_part ( void  )

Get the size of the static part of an IR packet (without IP)

Returns:
the size

Variable Documentation

Initial value:

Define the decompression part of the IP-only profile as described in the RFC 3843.