ROHC compression/decompression library
Classes | Defines | Typedefs | Enumerations | Functions
rohc.h File Reference

ROHC common definitions and routines. More...

#include <endian.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
#include <netinet/in.h>
#include "crc.h"
#include "decode.h"
#include "ip_id.h"
#include "lsb.h"
#include "sdvl.h"
#include "wlsb.h"
#include "rtp.h"
#include "ip.h"
Include dependency graph for rohc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  medium
 ROHC medium (CID characteristics). More...

Defines

#define ROHC_OK   1
 Return code: the action done without problem.
#define ROHC_ERROR_NO_CONTEXT   -1
 Return code: the action can not proceed because no context is defined.
#define ROHC_ERROR_PACKET_FAILED   -2
 Return code: the action failed due to an unattended or malformed packet.
#define ROHC_FEEDBACK_ONLY   -3
 Return code: the action failed because the packet only contains feedback info.
#define ROHC_ERROR_CRC   -4
 Return code: the action failed due to a CRC failure.
#define ROHC_ERROR   -5
 Return code: the action encountered a problem.
#define ROHC_NEED_REPARSE   -6
 Return code: the packet needs to be parsed again.
#define ROHC_TRUE   1
 True value for the boolean type.
#define ROHC_FALSE   0
 False value for the boolean type.
#define RTP_PORTS   1234, 36780, 33238, 5020, 5002
 List of UDP ports associated with RTP streams The port numbers must be separated by a comma.
#define ROHC_PROFILE_UNCOMPRESSED   0x0000
 The number allocated for the ROHC Uncompressed profile.
#define ROHC_PROFILE_RTP   0x0001
 The number allocated for the ROHC RTP profile.
#define ROHC_PROFILE_UDP   0x0002
 The number allocated for the ROHC UDP profile.
#define ROHC_PROFILE_IP   0x0004
 The number allocated for the ROHC IP-only profile (see 5 in the RFC 3843)
#define ROHC_PROFILE_UDPLITE   0x0008
 The number allocated for the ROHC UDP-Lite profile (see 7 in the RFC 4019)
#define CHANGE_TO_IR_COUNT   1700
 The maximal number of packets sent in > IR states (= FO and SO states) before changing back the state to IR (periodic refreshes)
#define CHANGE_TO_FO_COUNT   700
 The maximal number of packets sent in > FO states (= SO state) before changing back the state to FO (periodic refreshes)
#define MAX_IR_COUNT   3
 Defines the minimal number of packets that must be sent while in IR state before being able to switch the the FO state.
#define MAX_FO_COUNT   3
 Defines the minimal number of packets that must be sent while in FO state before being able to switch the the SO state.
#define PACKET_UO_0   0
 Defines an UO-0 packet.
#define PACKET_UO_1   1
 Defines an UO-1 packet.
#define PACKET_UOR_2   2
 Defines an UOR-2 packet.
#define PACKET_IR_DYN   3
 Defines an IR-DYN packet.
#define PACKET_IR   4
 Defines an IR packet.
#define PACKET_UNKNOWN   5
 If packet type is not defined yet.
#define PACKET_CCE   6
 Defines an CCE packet (UDP-Lite profile only)
#define PACKET_CCE_OFF   7
 Defines an CCE(OFF) packet (UDP-Lite profile only)
#define PACKET_UO_1_RTP   8
 Defines an UO-1-RTP packet.
#define PACKET_UO_1_ID   9
 Defines an UO-1-ID packet.
#define PACKET_UO_1_TS   10
 Defines an UO-1-TS packet.
#define PACKET_UOR_2_RTP   11
 Defines an UO-2-RTP packet.
#define PACKET_UOR_2_ID   12
 Defines an UO-2-ID packet.
#define PACKET_UOR_2_TS   13
 Defines an UO-2-TS packet.
#define PACKET_NORMAL   14
 Defines a Normal packet (Uncompressed profile only)
#define PACKET_NOEXT   (-1)
 No extension for the UOR-2 packet.
#define PACKET_EXT_0   0
 Defines the EXT-0 extension for the UOR-2 packet.
#define PACKET_EXT_1   1
 Defines the EXT-1 extension for the UOR-2 packet.
#define PACKET_EXT_2   2
 Defines the EXT-2 extension for the UOR-2 packet.
#define PACKET_EXT_3   3
 Defines the EXT-3 extension for the UOR-2 packet.
#define CRC_ACTION   1
 Whether to attempt packet recovery after CRC failure or not.
#define GET_BIT_0_2(x)   ((*(x)) & 0x07)
#define GET_BIT_0_4(x)   ((*(x)) & 0x1f)
#define GET_BIT_0_3(x)   ((*(x)) & 0x0f)
#define GET_BIT_0_5(x)   ((*(x)) & 0x3f)
#define GET_BIT_0_6(x)   ((*(x)) & 0x7f)
#define GET_BIT_0_7(x)   ((*(x)) & 0xff)
#define GET_BIT_1_7(x)   ( ((*(x)) & 0xfe) >> 1 )
#define GET_BIT_3_4(x)   ( ((*(x)) & 0x18) >> 3 )
#define GET_BIT_3_5(x)   ( ((*(x)) & 0x38) >> 3 )
#define GET_BIT_3_6(x)   ( ((*(x)) & 0x78) >> 3 )
#define GET_BIT_3_7(x)   ( ((*(x)) & 0xf8) >> 3 )
#define GET_BIT_4_7(x)   ( ((*(x)) & 0xf0) >> 4 )
#define GET_BIT_5_7(x)   ( ((*(x)) & 0xe0) >> 5 )
#define GET_BIT_6_7(x)   ( ((*(x)) & 0xc0) >> 6 )
#define GET_BIT_4_6(x)   ( ((*(x)) & 0x70) >> 4 )
#define GET_BIT_0(x)   ((*(x)) & 0x01)
#define GET_BIT_1(x)   ((*(x)) & 0x02)
#define GET_BIT_2(x)   ((*(x)) & 0x04)
#define GET_BIT_3(x)   ((*(x)) & 0x08)
#define GET_BIT_4(x)   ((*(x)) & 0x10)
#define GET_BIT_5(x)   ((*(x)) & 0x20)
#define GET_BIT_6(x)   ((*(x)) & 0x40)
#define GET_BIT_7(x)   ((*(x)) & 0x80)
#define GET_REAL(x)   ( (x) ? 1 : 0 )
 Convert GET_BIT_x values to 0 or 1, ex: GET_REAL(GET_BIT_5(data_ptr));.
#define GET_NEXT_16_BITS(x)   ((((*((x) + 1)) << 8) & 0xff00) | ((*(x)) & 0x00ff))
#define MOD_TOS   0x0001
 Indicates that the IPv4 Type Of Service field changed.
#define MOD_TOT_LEN   0x0002
 Indicates that the IPv4 Total Length field changed.
#define MOD_ID   0x0004
 Indicates that the IPv4 Identification field changed.
#define MOD_FRAG_OFF   0x0008
 Indicates that the IPv4 Fragment Offset field changed.
#define MOD_TTL   0x0010
 Indicates that the IPv4 Time To Live field changed.
#define MOD_PROTOCOL   0x0020
 Indicates that the IPv4 Protocol field changed.
#define MOD_CHECK   0x0040
 Indicates that the IPv4 Checksum field changed.
#define MOD_SADDR   0x0080
 Indicates that the IPv4 Source Address field changed.
#define MOD_DADDR   0x0100
 Indicates that the IPv4 Destination Address field changed.
#define MOD_RTP_PADDING   0x0200
 Indicates that the RTP Padding field changed.
#define MOD_RTP_EXT   0x0400
 Indicates that the RTP Extension field changed.
#define MOD_RTP_M   0x0800
 Indicates that the RTP Marker field changed.
#define MOD_RTP_PT   0x1000
 Indicates that the Payload Type field changed.
#define MOD_RTP_SN   0x2000
 Indicates that the Sequence Number field changed.
#define MOD_RTP_TS   0x4000
 Indicates that the Timestamp field changed.
#define MOD_RTP_SSRC   0x8000
 Indicates that the SSRC field changed.
#define WEIGHT_OLD   1
#define WEIGHT_NEW   1
#define zfree(pointer)
 Free a pointer plus set it to NULL to avoid hidden bugs.

Typedefs

typedef unsigned char boolean
 Boolean type that can only take two values: ROHC_TRUE or ROHC_FALSE.

Enumerations

enum  rohc_mode { U_MODE = 1, O_MODE = 2, R_MODE = 3 }

Functions

char * rohc_version (void)
 Get the version of the ROHC library.

Detailed Description

ROHC common definitions and routines.

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

Define Documentation

#define CHANGE_TO_FO_COUNT   700

The maximal number of packets sent in > FO states (= SO state) before changing back the state to FO (periodic refreshes)

Referenced by periodic_down_transition().

#define CHANGE_TO_IR_COUNT   1700

The maximal number of packets sent in > IR states (= FO and SO states) before changing back the state to IR (periodic refreshes)

Referenced by periodic_down_transition(), and uncompressed_periodic_down_transition().

#define CRC_ACTION   1

Whether to attempt packet recovery after CRC failure or not.

Referenced by act_on_crc_failure().

#define GET_BIT_0 (   x)    ((*(x)) & 0x01)
#define GET_BIT_0_2 (   x)    ((*(x)) & 0x07)
#define GET_BIT_0_3 (   x)    ((*(x)) & 0x0f)
#define GET_BIT_0_4 (   x)    ((*(x)) & 0x1f)
#define GET_BIT_0_5 (   x)    ((*(x)) & 0x3f)
#define GET_BIT_0_6 (   x)    ((*(x)) & 0x7f)
#define GET_BIT_0_7 (   x)    ((*(x)) & 0xff)
#define GET_BIT_1 (   x)    ((*(x)) & 0x02)
#define GET_BIT_1_7 (   x)    ( ((*(x)) & 0xfe) >> 1 )

Referenced by d_is_ir(), and d_is_segment().

#define GET_BIT_2 (   x)    ((*(x)) & 0x04)
#define GET_BIT_3 (   x)    ((*(x)) & 0x08)
#define GET_BIT_3_4 (   x)    ( ((*(x)) & 0x18) >> 3 )

Referenced by decode_extension3().

#define GET_BIT_3_5 (   x)    ( ((*(x)) & 0x38) >> 3 )
#define GET_BIT_3_6 (   x)    ( ((*(x)) & 0x78) >> 3 )

Referenced by decode_uo0(), and decode_uo1().

#define GET_BIT_3_7 (   x)    ( ((*(x)) & 0xf8) >> 3 )

Referenced by d_is_feedback(), and decode_uo1().

#define GET_BIT_4 (   x)    ((*(x)) & 0x10)
#define GET_BIT_4_6 (   x)    ( ((*(x)) & 0x70) >> 4 )
#define GET_BIT_4_7 (   x)    ( ((*(x)) & 0xf0) >> 4 )
#define GET_BIT_5 (   x)    ((*(x)) & 0x20)
#define GET_BIT_5_7 (   x)    ( ((*(x)) & 0xe0) >> 5 )
#define GET_BIT_6 (   x)    ((*(x)) & 0x40)
#define GET_BIT_6_7 (   x)    ( ((*(x)) & 0xc0) >> 6 )
#define GET_BIT_7 (   x)    ((*(x)) & 0x80)
#define GET_NEXT_16_BITS (   x)    ((((*((x) + 1)) << 8) & 0xff00) | ((*(x)) & 0x00ff))
#define GET_REAL (   x)    ( (x) ? 1 : 0 )
#define MAX_FO_COUNT   3

Defines the minimal number of packets that must be sent while in FO state before being able to switch the the SO state.

Referenced by c_init_header_info(), changed_dynamic_one_hdr(), changed_static_one_hdr(), code_EXT3_packet(), decide_FO_packet(), decide_state(), header_fields(), and header_flags().

#define MAX_IR_COUNT   3

Defines the minimal number of packets that must be sent while in IR state before being able to switch the the FO state.

Referenced by c_udp_lite_create(), decide_state(), rtp_changed_rtp_dynamic(), rtp_decide_state(), rtp_header_flags_and_fields(), udp_changed_udp_dynamic(), udp_lite_send_cce_packet(), and uncompressed_decide_state().

#define MOD_CHECK   0x0040

Indicates that the IPv4 Checksum field changed.

#define MOD_DADDR   0x0100

Indicates that the IPv4 Destination Address field changed.

#define MOD_FRAG_OFF   0x0008

Indicates that the IPv4 Fragment Offset field changed.

#define MOD_ID   0x0004

Indicates that the IPv4 Identification field changed.

#define MOD_PROTOCOL   0x0020

Indicates that the IPv4 Protocol field changed.

Referenced by changed_fields(), changed_static_one_hdr(), header_fields(), and header_flags().

#define MOD_RTP_EXT   0x0400

Indicates that the RTP Extension field changed.

#define MOD_RTP_M   0x0800

Indicates that the RTP Marker field changed.

#define MOD_RTP_PADDING   0x0200

Indicates that the RTP Padding field changed.

#define MOD_RTP_PT   0x1000

Indicates that the Payload Type field changed.

#define MOD_RTP_SN   0x2000

Indicates that the Sequence Number field changed.

#define MOD_RTP_SSRC   0x8000

Indicates that the SSRC field changed.

#define MOD_RTP_TS   0x4000

Indicates that the Timestamp field changed.

#define MOD_SADDR   0x0080

Indicates that the IPv4 Source Address field changed.

#define MOD_TOS   0x0001

Indicates that the IPv4 Type Of Service field changed.

Referenced by changed_dynamic_one_hdr(), changed_fields(), header_fields(), and header_flags().

#define MOD_TOT_LEN   0x0002

Indicates that the IPv4 Total Length field changed.

#define MOD_TTL   0x0010

Indicates that the IPv4 Time To Live field changed.

Referenced by changed_dynamic_one_hdr(), changed_fields(), header_fields(), and header_flags().

#define PACKET_CCE   6

Defines an CCE packet (UDP-Lite profile only)

Referenced by d_udp_lite_decode().

#define PACKET_CCE_OFF   7

Defines an CCE(OFF) packet (UDP-Lite profile only)

Referenced by d_udp_lite_decode().

#define PACKET_EXT_0   0
#define PACKET_EXT_1   1
#define PACKET_EXT_2   2
#define PACKET_EXT_3   3
#define PACKET_IR   4
#define PACKET_IR_DYN   3
#define PACKET_NOEXT   (-1)
#define PACKET_NORMAL   14

Defines a Normal packet (Uncompressed profile only)

Referenced by uncompressed_code_packet().

#define PACKET_UNKNOWN   5

If packet type is not defined yet.

Referenced by find_packet_type(), and uncompressed_code_packet().

#define PACKET_UO_0   0
#define PACKET_UO_1   1
#define PACKET_UO_1_ID   9
#define PACKET_UO_1_RTP   8
#define PACKET_UO_1_TS   10
#define PACKET_UOR_2   2
#define PACKET_UOR_2_ID   12
#define PACKET_UOR_2_RTP   11
#define PACKET_UOR_2_TS   13
#define ROHC_ERROR   -5
#define ROHC_ERROR_CRC   -4

Return code: the action failed due to a CRC failure.

Referenced by act_on_crc_failure(), d_decode_header(), d_optimistic_feedback(), decode_uo0(), decode_uo1(), decode_uor2(), and rohc_decompress().

#define ROHC_ERROR_NO_CONTEXT   -1

Return code: the action can not proceed because no context is defined.

Referenced by d_decode_header(), d_optimistic_feedback(), and rohc_decompress().

#define ROHC_ERROR_PACKET_FAILED   -2

Return code: the action failed due to an unattended or malformed packet.

Referenced by d_optimistic_feedback(), and rohc_decompress().

#define ROHC_FALSE   0

False value for the boolean type.

Referenced by c_ack_remove(), c_create_wlsb(), c_encodeSdvl(), and c_is_in_list().

#define ROHC_FEEDBACK_ONLY   -3

Return code: the action failed because the packet only contains feedback info.

Referenced by d_decode_header(), and rohc_decompress().

#define ROHC_NEED_REPARSE   -6

Return code: the packet needs to be parsed again.

Referenced by d_generic_decode(), and decode_uor2().

#define ROHC_OK   1

Return code: the action done without problem.

Referenced by d_decode_header(), d_optimistic_feedback(), and rohc_decompress().

#define ROHC_PROFILE_IP   0x0004

The number allocated for the ROHC IP-only profile (see 5 in the RFC 3843)

Referenced by c_assessment_size(), and c_generic_create().

#define ROHC_PROFILE_RTP   0x0001
#define ROHC_PROFILE_UDP   0x0002

The number allocated for the ROHC UDP profile.

Referenced by c_assessment_size(), and c_generic_create().

#define ROHC_PROFILE_UDPLITE   0x0008

The number allocated for the ROHC UDP-Lite profile (see 7 in the RFC 4019)

Referenced by c_assessment_size(), and c_generic_create().

#define ROHC_PROFILE_UNCOMPRESSED   0x0000

The number allocated for the ROHC Uncompressed profile.

Referenced by c_generic_create(), c_get_profile_from_packet(), rohc_compress(), and uncompressed_code_IR_packet().

#define ROHC_TRUE   1
#define RTP_PORTS   1234, 36780, 33238, 5020, 5002

List of UDP ports associated with RTP streams The port numbers must be separated by a comma.

#define WEIGHT_NEW   1

Referenced by update_inter_packet().

#define WEIGHT_OLD   1

Referenced by update_inter_packet().

#define zfree (   pointer)

Typedef Documentation

typedef unsigned char boolean

Boolean type that can only take two values: ROHC_TRUE or ROHC_FALSE.


Enumeration Type Documentation

enum rohc_mode

ROHC operation modes (see 4.4 in the RFC 3095)

Enumerator:
U_MODE 

The Unidirectional mode (U-mode)

O_MODE 

The Bidirectional Optimistic mode (O-mode)

R_MODE 

The Bidirectional Reliable mode (R-mode)