api: Implement log_dump/log_details
[vpp.git] / src / vpp / api / vpe.api
1 /*
2  * Copyright (c) 2015-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 /** \file
17
18     This file defines vpe control-plane API messages which are generally
19     called through a shared memory interface. 
20 */
21
22 option version = "1.3.0";
23
24 /* 
25  * Note: API placement cleanup in progress
26  * If you're looking for interface APIs, please
27  * see .../src/vnet/{interface.api,interface_api.c}
28  * IP APIs: see .../src/vnet/ip/{ip.api, ip_api.c}
29  * VXLAN APIs: see .../src/vnet/vxlan/{vxlan.api, vxlan_api.c}
30  * GENEVE APIs: see .../src/vnet/geneve/{geneve.api, geneve_api.c}
31  * LLDP APIs: see .../src/vnet/lldp/{lldp.api, lldp_api.c}
32  * AF-PACKET APIs: see ... /vnet/devices/af_packet/{af_packet.api, af_packet_api.c}
33  * NETMAP APIs: see ... /src/vnet/devices/netmap/{netmap.api, netmap_api.c}
34  * VHOST-USER APIs: see .../vnet/devices/virtio/{vhost_user.api, vhost_user_api.c}
35  * VXLAN GPE APIs: see .../src/vnet/vxlan-gpe/{vxlan_gpe.api, vxlan_gpe_api.c}
36  * GRE APIs: see .../src/vnet/gre/{gre.api, gre_api.c}
37  * L2 APIs: see .../src/vnet/l2/{l2.api, l2_api.c}
38  * L2TP APIs: see .../src/vnet/l2tp/{l2tp.api, l2tp_api.c}
39  * BFD APIs: see .../src/vnet/bfd/{bfd.api, bfd_api.c}
40  * IPSEC APIs: see .../src/vnet/ipsec/{ipsec.api, ipsec_api.c}
41  * LISP APIs: see .../src/vnet/lisp/{lisp.api, lisp_api.c}
42  * LISP-GPE APIs: see .../src/vnet/lisp-gpe/{lisp_gpe.api, lisp_gpe_api.c}
43  * SESSION APIs: .../vnet/session/{session.api session_api.c}
44  * MPLS APIs: see .../src/vnet/mpls/{mpls.api, mpls_api.c}
45  * SR APIs: see .../src/vnet/srv6/{sr.api, sr_api.c}
46  * CLASSIFY APIs: see ... /src/vnet/classify/{classify.api, classify_api.c}
47  * FLOW APIs: see ... /src/vnet/flow/{flow.api, flow_api.c}
48  * DHCP APIs: see ... /src/vnet/dhcp/{dhcp.api, dhcp_api.c}
49  * COP APIs: see ... /src/vnet/cop/{cop.api, cop_api.c}
50  * POLICER APIs: see ... /src/vnet/policer/{policer.api, policer_api.c}
51  * BIER APIs: see ... /src/vnet/policer/{bier.api, bier_api.c}
52  */
53
54 /** \brief Control ping from client to api server request
55     @param client_index - opaque cookie to identify the sender
56     @param context - sender context, to match reply w/ request
57 */
58 define control_ping
59 {
60   u32 client_index;
61   u32 context;
62 };
63
64 /** \brief Control ping from the client to the server response
65     @param client_index - opaque cookie to identify the sender
66     @param context - sender context, to match reply w/ request
67     @param retval - return code for the request
68     @param vpe_pid - the pid of the vpe, returned by the server
69 */
70 define control_ping_reply
71 {
72   u32 context;
73   i32 retval;
74   u32 client_index;
75   u32 vpe_pid;
76 };
77
78 /** \brief Process a vpe parser cli string request
79     @param client_index - opaque cookie to identify the sender
80     @param context - sender context, to match reply w/ request
81     @param cmd_in_shmem - pointer to cli command string
82 */
83 define cli
84 {
85   u32 client_index;
86   u32 context;
87   u64 cmd_in_shmem;
88 };
89 define cli_inband
90 {
91   u32 client_index;
92   u32 context;
93   string cmd;
94 };
95
96 /** \brief vpe parser cli string response
97     @param context - sender context, to match reply w/ request
98     @param retval - return code for request
99     @param reply_in_shmem - Reply string from cli processing if any
100 */
101 define cli_reply
102 {
103   u32 context;
104   i32 retval;
105   u64 reply_in_shmem;
106 };
107 define cli_inband_reply
108 {
109   u32 context;
110   i32 retval;
111   string reply;
112 };
113
114 /** \brief Get node index using name request
115     @param client_index - opaque cookie to identify the sender
116     @param context - sender context, to match reply w/ request
117     @param node_name[] - name of the node
118 */
119 define get_node_index
120 {
121   u32 client_index;
122   u32 context;
123   u8 node_name[64];
124 };
125
126 /** \brief Get node index using name request
127     @param context - sender context, to match reply w/ request
128     @param retval - return code for the request
129     @param node_index - index of the desired node if found, else ~0
130 */
131 define get_node_index_reply
132 {
133   u32 context;
134   i32 retval;
135   u32 node_index;
136 };
137
138 /** \brief Set the next node for a given node request
139     @param client_index - opaque cookie to identify the sender
140     @param context - sender context, to match reply w/ request
141     @param node_name[] - node to add the next node to
142     @param next_name[] - node to add as the next node
143 */
144 define add_node_next
145 {
146   u32 client_index;
147   u32 context;
148   u8 node_name[64];
149   u8 next_name[64];
150 };
151
152 /** \brief IP Set the next node for a given node response
153     @param context - sender context, to match reply w/ request
154     @param retval - return code for the add next node request
155     @param next_index - the index of the next node if success, else ~0
156 */
157 define add_node_next_reply
158 {
159   u32 context;
160   i32 retval;
161   u32 next_index;
162 };
163
164 /** \brief show version
165     @param client_index - opaque cookie to identify the sender
166     @param context - sender context, to match reply w/ request
167 */
168 define show_version
169 {
170   u32 client_index;
171   u32 context;
172 };
173
174 /** \brief show version response
175     @param context - sender context, to match reply w/ request
176     @param retval - return code for the request
177     @param program - name of the program (vpe)
178     @param version  - version of the program
179     @param build_directory - root of the workspace where the program was built
180 */
181 define show_version_reply
182 {
183   u32 context;
184   i32 retval;
185   string program [limit = 32];
186   string version [limit = 32];
187   string build_date [limit = 32];
188   string build_directory [limit = 256];
189 };
190
191
192 /** \brief show_threads display the information about vpp
193     threads running on system along with their process id,
194     cpu id, physical core and cpu socket.
195 */
196 define show_threads
197 {
198   u32 client_index;
199   u32 context;
200 };
201
202 /** \brief thread data
203     @param id - thread index
204     @param name - thread name i.e. vpp_main or vpp_wk_0
205     @param type - thread type i.e. workers or stats
206     @param pid - thread Process Id
207     @param cpu_id - thread pinned to cpu.
208     "CPUs or Logical cores are the number of physical cores times
209     the number of threads that can run on each core through
210     the use of hyperthreading." (from unix.stackexchange.com)
211     @param core - thread pinned to actual physical core.
212     @param cpu_socket - thread is running on which cpu socket.
213 */
214 typeonly define thread_data
215 {
216   u32 id;
217   u8 name[64];
218   u8 type[64];
219   u32 pid;
220   u32 cpu_id;
221   u32 core;
222   u32 cpu_socket;
223 };
224
225 /** \brief show_threads_reply
226     @param context - returned sender context, to match reply w/ request
227     @param retval - return code
228     @param count - number of threads in thread_data array
229     @param thread_data - array of thread data
230 */
231 define show_threads_reply
232 {
233   u32 context;
234   i32 retval;
235   u32 count;
236   vl_api_thread_data_t thread_data[count];
237 };
238
239 define get_node_graph
240 {
241   u32 client_index;
242   u32 context;
243 };
244
245 /** \brief get_node_graph_reply
246     @param context - returned sender context, to match reply w/ request
247     @param retval - return code
248     @param reply_in_shmem - result from vlib_node_serialize, in shared
249     memory. Process with vlib_node_unserialize, remember to switch
250     heaps and free the result.
251 */
252
253 define get_node_graph_reply
254 {
255   u32 context;
256   i32 retval;
257   u64 reply_in_shmem;
258 };
259
260 /** \brief Query relative index via node names
261     @param client_index - opaque cookie to identify the sender
262     @param context - sender context, to match reply w/ request
263     @param node_name - name of node to find relative index from
264     @param next_name - next node from node_name to find relative index of
265 */
266 define get_next_index
267 {
268   u32 client_index;
269   u32 context;
270   u8 node_name[64];
271   u8 next_name[64];
272 };
273
274 /** \brief Reply for get next node index
275     @param context - sender context which was passed in the request
276     @param retval - return value
277     @param next_index - index of the next_node
278 */
279 define get_next_index_reply
280 {
281   u32 context;
282   i32 retval;
283   u32 next_index;
284 };
285
286 enum log_level {
287   VPE_API_LOG_LEVEL_EMERG = 0,    /* emerg */
288   VPE_API_LOG_LEVEL_ALERT = 1,    /* alert */
289   VPE_API_LOG_LEVEL_CRIT = 2,     /* crit */
290   VPE_API_LOG_LEVEL_ERR = 3,      /* err  */
291   VPE_API_LOG_LEVEL_WARNING = 4,  /* warn */
292   VPE_API_LOG_LEVEL_NOTICE = 5,   /* notice */
293   VPE_API_LOG_LEVEL_INFO = 6,     /* info */
294   VPE_API_LOG_LEVEL_DEBUG = 7,    /* debug */
295   VPE_API_LOG_LEVEL_DISABLED = 8, /* disabled */
296 };
297
298 define log_dump {
299   u32 client_index;
300   u32 context;
301   f64 start_timestamp;
302 };
303
304 define log_details {
305   u32 context;
306   f64 timestamp_ticks;
307   vl_api_log_level_t level;
308   string timestamp [limit=24];
309   string msg_class [limit=32];
310   string message [limit=256];
311 };
312
313 /** \brief Show the current system timestamp.
314     @param client_index - opaque cookie to identify the sender
315     @param context - sender context, to match reply w/ request
316 */
317 define show_vpe_system_time_ticks
318 {
319   u32 client_index;
320   u32 context;
321 };
322
323 /** \brief Reply for show vpe system time ticks.
324     @param context - sender context which was passed in the request
325     @param retval - return value
326     @param vpe_system_time_ticks - the time in ticks of the host system.
327 */
328 define show_vpe_system_time_ticks_reply
329 {
330   u32 context;
331   i32 retval;
332   f64 vpe_system_time_ticks;
333 };
334
335 /*
336  * Local Variables:
337  * eval: (c-set-style "gnu")
338  * End:
339  */