ROHC compression/decompression library
Data Structures | Macros | Enumerations | Functions
interval.h File Reference

Compute the interpretation interval for LSB and W-LSB encoding. More...

#include <rohc/rohc.h>
#include <stdlib.h>
#include <stdint.h>
Include dependency graph for interval.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rohc_interval8
 An interval of 8-bit values. More...
 
struct  rohc_interval16
 An interval of 16-bit values. More...
 
struct  rohc_interval32
 An interval of 32-bit values. More...
 

Macros

#define ROHC_WLSB_WIDTH_MAX   64U
 
#define ROHC_LSB_SHIFT_TCP_TS_1B   ROHC_LSB_SHIFT_SN
 
#define ROHC_LSB_SHIFT_TCP_TS_2B   ROHC_LSB_SHIFT_SN
 
#define ROHC_LSB_SHIFT_TCP_ACK_SCALED   ROHC_LSB_SHIFT_TCP_TTL
 

Enumerations

enum  rohc_lsb_shift_t {
  ROHC_LSB_SHIFT_SN = -1, ROHC_LSB_SHIFT_IP_ID = 0, ROHC_LSB_SHIFT_TCP_TTL = 3, ROHC_LSB_SHIFT_TCP_SN = 4,
  ROHC_LSB_SHIFT_TCP_SEQ_SCALED = 7, ROHC_LSB_SHIFT_RTP_TS = 100, ROHC_LSB_SHIFT_RTP_SN = 101, ROHC_LSB_SHIFT_ESP_SN = 102,
  ROHC_LSB_SHIFT_VAR = 103, ROHC_LSB_SHIFT_TCP_WINDOW = 16383, ROHC_LSB_SHIFT_TCP_TS_3B = 0x00040000, ROHC_LSB_SHIFT_TCP_TS_4B = 0x04000000
}
 the different values of the shift parameter of the LSB algorithm More...
 

Functions

static int32_t rohc_interval_compute_p (const size_t k, const rohc_lsb_shift_t p)
 Compute the shift parameter p for the f function. More...
 
struct rohc_interval32 rohc_f_32bits (const uint32_t v_ref, const size_t k, const rohc_lsb_shift_t p)
 The f function as defined in LSB encoding for 32-bit fields. More...
 
int32_t rohc_interval_get_rfc5225_msn_p (const size_t k, rohc_reordering_offset_t reorder_ratio)
 Get shift parameter p from number of bytes k and reorder ratio. More...
 
int32_t rohc_interval_get_rfc5225_id_id_p (const size_t k)
 Get shift parameter p from number of bytes k for ip_id_lsb. More...
 

Detailed Description

Compute the interpretation interval for LSB and W-LSB encoding.

Author
Didier Barvaux didie.nosp@m.r.ba.nosp@m.rvaux.nosp@m.@tou.nosp@m.louse.nosp@m..viv.nosp@m.eris..nosp@m.com

Macro Definition Documentation

◆ ROHC_LSB_SHIFT_TCP_ACK_SCALED

#define ROHC_LSB_SHIFT_TCP_ACK_SCALED   ROHC_LSB_SHIFT_TCP_TTL

◆ ROHC_LSB_SHIFT_TCP_TS_1B

#define ROHC_LSB_SHIFT_TCP_TS_1B   ROHC_LSB_SHIFT_SN

real value for TCP TS

◆ ROHC_LSB_SHIFT_TCP_TS_2B

#define ROHC_LSB_SHIFT_TCP_TS_2B   ROHC_LSB_SHIFT_SN

real value for TCP TS

◆ ROHC_WLSB_WIDTH_MAX

#define ROHC_WLSB_WIDTH_MAX   64U

The maximum width of the W-LSB window (implementation specific)

Enumeration Type Documentation

◆ rohc_lsb_shift_t

the different values of the shift parameter of the LSB algorithm

The shift parameter is also named 'p' in some RFCs.

Some values are the real values to use directly. Some others are code that means that the real value to use shall be computed from the number of least significant bits that are transmitted.

Enumerator
ROHC_LSB_SHIFT_SN 

real value for non-RTP SN

ROHC_LSB_SHIFT_IP_ID 

real value for IP-ID

ROHC_LSB_SHIFT_TCP_TTL 

real value for TCP TTL/HL

ROHC_LSB_SHIFT_TCP_SN 

real value for TCP MSN

ROHC_LSB_SHIFT_TCP_SEQ_SCALED 

real value for TCP seq/ack scaled

ROHC_LSB_SHIFT_RTP_TS 

need to compute real value for RTP TS

ROHC_LSB_SHIFT_RTP_SN 

need to compute real value for RTP SN

ROHC_LSB_SHIFT_ESP_SN 

need to compute real value for ESP SN

ROHC_LSB_SHIFT_VAR 

real value is variable

ROHC_LSB_SHIFT_TCP_WINDOW 

real value for TCP window

ROHC_LSB_SHIFT_TCP_TS_3B 

real value for TCP TS

ROHC_LSB_SHIFT_TCP_TS_4B 

real value for TCP TS

Function Documentation

◆ rohc_f_32bits()

struct rohc_interval32 rohc_f_32bits ( const uint32_t  v_ref,
const size_t  k,
const rohc_lsb_shift_t  p 
)

The f function as defined in LSB encoding for 32-bit fields.

Find out the interval [v_ref - p, v_ref + (2^k - 1) - p] for a given k. See 4.5.1 in the RFC 3095 for details.

As stated RFC, the values to be encoded have a finite range and the interpretation interval can straddle the wraparound boundary. So, the min value may be greater than the max value!

Parameters
v_refThe reference value
kThe number of least significant bits of the value that are transmitted
pThe shift parameter (may be negative)
Returns
The computed interval

◆ rohc_interval_compute_p()

static int32_t rohc_interval_compute_p ( const size_t  k,
const rohc_lsb_shift_t  p 
)
inlinestatic

Compute the shift parameter p for the f function.

Parameters
kThe number of least significant bits of the value that are transmitted
pThe shift parameter (may be negative)
Returns
The computed shift parameter p

◆ rohc_interval_get_rfc5225_id_id_p()

int32_t rohc_interval_get_rfc5225_id_id_p ( const size_t  k)

Get shift parameter p from number of bytes k for ip_id_lsb.

Parameters
kThe number of least significant bits of the value that are transmitted
Returns
The shift parameter p

◆ rohc_interval_get_rfc5225_msn_p()

int32_t rohc_interval_get_rfc5225_msn_p ( const size_t  k,
rohc_reordering_offset_t  reorder_ratio 
)

Get shift parameter p from number of bytes k and reorder ratio.

Parameters
kThe number of least significant bits of the value that are transmitted
reorder_ratioThe reordering ratio
Returns
The shift parameter p