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

The IPv6 header. More...

#include "rohc_utils.h"
#include <stdint.h>
#include <stddef.h>
#include "config.h"
Include dependency graph for ipv6.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ipv6_addr
 The IPv6 address. More...
 
struct  ipv6_hdr
 The IPv6 header. More...
 
struct  ipv6_opt
 

Macros

#define IPV6_ADDR_FORMAT   "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x"
 
#define IPV6_ADDR_IN6(x)   IPV6_ADDR_RAW((x)->u8)
 
#define IPV6_ADDR_RAW(x)
 
#define IPV6_ADDR_CMP(x, y)
 
#define IPV6_VERSION_MASK   0xf0000000U
 
#define IPV6_TC_MASK   0x0ff00000U
 
#define IPV6_FLOW_MASK   0x000fffffU
 
#define IPV6_OPT_HDR_LEN_FIELD_MAX_VAL   0xffU
 
#define IPV6_OPT_HDR_LEN_MAX   ((IPV6_OPT_HDR_LEN_FIELD_MAX_VAL + 1) * 8)
 
#define IPV6_OPT_CTXT_LEN_MAX   (IPV6_OPT_HDR_LEN_MAX - 2)
 

Functions

static uint8_t ipv6_get_tc (const struct ipv6_hdr *const ipv6)
 Get the Traffic Class (TC) of the given IPv6 packet. More...
 
static void ipv6_set_tc (struct ipv6_hdr *const ipv6, const uint8_t tc)
 Set the Traffic Class (TC) of the given IPv6 packet. More...
 
static void ipv6_set_dscp_ecn (struct ipv6_hdr *const ipv6, const uint8_t dscp, const uint8_t ecn)
 Set the DSCP and ECN of the given IPv6 packet. More...
 
static uint8_t ipv6_get_dscp (const struct ipv6_hdr *const ipv6)
 Get the Differentiated Services Code Point (DSCP) of the given IPv6 packet. More...
 
static void ipv6_set_dscp (struct ipv6_hdr *const ipv6, const uint8_t dscp)
 Set the Differentiated Services Code Point (DSCP) of the given IPv6 packet. More...
 
static uint32_t ipv6_get_flow_label (const struct ipv6_hdr *const ipv6)
 Get the Flow Label of the given IPv6 packet. More...
 
static void ipv6_set_flow_label (struct ipv6_hdr *const ipv6, const uint32_t flow_label)
 Set the Flow Label of the given IPv6 packet. More...
 
static size_t ipv6_opt_get_length (const struct ipv6_opt *const opt)
 get the length (in bytes) of the IPv6 option header More...
 

Detailed Description

The IPv6 header.

Author
Didier Barvaux didie.nosp@m.r@ba.nosp@m.rvaux.nosp@m..org

Macro Definition Documentation

#define IPV6_ADDR_CMP (   x,
 
)
Value:
((x)->u32[0] == (y)->u32[0] && (x)->u32[1] == (y)->u32[1] && \
(x)->u32[2] == (y)->u32[2] && (x)->u32[3] == (y)->u32[3])

Compare two IPv6 addresses in (struct ipv6_addr *) format

#define IPV6_ADDR_FORMAT   "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x"

The format to print an IPv6 address

#define IPV6_ADDR_IN6 (   x)    IPV6_ADDR_RAW((x)->u8)

The data to print an IPv6 address in (struct ipv6_addr *) format

#define IPV6_ADDR_RAW (   x)
Value:
(x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], \
(x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15]

The data to print an IPv6 address in raw format

#define IPV6_FLOW_MASK   0x000fffffU

The mask for the Flow Label field

#define IPV6_OPT_CTXT_LEN_MAX   (IPV6_OPT_HDR_LEN_MAX - 2)

The maximum length for the IPv6 extension header context

#define IPV6_OPT_HDR_LEN_FIELD_MAX_VAL   0xffU

The maximum value of the length field of one IPv6 extension header

#define IPV6_OPT_HDR_LEN_MAX   ((IPV6_OPT_HDR_LEN_FIELD_MAX_VAL + 1) * 8)

The maximum length of one IPv6 extension header

#define IPV6_TC_MASK   0x0ff00000U

The mask for the Traffic Class (TC) field

#define IPV6_VERSION_MASK   0xf0000000U

The mask for the Traffic Class (TC) field

Function Documentation

static uint8_t ipv6_get_dscp ( const struct ipv6_hdr *const  ipv6)
inlinestatic

Get the Differentiated Services Code Point (DSCP) of the given IPv6 packet.

Parameters
ipv6The header of the IPv6 packet
Returns
The 6-bit DSCP
static uint32_t ipv6_get_flow_label ( const struct ipv6_hdr *const  ipv6)
inlinestatic

Get the Flow Label of the given IPv6 packet.

Parameters
ipv6The header of the IPv6 packet
Returns
The 20-bit Flow Label
static uint8_t ipv6_get_tc ( const struct ipv6_hdr *const  ipv6)
inlinestatic

Get the Traffic Class (TC) of the given IPv6 packet.

Parameters
ipv6The header of the IPv6 packet
Returns
The 8-bit Traffic Class (TC)
static size_t ipv6_opt_get_length ( const struct ipv6_opt *const  opt)
inlinestatic

get the length (in bytes) of the IPv6 option header

Parameters
optThe IPv6 option header
Returns
The length (in bytes) of the IPv6 option header
static void ipv6_set_dscp ( struct ipv6_hdr *const  ipv6,
const uint8_t  dscp 
)
inlinestatic

Set the Differentiated Services Code Point (DSCP) of the given IPv6 packet.

Parameters
[in,out]ipv6The header of the IPv6 packet
dscpThe 6-bit DSCP
static void ipv6_set_dscp_ecn ( struct ipv6_hdr *const  ipv6,
const uint8_t  dscp,
const uint8_t  ecn 
)
inlinestatic

Set the DSCP and ECN of the given IPv6 packet.

Parameters
[in,out]ipv6The header of the IPv6 packet
dscpThe 6-bit DSCP
ecnThe 2-bit ECN
static void ipv6_set_flow_label ( struct ipv6_hdr *const  ipv6,
const uint32_t  flow_label 
)
inlinestatic

Set the Flow Label of the given IPv6 packet.

Parameters
[in,out]ipv6The header of the IPv6 packet
flow_labelThe 20-bit Flow Label
static void ipv6_set_tc ( struct ipv6_hdr *const  ipv6,
const uint8_t  tc 
)
inlinestatic

Set the Traffic Class (TC) of the given IPv6 packet.

Parameters
[in,out]ipv6The header of the IPv6 packet
tcThe 8-bit Traffic Class (TC)