X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fip%2Fip6_hop_by_hop.h;h=5f12f647dba132076bfa159134514a0867100f4d;hb=72454dd4c5196594b366883bbf732c9e067c64ec;hp=acfaa37ed2f76bc36fc87168db5df304c159c208;hpb=7cd468a3d7dee7d6c92f69a0bb7061ae208ec727;p=vpp.git diff --git a/src/vnet/ip/ip6_hop_by_hop.h b/src/vnet/ip/ip6_hop_by_hop.h index acfaa37ed2f..5f12f647dba 100644 --- a/src/vnet/ip/ip6_hop_by_hop.h +++ b/src/vnet/ip/ip6_hop_by_hop.h @@ -92,8 +92,6 @@ typedef struct extern ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main; -extern u8 *format_path_map (u8 * s, va_list * args); - extern clib_error_t *ip6_ioam_enable (int has_trace_option, int has_pot_option, int has_seqno_option, @@ -206,6 +204,68 @@ is_seqno_enabled (void) } int ip6_trace_profile_setup (); + +static inline u32 +ioam_flow_add (u8 encap, u8 * flow_name) +{ + ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; + flow_data_t *flow = 0; + u32 index = 0; + u8 i; + + pool_get (hm->flows, flow); + memset (flow, 0, sizeof (flow_data_t)); + + index = flow - hm->flows; + strncpy ((char *) flow->flow_name, (char *) flow_name, 31); + + if (!encap) + IOAM_SET_DECAP (index); + + for (i = 0; i < 255; i++) + { + if (hm->flow_handler[i]) + flow->ctx[i] = hm->flow_handler[i] (index, 1); + } + return (index); +} + +always_inline ip6_hop_by_hop_option_t * +ip6_hbh_get_option (ip6_hop_by_hop_header_t * hbh0, u8 option_to_search) +{ + ip6_hop_by_hop_option_t *opt0, *limit0; + u8 type0; + + if (!hbh0) + return NULL; + + opt0 = (ip6_hop_by_hop_option_t *) (hbh0 + 1); + limit0 = (ip6_hop_by_hop_option_t *) + ((u8 *) hbh0 + ((hbh0->length + 1) << 3)); + + /* Scan the set of h-b-h options, process ones that we understand */ + while (opt0 < limit0) + { + type0 = opt0->type; + switch (type0) + { + case 0: /* Pad1 */ + opt0 = (ip6_hop_by_hop_option_t *) ((u8 *) opt0) + 1; + continue; + case 1: /* PadN */ + break; + default: + if (type0 == option_to_search) + return opt0; + break; + } + opt0 = + (ip6_hop_by_hop_option_t *) (((u8 *) opt0) + opt0->length + + sizeof (ip6_hop_by_hop_option_t)); + } + return NULL; +} + #endif /* __included_ip6_hop_by_hop_ioam_h__ */ /*