FD.io VPP  v16.09
Vector Packet Processing
ip6_hop_by_hop.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __included_ip6_hop_by_hop_ioam_h__
16 #define __included_ip6_hop_by_hop_ioam_h__
17 
18 #include <vnet/ip/ip6_hop_by_hop.h>
20 #include <vnet/ip/ip.h>
21 
22 typedef struct {
23  /* The current rewrite we're using */
25 
26  /* Trace data processing callback */
28  /* Configuration data */
29  /* Adjacency */
31 #define IOAM_HBYH_ADD 0
32 #define IOAM_HBYH_MOD 1
33 #define IOAM_HBYH_POP 2
35  /* time scale transform. Joy. */
38 
39 
40  /* Trace option */
43 
44  /* Configured node-id */
47 
48  /* Pot option */
50 
51 #define PPC_NONE 0
52 #define PPC_ENCAP 1
53 #define PPC_DECAP 2
55 
56 #define TSP_SECONDS 0
57 #define TSP_MILLISECONDS 1
58 #define TSP_MICROSECONDS 2
59 #define TSP_NANOSECONDS 3
60  /* Time stamp precision. This is enumerated to above four options */
62 
63  /* Array of function pointers to ADD and POP HBH option handling routines */
64  u8 options_size[256];
65  int (*add_options[256])(u8 *rewrite_string, u8 rewrite_size);
66  int (*pop_options[256])(ip6_header_t *ip, ip6_hop_by_hop_option_t *opt);
67 
68  /* convenience */
72 
74 
75 extern u8 * format_path_map(u8 * s, va_list * args);
76 extern clib_error_t *
77 ip6_ioam_trace_profile_set(u32 trace_option_elts, u32 trace_type, u32 node_id,
78  u32 app_data, int has_pot_option, u32 trace_tsp,
79  int has_e2e_option);
80 extern int ip6_ioam_set_destination (ip6_address_t *addr, u32 mask_width,
81  u32 vrf_id, int is_add, int is_pop, int is_none);
82 
83 extern clib_error_t * clear_ioam_rewrite_fn(void);
84 
86 {
87  return (a->as_u32 == 0);
88 }
89 
90 static inline void copy_ip6_address (ip6_address_t *dst, ip6_address_t *src)
91 {
92  dst->as_u64[0] = src->as_u64[0];
93  dst->as_u64[1] = src->as_u64[1];
94 }
95 
96 static inline void set_zero_ip6_address (ip6_address_t *a)
97 {
98  a->as_u64[0] = 0;
99  a->as_u64[1] = 0;
100 }
101 
103 {
104  return ((a1->as_u64[0] == a2->as_u64[0]) && (a1->as_u64[1] == a2->as_u64[1]));
105 }
107 {
108  return ((a->as_u64[0] == 0) && (a->as_u64[1] == 0));
109 }
110 
111 int ip6_hbh_add_register_option (u8 option,
112  u8 size,
113  int rewrite_options(u8 *rewrite_string, u8 size));
114 int ip6_hbh_add_unregister_option (u8 option);
115 
116 int ip6_hbh_pop_register_option (u8 option,
117  int options(ip6_header_t *ip, ip6_hop_by_hop_option_t *opt));
118 int ip6_hbh_pop_unregister_option (u8 option);
119 
120 
121 #endif /* __included_ip6_hop_by_hop_ioam_h__ */
int ip6_hbh_add_register_option(u8 option, u8 size, int rewrite_options(u8 *rewrite_string, u8 size))
a
Definition: bitmap.h:516
u64 as_u64[2]
Definition: ip6_packet.h:50
int ip6_ioam_set_destination(ip6_address_t *addr, u32 mask_width, u32 vrf_id, int is_add, int is_pop, int is_none)
static void set_zero_ip6_address(ip6_address_t *a)
clib_error_t * clear_ioam_rewrite_fn(void)
static u8 cmp_ip6_address(ip6_address_t *a1, ip6_address_t *a2)
u8 * format_path_map(u8 *s, va_list *args)
static u8 is_zero_ip4_address(ip4_address_t *a)
ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main
unsigned int u32
Definition: types.h:88
int ip6_hbh_pop_register_option(u8 option, int options(ip6_header_t *ip, ip6_hop_by_hop_option_t *opt))
static u8 is_zero_ip6_address(ip6_address_t *a)
u32 size
Definition: vhost-user.h:77
double f64
Definition: types.h:142
unsigned char u8
Definition: types.h:56
clib_error_t * ip6_ioam_trace_profile_set(u32 trace_option_elts, u32 trace_type, u32 node_id, u32 app_data, int has_pot_option, u32 trace_tsp, int has_e2e_option)
vhost_vring_addr_t addr
Definition: vhost-user.h:82
static void copy_ip6_address(ip6_address_t *dst, ip6_address_t *src)
int ip6_hbh_pop_unregister_option(u8 option)
int ip6_hbh_add_unregister_option(u8 option)