misc: remove GNU Indent directives
[vpp.git] / src / plugins / ioam / encap / ip6_ioam_e2e.h
1 /*
2  * Copyright (c) 2016 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
16 #ifndef __included_ip6_ioam_e2e_h__
17 #define __included_ip6_ioam_e2e_h__
18
19 #include <ioam/lib-e2e/e2e_util.h>
20 #include "ip6_ioam_seqno.h"
21
22 typedef CLIB_PACKED(struct {
23   ip6_hop_by_hop_option_t hdr;
24   ioam_e2e_packet_t e2e_hdr;
25 }) ioam_e2e_option_t;
26
27 typedef struct ioam_e2e_data_t_ {
28   u32 flow_ctx;
29   u32 pad;
30   ioam_seqno_data seqno_data;
31 } ioam_e2e_data_t;
32
33 typedef struct {
34   ioam_e2e_data_t *e2e_data;
35   vlib_main_t *vlib_main;
36   vnet_main_t *vnet_main;
37 } ioam_e2e_main_t;
38
39 extern ioam_e2e_main_t ioam_e2e_main;
40
41 static inline ioam_seqno_data *
42 ioam_e2ec_get_seqno_data_from_flow_ctx (u32 flow_ctx)
43 {
44   ioam_e2e_data_t *data = NULL;
45   u32 index;
46
47   index =  get_flow_data_from_flow_ctx(flow_ctx,
48                                        HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE);
49   data = &ioam_e2e_main.e2e_data[index];
50   return &(data->seqno_data);
51 }
52
53 static inline u32
54 ioam_e2e_get_cur_seqno_from_flow_ctx (u32 flow_ctx)
55 {
56   ioam_seqno_data *data = NULL;
57
58   data =  ioam_e2ec_get_seqno_data_from_flow_ctx(flow_ctx);
59   return data->seq_num;
60 }
61
62 #endif /* __included_ioam_e2e_h__ */