ROHC compression/decompression library
Macros
rohc_bit_ops.h File Reference

Bitwised operations for ROHC compression/decompression. More...

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

Go to the source code of this file.

Macros

#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_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_REAL(x)   ((x) ? 1 : 0)
 Convert GET_BIT_* values to 0 or 1. More...
 
#define GET_BOOL(x)   ((x) ? true : false)
 Convert GET_BIT_* values to boolean. More...
 
#define GET_NEXT_16_BITS(x)   ((((*((x) + 1)) << 8) & 0xff00) | ((*(x)) & 0x00ff))
 Get the next 16 bits at the given memory location in Network Byte Order. More...
 
#define APPEND_BITS(field_descr, ext_no, field, field_nr, bits, bits_nr, max)
 
#define APPEND_SN_BITS(ext_no, base, bits, bits_nr)
 
#define APPEND_OUTER_IP_ID_BITS(ext_no, base, bits, bits_nr)
 
#define APPEND_INNER_IP_ID_BITS(ext_no, base, bits, bits_nr)
 
#define APPEND_TS_BITS(ext_no, base, bits, bits_nr)
 

Detailed Description

Bitwised operations for ROHC compression/decompression.

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
Didier Barvaux didie.nosp@m.r@ba.nosp@m.rvaux.nosp@m..org

Macro Definition Documentation

#define APPEND_BITS (   field_descr,
  ext_no,
  field,
  field_nr,
  bits,
  bits_nr,
  max 
)

Append new LSB bits to already extracted bits

#define APPEND_INNER_IP_ID_BITS (   ext_no,
  base,
  bits,
  bits_nr 
)
Value:
APPEND_BITS(inner IP-ID, ext_no, \
(base)->inner_ip.id, (base)->inner_ip.id_nr, \
(bits), (bits_nr), 16)
#define APPEND_BITS(field_descr, ext_no, field, field_nr, bits, bits_nr, max)
Definition: rohc_bit_ops.h:112

Inner IP-ID: append new LSB bits to already extracted bits

#define APPEND_OUTER_IP_ID_BITS (   ext_no,
  base,
  bits,
  bits_nr 
)
Value:
APPEND_BITS(outer IP-ID, ext_no, \
(base)->outer_ip.id, (base)->outer_ip.id_nr, \
(bits), (bits_nr), 16)
#define APPEND_BITS(field_descr, ext_no, field, field_nr, bits, bits_nr, max)
Definition: rohc_bit_ops.h:112

Outer IP-ID: append new LSB bits to already extracted bits

#define APPEND_SN_BITS (   ext_no,
  base,
  bits,
  bits_nr 
)
Value:
APPEND_BITS(SN, ext_no, \
(base)->sn, (base)->sn_nr, \
(bits), (bits_nr), 32)
#define APPEND_BITS(field_descr, ext_no, field, field_nr, bits, bits_nr, max)
Definition: rohc_bit_ops.h:112

SN: append new LSB bits to already extracted bits

#define APPEND_TS_BITS (   ext_no,
  base,
  bits,
  bits_nr 
)
Value:
APPEND_BITS(TS, ext_no, \
(base)->ts, (base)->ts_nr, \
(bits), (bits_nr), 32)
#define APPEND_BITS(field_descr, ext_no, field, field_nr, bits, bits_nr, max)
Definition: rohc_bit_ops.h:112

TS: append new LSB bits to already extracted bits

#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 )
#define GET_BIT_2 (   x)    ((*(x)) & 0x04)
#define GET_BIT_3 (   x)    ((*(x)) & 0x08)
#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 (   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_BOOL (   x)    ((x) ? true : false)

Convert GET_BIT_* values to boolean.

example: GET_BOOL(GET_BIT_5(data_ptr));

#define GET_NEXT_16_BITS (   x)    ((((*((x) + 1)) << 8) & 0xff00) | ((*(x)) & 0x00ff))

Get the next 16 bits at the given memory location in Network Byte Order.

#define GET_REAL (   x)    ((x) ? 1 : 0)

Convert GET_BIT_* values to 0 or 1.

example: GET_REAL(GET_BIT_5(data_ptr));