ip6: fix ip6-michain trace function
[vpp.git] / src / plugins / urpf / urpf.h
1 /*
2  * Copyright (c) 2020 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 __URPF_H__
17 #define __URPF_H__
18
19 #include <vnet/ip/ip_types.h>
20
21 #define foreach_urpf_mode                                                     \
22   _ (OFF, "off")                                                              \
23   _ (LOOSE, "loose")                                                          \
24   _ (STRICT, "strict")
25
26 typedef enum urpf_mode_t_
27 {
28 #define _(a,b) URPF_MODE_##a,
29   foreach_urpf_mode
30 #undef _
31 } __clib_packed urpf_mode_t;
32
33 #define URPF_N_MODES (URPF_MODE_STRICT+1)
34
35 typedef struct
36 {
37   index_t urpf;
38   u32 fib_index;
39 } urpf_trace_t;
40
41 u8 *format_urpf_trace (u8 *s, va_list *va);
42 u8 *format_urpf_mode (u8 *s, va_list *a);
43 uword unformat_urpf_mode (unformat_input_t *input, va_list *args);
44
45 typedef struct
46 {
47   urpf_mode_t mode;
48   u32 fib_index;
49   u8 fib_index_is_custom;
50 } urpf_data_t;
51
52 extern urpf_data_t *urpf_cfgs[N_AF][VLIB_N_DIR];
53
54 int urpf_update (urpf_mode_t mode, u32 sw_if_index, ip_address_family_t af,
55                  vlib_dir_t dir, u32 table_id);
56
57 #endif
58
59 /*
60  * fd.io coding-style-patch-verification: ON
61  *
62  * Local Variables:
63  * eval: (c-set-style "gnu")
64  * End:
65  */