FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ip_types.h File Reference
+ Include dependency graph for ip_types.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ip_address
 
struct  ip_prefix
 

Macros

#define N_AF   (AF_IP6+1)
 
#define FOR_EACH_IP_ADDRESS_FAMILY(_af)   for (_af = AF_IP4; _af <= AF_IP6; _af++)
 
#define N_SAFI   (SAFI_MULTICAST+1)
 
#define FOR_EACH_IP_ADDRESS_SUB_FAMILY(_safi)   for (_safi = SAFI_UNICAST; _safi <= SAFI_MULTICAST; _safi++)
 
#define u8_ptr_add(ptr, index)   (((u8 *)ptr) + index)
 
#define u16_net_add(u, val)   clib_host_to_net_u16(clib_net_to_host_u16(u) + (val))
 
#define foreach_ip_feature_location
 Locations in the IP switch path where features can be applied. More...
 
#define N_IP_FEATURE_LOCATIONS   (IP_FEATURE_DROP+1)
 
#define IP_ADDRESS_V4_ALL_0S   {.ip.ip4.as_u32 = 0, .version = AF_IP4}
 
#define IP_ADDRESS_V6_ALL_0S   {.ip.ip6.as_u64 = {0, 0}, .version = AF_IP6}
 
#define ip_address_initializer   IP_ADDRESS_V6_ALL_0S
 
#define ip_addr_46(_a)   (_a)->ip
 
#define ip_addr_v4(_a)   (_a)->ip.ip4
 
#define ip_addr_v6(_a)   (_a)->ip.ip6
 
#define ip_addr_version(_a)   (_a)->version
 
#define ip_prefix_addr(_a)   (_a)->addr
 
#define ip_prefix_version(_a)   ip_addr_version(&ip_prefix_addr(_a))
 
#define ip_prefix_len(_a)   (_a)->len
 
#define ip_prefix_v4(_a)   ip_addr_v4(&ip_prefix_addr(_a))
 
#define ip_prefix_v6(_a)   ip_addr_v6(&ip_prefix_addr(_a))
 

Typedefs

typedef enum ip_address_family_t_ ip_address_family_t
 
typedef enum ip_sub_address_family_t_ ip_sub_address_family_t
 
typedef enum ip_feature_location_t_ ip_feature_location_t
 
typedef struct ip_address ip_address_t
 
typedef struct ip_prefix ip_prefix_t
 

Enumerations

enum  ip_address_family_t_ { AF_IP4, AF_IP6 }
 
enum  ip_sub_address_family_t_ { SAFI_UNICAST, SAFI_MULTICAST }
 
enum  ip_feature_location_t_ { foreach_ip_feature_location }
 

Functions

uword unformat_ip_address_family (unformat_input_t *input, va_list *args)
 
u8format_ip_address_family (u8 *s, va_list *args)
 
vnet_link_t ip_address_family_to_link_type (ip_address_family_t af)
 
fib_protocol_t ip_address_family_to_fib_proto (ip_address_family_t af)
 
ip_address_family_t ip_address_family_from_fib_proto (fib_protocol_t fp)
 
uword unformat_ip_sub_address_family (unformat_input_t *input, va_list *args)
 
u8format_ip_sub_address_family (u8 *s, va_list *args)
 
u8ip_addr_bytes (ip_address_t *ip)
 
bool ip_address_is_zero (const ip_address_t *ip)
 
int ip_address_cmp (const ip_address_t *ip1, const ip_address_t *ip2)
 
void ip_address_copy (ip_address_t *dst, const ip_address_t *src)
 
void ip_address_copy_addr (void *dst, const ip_address_t *src)
 
void ip_address_set (ip_address_t *dst, const void *src, ip_address_family_t version)
 
u16 ip_address_size (const ip_address_t *a)
 
u16 ip_version_to_size (ip_address_family_t af)
 
u8format_ip_address (u8 *s, va_list *args)
 
uword unformat_ip_address (unformat_input_t *input, va_list *args)
 
fib_protocol_t ip_address_to_46 (const ip_address_t *addr, ip46_address_t *a)
 
void ip_address_from_46 (const ip46_address_t *a, fib_protocol_t fproto, ip_address_t *addr)
 
void ip_address_increment (ip_address_t *ip)
 
void ip_address_reset (ip_address_t *ip)
 
int ip_prefix_cmp (ip_prefix_t *p1, ip_prefix_t *p2)
 
void ip_prefix_normalize (ip_prefix_t *a)
 
void ip_address_to_fib_prefix (const ip_address_t *addr, fib_prefix_t *prefix)
 convert from a IP address to a FIB prefix More...
 
void ip_prefix_to_fib_prefix (const ip_prefix_t *ipp, fib_prefix_t *fibp)
 convert from a LISP to a FIB prefix More...
 
u8format_ip_prefix (u8 *s, va_list *args)
 
uword unformat_ip_prefix (unformat_input_t *input, va_list *args)
 
bool ip_prefix_validate (const ip_prefix_t *ip)
 
void ip4_address_normalize (ip4_address_t *ip4, u8 preflen)
 
void ip6_address_normalize (ip6_address_t *ip6, u8 preflen)
 
void ip4_preflen_to_mask (u8 pref_len, ip4_address_t *ip)
 
u32 ip4_mask_to_preflen (ip4_address_t *mask)
 
void ip4_prefix_max_address_host_order (ip4_address_t *ip, u8 plen, ip4_address_t *res)
 
void ip6_prefix_max_address_host_order (ip6_address_t *ip, u8 plen, ip6_address_t *res)
 
void ip6_preflen_to_mask (u8 pref_len, ip6_address_t *mask)
 
u32 ip6_mask_to_preflen (ip6_address_t *mask)
 

Macro Definition Documentation

◆ FOR_EACH_IP_ADDRESS_FAMILY

#define FOR_EACH_IP_ADDRESS_FAMILY (   _af)    for (_af = AF_IP4; _af <= AF_IP6; _af++)

Definition at line 33 of file ip_types.h.

◆ FOR_EACH_IP_ADDRESS_SUB_FAMILY

#define FOR_EACH_IP_ADDRESS_SUB_FAMILY (   _safi)    for (_safi = SAFI_UNICAST; _safi <= SAFI_MULTICAST; _safi++)

Definition at line 53 of file ip_types.h.

◆ foreach_ip_feature_location

#define foreach_ip_feature_location
Value:
_(INPUT, "input") \
_(OUTPUT, "output") \
_(LOCAL, "local") \
_(PUNT, "punt") \
_(DROP, "drop") \

Locations in the IP switch path where features can be applied.

Definition at line 62 of file ip_types.h.

◆ ip_addr_46

#define ip_addr_46 (   _a)    (_a)->ip

Definition at line 90 of file ip_types.h.

◆ ip_addr_v4

#define ip_addr_v4 (   _a)    (_a)->ip.ip4

Definition at line 91 of file ip_types.h.

◆ ip_addr_v6

#define ip_addr_v6 (   _a)    (_a)->ip.ip6

Definition at line 92 of file ip_types.h.

◆ ip_addr_version

#define ip_addr_version (   _a)    (_a)->version

Definition at line 93 of file ip_types.h.

◆ ip_address_initializer

#define ip_address_initializer   IP_ADDRESS_V6_ALL_0S

Definition at line 88 of file ip_types.h.

◆ IP_ADDRESS_V4_ALL_0S

#define IP_ADDRESS_V4_ALL_0S   {.ip.ip4.as_u32 = 0, .version = AF_IP4}

Definition at line 86 of file ip_types.h.

◆ IP_ADDRESS_V6_ALL_0S

#define IP_ADDRESS_V6_ALL_0S   {.ip.ip6.as_u64 = {0, 0}, .version = AF_IP6}

Definition at line 87 of file ip_types.h.

◆ ip_prefix_addr

#define ip_prefix_addr (   _a)    (_a)->addr

Definition at line 123 of file ip_types.h.

◆ ip_prefix_len

#define ip_prefix_len (   _a)    (_a)->len

Definition at line 125 of file ip_types.h.

◆ ip_prefix_v4

#define ip_prefix_v4 (   _a)    ip_addr_v4(&ip_prefix_addr(_a))

Definition at line 126 of file ip_types.h.

◆ ip_prefix_v6

#define ip_prefix_v6 (   _a)    ip_addr_v6(&ip_prefix_addr(_a))

Definition at line 127 of file ip_types.h.

◆ ip_prefix_version

#define ip_prefix_version (   _a)    ip_addr_version(&ip_prefix_addr(_a))

Definition at line 124 of file ip_types.h.

◆ N_AF

#define N_AF   (AF_IP6+1)

Definition at line 27 of file ip_types.h.

◆ N_IP_FEATURE_LOCATIONS

#define N_IP_FEATURE_LOCATIONS   (IP_FEATURE_DROP+1)

Definition at line 76 of file ip_types.h.

◆ N_SAFI

#define N_SAFI   (SAFI_MULTICAST+1)

Definition at line 47 of file ip_types.h.

◆ u16_net_add

#define u16_net_add (   u,
  val 
)    clib_host_to_net_u16(clib_net_to_host_u16(u) + (val))

Definition at line 57 of file ip_types.h.

◆ u8_ptr_add

#define u8_ptr_add (   ptr,
  index 
)    (((u8 *)ptr) + index)

Definition at line 56 of file ip_types.h.

Typedef Documentation

◆ ip_address_family_t

◆ ip_address_t

typedef struct ip_address ip_address_t

◆ ip_feature_location_t

◆ ip_prefix_t

typedef struct ip_prefix ip_prefix_t

◆ ip_sub_address_family_t

Enumeration Type Documentation

◆ ip_address_family_t_

Enumerator
AF_IP4 
AF_IP6 

Definition at line 21 of file ip_types.h.

◆ ip_feature_location_t_

Enumerator
foreach_ip_feature_location 

Definition at line 69 of file ip_types.h.

◆ ip_sub_address_family_t_

Enumerator
SAFI_UNICAST 
SAFI_MULTICAST 

Definition at line 41 of file ip_types.h.

Function Documentation

◆ format_ip_address()

u8* format_ip_address ( u8 s,
va_list *  args 
)

Definition at line 21 of file ip_types.c.

+ Here is the caller graph for this function:

◆ format_ip_address_family()

u8* format_ip_address_family ( u8 s,
va_list *  args 
)

Definition at line 215 of file ip.c.

+ Here is the caller graph for this function:

◆ format_ip_prefix()

u8* format_ip_prefix ( u8 s,
va_list *  args 
)

Definition at line 56 of file ip_types.c.

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

◆ format_ip_sub_address_family()

u8* format_ip_sub_address_family ( u8 s,
va_list *  args 
)

Definition at line 251 of file ip.c.

◆ ip4_address_normalize()

void ip4_address_normalize ( ip4_address_t ip4,
u8  preflen 
)

Definition at line 461 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip4_mask_to_preflen()

u32 ip4_mask_to_preflen ( ip4_address_t mask)

Definition at line 500 of file ip_types.c.

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

◆ ip4_prefix_max_address_host_order()

void ip4_prefix_max_address_host_order ( ip4_address_t ip,
u8  plen,
ip4_address_t res 
)

Definition at line 508 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip4_preflen_to_mask()

void ip4_preflen_to_mask ( u8  pref_len,
ip4_address_t ip 
)

Definition at line 491 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip6_address_normalize()

void ip6_address_normalize ( ip6_address_t *  ip6,
u8  preflen 
)

Definition at line 471 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip6_mask_to_preflen()

u32 ip6_mask_to_preflen ( ip6_address_t *  mask)

Definition at line 562 of file ip_types.c.

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

◆ ip6_prefix_max_address_host_order()

void ip6_prefix_max_address_host_order ( ip6_address_t *  ip,
u8  plen,
ip6_address_t *  res 
)

Definition at line 539 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip6_preflen_to_mask()

void ip6_preflen_to_mask ( u8  pref_len,
ip6_address_t *  mask 
)

Definition at line 517 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip_addr_bytes()

u8* ip_addr_bytes ( ip_address_t ip)

Definition at line 149 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip_address_cmp()

int ip_address_cmp ( const ip_address_t ip1,
const ip_address_t ip2 
)

Definition at line 117 of file ip_types.c.

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

◆ ip_address_copy()

void ip_address_copy ( ip_address_t dst,
const ip_address_t src 
)

Definition at line 133 of file ip_types.c.

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

◆ ip_address_copy_addr()

void ip_address_copy_addr ( void *  dst,
const ip_address_t src 
)

Definition at line 164 of file ip_types.c.

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

◆ ip_address_family_from_fib_proto()

ip_address_family_t ip_address_family_from_fib_proto ( fib_protocol_t  fp)

Definition at line 237 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip_address_family_to_fib_proto()

fib_protocol_t ip_address_family_to_fib_proto ( ip_address_family_t  af)

Definition at line 223 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip_address_family_to_link_type()

vnet_link_t ip_address_family_to_link_type ( ip_address_family_t  af)

Definition at line 193 of file ip_types.c.

◆ ip_address_from_46()

void ip_address_from_46 ( const ip46_address_t *  a,
fib_protocol_t  fproto,
ip_address_t addr 
)

Definition at line 259 of file ip_types.c.

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

◆ ip_address_increment()

void ip_address_increment ( ip_address_t ip)

Definition at line 291 of file ip_types.c.

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

◆ ip_address_is_zero()

bool ip_address_is_zero ( const ip_address_t ip)

Definition at line 102 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip_address_reset()

void ip_address_reset ( ip_address_t ip)

Definition at line 298 of file ip_types.c.

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

◆ ip_address_set()

void ip_address_set ( ip_address_t dst,
const void *  src,
ip_address_family_t  version 
)

Definition at line 207 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip_address_size()

u16 ip_address_size ( const ip_address_t a)

Definition at line 87 of file ip_types.c.

+ Here is the caller graph for this function:

◆ ip_address_to_46()

fib_protocol_t ip_address_to_46 ( const ip_address_t addr,
ip46_address_t *  a 
)

Definition at line 252 of file ip_types.c.

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

◆ ip_address_to_fib_prefix()

void ip_address_to_fib_prefix ( const ip_address_t addr,
fib_prefix_t prefix 
)

convert from a IP address to a FIB prefix

Definition at line 270 of file ip_types.c.

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

◆ ip_prefix_cmp()

int ip_prefix_cmp ( ip_prefix_t p1,
ip_prefix_t p2 
)

Definition at line 383 of file ip_types.c.

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

◆ ip_prefix_normalize()

void ip_prefix_normalize ( ip_prefix_t a)

Definition at line 357 of file ip_types.c.

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

◆ ip_prefix_to_fib_prefix()

void ip_prefix_to_fib_prefix ( const ip_prefix_t ipp,
fib_prefix_t fibp 
)

convert from a LISP to a FIB prefix

Definition at line 410 of file ip_types.c.

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

◆ ip_prefix_validate()

bool ip_prefix_validate ( const ip_prefix_t ip)

Definition at line 447 of file ip_types.c.

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

◆ ip_version_to_size()

u16 ip_version_to_size ( ip_address_family_t  af)

Definition at line 178 of file ip_types.c.

+ Here is the caller graph for this function:

◆ unformat_ip_address()

uword unformat_ip_address ( unformat_input_t input,
va_list *  args 
)

Definition at line 41 of file ip_types.c.

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

◆ unformat_ip_address_family()

uword unformat_ip_address_family ( unformat_input_t input,
va_list *  args 
)

Definition at line 231 of file ip.c.

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

◆ unformat_ip_prefix()

uword unformat_ip_prefix ( unformat_input_t input,
va_list *  args 
)

Definition at line 64 of file ip_types.c.

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

◆ unformat_ip_sub_address_family()

uword unformat_ip_sub_address_family ( unformat_input_t input,
va_list *  args 
)

Definition at line 267 of file ip.c.

+ Here is the call graph for this function:
DROP
DROP
Definition: error.def:41