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_VERSION_MASK   0xf0000000U
 
#define IPV6_TC_MASK   0x0ff00000U
 
#define IPV6_FLOW_MASK   0x000fffffU
 
#define IPV6_OPT_HDR_LEN_FIELD_MAX_VAL   4U
 
#define IPV6_OPT_HDR_LEN_MAX   ((IPV6_OPT_HDR_LEN_FIELD_MAX_VAL + 1U) * 8U)
 
#define IPV6_OPT_CTXT_LEN_MAX   (IPV6_OPT_HDR_LEN_MAX - 2U)
 

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

◆ 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

◆ IPV6_ADDR_IN6

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

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

◆ IPV6_ADDR_RAW

#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

◆ IPV6_FLOW_MASK

#define IPV6_FLOW_MASK   0x000fffffU

The mask for the Flow Label field

◆ IPV6_OPT_CTXT_LEN_MAX

#define IPV6_OPT_CTXT_LEN_MAX   (IPV6_OPT_HDR_LEN_MAX - 2U)

The maximum length for the IPv6 extension header context

◆ IPV6_OPT_HDR_LEN_FIELD_MAX_VAL

#define IPV6_OPT_HDR_LEN_FIELD_MAX_VAL   4U

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

◆ IPV6_OPT_HDR_LEN_MAX

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

The maximum length of one IPv6 extension header

◆ IPV6_TC_MASK

#define IPV6_TC_MASK   0x0ff00000U

The mask for the Traffic Class (TC) field

◆ IPV6_VERSION_MASK

#define IPV6_VERSION_MASK   0xf0000000U

The mask for the Traffic Class (TC) field

Function Documentation

◆ ipv6_get_dscp()

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

◆ ipv6_get_flow_label()

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

◆ ipv6_get_tc()

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)

◆ ipv6_opt_get_length()

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

◆ ipv6_set_dscp()

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

◆ ipv6_set_dscp_ecn()

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

◆ ipv6_set_flow_label()

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

◆ ipv6_set_tc()

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)