ROHC compression/decompression library
Defines | Functions
decode.h File Reference

ROHC packet related routines. More...

#include "dllexport.h"
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for decode.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define D_SEGMENT   (0xfe >> 1)
 The magic bits to find out whether a field is a segment field or not.
#define D_PADDING   0xe0
 The magic byte to find out whether a field is a padding field or not.
#define D_FEEDBACK   (0xf0 >> 3)
 The magic bits to find out whether a ROHC packet is a Feedback packet or not.
#define D_IR_PACKET   (0xfc >> 1)
 The magic bits to find out whether a ROHC packet is an IR packet or not.
#define D_IR_DYN_PACKET   0xf8
 The magic byte to find out whether a ROHC packet is an IR-DYN packet or not.
#define D_ADD_CID   0xe
 The magic bits to find out whether a ROHC packet starts with an add-CID byte or not.

Functions

int ROHC_EXPORT d_is_segment (const unsigned char *)
 Find out whether the field is a segment field or not.
int ROHC_EXPORT d_is_padding (const unsigned char *)
 Find out whether the field is a padding field or not.
int ROHC_EXPORT d_is_feedback (const unsigned char *)
 Find out whether a ROHC packet is a Feedback packet or not.
int ROHC_EXPORT d_feedback_size (const unsigned char *)
 Find out the size of the feedback.
int ROHC_EXPORT d_feedback_headersize (const unsigned char *)
 Find out the size of the feedback header.
bool ROHC_EXPORT d_is_ir (const unsigned char *data, const size_t len)
 Find out whether a ROHC packet is an IR packet or not.
bool ROHC_EXPORT d_is_irdyn (const unsigned char *data, const size_t len)
 Find out whether a ROHC packet is an IR-DYN packet or not.
bool ROHC_EXPORT d_is_uo0 (const unsigned char *data, const size_t len)
 Find out whether a ROHC packet is an UO-0 packet or not.
bool ROHC_EXPORT d_is_uo1 (const unsigned char *data, const size_t len)
 Find out whether a ROHC packet is an UO-1* packet or not.
bool ROHC_EXPORT d_is_uor2 (const unsigned char *data, const size_t len)
 Find out whether a ROHC packet is an UOR-2* packet or not.
bool ROHC_EXPORT d_is_uor2_ts (const unsigned char *const data, const size_t data_len, const size_t large_cid_len)
 Find out whether a ROHC packet is an UOR-2-TS packet or not.
bool ROHC_EXPORT d_is_uor2_rtp (const unsigned char *const data, const size_t data_len, const size_t large_cid_len)
 Find out whether a ROHC packet is an UOR-2-RTP packet or not.
int ROHC_EXPORT d_is_add_cid (const unsigned char *)
 Check whether a ROHC packet starts with an add-CID byte or not.
int ROHC_EXPORT d_decode_add_cid (const unsigned char *)
 Decode the add-CID byte of a ROHC packet (if the add-CID byte is present)

Detailed Description

ROHC packet related routines.

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

Define Documentation

#define D_ADD_CID   0xe

The magic bits to find out whether a ROHC packet starts with an add-CID byte or not.

Referenced by d_is_add_cid().

#define D_FEEDBACK   (0xf0 >> 3)

The magic bits to find out whether a ROHC packet is a Feedback packet or not.

Referenced by d_is_feedback().

#define D_IR_DYN_PACKET   0xf8

The magic byte to find out whether a ROHC packet is an IR-DYN packet or not.

Referenced by d_is_irdyn().

#define D_IR_PACKET   (0xfc >> 1)

The magic bits to find out whether a ROHC packet is an IR packet or not.

Referenced by d_is_ir().

#define D_PADDING   0xe0

The magic byte to find out whether a field is a padding field or not.

Referenced by d_is_padding().

#define D_SEGMENT   (0xfe >> 1)

The magic bits to find out whether a field is a segment field or not.

Referenced by d_is_segment().


Function Documentation

int ROHC_EXPORT d_decode_add_cid ( const unsigned char *  data)

Decode the add-CID byte of a ROHC packet (if the add-CID byte is present)

Parameters:
dataThe ROHC packet with a possible add-CID byte
Returns:
0 if no add-CID byte is present, the CID value otherwise

References d_is_add_cid(), and GET_BIT_0_3.

Referenced by c_deliver_feedback().

int ROHC_EXPORT d_feedback_headersize ( const unsigned char *  data)

Find out the size of the feedback header.

See 5.2.2 in the RFC 3095 for details.

Parameters:
dataThe feedback header
Returns:
The size of the feedback header (1 or 2 bytes)

References GET_BIT_0_2.

int ROHC_EXPORT d_feedback_size ( const unsigned char *  data)

Find out the size of the feedback.

See 5.2.2 in the RFC 3095 for details.

Parameters:
dataThe feedback header
Returns:
The size of the feedback

References GET_BIT_0_2, and GET_BIT_0_7.

int ROHC_EXPORT d_is_add_cid ( const unsigned char *  data)

Check whether a ROHC packet starts with an add-CID byte or not.

Parameters:
dataThe ROHC packet with a possible add-CID byte
Returns:
Whether the ROHC packet starts with an add-CID byte or not

References D_ADD_CID, and GET_BIT_4_7.

Referenced by c_deliver_feedback(), and d_decode_add_cid().

int ROHC_EXPORT d_is_feedback ( const unsigned char *  data)

Find out whether a ROHC packet is a Feedback packet or not.

Parameters:
dataThe ROHC packet to analyze
Returns:
Whether the ROHC packet is a Feedback packet or not

References D_FEEDBACK, and GET_BIT_3_7.

bool ROHC_EXPORT d_is_ir ( const unsigned char *  data,
const size_t  len 
)

Find out whether a ROHC packet is an IR packet or not.

Parameters:
dataThe ROHC packet to analyze
lenThe length of the ROHC packet
Returns:
Whether the ROHC packet is an IR packet or not

References D_IR_PACKET, and GET_BIT_1_7.

Referenced by d_decode_header(), and ip_detect_packet_type().

bool ROHC_EXPORT d_is_irdyn ( const unsigned char *  data,
const size_t  len 
)

Find out whether a ROHC packet is an IR-DYN packet or not.

Parameters:
dataThe ROHC packet to analyze
lenThe length of the ROHC packet
Returns:
Whether the ROHC packet is an IR-DYN packet or not

References D_IR_DYN_PACKET, and GET_BIT_0_7.

Referenced by d_decode_header(), and ip_detect_packet_type().

int ROHC_EXPORT d_is_padding ( const unsigned char *  data)

Find out whether the field is a padding field or not.

Parameters:
dataThe field to analyze
Returns:
Whether the field is a padding field or not

References D_PADDING, and GET_BIT_0_7.

int ROHC_EXPORT d_is_segment ( const unsigned char *  data)

Find out whether the field is a segment field or not.

Parameters:
dataThe field to analyze
Returns:
Whether the field is a segment field or not

References D_SEGMENT, and GET_BIT_1_7.

bool ROHC_EXPORT d_is_uo0 ( const unsigned char *  data,
const size_t  len 
)

Find out whether a ROHC packet is an UO-0 packet or not.

Parameters:
dataThe ROHC packet to analyze
lenThe length of the ROHC packet
Returns:
Whether the ROHC packet is an UO-0 packet or not

References GET_BIT_7.

Referenced by ip_detect_packet_type().

bool ROHC_EXPORT d_is_uo1 ( const unsigned char *  data,
const size_t  len 
)

Find out whether a ROHC packet is an UO-1* packet or not.

Parameters:
dataThe ROHC packet to analyze
lenThe length of the ROHC packet
Returns:
Whether the ROHC packet is an UO-1* packet or not

References GET_BIT_6_7.

Referenced by ip_detect_packet_type().

bool ROHC_EXPORT d_is_uor2 ( const unsigned char *  data,
const size_t  len 
)

Find out whether a ROHC packet is an UOR-2* packet or not.

Parameters:
dataThe ROHC packet to analyze
lenThe length of the ROHC packet
Returns:
Whether the ROHC packet is an UOR-2* packet or not

References GET_BIT_5_7.

Referenced by ip_detect_packet_type().

bool ROHC_EXPORT d_is_uor2_rtp ( const unsigned char *const  data,
const size_t  data_len,
const size_t  large_cid_len 
)

Find out whether a ROHC packet is an UOR-2-RTP packet or not.

If RTP disambiguation bit is enabled, check it. Otherwise, always return true.

The RTP disambiguation bit type is a proprietary extension to the ROHC standard. It was introduced to avoid reparsing the UOR-2* headers in cases where RND changes in extension 3.

Parameters:
dataThe ROHC packet to analyze
data_lenThe length of the ROHC packet
large_cid_lenThe length of the optional large CID field
Returns:
Whether the ROHC packet is an UOR-2-RTP packet or not

References GET_BIT_6.

bool ROHC_EXPORT d_is_uor2_ts ( const unsigned char *const  data,
const size_t  data_len,
const size_t  large_cid_len 
)

Find out whether a ROHC packet is an UOR-2-TS packet or not.

Check the T field that discriminates between UOR-2-TS and UOR-2-ID.

Parameters:
dataThe ROHC packet to analyze
data_lenThe length of the ROHC packet
large_cid_lenThe length of the optional large CID field
Returns:
Whether the ROHC packet is an UOR-2-TS packet or not

References GET_BIT_7.