FD.io VPP  v21.01.1
Vector Packet Processing
ip4_packet.h File Reference
+ Include dependency graph for ip4_packet.h:

Go to the source code of this file.

Data Structures

union  ip4_address_t
 
struct  ip4_address_fib_t
 
struct  ip4_address_pair_t
 
struct  ip4_address_and_mask_t
 
union  ip4_header_t
 

Macros

#define IP4_HEADER_FLAG_MORE_FRAGMENTS   (1 << 13)
 
#define IP4_HEADER_FLAG_DONT_FRAGMENT   (1 << 14)
 
#define IP4_HEADER_FLAG_CONGESTION   (1 << 15)
 
#define IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS   ((4 << 4) | (sizeof (ip4_header_t) / sizeof (u32)))
 
#define IP4_ROUTER_ALERT_OPTION   20
 
#define ip4_partial_header_checksum_x1(ip0, sum0)
 
#define ip4_partial_header_checksum_x2(ip0, ip1, sum0, sum1)
 

Functions

static void ip4_addr_fib_init (ip4_address_fib_t *addr_fib, const ip4_address_t *address, u32 fib_index)
 
static u16 ip4_get_fragment_offset (const ip4_header_t *i)
 
static u16 ip4_get_fragment_more (const ip4_header_t *i)
 
static int ip4_is_fragment (const ip4_header_t *i)
 
static int ip4_is_first_fragment (const ip4_header_t *i)
 
static int ip4_get_fragment_offset_bytes (const ip4_header_t *i)
 
static int ip4_header_bytes (const ip4_header_t *i)
 
static void * ip4_next_header (ip4_header_t *i)
 
static_always_inline u16 ip4_header_checksum_inline (ip4_header_t *i, int with_checksum)
 
static u16 ip4_header_checksum (ip4_header_t *i)
 
static void ip4_header_set_dscp (ip4_header_t *ip4, ip_dscp_t dscp)
 
static void ip4_header_set_ecn (ip4_header_t *ip4, ip_ecn_t ecn)
 
static void ip4_header_set_ecn_w_chksum (ip4_header_t *ip4, ip_ecn_t ecn)
 
static ip_dscp_t ip4_header_get_dscp (const ip4_header_t *ip4)
 
static ip_ecn_t ip4_header_get_ecn (const ip4_header_t *ip4)
 
static void ip4_header_set_df (ip4_header_t *ip4)
 
static void ip4_header_clear_df (ip4_header_t *ip4)
 
static u8 ip4_header_get_df (const ip4_header_t *ip4)
 
static uword ip4_header_checksum_is_valid (ip4_header_t *i)
 
static uword ip4_address_is_multicast (const ip4_address_t *a)
 
static uword ip4_address_is_global_broadcast (const ip4_address_t *a)
 
static void ip4_multicast_address_set_for_group (ip4_address_t *a, ip_multicast_group_t g)
 
static void ip4_multicast_ethernet_address (u8 *ethernet_address, const ip4_address_t *a)
 
static void ip4_tcp_reply_x1 (ip4_header_t *ip0, tcp_header_t *tcp0)
 
static void ip4_tcp_reply_x2 (ip4_header_t *ip0, ip4_header_t *ip1, tcp_header_t *tcp0, tcp_header_t *tcp1)
 

Macro Definition Documentation

◆ IP4_HEADER_FLAG_CONGESTION

#define IP4_HEADER_FLAG_CONGESTION   (1 << 15)

Definition at line 109 of file ip4_packet.h.

◆ IP4_HEADER_FLAG_DONT_FRAGMENT

#define IP4_HEADER_FLAG_DONT_FRAGMENT   (1 << 14)

Definition at line 108 of file ip4_packet.h.

◆ IP4_HEADER_FLAG_MORE_FRAGMENTS

#define IP4_HEADER_FLAG_MORE_FRAGMENTS   (1 << 13)

Definition at line 107 of file ip4_packet.h.

◆ ip4_partial_header_checksum_x1

#define ip4_partial_header_checksum_x1 (   ip0,
  sum0 
)
Value:
do { \
if (BITS (ip_csum_t) > 32) \
{ \
sum0 = ip0->checksum_data_64[0]; \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64[1]); \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64_32[0]); \
} \
else \
{ \
sum0 = ip0->checksum_data_32[0]; \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[1]); \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[2]); \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[3]); \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[4]); \
} \
} while (0)
uword ip_csum_t
Definition: ip_packet.h:246
static ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
Definition: ip_packet.h:249
#define BITS(x)
Definition: clib.h:66

Definition at line 389 of file ip4_packet.h.

◆ ip4_partial_header_checksum_x2

#define ip4_partial_header_checksum_x2 (   ip0,
  ip1,
  sum0,
  sum1 
)
Value:
do { \
if (BITS (ip_csum_t) > 32) \
{ \
sum0 = ip0->checksum_data_64[0]; \
sum1 = ip1->checksum_data_64[0]; \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64[1]); \
sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_64[1]); \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_64_32[0]); \
sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_64_32[0]); \
} \
else \
{ \
sum0 = ip0->checksum_data_32[0]; \
sum1 = ip1->checksum_data_32[0]; \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[1]); \
sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[1]); \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[2]); \
sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[2]); \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[3]); \
sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[3]); \
sum0 = ip_csum_with_carry (sum0, ip0->checksum_data_32[4]); \
sum1 = ip_csum_with_carry (sum1, ip1->checksum_data_32[4]); \
} \
} while (0)
uword ip_csum_t
Definition: ip_packet.h:246
static ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
Definition: ip_packet.h:249
#define BITS(x)
Definition: clib.h:66

Definition at line 407 of file ip4_packet.h.

◆ IP4_ROUTER_ALERT_OPTION

#define IP4_ROUTER_ALERT_OPTION   20

Definition at line 152 of file ip4_packet.h.

◆ IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS

#define IP4_VERSION_AND_HEADER_LENGTH_NO_OPTIONS   ((4 << 4) | (sizeof (ip4_header_t) / sizeof (u32)))

Definition at line 149 of file ip4_packet.h.

Function Documentation

◆ ip4_addr_fib_init()

static void ip4_addr_fib_init ( ip4_address_fib_t addr_fib,
const ip4_address_t address,
u32  fib_index 
)
inlinestatic

Definition at line 68 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_address_is_global_broadcast()

static uword ip4_address_is_global_broadcast ( const ip4_address_t a)
inlinestatic

Definition at line 440 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_address_is_multicast()

static uword ip4_address_is_multicast ( const ip4_address_t a)
inlinestatic

Definition at line 434 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_get_fragment_more()

static u16 ip4_get_fragment_more ( const ip4_header_t i)
inlinestatic

Definition at line 161 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_get_fragment_offset()

static u16 ip4_get_fragment_offset ( const ip4_header_t i)
inlinestatic

Definition at line 155 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_get_fragment_offset_bytes()

static int ip4_get_fragment_offset_bytes ( const ip4_header_t i)
inlinestatic

Definition at line 184 of file ip4_packet.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_header_bytes()

static int ip4_header_bytes ( const ip4_header_t i)
inlinestatic

Definition at line 190 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_header_checksum()

static u16 ip4_header_checksum ( ip4_header_t i)
inlinestatic

Definition at line 314 of file ip4_packet.h.

+ Here is the call graph for this function:

◆ ip4_header_checksum_inline()

static_always_inline u16 ip4_header_checksum_inline ( ip4_header_t i,
int  with_checksum 
)

Definition at line 209 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_header_checksum_is_valid()

static uword ip4_header_checksum_is_valid ( ip4_header_t i)
inlinestatic

Definition at line 384 of file ip4_packet.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_header_clear_df()

static void ip4_header_clear_df ( ip4_header_t ip4)
inlinestatic

Definition at line 370 of file ip4_packet.h.

◆ ip4_header_get_df()

static u8 ip4_header_get_df ( const ip4_header_t ip4)
inlinestatic

Definition at line 377 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_header_get_dscp()

static ip_dscp_t ip4_header_get_dscp ( const ip4_header_t ip4)
inlinestatic

Definition at line 351 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_header_get_ecn()

static ip_ecn_t ip4_header_get_ecn ( const ip4_header_t ip4)
inlinestatic

Definition at line 357 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_header_set_df()

static void ip4_header_set_df ( ip4_header_t ip4)
inlinestatic

Definition at line 363 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_header_set_dscp()

static void ip4_header_set_dscp ( ip4_header_t ip4,
ip_dscp_t  dscp 
)
inlinestatic

Definition at line 320 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_header_set_ecn()

static void ip4_header_set_ecn ( ip4_header_t ip4,
ip_ecn_t  ecn 
)
inlinestatic

Definition at line 332 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_header_set_ecn_w_chksum()

static void ip4_header_set_ecn_w_chksum ( ip4_header_t ip4,
ip_ecn_t  ecn 
)
inlinestatic

Definition at line 339 of file ip4_packet.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ip4_is_first_fragment()

static int ip4_is_first_fragment ( const ip4_header_t i)
inlinestatic

Definition at line 175 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_is_fragment()

static int ip4_is_fragment ( const ip4_header_t i)
inlinestatic

Definition at line 168 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_multicast_address_set_for_group()

static void ip4_multicast_address_set_for_group ( ip4_address_t a,
ip_multicast_group_t  g 
)
inlinestatic

Definition at line 446 of file ip4_packet.h.

◆ ip4_multicast_ethernet_address()

static void ip4_multicast_ethernet_address ( u8 ethernet_address,
const ip4_address_t a 
)
inlinestatic

Definition at line 454 of file ip4_packet.h.

◆ ip4_next_header()

static void* ip4_next_header ( ip4_header_t i)
inlinestatic

Definition at line 196 of file ip4_packet.h.

+ Here is the call graph for this function:

◆ ip4_tcp_reply_x1()

static void ip4_tcp_reply_x1 ( ip4_header_t ip0,
tcp_header_t tcp0 
)
inlinestatic

Definition at line 468 of file ip4_packet.h.

◆ ip4_tcp_reply_x2()

static void ip4_tcp_reply_x2 ( ip4_header_t ip0,
ip4_header_t ip1,
tcp_header_t tcp0,
tcp_header_t tcp1 
)
inlinestatic

Definition at line 484 of file ip4_packet.h.