FD.io VPP  v20.05.1-6-gf53edbc3b
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 uword ip4_address_netmask_length (const ip4_address_t *a)
 
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 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 154 of file ip4_packet.h.

◆ IP4_HEADER_FLAG_DONT_FRAGMENT

#define IP4_HEADER_FLAG_DONT_FRAGMENT   (1 << 14)

Definition at line 153 of file ip4_packet.h.

◆ IP4_HEADER_FLAG_MORE_FRAGMENTS

#define IP4_HEADER_FLAG_MORE_FRAGMENTS   (1 << 13)

Definition at line 152 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:244
static ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
Definition: ip_packet.h:247
#define BITS(x)
Definition: clib.h:65

Definition at line 337 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:244
static ip_csum_t ip_csum_with_carry(ip_csum_t sum, ip_csum_t x)
Definition: ip_packet.h:247
#define BITS(x)
Definition: clib.h:65

Definition at line 355 of file ip4_packet.h.

◆ IP4_ROUTER_ALERT_OPTION

#define IP4_ROUTER_ALERT_OPTION   20

Definition at line 197 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 194 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 67 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 388 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 382 of file ip4_packet.h.

+ Here is the caller graph for this function:

◆ ip4_address_netmask_length()

static uword ip4_address_netmask_length ( const ip4_address_t a)
inlinestatic

Definition at line 88 of file ip4_packet.h.

◆ ip4_get_fragment_more()

static u16 ip4_get_fragment_more ( const ip4_header_t i)
inlinestatic

Definition at line 206 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 200 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 229 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 235 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 247 of file ip4_packet.h.

+ Here is the call graph for this function:

◆ ip4_header_checksum_is_valid()

static uword ip4_header_checksum_is_valid ( ip4_header_t i)
inlinestatic

Definition at line 332 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 318 of file ip4_packet.h.

◆ ip4_header_get_df()

static u8 ip4_header_get_df ( const ip4_header_t ip4)
inlinestatic

Definition at line 325 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 299 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 305 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 311 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 268 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 280 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 287 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 220 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 213 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 394 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 402 of file ip4_packet.h.

◆ ip4_next_header()

static void* ip4_next_header ( ip4_header_t i)
inlinestatic

Definition at line 241 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 416 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 432 of file ip4_packet.h.