From fdd81af6afe6c782ad2c1a139210378badec626b Mon Sep 17 00:00:00 2001 From: AkshayaNadahalli Date: Thu, 1 Dec 2016 16:33:51 +0530 Subject: VPP-632 : InBand OAM Analyser Refer to jira ticket for more details. Change-Id: I6facb9ef8553a21464f9a2e612706f152badbb68 Signed-off-by: AkshayaNadahalli --- src/plugins/ioam/analyse/ip6/ip6_ioam_analyse.h | 68 +++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/plugins/ioam/analyse/ip6/ip6_ioam_analyse.h (limited to 'src/plugins/ioam/analyse/ip6/ip6_ioam_analyse.h') diff --git a/src/plugins/ioam/analyse/ip6/ip6_ioam_analyse.h b/src/plugins/ioam/analyse/ip6/ip6_ioam_analyse.h new file mode 100644 index 00000000000..f6abdce3c9a --- /dev/null +++ b/src/plugins/ioam/analyse/ip6/ip6_ioam_analyse.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2017 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IP6_IOAM_ANALYSE_NODE_H_ +#define PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IP6_IOAM_ANALYSE_NODE_H_ + +#include +#include + +/** @brief IP6-iOAM analyser main structure. + @note cache aligned. +*/ +typedef struct +{ + /** Array of function pointer to analyse each hop-by-hop option. */ + int (*analyse_hbh_handler[MAX_IP6_HBH_OPTION]) (u32 flow_id, + ip6_hop_by_hop_option_t * + opt, u16 len); + + /** This contains the aggregated data from the time VPP started analysing. */ + ioam_analyser_data_t *aggregated_data; + +} ip6_ioam_analyser_main_t; + +extern ip6_ioam_analyser_main_t ioam_analyser_main; + +extern vlib_node_registration_t analyse_node_local; +extern vlib_node_registration_t analyse_node_remote; + +void ip6_ioam_analyse_register_handlers (void); + +void ip6_ioam_analyse_unregister_handlers (void); + +clib_error_t *ip6_ioam_analyse_init (vlib_main_t * vm); + +inline static ioam_analyser_data_t * +ioam_analyse_get_data_from_flow_id (u32 flow_id) +{ + if (flow_id >= vec_len (ioam_analyser_main.aggregated_data)) + return NULL; + + if (ioam_analyser_main.aggregated_data[flow_id].is_free) + ioam_analyser_main.aggregated_data[flow_id].is_free = 0; + + return (ioam_analyser_main.aggregated_data + flow_id); +} + +#endif /* PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IP6_IOAM_ANALYSE_NODE_H_ */ + +/* + * fd.io coding-style-patch-verification: ON + * + * Local Variables: + * eval: (c-set-style "gnu") + * End: + */ -- cgit 1.2.3-korg