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"
38 * Subinterface ID. A number 0-N to uniquely identify this
39 * subinterface under the super interface
43 /* 0 = dot1q, 1=dot1ad */
46 /* Number of tags 0-2 */
47 u8 sub_number_of_tags;
48 u16 sub_outer_vlan_id;
49 u16 sub_inner_vlan_id;
52 u8 sub_outer_vlan_id_any;
53 u8 sub_inner_vlan_id_any;
55 /* vlan tag rewrite */
60 } sw_interface_subif_t;
66 } ip_address_details_t;
71 ip_address_details_t *addr;
78 } interface_counter_t;
82 struct in_addr address;
90 struct in6_addr address;
99 u32 locator_set_index;
114 u32 locator_set_index;
126 /* vpe input queue */
127 unix_shared_memory_queue_t *vl_input_queue;
129 /* interface name table */
130 uword *sw_if_index_by_interface_name;
132 /* subinterface table */
133 sw_interface_subif_t *sw_if_subif_table;
135 /* Graph node table */
136 uword *graph_node_index_by_name;
137 vlib_node_t **graph_nodes;
140 ip_details_t *ip_details_by_sw_if_index[2];
142 /* sw_if_index of currently processed interface */
143 u32 current_sw_if_index;
145 /* remember that we are dumping ipv6 */
149 uword *function_by_name;
155 macro_main_t macro_main;
157 /* Errors by number */
158 uword *error_string_by_error_number;
161 /* Main thread can spin (w/ timeout) here if needed */
164 volatile u32 result_ready;
166 volatile u32 sw_if_index;
167 volatile u8 *shmem_result;
169 /* our client index */
172 /* Time is of the essence... */
173 clib_time_t clib_time;
175 /* Unwind (so we can quit) */
178 /* temporary parse buffer */
179 unformat_input_t *input;
184 /* stdio input / output FILEs */
187 u32 input_line_number;
189 /* exec mode toggle */
192 /* Regenerate the interface table */
193 volatile int regenerate_interface_table;
195 /* flag for JSON output format */
198 /* flag for interface event display */
199 u8 interface_event_display;
201 /* JSON tree used in composing dump api call results */
202 vat_json_node_t json_tree;
205 u64 **simple_interface_counters;
206 interface_counter_t **combined_interface_counters;
207 ip4_fib_counter_t **ip4_fib_counters;
208 u32 *ip4_fib_counters_vrf_id_by_index;
209 ip6_fib_counter_t **ip6_fib_counters;
210 u32 *ip6_fib_counters_vrf_id_by_index;
214 locator_set_msg_t *locator_set_msg;
215 locator_msg_t *locator_msg;
216 eid_table_t *eid_tables;
223 vat_time_now (vat_main_t * vam)
225 return clib_time_now (&vam->clib_time);
228 #define errmsg(fmt,args...) \
230 if(vam->ifp != stdin) \
231 fformat(vam->ofp,"%s(%d): ", vam->current_file, \
232 vam->input_line_number); \
233 fformat(vam->ofp, fmt, ##args); \
237 void vat_api_hookup (vat_main_t * vam);
238 int api_sw_interface_dump (vat_main_t * vam);
239 void do_one_file (vat_main_t * vam);
240 int exec (vat_main_t * vam);
242 /* Plugin API library functions */
243 char *vat_plugin_path;
244 char *vat_plugin_name_filter;
245 void vat_plugin_api_reference (void);
246 uword unformat_sw_if_index (unformat_input_t * input, va_list * args);
247 uword unformat_ip4_address (unformat_input_t * input, va_list * args);
248 uword unformat_ethernet_address (unformat_input_t * input, va_list * args);
249 uword unformat_ethernet_type_host_byte_order (unformat_input_t * input,
251 uword unformat_ip6_address (unformat_input_t * input, va_list * args);
252 u8 *format_ip4_address (u8 * s, va_list * args);
253 u8 *format_ethernet_address (u8 * s, va_list * args);
256 #endif /* __included_vat_h__ */
259 * fd.io coding-style-patch-verification: ON
262 * eval: (c-set-style "gnu")