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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
15 #ifndef __included_vat_h__
16 #define __included_vat_h__
20 #include <vppinfra/clib.h>
21 #include <vppinfra/format.h>
22 #include <vppinfra/error.h>
23 #include <vppinfra/time.h>
24 #include <vppinfra/macros.h>
25 #include <vnet/vnet.h>
26 #include <vlib/vlib.h>
27 #include <vlib/unix/unix.h>
28 #include <vlibapi/api.h>
29 #include <vlibmemory/api.h>
31 #include "vat/json_format.h"
33 #include <vlib/vlib.h>
40 * Subinterface ID. A number 0-N to uniquely identify this
41 * subinterface under the super interface
45 /* 0 = dot1q, 1=dot1ad */
48 /* Number of tags 0-2 */
49 u8 sub_number_of_tags;
50 u16 sub_outer_vlan_id;
51 u16 sub_inner_vlan_id;
54 u8 sub_outer_vlan_id_any;
55 u8 sub_inner_vlan_id_any;
57 /* vlan tag rewrite */
62 } sw_interface_subif_t;
68 } ip_address_details_t;
73 ip_address_details_t *addr;
80 } interface_counter_t;
84 struct in_addr address;
92 struct in6_addr address;
100 struct in_addr address;
108 struct in6_addr address;
116 /* vpe input queue */
117 unix_shared_memory_queue_t *vl_input_queue;
119 /* interface name table */
120 uword *sw_if_index_by_interface_name;
122 /* subinterface table */
123 sw_interface_subif_t *sw_if_subif_table;
125 /* Graph node table */
126 uword *graph_node_index_by_name;
127 vlib_node_t **graph_nodes;
130 ip_details_t *ip_details_by_sw_if_index[2];
132 /* sw_if_index of currently processed interface */
133 u32 current_sw_if_index;
135 /* remember that we are dumping ipv6 */
139 uword *function_by_name;
145 macro_main_t macro_main;
147 /* Errors by number */
148 uword *error_string_by_error_number;
151 /* Main thread can spin (w/ timeout) here if needed */
154 volatile u32 result_ready;
156 volatile u32 sw_if_index;
157 volatile u8 *shmem_result;
158 volatile u8 *cmd_reply;
160 /* our client index */
163 /* Time is of the essence... */
164 clib_time_t clib_time;
166 /* Unwind (so we can quit) */
169 volatile int do_exit;
171 /* temporary parse buffer */
172 unformat_input_t *input;
177 /* stdio input / output FILEs */
180 u32 input_line_number;
182 /* exec mode toggle */
185 /* Regenerate the interface table */
186 volatile int regenerate_interface_table;
188 /* flag for JSON output format */
191 /* flag for interface event display */
192 u8 interface_event_display;
194 /* JSON tree used in composing dump api call results */
195 vat_json_node_t json_tree;
198 u64 **simple_interface_counters;
199 interface_counter_t **combined_interface_counters;
200 ip4_fib_counter_t **ip4_fib_counters;
201 u32 *ip4_fib_counters_vrf_id_by_index;
202 ip6_fib_counter_t **ip6_fib_counters;
203 u32 *ip6_fib_counters_vrf_id_by_index;
204 ip4_nbr_counter_t **ip4_nbr_counters;
205 ip6_nbr_counter_t **ip6_nbr_counters;
208 vlib_main_t *vlib_main;
211 extern vat_main_t vat_main;
213 void vat_suspend (vlib_main_t * vm, f64 interval);
214 f64 vat_time_now (vat_main_t * vam);
215 void errmsg (char *fmt, ...);
216 void vat_api_hookup (vat_main_t * vam);
217 int api_sw_interface_dump (vat_main_t * vam);
218 void do_one_file (vat_main_t * vam);
219 int exec (vat_main_t * vam);
221 /* Plugin API library functions */
222 char *vat_plugin_path;
223 char *vat_plugin_name_filter;
224 void vat_plugin_api_reference (void);
225 uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
226 uword unformat_ip4_address (unformat_input_t * input, va_list * args);
227 uword unformat_ethernet_address (unformat_input_t * input, va_list * args);
228 uword unformat_ethernet_type_host_byte_order (unformat_input_t * input,
230 uword unformat_ip6_address (unformat_input_t * input, va_list * args);
231 u8 *format_ip4_address (u8 * s, va_list * args);
232 u8 *format_ethernet_address (u8 * s, va_list * args);
234 #if VPP_API_TEST_BUILTIN
235 #define print api_cli_output
236 void api_cli_output (void *, const char *fmt, ...);
238 #define print fformat_append_cr
239 void fformat_append_cr (FILE *, const char *fmt, ...);
242 #endif /* __included_vat_h__ */
245 * fd.io coding-style-patch-verification: ON
248 * eval: (c-set-style "gnu")