lisp: Move to plugin
[vpp.git] / src / vpp / api / custom_dump.c
1 /*
2  * ------------------------------------------------------------------
3  * custom_dump.c - pretty-print API messages for replay
4  *
5  * Copyright (c) 2014-2016 Cisco and/or its affiliates. Licensed under the
6  * Apache License, Version 2.0 (the "License"); you may not use this file
7  * except in compliance with the License. You may obtain a copy of the
8  * License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  * ------------------------------------------------------------------
18  */
19
20 #include <vnet/vnet.h>
21 #include <vnet/ip/ip.h>
22 #include <vnet/ip-neighbor/ip_neighbor.h>
23 #include <vnet/ip/ip_types_api.h>
24 #include <vnet/fib/fib_api.h>
25 #include <vnet/unix/tuntap.h>
26 #include <vnet/mpls/mpls.h>
27 #include <vnet/l2/l2_input.h>
28 #include <vnet/srv6/sr.h>
29 #include <vnet/srmpls/sr_mpls.h>
30 #include <vnet/gre/gre.h>
31 #include <vnet/vxlan-gpe/vxlan_gpe.h>
32 #include <vnet/classify/policer_classify.h>
33 #include <vnet/policer/xlate.h>
34 #include <vnet/policer/policer.h>
35 #include <vnet/classify/flow_classify.h>
36 #include <vlib/vlib.h>
37 #include <vlib/pci/pci.h>
38 #include <vlib/unix/unix.h>
39 #include <vlibapi/api.h>
40 #include <vlibmemory/api.h>
41 #include <vnet/qos/qos_types.h>
42
43 #include <vnet/ethernet/ethernet.h>
44 #include <vnet/ethernet/ethernet_types_api.h>
45 #include <vnet/l2/l2_vtr.h>
46
47 #include <vpp/api/vpe_msg_enum.h>
48 #include <vpp/api/types.h>
49
50 #include <vnet/bonding/node.h>
51
52 #include <vnet/format_fns.h>
53
54 #define vl_typedefs             /* define message structures */
55 #include <vpp/api/vpe_all_api_h.h>
56 #undef vl_typedefs
57
58 #define vl_endianfun            /* define message structures */
59 #include <vpp/api/vpe_all_api_h.h>
60 #undef vl_endianfun
61
62 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
63
64 #define FINISH                                  \
65     vec_add1 (s, 0);                            \
66     vl_print (handle, (char *)s);               \
67     vec_free (s);                               \
68     return handle;
69
70
71 static void *vl_api_create_loopback_t_print
72   (vl_api_create_loopback_t * mp, void *handle)
73 {
74   u8 *s;
75
76   s = format (0, "SCRIPT: create_loopback ");
77   s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
78
79   FINISH;
80 }
81
82 static void *vl_api_create_loopback_instance_t_print
83   (vl_api_create_loopback_instance_t * mp, void *handle)
84 {
85   u8 *s;
86
87   s = format (0, "SCRIPT: create_loopback ");
88   s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address);
89   s = format (s, "instance %d ", mp->user_instance);
90
91   FINISH;
92 }
93
94 static void *vl_api_delete_loopback_t_print
95   (vl_api_delete_loopback_t * mp, void *handle)
96 {
97   u8 *s;
98
99   s = format (0, "SCRIPT: delete_loopback ");
100   s = format (s, "sw_if_index %d ", mp->sw_if_index);
101
102   FINISH;
103 }
104
105 static void *vl_api_sw_interface_set_flags_t_print
106   (vl_api_sw_interface_set_flags_t * mp, void *handle)
107 {
108   u8 *s;
109   s = format (0, "SCRIPT: sw_interface_set_flags ");
110
111   s = format (s, "sw_if_index %d ", mp->sw_if_index);
112
113   if ((mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
114     s = format (s, "admin-up ");
115   else
116     s = format (s, "admin-down ");
117
118   FINISH;
119 }
120
121 __clib_unused
122   static void *vl_api_sw_interface_set_rx_placement_t_print
123   (vl_api_sw_interface_set_rx_placement_t * mp, void *handle)
124 {
125   u8 *s;
126   s = format (0, "SCRIPT: sw_interface_set_rx_placement ");
127
128   s = format (s, "sw_if_index %d ", mp->sw_if_index);
129
130   s = format (s, "queue %d ", mp->queue_id);
131   if (mp->is_main)
132     s = format (s, "main ");
133   else
134     s = format (s, "worker %d ", mp->worker_id);
135
136   FINISH;
137 }
138
139 static void *vl_api_sw_interface_rx_placement_dump_t_print
140   (vl_api_sw_interface_rx_placement_dump_t * mp, void *handle)
141 {
142   u8 *s;
143   u32 sw_if_index = (mp->sw_if_index);
144
145   s = format (0, "SCRIPT: sw_interface_rx_placement_dump ");
146
147   if (sw_if_index != ~0)
148     s = format (s, "sw_if_index %d ", sw_if_index);
149
150   FINISH;
151 }
152
153 static void *vl_api_sw_interface_event_t_print
154   (vl_api_sw_interface_event_t * mp, void *handle)
155 {
156   u8 *s;
157   s = format (0, "SCRIPT: sw_interface_event ");
158
159   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
160
161   if ((mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
162     s = format (s, "admin-up ");
163   else
164     s = format (s, "admin-down ");
165
166   if ((mp->flags) & IF_STATUS_API_FLAG_LINK_UP)
167     s = format (s, "link-up");
168   else
169     s = format (s, "link-down");
170
171   if (mp->deleted)
172     s = format (s, " deleted");
173
174   FINISH;
175 }
176
177
178 static void *vl_api_sw_interface_add_del_address_t_print
179   (vl_api_sw_interface_add_del_address_t * mp, void *handle)
180 {
181   u8 *s;
182
183   s = format (0, "SCRIPT: sw_interface_add_del_address ");
184   s = format (s, "sw_if_index %d ", mp->sw_if_index);
185   s = format (s, "%U ", format_vl_api_prefix_t, &mp->prefix);
186   if (mp->is_add == 0)
187     s = format (s, "del ");
188   if (mp->del_all)
189     s = format (s, "del-all ");
190
191   FINISH;
192 }
193
194 static void *vl_api_sw_interface_set_table_t_print
195   (vl_api_sw_interface_set_table_t * mp, void *handle)
196 {
197   u8 *s;
198
199   s = format (0, "SCRIPT: sw_interface_set_table ");
200
201   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
202
203   if (mp->vrf_id)
204     s = format (s, "vrf %d ", (mp->vrf_id));
205
206   if (mp->is_ipv6)
207     s = format (s, "ipv6 ");
208
209   FINISH;
210 }
211
212 static void *vl_api_sw_interface_set_mpls_enable_t_print
213   (vl_api_sw_interface_set_mpls_enable_t * mp, void *handle)
214 {
215   u8 *s;
216
217   s = format (0, "SCRIPT: sw_interface_set_mpls_enable ");
218
219   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
220
221   if (mp->enable == 0)
222     s = format (s, "disable");
223
224   FINISH;
225 }
226
227 static void *vl_api_sw_interface_set_vpath_t_print
228   (vl_api_sw_interface_set_vpath_t * mp, void *handle)
229 {
230   u8 *s;
231
232   s = format (0, "SCRIPT: sw_interface_set_vpath ");
233
234   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
235
236   if (mp->enable)
237     s = format (s, "enable ");
238   else
239     s = format (s, "disable ");
240
241   FINISH;
242 }
243
244 static void *vl_api_sw_interface_set_vxlan_bypass_t_print
245   (vl_api_sw_interface_set_vxlan_bypass_t * mp, void *handle)
246 {
247   u8 *s;
248
249   s = format (0, "SCRIPT: sw_interface_set_vxlan_bypass ");
250
251   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
252
253   if (mp->is_ipv6)
254     s = format (s, "ip6 ");
255
256   if (mp->enable)
257     s = format (s, "enable ");
258   else
259     s = format (s, "disable ");
260
261   FINISH;
262 }
263
264 static void *vl_api_sw_interface_set_l2_xconnect_t_print
265   (vl_api_sw_interface_set_l2_xconnect_t * mp, void *handle)
266 {
267   u8 *s;
268
269   s = format (0, "SCRIPT: sw_interface_set_l2_xconnect ");
270
271   s = format (s, "sw_if_index %d ", (mp->rx_sw_if_index));
272
273   if (mp->enable)
274     {
275       s = format (s, "tx_sw_if_index %d ", (mp->tx_sw_if_index));
276     }
277   else
278     s = format (s, "delete ");
279
280   FINISH;
281 }
282
283 static void *vl_api_sw_interface_set_l2_bridge_t_print
284   (vl_api_sw_interface_set_l2_bridge_t * mp, void *handle)
285 {
286   u8 *s;
287
288   s = format (0, "SCRIPT: sw_interface_set_l2_bridge ");
289
290   s = format (s, "sw_if_index %d ", (mp->rx_sw_if_index));
291
292   if (mp->enable)
293     {
294       s = format (s, "bd_id %d shg %d ", (mp->bd_id), mp->shg);
295       if (L2_API_PORT_TYPE_BVI == (mp->port_type))
296         s = format (s, "bvi ");
297       if (L2_API_PORT_TYPE_UU_FWD == (mp->port_type))
298         s = format (s, "uu-fwd ");
299       s = format (s, "enable");
300     }
301   else
302     s = format (s, "disable ");
303
304   FINISH;
305 }
306
307 static void *vl_api_bridge_domain_add_del_t_print
308   (vl_api_bridge_domain_add_del_t * mp, void *handle)
309 {
310   u8 *s;
311
312   s = format (0, "SCRIPT: bridge_domain_add_del ");
313
314   s = format (s, "bd_id %d ", (mp->bd_id));
315
316   if (mp->is_add)
317     {
318       if (mp->bd_tag[0])
319         s = format (s, "bd_tag %s ", mp->bd_tag);
320       s = format (s, "flood %d uu-flood %d ", mp->flood, mp->uu_flood);
321       s = format (s, "forward %d learn %d ", mp->forward, mp->learn);
322       s = format (s, "arp-term %d mac-age %d", mp->arp_term, mp->mac_age);
323     }
324   else
325     s = format (s, "del ");
326
327   FINISH;
328 }
329
330 static void *vl_api_bridge_domain_set_mac_age_t_print
331   (vl_api_bridge_domain_set_mac_age_t * mp, void *handle)
332 {
333   u8 *s;
334
335   s = format (0, "SCRIPT: bridge_domain_set_mac_age ");
336
337   s = format (s, "bd_id %d ", (mp->bd_id));
338
339   s = format (s, "mac-age %d", mp->mac_age);
340
341   FINISH;
342 }
343
344 static void *vl_api_bridge_domain_dump_t_print
345   (vl_api_bridge_domain_dump_t * mp, void *handle)
346 {
347   u8 *s;
348   u32 bd_id = (mp->bd_id);
349
350   s = format (0, "SCRIPT: bridge_domain_dump ");
351
352   if (bd_id != ~0)
353     s = format (s, "bd_id %d ", bd_id);
354
355   FINISH;
356 }
357
358 static void *vl_api_l2fib_flush_all_t_print
359   (vl_api_l2fib_flush_all_t * mp, void *handle)
360 {
361   u8 *s;
362
363   s = format (0, "SCRIPT: l2fib_flush_all ");
364
365   FINISH;
366 }
367
368
369 static void *vl_api_l2fib_flush_bd_t_print
370   (vl_api_l2fib_flush_bd_t * mp, void *handle)
371 {
372   u8 *s;
373   u32 bd_id = (mp->bd_id);
374
375   s = format (0, "SCRIPT: l2fib_flush_bd ");
376   s = format (s, "bd_id %d ", bd_id);
377
378   FINISH;
379 }
380
381 static void *vl_api_l2fib_flush_int_t_print
382   (vl_api_l2fib_flush_int_t * mp, void *handle)
383 {
384   u8 *s;
385   u32 sw_if_index = (mp->sw_if_index);
386
387   s = format (0, "SCRIPT: l2fib_flush_int ");
388   s = format (s, "sw_if_index %d ", sw_if_index);
389
390   FINISH;
391 }
392
393 static void *vl_api_l2fib_add_del_t_print
394   (vl_api_l2fib_add_del_t * mp, void *handle)
395 {
396   u8 *s;
397
398   s = format (0, "SCRIPT: l2fib_add_del ");
399
400   s = format (s, "mac %U ", format_ethernet_address, mp->mac);
401
402   s = format (s, "bd_id %d ", (mp->bd_id));
403
404
405   if (mp->is_add)
406     {
407       s = format (s, "sw_if_index %d ", (mp->sw_if_index));
408       if (mp->static_mac)
409         s = format (s, "%s", "static ");
410       if (mp->filter_mac)
411         s = format (s, "%s", "filter ");
412       if (mp->bvi_mac)
413         s = format (s, "%s", "bvi ");
414     }
415   else
416     {
417       s = format (s, "del ");
418     }
419
420   FINISH;
421 }
422
423 static void *
424 vl_api_l2_flags_t_print (vl_api_l2_flags_t * mp, void *handle)
425 {
426   u8 *s;
427   u32 flags = (mp->feature_bitmap);
428
429   s = format (0, "SCRIPT: l2_flags ");
430
431   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
432
433   if (flags & L2_LEARN)
434     s = format (s, "learn ");
435   if (flags & L2_FWD)
436     s = format (s, "forward ");
437   if (flags & L2_FLOOD)
438     s = format (s, "flood ");
439   if (flags & L2_UU_FLOOD)
440     s = format (s, "uu-flood ");
441   if (flags & L2_ARP_TERM)
442     s = format (s, "arp-term ");
443
444   if (mp->is_set == 0)
445     s = format (s, "clear ");
446
447   FINISH;
448 }
449
450 static void *vl_api_bridge_flags_t_print
451   (vl_api_bridge_flags_t * mp, void *handle)
452 {
453   u8 *s;
454   u32 flags = (mp->flags);
455
456   s = format (0, "SCRIPT: bridge_flags ");
457
458   s = format (s, "bd_id %d ", (mp->bd_id));
459
460   if (flags & BRIDGE_API_FLAG_LEARN)
461     s = format (s, "learn ");
462   if (flags & BRIDGE_API_FLAG_FWD)
463     s = format (s, "forward ");
464   if (flags & BRIDGE_API_FLAG_FLOOD)
465     s = format (s, "flood ");
466   if (flags & BRIDGE_API_FLAG_UU_FLOOD)
467     s = format (s, "uu-flood ");
468   if (flags & BRIDGE_API_FLAG_ARP_TERM)
469     s = format (s, "arp-term ");
470
471   if (mp->is_set == 0)
472     s = format (s, "clear ");
473
474   FINISH;
475 }
476
477 static void *vl_api_bd_ip_mac_add_del_t_print
478   (vl_api_bd_ip_mac_add_del_t * mp, void *handle)
479 {
480   u8 *s;
481
482   s = format (0, "SCRIPT: bd_ip_mac_add_del ");
483   s = format (s, "bd_id %d ", (mp->entry.bd_id));
484
485   s = format (s, "%U ", format_vl_api_address, &mp->entry.ip);
486   s = format (s, "%U ", format_vl_api_mac_address, &mp->entry.mac);
487   if (mp->is_add == 0)
488     s = format (s, "del ");
489
490   FINISH;
491 }
492
493 static void *vl_api_bd_ip_mac_flush_t_print
494   (vl_api_bd_ip_mac_flush_t * mp, void *handle)
495 {
496   u8 *s;
497
498   s = format (0, "SCRIPT: bd_ip_mac_flush ");
499   s = format (s, "bd_id %d ", (mp->bd_id));
500
501   FINISH;
502 }
503
504 __clib_unused
505   static void *vl_api_bd_ip_mac_dump_t_print
506   (vl_api_bd_ip_mac_dump_t * mp, void *handle)
507 {
508   u8 *s;
509
510   s = format (0, "SCRIPT: bd_ip_mac_dump ");
511
512   FINISH;
513 }
514
515 static void *vl_api_tap_create_v2_t_print
516   (vl_api_tap_create_v2_t * mp, void *handle)
517 {
518   u8 *s;
519   u8 null_mac[6];
520
521   clib_memset (null_mac, 0, sizeof (null_mac));
522
523   s = format (0, "SCRIPT: tap_create_v2 ");
524   s = format (s, "id %u ", (mp->id));
525   if (memcmp (mp->mac_address, null_mac, 6))
526     s = format (s, "mac-address %U ",
527                 format_ethernet_address, mp->mac_address);
528   if (memcmp (mp->host_mac_addr, null_mac, 6))
529     s = format (s, "host-mac-addr %U ",
530                 format_ethernet_address, mp->host_mac_addr);
531   if (mp->host_if_name_set)
532     s = format (s, "host-if-name %s ", mp->host_if_name);
533   if (mp->host_namespace_set)
534     s = format (s, "host-ns %s ", mp->host_namespace);
535   if (mp->host_bridge_set)
536     s = format (s, "host-bridge %s ", mp->host_bridge);
537   if (mp->host_ip4_prefix_set)
538     s = format (s, "host-ip4-addr %U/%d ", format_ip4_address,
539                 mp->host_ip4_prefix.address, mp->host_ip4_prefix.len);
540   if (mp->host_ip6_prefix_set)
541     s = format (s, "host-ip6-addr %U/%d ", format_ip6_address,
542                 mp->host_ip6_prefix.address, mp->host_ip6_prefix.len);
543   if (mp->host_ip4_gw_set)
544     s =
545       format (s, "host-ip4-gw %U ", format_ip4_address,
546               mp->host_ip4_prefix.address);
547   if (mp->host_ip6_gw_set)
548     s =
549       format (s, "host-ip6-gw %U ", format_ip6_address,
550               mp->host_ip6_prefix.address);
551   if (mp->num_rx_queues)
552     s = format (s, "num_rx_queues %u ", mp->num_rx_queues);
553   if (mp->tx_ring_sz)
554     s = format (s, "tx-ring-size %u ", (mp->tx_ring_sz));
555   if (mp->rx_ring_sz)
556     s = format (s, "rx-ring-size %u ", (mp->rx_ring_sz));
557   if (mp->host_mtu_set)
558     s = format (s, "host-mtu-size %u ", (mp->host_mtu_size));
559   if ((mp->tap_flags) & TAP_API_FLAG_GSO)
560     s = format (s, "gso-enabled ");
561   if ((mp->tap_flags) & TAP_API_FLAG_CSUM_OFFLOAD)
562     s = format (s, "csum-offload-enabled ");
563   if ((mp->tap_flags) & TAP_API_FLAG_PERSIST)
564     s = format (s, "persist ");
565   if ((mp->tap_flags) & TAP_API_FLAG_ATTACH)
566     s = format (s, "attach ");
567   if ((mp->tap_flags) & TAP_API_FLAG_TUN)
568     s = format (s, "tun ");
569   if ((mp->tap_flags) & TAP_API_FLAG_GRO_COALESCE)
570     s = format (s, "gro-coalesce-enabled ");
571   if ((mp->tap_flags) & TAP_API_FLAG_PACKED)
572     s = format (s, "packed ");
573   if ((mp->tap_flags) & TAP_API_FLAG_IN_ORDER)
574     s = format (s, "in-order ");
575   FINISH;
576 }
577
578 static void *vl_api_tap_delete_v2_t_print
579   (vl_api_tap_delete_v2_t * mp, void *handle)
580 {
581   u8 *s;
582
583   s = format (0, "SCRIPT: tap_delete_v2 ");
584   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
585
586   FINISH;
587 }
588
589 static void *vl_api_sw_interface_tap_v2_dump_t_print
590   (vl_api_sw_interface_tap_v2_dump_t * mp, void *handle)
591 {
592   u8 *s;
593
594   s = format (0, "SCRIPT: sw_interface_tap_v2_dump ");
595
596   FINISH;
597 }
598
599 __clib_unused
600   static void *vl_api_virtio_pci_create_t_print
601   (vl_api_virtio_pci_create_t * mp, void *handle)
602 {
603   u8 *s;
604   u8 null_mac[6];
605
606   clib_memset (null_mac, 0, sizeof (null_mac));
607
608   s = format (0, "SCRIPT: virtio_pci_create ");
609   s = format (s, "pci_addr %U ", format_vlib_pci_addr, (mp->pci_addr));
610   if (memcmp (mp->mac_address, null_mac, 6))
611     s = format (s, "mac-address %U ",
612                 format_ethernet_address, mp->mac_address);
613   if (mp->features)
614     s = format (s, "features 0x%llx ", clib_net_to_host_u64 (mp->features));
615   if (mp->gso_enabled)
616     s = format (s, "gso-enabled ");
617   if (mp->checksum_offload_enabled)
618     s = format (s, "checksum_offload_enabled");
619   FINISH;
620 }
621
622 __clib_unused
623   static void *vl_api_virtio_pci_create_v2_t_print
624   (vl_api_virtio_pci_create_v2_t * mp, void *handle)
625 {
626   u8 *s;
627   u8 null_mac[6];
628
629   clib_memset (null_mac, 0, sizeof (null_mac));
630
631   s = format (0, "SCRIPT: virtio_pci_create_v2 ");
632   s = format (s, "pci_addr %U ", format_vlib_pci_addr, (mp->pci_addr));
633   if (memcmp (mp->mac_address, null_mac, 6))
634     s = format (s, "mac-address %U ",
635                 format_ethernet_address, mp->mac_address);
636   if (mp->features)
637     s = format (s, "features 0x%llx ", clib_net_to_host_u64 (mp->features));
638   if (mp->virtio_flags & VIRTIO_API_FLAG_GSO)
639     s = format (s, "gso-enabled ");
640   if (mp->virtio_flags & VIRTIO_API_FLAG_CSUM_OFFLOAD)
641     s = format (s, "checksum_offload_enabled ");
642   if ((mp->virtio_flags) & VIRTIO_API_FLAG_GRO_COALESCE)
643     s = format (s, "gro-coalesce-enabled ");
644   if ((mp->virtio_flags) & VIRTIO_API_FLAG_PACKED)
645     s = format (s, "packed ");
646   if ((mp->virtio_flags) & VIRTIO_API_FLAG_IN_ORDER)
647     s = format (s, "in-order ");
648   FINISH;
649 }
650
651 __clib_unused
652   static void *vl_api_virtio_pci_delete_t_print
653   (vl_api_virtio_pci_delete_t * mp, void *handle)
654 {
655   u8 *s;
656
657   s = format (0, "SCRIPT: virtio_pci_delete ");
658   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
659
660   FINISH;
661 }
662
663 __clib_unused
664   static void *vl_api_sw_interface_virtio_pci_dump_t_print
665   (vl_api_sw_interface_virtio_pci_dump_t * mp, void *handle)
666 {
667   u8 *s;
668
669   s = format (0, "SCRIPT: sw_interface_virtio_pci_dump ");
670
671   FINISH;
672 }
673
674 static void *vl_api_bond_create_t_print
675   (vl_api_bond_create_t * mp, void *handle)
676 {
677   u8 *s;
678   u8 null_mac[6];
679
680   clib_memset (null_mac, 0, sizeof (null_mac));
681
682   s = format (0, "SCRIPT: bond_create ");
683   if (memcmp (mp->mac_address, null_mac, 6))
684     s = format (s, "mac-address %U ",
685                 format_ethernet_address, mp->mac_address);
686   if (mp->mode)
687     s = format (s, "mode %U ", format_bond_mode, ntohl (mp->mode));
688   if (mp->lb)
689     s = format (s, "lb %U ", format_bond_load_balance, ntohl (mp->lb));
690   if (mp->numa_only)
691     s = format (s, "numa-only is set in lacp mode");
692   if (mp->id != ~0)
693     s = format (s, "id %u ", (mp->id));
694   FINISH;
695 }
696
697 static void *vl_api_bond_create2_t_print
698   (vl_api_bond_create2_t * mp, void *handle)
699 {
700   u8 *s;
701   u8 null_mac[6];
702
703   clib_memset (null_mac, 0, sizeof (null_mac));
704
705   s = format (0, "SCRIPT: bond_create2 ");
706   if (memcmp (mp->mac_address, null_mac, 6))
707     s = format (s, "mac-address %U ",
708                 format_ethernet_address, mp->mac_address);
709   if (mp->mode)
710     s = format (s, "mode %U ", format_bond_mode, ntohl (mp->mode));
711   if (mp->lb)
712     s = format (s, "lb %U ", format_bond_load_balance, ntohl (mp->lb));
713   if (mp->numa_only)
714     s = format (s, "numa-only ");
715   if (mp->enable_gso)
716     s = format (s, "gso ");
717   if (mp->id != ~0)
718     s = format (s, "id %u ", (mp->id));
719   FINISH;
720 }
721
722 static void *vl_api_bond_delete_t_print
723   (vl_api_bond_delete_t * mp, void *handle)
724 {
725   u8 *s;
726
727   s = format (0, "SCRIPT: bond_delete ");
728   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
729
730   FINISH;
731 }
732
733 static void *vl_api_bond_add_member_t_print
734   (vl_api_bond_add_member_t * mp, void *handle)
735 {
736   u8 *s;
737
738   s = format (0, "SCRIPT: bond_add_member ");
739   s = format (s, "bond_sw_if_index %u ", (mp->bond_sw_if_index));
740   s = format (s, "sw_if_index %u ", (mp->sw_if_index));
741   if (mp->is_passive)
742     s = format (s, "passive ");
743   if (mp->is_long_timeout)
744     s = format (s, "long-timeout ");
745
746   FINISH;
747 }
748
749 static void *vl_api_sw_interface_set_bond_weight_t_print
750   (vl_api_sw_interface_set_bond_weight_t * mp, void *handle)
751 {
752   u8 *s;
753
754   s = format (0, "SCRIPT: sw_interface_set_bond_weight ");
755   s = format (s, "sw_if_index %u ", ntohl (mp->sw_if_index));
756   s = format (s, "weight %u ", ntohl (mp->weight));
757
758   FINISH;
759 }
760
761 static void *vl_api_bond_detach_member_t_print
762   (vl_api_bond_detach_member_t * mp, void *handle)
763 {
764   u8 *s;
765
766   s = format (0, "SCRIPT: bond_detach_member ");
767   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
768
769   FINISH;
770 }
771
772 static void *vl_api_sw_bond_interface_dump_t_print
773   (vl_api_sw_bond_interface_dump_t * mp, void *handle)
774 {
775   u8 *s;
776
777   s = format (0, "SCRIPT: sw_bond_interface_dump ");
778   if (mp->sw_if_index != ~0)
779     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
780
781   FINISH;
782 }
783
784 static void *vl_api_sw_member_interface_dump_t_print
785   (vl_api_sw_member_interface_dump_t * mp, void *handle)
786 {
787   u8 *s;
788
789   s = format (0, "SCRIPT: sw_member_interface_dump ");
790   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
791
792   FINISH;
793 }
794
795 static void *vl_api_ip_route_add_del_t_print
796   (vl_api_ip_route_add_del_t * mp, void *handle)
797 {
798   u8 *s, p;
799
800   s = format (0, "SCRIPT: ip_route_add_del ");
801   if (mp->is_add == 0)
802     s = format (s, "del ");
803
804   s = format (s, "%U", format_vl_api_prefix, &mp->route.prefix);
805
806   for (p = 0; p < mp->route.n_paths; p++)
807     s = format (s, " [%U]", format_vl_api_fib_path, &mp->route.paths[p]);
808
809   FINISH;
810 }
811
812 static void *vl_api_mpls_route_add_del_t_print
813   (vl_api_mpls_route_add_del_t * mp, void *handle)
814 {
815   u8 *s, p;
816
817   s = format (0, "SCRIPT: mpls_route_add_del ");
818
819   if (mp->mr_is_add)
820     s = format (s, "add ");
821   else
822     s = format (s, "del ");
823
824   s = format (s, "table %d ", (mp->mr_route.mr_table_id));
825   s = format (s, "%d ", (mp->mr_route.mr_label));
826
827   if (mp->mr_route.mr_eos)
828     s = format (s, "eos ");
829   else
830     s = format (s, "non-eos ");
831
832   if (mp->mr_route.mr_is_multicast)
833     s = format (s, "multicast ");
834
835   for (p = 0; p < mp->mr_route.mr_n_paths; p++)
836     s =
837       format (s, " [%U]", format_vl_api_fib_path, &mp->mr_route.mr_paths[p]);
838
839
840   FINISH;
841 }
842
843 static void *vl_api_ip_table_add_del_t_print
844   (vl_api_ip_table_add_del_t * mp, void *handle)
845 {
846   u8 *s;
847
848   s = format (0, "SCRIPT: ip_table_add_del ");
849   if (mp->is_add)
850     s = format (s, "add ");
851   else
852     s = format (s, "del ");
853   if (mp->table.is_ip6)
854     s = format (s, "ip6 ");
855   s = format (s, "table %d ", (mp->table.table_id));
856   s = format (s, "%s ", mp->table.name);
857
858   FINISH;
859 }
860
861 static void *vl_api_mpls_table_add_del_t_print
862   (vl_api_mpls_table_add_del_t * mp, void *handle)
863 {
864   u8 *s;
865
866   s = format (0, "SCRIPT: mpls_table_add_del ");
867   if (mp->mt_is_add)
868     s = format (s, "add ");
869   else
870     s = format (s, "del ");
871   s = format (s, "table %d ", (mp->mt_table.mt_table_id));
872
873   FINISH;
874 }
875
876 static void *vl_api_mpls_tunnel_add_del_t_print
877   (vl_api_mpls_tunnel_add_del_t * mp, void *handle)
878 {
879   u8 *s, p;
880
881   s = format (0, "SCRIPT: mpls_tunnel_add_del ");
882
883   if (mp->mt_is_add == 0)
884     s = format (s, "del sw_if_index %d ", (mp->mt_tunnel.mt_sw_if_index));
885   else
886     s = format (s, "sw_if_index %d ", (mp->mt_tunnel.mt_sw_if_index));
887
888
889   if (mp->mt_tunnel.mt_l2_only)
890     s = format (s, "l2-only ");
891   if (mp->mt_tunnel.mt_is_multicast)
892     s = format (s, "multicast ");
893   if (mp->mt_tunnel.mt_tunnel_index)
894     s = format (s, "tunnel-index ");
895
896   for (p = 0; p < mp->mt_tunnel.mt_n_paths; p++)
897     s = format (s, " [%U]", format_vl_api_fib_path,
898                 &mp->mt_tunnel.mt_paths[p]);
899
900   FINISH;
901 }
902
903 static void *vl_api_sr_mpls_policy_add_t_print
904   (vl_api_sr_mpls_policy_add_t * mp, void *handle)
905 {
906   u8 *s;
907
908   s = format (0, "SCRIPT: sr_mpls_policy_add ");
909
910   s = format (s, "bsid %d ", (mp->bsid));
911
912   if (mp->weight != htonl ((u32) 1))
913     s = format (s, "%d ", (mp->weight));
914
915   if (mp->is_spray)
916     s = format (s, "spray ");
917
918   if (mp->n_segments)
919     {
920       int i;
921       for (i = 0; i < mp->n_segments; i++)
922         s = format (s, "next %d ", (mp->segments[i]));
923     }
924
925   FINISH;
926 }
927
928 static void *vl_api_sr_mpls_policy_del_t_print
929   (vl_api_sr_mpls_policy_del_t * mp, void *handle)
930 {
931   u8 *s;
932
933   s = format (0, "SCRIPT: sr_mpls_policy_del ");
934
935   s = format (s, "bsid %d ", (mp->bsid));
936
937   FINISH;
938 }
939
940 static void *vl_api_sw_interface_set_unnumbered_t_print
941   (vl_api_sw_interface_set_unnumbered_t * mp, void *handle)
942 {
943   u8 *s;
944
945   s = format (0, "SCRIPT: sw_interface_set_unnumbered ");
946
947   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
948
949   s = format (s, "unnum_if_index %d ", (mp->unnumbered_sw_if_index));
950
951   if (mp->is_add == 0)
952     s = format (s, "del ");
953
954   FINISH;
955 }
956
957 static void *vl_api_create_vlan_subif_t_print
958   (vl_api_create_vlan_subif_t * mp, void *handle)
959 {
960   u8 *s;
961
962   s = format (0, "SCRIPT: create_vlan_subif ");
963
964   if (mp->sw_if_index)
965     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
966
967   if (mp->vlan_id)
968     s = format (s, "vlan_id %d ", (mp->vlan_id));
969
970   FINISH;
971 }
972
973 #define foreach_create_subif_flag               \
974 _(0, "no_tags")                                 \
975 _(1, "one_tag")                                 \
976 _(2, "two_tags")                                \
977 _(3, "dot1ad")                                  \
978 _(4, "exact_match")                             \
979 _(5, "default_sub")                             \
980 _(6, "outer_vlan_id_any")                       \
981 _(7, "inner_vlan_id_any")
982
983 static void *vl_api_create_subif_t_print
984   (vl_api_create_subif_t * mp, void *handle)
985 {
986   u8 *s;
987
988   s = format (0, "SCRIPT: create_subif ");
989
990   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
991
992   s = format (s, "sub_id %d ", (mp->sub_id));
993
994   if (mp->outer_vlan_id)
995     s = format (s, "outer_vlan_id %d ", (mp->outer_vlan_id));
996
997   if (mp->inner_vlan_id)
998     s = format (s, "inner_vlan_id %d ", (mp->inner_vlan_id));
999
1000 #define _(a,b) if (mp->sub_if_flags & (1 << a)) s = format (s, "%s ", b);
1001   foreach_create_subif_flag;
1002 #undef _
1003
1004   FINISH;
1005 }
1006
1007 static void *vl_api_delete_subif_t_print
1008   (vl_api_delete_subif_t * mp, void *handle)
1009 {
1010   u8 *s;
1011
1012   s = format (0, "SCRIPT: delete_subif ");
1013   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1014
1015   FINISH;
1016 }
1017
1018 static void *
1019 vl_api_ip_table_replace_begin_t_print (vl_api_ip_table_replace_begin_t * mp,
1020                                        void *handle)
1021 {
1022   u8 *s;
1023
1024   s = format (0, "SCRIPT: ip_table_replace_begin ");
1025
1026   s = format (s, "v%s-table %d ",
1027               mp->table.is_ip6 ? "6" : "4", (mp->table.table_id));
1028
1029   FINISH;
1030 }
1031
1032 static void *
1033 vl_api_ip_table_flush_t_print (vl_api_ip_table_flush_t * mp, void *handle)
1034 {
1035   u8 *s;
1036
1037   s = format (0, "SCRIPT: ip_table_flush ");
1038
1039   s = format (s, "v%s-table %d ",
1040               mp->table.is_ip6 ? "6" : "4", (mp->table.table_id));
1041
1042   FINISH;
1043 }
1044
1045 static void *
1046 vl_api_ip_table_replace_end_t_print (vl_api_ip_table_replace_end_t * mp,
1047                                      void *handle)
1048 {
1049   u8 *s;
1050
1051   s = format (0, "SCRIPT: ip_table_replace_end ");
1052
1053   s = format (s, "v%s-table %d ",
1054               mp->table.is_ip6 ? "6" : "4", (mp->table.table_id));
1055
1056   FINISH;
1057 }
1058
1059 static void *vl_api_set_ip_flow_hash_t_print
1060   (vl_api_set_ip_flow_hash_t * mp, void *handle)
1061 {
1062   u8 *s;
1063
1064   s = format (0, "SCRIPT: set_ip_flow_hash ");
1065
1066   s = format (s, "vrf_id %d ", (mp->vrf_id));
1067
1068   if (mp->src)
1069     s = format (s, "src ");
1070
1071   if (mp->dst)
1072     s = format (s, "dst ");
1073
1074   if (mp->sport)
1075     s = format (s, "sport ");
1076
1077   if (mp->dport)
1078     s = format (s, "dport ");
1079
1080   if (mp->proto)
1081     s = format (s, "proto ");
1082
1083   if (mp->reverse)
1084     s = format (s, "reverse ");
1085
1086   if (mp->is_ipv6 != 0)
1087     s = format (s, "ipv6 ");
1088
1089   FINISH;
1090 }
1091
1092
1093 static void *vl_api_l2_patch_add_del_t_print
1094   (vl_api_l2_patch_add_del_t * mp, void *handle)
1095 {
1096   u8 *s;
1097
1098   s = format (0, "SCRIPT: l2_patch_add_del ");
1099
1100   s = format (s, "rx_sw_if_index %d ", (mp->rx_sw_if_index));
1101
1102   s = format (s, "tx_sw_if_index %d ", (mp->tx_sw_if_index));
1103
1104   if (mp->is_add == 0)
1105     s = format (s, "del ");
1106
1107   FINISH;
1108 }
1109
1110 static void *vl_api_sr_localsid_add_del_t_print
1111   (vl_api_sr_localsid_add_del_t * mp, void *handle)
1112 {
1113   vnet_main_t *vnm = vnet_get_main ();
1114   u8 *s;
1115
1116   s = format (0, "SCRIPT: sr_localsid_add_del ");
1117
1118   switch (mp->behavior)
1119     {
1120     case SR_BEHAVIOR_END:
1121       s = format (s, "Address: %U\nBehavior: End",
1122                   format_ip6_address, (ip6_address_t *) mp->localsid);
1123       s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1124       break;
1125     case SR_BEHAVIOR_X:
1126       s =
1127         format (s,
1128                 "Address: %U\nBehavior: X (Endpoint with Layer-3 cross-connect)"
1129                 "\nIface: %U\nNext hop: %U", format_ip6_address,
1130                 (ip6_address_t *) mp->localsid,
1131                 format_vnet_sw_if_index_name, vnm, (mp->sw_if_index),
1132                 format_ip6_address, (ip6_address_t *) mp->nh_addr.un.ip6);
1133       s = format (s, (mp->end_psp ? "End.PSP: True" : "End.PSP: False"));
1134       break;
1135     case SR_BEHAVIOR_DX4:
1136       s =
1137         format (s,
1138                 "Address: %U\nBehavior: DX4 (Endpoint with decapsulation with IPv4 cross-connect)"
1139                 "\nIface: %U\nNext hop: %U", format_ip6_address,
1140                 (ip6_address_t *) mp->localsid,
1141                 format_vnet_sw_if_index_name, vnm, (mp->sw_if_index),
1142                 format_ip4_address, (ip4_address_t *) mp->nh_addr.un.ip4);
1143       break;
1144     case SR_BEHAVIOR_DX6:
1145       s =
1146         format (s,
1147                 "Address: %U\nBehavior: DX6 (Endpoint with decapsulation with IPv6 cross-connect)"
1148                 "\nIface: %UNext hop: %U", format_ip6_address,
1149                 (ip6_address_t *) mp->localsid,
1150                 format_vnet_sw_if_index_name, vnm, (mp->sw_if_index),
1151                 format_ip6_address, (ip6_address_t *) mp->nh_addr.un.ip6);
1152       break;
1153     case SR_BEHAVIOR_DX2:
1154       s =
1155         format (s,
1156                 "Address: %U\nBehavior: DX2 (Endpoint with decapulation and Layer-2 cross-connect)"
1157                 "\nIface: %U", format_ip6_address,
1158                 (ip6_address_t *) mp->localsid,
1159                 format_vnet_sw_if_index_name, vnm, (mp->sw_if_index));
1160       break;
1161     case SR_BEHAVIOR_DT6:
1162       s =
1163         format (s,
1164                 "Address: %U\nBehavior: DT6 (Endpoint with decapsulation and specific IPv6 table lookup)"
1165                 "\nTable: %u", format_ip6_address,
1166                 (ip6_address_t *) mp->localsid, (mp->fib_table));
1167       break;
1168     case SR_BEHAVIOR_DT4:
1169       s =
1170         format (s,
1171                 "Address: %U\nBehavior: DT4 (Endpoint with decapsulation and specific IPv4 table lookup)"
1172                 "\nTable: %u", format_ip6_address,
1173                 (ip6_address_t *) mp->localsid, (mp->fib_table));
1174       break;
1175     default:
1176       if (mp->behavior >= SR_BEHAVIOR_LAST)
1177         {
1178           s = format (s, "Address: %U\n Behavior: %u",
1179                       format_ip6_address, (ip6_address_t *) mp->localsid,
1180                       mp->behavior);
1181         }
1182       else
1183         //Should never get here...
1184         s = format (s, "Internal error");
1185       break;
1186     }
1187   FINISH;
1188 }
1189
1190 static void *vl_api_sr_steering_add_del_t_print
1191   (vl_api_sr_steering_add_del_t * mp, void *handle)
1192 {
1193   u8 *s;
1194
1195   s = format (0, "SCRIPT: sr_steering_add_del ");
1196
1197   s = format (s, (mp->is_del ? "Del: True" : "Del: False"));
1198
1199   switch (mp->traffic_type)
1200     {
1201     case SR_STEER_L2:
1202       s = format (s, "Traffic type: L2 iface: %u", (mp->sw_if_index));
1203       break;
1204     case SR_STEER_IPV4:
1205       s = format (s, "Traffic type: IPv4 %U/%u", format_ip4_address,
1206                   (ip4_address_t *) mp->prefix.address.un.ip4,
1207                   (mp->prefix.len));
1208       break;
1209     case SR_STEER_IPV6:
1210       s = format (s, "Traffic type: IPv6 %U/%u", format_ip6_address,
1211                   (ip6_address_t *) mp->prefix.address.un.ip6,
1212                   (mp->prefix.len));
1213       break;
1214     default:
1215       s = format (s, "Traffic type: Unknown(%u)", mp->traffic_type);
1216       break;
1217     }
1218   s = format (s, "BindingSID: %U", format_ip6_address,
1219               (ip6_address_t *) mp->bsid_addr);
1220
1221   s = format (s, "SR Policy Index: %u", (mp->sr_policy_index));
1222
1223   s = format (s, "FIB_table: %u", (mp->table_id));
1224
1225   FINISH;
1226 }
1227
1228 static void *vl_api_sr_policy_add_t_print
1229   (vl_api_sr_policy_add_t * mp, void *handle)
1230 {
1231   u8 *s;
1232
1233   ip6_address_t *segments = 0, *seg;
1234   ip6_address_t *this_address = (ip6_address_t *) mp->sids.sids;
1235
1236   int i;
1237   for (i = 0; i < mp->sids.num_sids; i++)
1238     {
1239       vec_add2 (segments, seg, 1);
1240       clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1241       this_address++;
1242     }
1243
1244   s = format (0, "SCRIPT: sr_policy_add ");
1245
1246   s = format (s, "BSID: %U", format_ip6_address,
1247               (ip6_address_t *) mp->bsid_addr);
1248
1249   s =
1250     format (s,
1251             (mp->is_encap ? "Behavior: Encapsulation" :
1252              "Behavior: SRH insertion"));
1253
1254   s = format (s, "FIB_table: %u", (mp->fib_table));
1255
1256   s = format (s, (mp->is_spray ? "Type: Default" : "Type: Spray"));
1257
1258   s = format (s, "SID list weight: %u", (mp->weight));
1259
1260   s = format (s, "{");
1261   vec_foreach (seg, segments)
1262   {
1263     s = format (s, "%U, ", format_ip6_address, seg);
1264   }
1265   s = format (s, "\b\b } ");
1266
1267   FINISH;
1268 }
1269
1270 static void *vl_api_sr_policy_mod_t_print
1271   (vl_api_sr_policy_mod_t * mp, void *handle)
1272 {
1273   u8 *s;
1274
1275   ip6_address_t *segments = 0, *seg;
1276   ip6_address_t *this_address = (ip6_address_t *) mp->sids.sids;
1277
1278   int i;
1279   for (i = 0; i < mp->sids.num_sids; i++)
1280     {
1281       vec_add2 (segments, seg, 1);
1282       clib_memcpy (seg->as_u8, this_address->as_u8, sizeof (*this_address));
1283       this_address++;
1284     }
1285
1286   s = format (0, "SCRIPT: sr_policy_mod ");
1287
1288   s = format (s, "BSID: %U", format_ip6_address,
1289               (ip6_address_t *) mp->bsid_addr);
1290
1291   s = format (s, "SR Policy index: %u", (mp->sr_policy_index));
1292
1293   s = format (s, "Operation: %u", mp->operation);
1294
1295   s = format (s, "SID list index: %u", (mp->sl_index));
1296
1297   s = format (s, "SID list weight: %u", (mp->weight));
1298
1299   s = format (s, "{");
1300   vec_foreach (seg, segments)
1301   {
1302     s = format (s, "%U, ", format_ip6_address, seg);
1303   }
1304   s = format (s, "\b\b } ");
1305
1306   FINISH;
1307 }
1308
1309 static void *vl_api_sr_policy_del_t_print
1310   (vl_api_sr_policy_del_t * mp, void *handle)
1311 {
1312   u8 *s;
1313
1314   s = format (0, "SCRIPT: sr_policy_del ");
1315   s = format (s, "To be delivered. Good luck.");
1316   FINISH;
1317 }
1318
1319 static void *vl_api_classify_add_del_table_t_print
1320   (vl_api_classify_add_del_table_t * mp, void *handle)
1321 {
1322   u8 *s;
1323   int i;
1324
1325   s = format (0, "SCRIPT: classify_add_del_table ");
1326
1327   if (mp->is_add == 0)
1328     {
1329       s = format (s, "table %d ", (mp->table_index));
1330       s = format (s, "%s ", mp->del_chain ? "del-chain" : "del");
1331     }
1332   else
1333     {
1334       s = format (s, "nbuckets %d ", (mp->nbuckets));
1335       s = format (s, "memory_size %d ", (mp->memory_size));
1336       s = format (s, "skip %d ", (mp->skip_n_vectors));
1337       s = format (s, "match %d ", (mp->match_n_vectors));
1338       s = format (s, "next-table %d ", (mp->next_table_index));
1339       s = format (s, "miss-next %d ", (mp->miss_next_index));
1340       s = format (s, "current-data-flag %d ", (mp->current_data_flag));
1341       if (mp->current_data_flag)
1342         s = format (s, "current-data-offset %d ", (mp->current_data_offset));
1343       s = format (s, "mask hex ");
1344       for (i = 0; i < (mp->match_n_vectors) * sizeof (u32x4); i++)
1345         s = format (s, "%02x", mp->mask[i]);
1346       vec_add1 (s, ' ');
1347     }
1348
1349   FINISH;
1350 }
1351
1352 static void *vl_api_classify_add_del_session_t_print
1353   (vl_api_classify_add_del_session_t * mp, void *handle)
1354 {
1355   u8 *s;
1356   int i, limit = 0;
1357
1358   s = format (0, "SCRIPT: classify_add_del_session ");
1359
1360   s = format (s, "table_index %d ", (mp->table_index));
1361   s = format (s, "hit_next_index %d ", (mp->hit_next_index));
1362   s = format (s, "opaque_index %d ", (mp->opaque_index));
1363   s = format (s, "advance %d ", (mp->advance));
1364   s = format (s, "action %d ", mp->action);
1365   if (mp->action)
1366     s = format (s, "metadata %d ", (mp->metadata));
1367   if (mp->is_add == 0)
1368     s = format (s, "del ");
1369
1370   s = format (s, "match hex ");
1371   for (i = 5 * sizeof (u32x4) - 1; i > 0; i--)
1372     {
1373       if (mp->match[i] != 0)
1374         {
1375           limit = i + 1;
1376           break;
1377         }
1378     }
1379
1380   for (i = 0; i < limit; i++)
1381     s = format (s, "%02x", mp->match[i]);
1382
1383   FINISH;
1384 }
1385
1386 static void *vl_api_classify_set_interface_ip_table_t_print
1387   (vl_api_classify_set_interface_ip_table_t * mp, void *handle)
1388 {
1389   u8 *s;
1390
1391   s = format (0, "SCRIPT: classify_set_interface_ip_table ");
1392
1393   if (mp->is_ipv6)
1394     s = format (s, "ipv6 ");
1395
1396   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1397   s = format (s, "table %d ", (mp->table_index));
1398
1399   FINISH;
1400 }
1401
1402 static void *vl_api_classify_set_interface_l2_tables_t_print
1403   (vl_api_classify_set_interface_l2_tables_t * mp, void *handle)
1404 {
1405   u8 *s;
1406
1407   s = format (0, "SCRIPT: classify_set_interface_l2_tables ");
1408
1409   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1410   s = format (s, "ip4-table %d ", (mp->ip4_table_index));
1411   s = format (s, "ip6-table %d ", (mp->ip6_table_index));
1412   s = format (s, "other-table %d ", (mp->other_table_index));
1413   s = format (s, "is-input %d ", mp->is_input);
1414
1415   FINISH;
1416 }
1417
1418 static void *vl_api_add_node_next_t_print
1419   (vl_api_add_node_next_t * mp, void *handle)
1420 {
1421   u8 *s;
1422
1423   s = format (0, "SCRIPT: add_node_next ");
1424
1425   s = format (s, "node %s next %s ", mp->node_name, mp->next_name);
1426
1427   FINISH;
1428 }
1429
1430 static void *vl_api_vxlan_add_del_tunnel_t_print
1431   (vl_api_vxlan_add_del_tunnel_t * mp, void *handle)
1432 {
1433   u8 *s;
1434   s = format (0, "SCRIPT: vxlan_add_del_tunnel ");
1435
1436   ip46_address_t src =
1437     to_ip46 (mp->src_address.af, (u8 *) & mp->src_address.un);
1438   ip46_address_t dst =
1439     to_ip46 (mp->dst_address.af, (u8 *) & mp->dst_address.un);
1440
1441   u8 is_grp = ip46_address_is_multicast (&dst);
1442   char *dst_name = is_grp ? "group" : "dst";
1443
1444   s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY);
1445   s = format (s, "%s %U ", dst_name, format_ip46_address,
1446               &dst, IP46_TYPE_ANY);
1447
1448   if (is_grp)
1449     s = format (s, "mcast_sw_if_index %d ", (mp->mcast_sw_if_index));
1450
1451   if (mp->encap_vrf_id)
1452     s = format (s, "encap-vrf-id %d ", (mp->encap_vrf_id));
1453
1454   s = format (s, "decap-next %d ", (mp->decap_next_index));
1455
1456   s = format (s, "vni %d ", (mp->vni));
1457
1458   s = format (s, "instance %d ", (mp->instance));
1459
1460   if (mp->is_add == 0)
1461     s = format (s, "del ");
1462
1463   FINISH;
1464 }
1465
1466 static void *vl_api_vxlan_offload_rx_t_print
1467   (vl_api_vxlan_offload_rx_t * mp, void *handle)
1468 {
1469   u8 *s;
1470   s = format (0, "SCRIPT: vxlan_offload_rx ");
1471
1472   s = format (s, "hw hw_if_index %d ", (mp->hw_if_index));
1473   s = format (s, "rx sw_if_index %d ", (mp->sw_if_index));
1474   if (!mp->enable)
1475     s = format (s, "del ");
1476
1477   FINISH;
1478 }
1479
1480 static void *vl_api_vxlan_tunnel_dump_t_print
1481   (vl_api_vxlan_tunnel_dump_t * mp, void *handle)
1482 {
1483   u8 *s;
1484
1485   s = format (0, "SCRIPT: vxlan_tunnel_dump ");
1486
1487   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1488
1489   FINISH;
1490 }
1491
1492 static void *vl_api_vxlan_gbp_tunnel_add_del_t_print
1493   (vl_api_vxlan_gbp_tunnel_add_del_t * mp, void *handle)
1494 {
1495   u8 *s;
1496   s = format (0, "SCRIPT: vxlan_gbp_tunnel_add_del ");
1497
1498   if (mp->is_add)
1499     s = format (s, "add ");
1500   else
1501     s = format (s, "del ");
1502
1503   s = format (s, "instance %d ", (mp->tunnel.instance));
1504   s = format (s, "src %U ", format_vl_api_address, &mp->tunnel.src);
1505   s = format (s, "dst %U ", format_vl_api_address, &mp->tunnel.dst);
1506   s = format (s, "mcast_sw_if_index %d ", (mp->tunnel.mcast_sw_if_index));
1507   s = format (s, "encap_table_id %d ", (mp->tunnel.encap_table_id));
1508   s = format (s, "vni %d ", (mp->tunnel.vni));
1509   s = format (s, "sw_if_index %d ", (mp->tunnel.sw_if_index));
1510
1511   FINISH;
1512 }
1513
1514 static void *vl_api_vxlan_gbp_tunnel_dump_t_print
1515   (vl_api_vxlan_gbp_tunnel_dump_t * mp, void *handle)
1516 {
1517   u8 *s;
1518
1519   s = format (0, "SCRIPT: vxlan_gbp_tunnel_dump ");
1520
1521   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1522
1523   FINISH;
1524 }
1525
1526 static void *vl_api_sw_interface_set_vxlan_gbp_bypass_t_print
1527   (vl_api_sw_interface_set_vxlan_gbp_bypass_t * mp, void *handle)
1528 {
1529   u8 *s;
1530
1531   s = format (0, "SCRIPT: sw_interface_set_vxlan_gbp_bypass ");
1532
1533   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1534   s = format (s, "%s ", (mp->is_ipv6 != 0) ? "ipv6" : "ipv4");
1535   s = format (s, "%s ", (mp->enable != 0) ? "enable" : "disable");
1536
1537   FINISH;
1538 }
1539
1540 static void *vl_api_gre_tunnel_add_del_t_print
1541   (vl_api_gre_tunnel_add_del_t * mp, void *handle)
1542 {
1543   u8 *s;
1544
1545   s = format (0, "SCRIPT: gre_tunnel_add_del ");
1546
1547   s = format (s, "dst %U ", format_vl_api_address, &mp->tunnel.dst);
1548   s = format (s, "src %U ", format_vl_api_address, &mp->tunnel.src);
1549
1550   s = format (s, "instance %d ", (mp->tunnel.instance));
1551
1552   if (mp->tunnel.type == GRE_API_TUNNEL_TYPE_TEB)
1553     s = format (s, "teb ");
1554
1555   if (mp->tunnel.type == GRE_API_TUNNEL_TYPE_ERSPAN)
1556     s = format (s, "erspan %d ", (mp->tunnel.session_id));
1557
1558   if (mp->tunnel.outer_table_id)
1559     s = format (s, "outer-table-id %d ", mp->tunnel.outer_table_id);
1560
1561   if (mp->is_add == 0)
1562     s = format (s, "del ");
1563
1564   FINISH;
1565 }
1566
1567 static void *vl_api_gre_tunnel_dump_t_print
1568   (vl_api_gre_tunnel_dump_t * mp, void *handle)
1569 {
1570   u8 *s;
1571
1572   s = format (0, "SCRIPT: gre_tunnel_dump ");
1573
1574   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1575
1576   FINISH;
1577 }
1578
1579 static void *vl_api_l2_fib_clear_table_t_print
1580   (vl_api_l2_fib_clear_table_t * mp, void *handle)
1581 {
1582   u8 *s;
1583
1584   s = format (0, "SCRIPT: l2_fib_clear_table ");
1585
1586   FINISH;
1587 }
1588
1589 static void *vl_api_l2_interface_efp_filter_t_print
1590   (vl_api_l2_interface_efp_filter_t * mp, void *handle)
1591 {
1592   u8 *s;
1593
1594   s = format (0, "SCRIPT: l2_interface_efp_filter ");
1595
1596   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1597   if (mp->enable_disable)
1598     s = format (s, "enable ");
1599   else
1600     s = format (s, "disable ");
1601
1602   FINISH;
1603 }
1604
1605 static void *vl_api_l2_interface_vlan_tag_rewrite_t_print
1606   (vl_api_l2_interface_vlan_tag_rewrite_t * mp, void *handle)
1607 {
1608   u8 *s;
1609
1610   s = format (0, "SCRIPT: l2_interface_vlan_tag_rewrite ");
1611
1612   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1613   s = format (s, "vtr_op %d ", (mp->vtr_op));
1614   s = format (s, "push_dot1q %d ", (mp->push_dot1q));
1615   s = format (s, "tag1 %d ", (mp->tag1));
1616   s = format (s, "tag2 %d ", (mp->tag2));
1617
1618   FINISH;
1619 }
1620
1621 static void *vl_api_create_vhost_user_if_t_print
1622   (vl_api_create_vhost_user_if_t * mp, void *handle)
1623 {
1624   u8 *s;
1625
1626   s = format (0, "SCRIPT: create_vhost_user_if ");
1627
1628   s = format (s, "socket %s ", mp->sock_filename);
1629   if (mp->is_server)
1630     s = format (s, "server ");
1631   if (mp->renumber)
1632     s = format (s, "renumber %d ", (mp->custom_dev_instance));
1633   if (mp->disable_mrg_rxbuf)
1634     s = format (s, "disable_mrg_rxbuf ");
1635   if (mp->disable_indirect_desc)
1636     s = format (s, "disable_indirect_desc ");
1637   if (mp->tag[0])
1638     s = format (s, "tag %s ", mp->tag);
1639   if (mp->enable_gso)
1640     s = format (s, "gso ");
1641   if (mp->enable_packed)
1642     s = format (s, "packed");
1643
1644   FINISH;
1645 }
1646
1647 static void *vl_api_modify_vhost_user_if_t_print
1648   (vl_api_modify_vhost_user_if_t * mp, void *handle)
1649 {
1650   u8 *s;
1651
1652   s = format (0, "SCRIPT: modify_vhost_user_if ");
1653
1654   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1655   s = format (s, "socket %s ", mp->sock_filename);
1656   if (mp->is_server)
1657     s = format (s, "server ");
1658   if (mp->renumber)
1659     s = format (s, "renumber %d ", (mp->custom_dev_instance));
1660   if (mp->enable_gso)
1661     s = format (s, "gso ");
1662   if (mp->enable_packed)
1663     s = format (s, "packed");
1664
1665   FINISH;
1666 }
1667
1668 static void *vl_api_delete_vhost_user_if_t_print
1669   (vl_api_delete_vhost_user_if_t * mp, void *handle)
1670 {
1671   u8 *s;
1672
1673   s = format (0, "SCRIPT: delete_vhost_user_if ");
1674   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1675
1676   FINISH;
1677 }
1678
1679 static void *vl_api_sw_interface_vhost_user_dump_t_print
1680   (vl_api_sw_interface_vhost_user_dump_t * mp, void *handle)
1681 {
1682   u8 *s;
1683
1684   s = format (0, "SCRIPT: sw_interface_vhost_user_dump ");
1685   if (mp->sw_if_index != ~0)
1686     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1687
1688   FINISH;
1689 }
1690
1691 static void *vl_api_sw_interface_dump_t_print
1692   (vl_api_sw_interface_dump_t * mp, void *handle)
1693 {
1694   u8 *s;
1695
1696   s = format (0, "SCRIPT: sw_interface_dump ");
1697
1698   if (mp->name_filter_valid)
1699     {
1700       u8 *v = vl_api_from_api_to_new_vec (mp, &mp->name_filter);
1701       s = format (s, "name_filter %v ", v);
1702       vec_free (v);
1703     }
1704   else
1705     s = format (s, "all ");
1706
1707   FINISH;
1708 }
1709
1710 static void *vl_api_l2_fib_table_dump_t_print
1711   (vl_api_l2_fib_table_dump_t * mp, void *handle)
1712 {
1713   u8 *s;
1714
1715   s = format (0, "SCRIPT: l2_fib_table_dump ");
1716
1717   s = format (s, "bd_id %d ", (mp->bd_id));
1718
1719   FINISH;
1720 }
1721
1722 static void *vl_api_control_ping_t_print
1723   (vl_api_control_ping_t * mp, void *handle)
1724 {
1725   u8 *s;
1726
1727   s = format (0, "SCRIPT: control_ping ");
1728
1729   FINISH;
1730 }
1731
1732 static void *vl_api_want_interface_events_t_print
1733   (vl_api_want_interface_events_t * mp, void *handle)
1734 {
1735   u8 *s;
1736
1737   s = format (0, "SCRIPT: want_interface_events pid %d enable %d ",
1738               (mp->pid), ntohl (mp->enable_disable));
1739
1740   FINISH;
1741 }
1742
1743 static void *
1744 vl_api_cli_t_print (vl_api_cli_t * mp, void *handle)
1745 {
1746   u8 *s;
1747
1748   s = format (0, "SCRIPT: cli ");
1749
1750   FINISH;
1751 }
1752
1753 static void *vl_api_cli_inband_t_print
1754   (vl_api_cli_inband_t * mp, void *handle)
1755 {
1756   u8 *s;
1757   u8 *cmd = 0;
1758
1759   cmd = vl_api_from_api_to_new_vec (mp, &mp->cmd);
1760
1761   s = format (0, "SCRIPT: exec %v ", cmd);
1762
1763   vec_free (cmd);
1764   FINISH;
1765 }
1766
1767 static void *vl_api_memclnt_create_t_print
1768   (vl_api_memclnt_create_t * mp, void *handle)
1769 {
1770   u8 *s;
1771
1772   s = format (0, "SCRIPT: memclnt_create name %s ", mp->name);
1773
1774   FINISH;
1775 }
1776
1777 static void *vl_api_sockclnt_create_t_print
1778   (vl_api_sockclnt_create_t * mp, void *handle)
1779 {
1780   u8 *s;
1781
1782   s = format (0, "SCRIPT: sockclnt_create name %s ", mp->name);
1783
1784   FINISH;
1785 }
1786
1787 static void *vl_api_show_version_t_print
1788   (vl_api_show_version_t * mp, void *handle)
1789 {
1790   u8 *s;
1791
1792   s = format (0, "SCRIPT: show_version ");
1793
1794   FINISH;
1795 }
1796
1797 __clib_unused
1798   static void *vl_api_show_threads_t_print
1799   (vl_api_show_threads_t * mp, void *handle)
1800 {
1801   u8 *s;
1802
1803   s = format (0, "SCRIPT: show_threads ");
1804
1805   FINISH;
1806 }
1807
1808 static void *vl_api_vxlan_gpe_add_del_tunnel_t_print
1809   (vl_api_vxlan_gpe_add_del_tunnel_t * mp, void *handle)
1810 {
1811   u8 *s;
1812
1813   s = format (0, "SCRIPT: vxlan_gpe_add_del_tunnel ");
1814
1815   ip46_address_t local, remote;
1816
1817   ip_address_decode (&mp->local, &local);
1818   ip_address_decode (&mp->remote, &remote);
1819
1820   u8 is_grp = ip46_address_is_multicast (&remote);
1821   char *remote_name = is_grp ? "group" : "remote";
1822
1823   s = format (s, "local %U ", format_ip46_address, &local, IP46_TYPE_ANY);
1824   s = format (s, "%s %U ", remote_name, format_ip46_address,
1825               &remote, IP46_TYPE_ANY);
1826
1827   if (is_grp)
1828     s = format (s, "mcast_sw_if_index %d ", (mp->mcast_sw_if_index));
1829   s = format (s, "protocol %d ", (mp->protocol));
1830
1831   s = format (s, "vni %d ", (mp->vni));
1832
1833   if (mp->is_add == 0)
1834     s = format (s, "del ");
1835
1836   if (mp->encap_vrf_id)
1837     s = format (s, "encap-vrf-id %d ", (mp->encap_vrf_id));
1838
1839   if (mp->decap_vrf_id)
1840     s = format (s, "decap-vrf-id %d ", (mp->decap_vrf_id));
1841
1842   FINISH;
1843 }
1844
1845 static void *vl_api_vxlan_gpe_tunnel_dump_t_print
1846   (vl_api_vxlan_gpe_tunnel_dump_t * mp, void *handle)
1847 {
1848   u8 *s;
1849
1850   s = format (0, "SCRIPT: vxlan_gpe_tunnel_dump ");
1851
1852   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1853
1854   FINISH;
1855 }
1856
1857 static void *vl_api_interface_name_renumber_t_print
1858   (vl_api_interface_name_renumber_t * mp, void *handle)
1859 {
1860   u8 *s;
1861
1862   s = format (0, "SCRIPT: interface_renumber ");
1863
1864   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1865
1866   s = format (s, "new_show_dev_instance %d ", (mp->new_show_dev_instance));
1867
1868   FINISH;
1869 }
1870
1871 static void *vl_api_want_l2_macs_events_t_print
1872   (vl_api_want_l2_macs_events_t * mp, void *handle)
1873 {
1874   u8 *s;
1875
1876   s = format (0, "SCRIPT: want_l2_macs_events ");
1877   s = format (s, "learn-limit %d ", (mp->learn_limit));
1878   s = format (s, "scan-delay %d ", (u32) mp->scan_delay);
1879   s = format (s, "max-entries %d ", (u32) mp->max_macs_in_event * 10);
1880   if (mp->enable_disable == 0)
1881     s = format (s, "disable");
1882
1883   FINISH;
1884 }
1885
1886 static void *vl_api_input_acl_set_interface_t_print
1887   (vl_api_input_acl_set_interface_t * mp, void *handle)
1888 {
1889   u8 *s;
1890
1891   s = format (0, "SCRIPT: input_acl_set_interface ");
1892
1893   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1894   s = format (s, "ip4-table %d ", (mp->ip4_table_index));
1895   s = format (s, "ip6-table %d ", (mp->ip6_table_index));
1896   s = format (s, "l2-table %d ", (mp->l2_table_index));
1897
1898   if (mp->is_add == 0)
1899     s = format (s, "del ");
1900
1901   FINISH;
1902 }
1903
1904 static void *vl_api_output_acl_set_interface_t_print
1905   (vl_api_output_acl_set_interface_t * mp, void *handle)
1906 {
1907   u8 *s;
1908
1909   s = format (0, "SCRIPT: output_acl_set_interface ");
1910
1911   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1912   s = format (s, "ip4-table %d ", (mp->ip4_table_index));
1913   s = format (s, "ip6-table %d ", (mp->ip6_table_index));
1914   s = format (s, "l2-table %d ", (mp->l2_table_index));
1915
1916   if (mp->is_add == 0)
1917     s = format (s, "del ");
1918
1919   FINISH;
1920 }
1921
1922 static void *vl_api_ip_address_dump_t_print
1923   (vl_api_ip_address_dump_t * mp, void *handle)
1924 {
1925   u8 *s;
1926
1927   s = format (0, "SCRIPT: ip6_address_dump ");
1928   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1929   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1930
1931   FINISH;
1932 }
1933
1934 static void *
1935 vl_api_ip_dump_t_print (vl_api_ip_dump_t * mp, void *handle)
1936 {
1937   u8 *s;
1938
1939   s = format (0, "SCRIPT: ip_dump ");
1940   s = format (s, "is_ipv6 %d ", mp->is_ipv6 != 0);
1941
1942   FINISH;
1943 }
1944
1945 static void *vl_api_cop_interface_enable_disable_t_print
1946   (vl_api_cop_interface_enable_disable_t * mp, void *handle)
1947 {
1948   u8 *s;
1949
1950   s = format (0, "SCRIPT: cop_interface_enable_disable ");
1951   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1952   if (mp->enable_disable)
1953     s = format (s, "enable ");
1954   else
1955     s = format (s, "disable ");
1956
1957   FINISH;
1958 }
1959
1960 static void *vl_api_cop_whitelist_enable_disable_t_print
1961   (vl_api_cop_whitelist_enable_disable_t * mp, void *handle)
1962 {
1963   u8 *s;
1964
1965   s = format (0, "SCRIPT: cop_whitelist_enable_disable ");
1966   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
1967   s = format (s, "fib-id %d ", (mp->fib_id));
1968   if (mp->ip4)
1969     s = format (s, "ip4 ");
1970   if (mp->ip6)
1971     s = format (s, "ip6 ");
1972   if (mp->default_cop)
1973     s = format (s, "default ");
1974
1975   FINISH;
1976 }
1977
1978 static void *vl_api_af_packet_create_t_print
1979   (vl_api_af_packet_create_t * mp, void *handle)
1980 {
1981   u8 *s;
1982
1983   s = format (0, "SCRIPT: af_packet_create ");
1984   s = format (s, "host_if_name %s ", mp->host_if_name);
1985   if (mp->use_random_hw_addr)
1986     s = format (s, "hw_addr random ");
1987   else
1988     s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
1989
1990   FINISH;
1991 }
1992
1993 static void *vl_api_af_packet_delete_t_print
1994   (vl_api_af_packet_delete_t * mp, void *handle)
1995 {
1996   u8 *s;
1997
1998   s = format (0, "SCRIPT: af_packet_delete ");
1999   s = format (s, "host_if_name %s ", mp->host_if_name);
2000
2001   FINISH;
2002 }
2003
2004 static void *vl_api_af_packet_dump_t_print
2005   (vl_api_af_packet_dump_t * mp, void *handle)
2006 {
2007   u8 *s;
2008
2009   s = format (0, "SCRIPT: af_packet_dump ");
2010
2011   FINISH;
2012 }
2013
2014 static u8 *
2015 format_policer_action (u8 * s, va_list * va)
2016 {
2017   u32 action = va_arg (*va, u32);
2018   u32 dscp = va_arg (*va, u32);
2019   char *t = 0;
2020
2021   if (action == SSE2_QOS_ACTION_DROP)
2022     s = format (s, "drop");
2023   else if (action == SSE2_QOS_ACTION_TRANSMIT)
2024     s = format (s, "transmit");
2025   else if (action == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
2026     {
2027       s = format (s, "mark-and-transmit ");
2028       switch (dscp)
2029         {
2030 #define _(v,f,str) case VNET_DSCP_##f: t = str; break;
2031           foreach_vnet_dscp
2032 #undef _
2033         default:
2034           break;
2035         }
2036       s = format (s, "%s", t);
2037     }
2038   return s;
2039 }
2040
2041 static void *vl_api_policer_add_del_t_print
2042   (vl_api_policer_add_del_t * mp, void *handle)
2043 {
2044   u8 *s;
2045
2046   s = format (0, "SCRIPT: policer_add_del ");
2047   s = format (s, "name %s ", mp->name);
2048   s = format (s, "cir %d ", mp->cir);
2049   s = format (s, "eir %d ", mp->eir);
2050   s = format (s, "cb %d ", mp->cb);
2051   s = format (s, "eb %d ", mp->eb);
2052
2053   switch (mp->rate_type)
2054     {
2055     case SSE2_QOS_RATE_KBPS:
2056       s = format (s, "rate_type kbps ");
2057       break;
2058     case SSE2_QOS_RATE_PPS:
2059       s = format (s, "rate_type pps ");
2060       break;
2061     default:
2062       break;
2063     }
2064
2065   switch (mp->round_type)
2066     {
2067     case SSE2_QOS_ROUND_TO_CLOSEST:
2068       s = format (s, "round_type closest ");
2069       break;
2070     case SSE2_QOS_ROUND_TO_UP:
2071       s = format (s, "round_type up ");
2072       break;
2073     case SSE2_QOS_ROUND_TO_DOWN:
2074       s = format (s, "round_type down ");
2075       break;
2076     default:
2077       break;
2078     }
2079
2080   switch (mp->type)
2081     {
2082     case SSE2_QOS_POLICER_TYPE_1R2C:
2083       s = format (s, "type 1r2c ");
2084       break;
2085     case SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697:
2086       s = format (s, "type 1r3c ");
2087       break;
2088     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698:
2089       s = format (s, "type 2r3c-2698 ");
2090       break;
2091     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115:
2092       s = format (s, "type 2r3c-4115 ");
2093       break;
2094     case SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1:
2095       s = format (s, "type 2r3c-mef5cf1 ");
2096       break;
2097     default:
2098       break;
2099     }
2100
2101   s = format (s, "conform_action %U ", format_policer_action,
2102               mp->conform_action.type, mp->conform_action.dscp);
2103   s = format (s, "exceed_action %U ", format_policer_action,
2104               mp->exceed_action.type, mp->exceed_action.dscp);
2105   s = format (s, "violate_action %U ", format_policer_action,
2106               mp->violate_action.type, mp->violate_action.dscp);
2107
2108   if (mp->color_aware)
2109     s = format (s, "color-aware ");
2110   if (mp->is_add == 0)
2111     s = format (s, "del ");
2112
2113   FINISH;
2114 }
2115
2116 static void *vl_api_policer_dump_t_print
2117   (vl_api_policer_dump_t * mp, void *handle)
2118 {
2119   u8 *s;
2120
2121   s = format (0, "SCRIPT: policer_dump ");
2122   if (mp->match_name_valid)
2123     s = format (s, "name %s ", mp->match_name);
2124
2125   FINISH;
2126 }
2127
2128 static void *vl_api_policer_classify_set_interface_t_print
2129   (vl_api_policer_classify_set_interface_t * mp, void *handle)
2130 {
2131   u8 *s;
2132
2133   s = format (0, "SCRIPT: policer_classify_set_interface ");
2134   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2135   if (mp->ip4_table_index != ~0)
2136     s = format (s, "ip4-table %d ", (mp->ip4_table_index));
2137   if (mp->ip6_table_index != ~0)
2138     s = format (s, "ip6-table %d ", (mp->ip6_table_index));
2139   if (mp->l2_table_index != ~0)
2140     s = format (s, "l2-table %d ", (mp->l2_table_index));
2141   if (mp->is_add == 0)
2142     s = format (s, "del ");
2143
2144   FINISH;
2145 }
2146
2147 static void *vl_api_policer_classify_dump_t_print
2148   (vl_api_policer_classify_dump_t * mp, void *handle)
2149 {
2150   u8 *s;
2151
2152   s = format (0, "SCRIPT: policer_classify_dump ");
2153   switch (mp->type)
2154     {
2155     case POLICER_CLASSIFY_API_TABLE_IP4:
2156       s = format (s, "type ip4 ");
2157       break;
2158     case POLICER_CLASSIFY_API_TABLE_IP6:
2159       s = format (s, "type ip6 ");
2160       break;
2161     case POLICER_CLASSIFY_API_TABLE_L2:
2162       s = format (s, "type l2 ");
2163       break;
2164     default:
2165       break;
2166     }
2167
2168   FINISH;
2169 }
2170
2171 static void *vl_api_sw_interface_clear_stats_t_print
2172   (vl_api_sw_interface_clear_stats_t * mp, void *handle)
2173 {
2174   u8 *s;
2175
2176   s = format (0, "SCRIPT: sw_interface_clear_stats ");
2177   if (mp->sw_if_index != ~0)
2178     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2179
2180   FINISH;
2181 }
2182
2183 static void *vl_api_mpls_tunnel_dump_t_print
2184   (vl_api_mpls_tunnel_dump_t * mp, void *handle)
2185 {
2186   u8 *s;
2187
2188   s = format (0, "SCRIPT: mpls_tunnel_dump ");
2189   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2190
2191   FINISH;
2192 }
2193
2194 static void *vl_api_mpls_table_dump_t_print
2195   (vl_api_mpls_table_dump_t * mp, void *handle)
2196 {
2197   u8 *s;
2198
2199   s = format (0, "SCRIPT: mpls_table_decap_dump ");
2200
2201   FINISH;
2202 }
2203
2204 static void *vl_api_mpls_route_dump_t_print
2205   (vl_api_mpls_route_dump_t * mp, void *handle)
2206 {
2207   u8 *s;
2208
2209   s = format (0, "SCRIPT: mpls_route_decap_dump ");
2210
2211   FINISH;
2212 }
2213
2214 static void *vl_api_ip_table_dump_t_print
2215   (vl_api_ip_table_dump_t * mp, void *handle)
2216 {
2217   u8 *s;
2218
2219   s = format (0, "SCRIPT: ip_table_dump ");
2220
2221   FINISH;
2222 }
2223
2224 static void *vl_api_ip_route_dump_t_print
2225   (vl_api_ip_route_dump_t * mp, void *handle)
2226 {
2227   u8 *s;
2228
2229   s = format (0, "SCRIPT: ip_route_dump ");
2230
2231   FINISH;
2232 }
2233
2234 static void *vl_api_classify_table_ids_t_print
2235   (vl_api_classify_table_ids_t * mp, void *handle)
2236 {
2237   u8 *s;
2238
2239   s = format (0, "SCRIPT: classify_table_ids ");
2240
2241   FINISH;
2242 }
2243
2244 static void *vl_api_classify_table_by_interface_t_print
2245   (vl_api_classify_table_by_interface_t * mp, void *handle)
2246 {
2247   u8 *s;
2248
2249   s = format (0, "SCRIPT: classify_table_by_interface ");
2250   if (mp->sw_if_index != ~0)
2251     s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2252
2253   FINISH;
2254 }
2255
2256 static void *vl_api_classify_table_info_t_print
2257   (vl_api_classify_table_info_t * mp, void *handle)
2258 {
2259   u8 *s;
2260
2261   s = format (0, "SCRIPT: classify_table_info ");
2262   if (mp->table_id != ~0)
2263     s = format (s, "table_id %d ", (mp->table_id));
2264
2265   FINISH;
2266 }
2267
2268 static void *vl_api_classify_session_dump_t_print
2269   (vl_api_classify_session_dump_t * mp, void *handle)
2270 {
2271   u8 *s;
2272
2273   s = format (0, "SCRIPT: classify_session_dump ");
2274   if (mp->table_id != ~0)
2275     s = format (s, "table_id %d ", (mp->table_id));
2276
2277   FINISH;
2278 }
2279
2280 static void *vl_api_set_ipfix_exporter_t_print
2281   (vl_api_set_ipfix_exporter_t * mp, void *handle)
2282 {
2283   u8 *s;
2284
2285   s = format (0, "SCRIPT: set_ipfix_exporter ");
2286
2287   s = format (s, "collector-address %U ", format_ip4_address,
2288               (ip4_address_t *) mp->collector_address.un.ip4);
2289   s = format (s, "collector-port %d ", (mp->collector_port));
2290   s = format (s, "src-address %U ", format_ip4_address,
2291               (ip4_address_t *) mp->src_address.un.ip4);
2292   s = format (s, "vrf-id %d ", (mp->vrf_id));
2293   s = format (s, "path-mtu %d ", (mp->path_mtu));
2294   s = format (s, "template-interval %d ", (mp->template_interval));
2295   s = format (s, "udp-checksum %d ", mp->udp_checksum);
2296
2297   FINISH;
2298 }
2299
2300 static void *vl_api_ipfix_exporter_dump_t_print
2301   (vl_api_ipfix_exporter_dump_t * mp, void *handle)
2302 {
2303   u8 *s;
2304
2305   s = format (0, "SCRIPT: ipfix_exporter_dump ");
2306
2307   FINISH;
2308 }
2309
2310 static void *vl_api_set_ipfix_classify_stream_t_print
2311   (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
2312 {
2313   u8 *s;
2314
2315   s = format (0, "SCRIPT: set_ipfix_classify_stream ");
2316
2317   s = format (s, "domain-id %d ", (mp->domain_id));
2318   s = format (s, "src-port %d ", (mp->src_port));
2319
2320   FINISH;
2321 }
2322
2323 static void *vl_api_ipfix_classify_stream_dump_t_print
2324   (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
2325 {
2326   u8 *s;
2327
2328   s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
2329
2330   FINISH;
2331 }
2332
2333 static void *vl_api_ipfix_classify_table_add_del_t_print
2334   (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
2335 {
2336   u8 *s;
2337
2338   s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
2339
2340   s = format (s, "table-id %d ", (mp->table_id));
2341   s = format (s, "ip-version %d ", mp->ip_version);
2342   s = format (s, "transport-protocol %d ", mp->transport_protocol);
2343
2344   FINISH;
2345 }
2346
2347 static void *vl_api_ipfix_classify_table_dump_t_print
2348   (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
2349 {
2350   u8 *s;
2351
2352   s = format (0, "SCRIPT: ipfix_classify_table_dump ");
2353
2354   FINISH;
2355 }
2356
2357 static void *vl_api_sw_interface_span_enable_disable_t_print
2358   (vl_api_sw_interface_span_enable_disable_t * mp, void *handle)
2359 {
2360   u8 *s;
2361
2362   s = format (0, "SCRIPT: sw_interface_span_enable_disable ");
2363   s = format (s, "src_sw_if_index %u ", (mp->sw_if_index_from));
2364   s = format (s, "dst_sw_if_index %u ", (mp->sw_if_index_to));
2365
2366   if (mp->is_l2)
2367     s = format (s, "l2 ");
2368
2369   switch (mp->state)
2370     {
2371     case 0:
2372       s = format (s, "disable ");
2373       break;
2374     case 1:
2375       s = format (s, "rx ");
2376       break;
2377     case 2:
2378       s = format (s, "tx ");
2379       break;
2380     case 3:
2381     default:
2382       s = format (s, "both ");
2383       break;
2384     }
2385
2386   FINISH;
2387 }
2388
2389 static void *
2390 vl_api_sw_interface_span_dump_t_print (vl_api_sw_interface_span_dump_t * mp,
2391                                        void *handle)
2392 {
2393   u8 *s;
2394
2395   s = format (0, "SCRIPT: sw_interface_span_dump ");
2396
2397   if (mp->is_l2)
2398     s = format (s, "l2 ");
2399
2400   FINISH;
2401 }
2402
2403 static void *vl_api_get_next_index_t_print
2404   (vl_api_get_next_index_t * mp, void *handle)
2405 {
2406   u8 *s;
2407
2408   s = format (0, "SCRIPT: get_next_index ");
2409   s = format (s, "node-name %s ", mp->node_name);
2410   s = format (s, "next-node-name %s ", mp->next_name);
2411
2412   FINISH;
2413 }
2414
2415 static void *vl_api_pg_create_interface_t_print
2416   (vl_api_pg_create_interface_t * mp, void *handle)
2417 {
2418   u8 *s;
2419
2420   s = format (0, "SCRIPT: pg_create_interface ");
2421   s = format (s, "if_id %d ", (mp->interface_id));
2422   s = format (s, "gso-enabled %u ", mp->gso_enabled);
2423   s = format (s, "gso-size %u", (mp->gso_size));
2424
2425   FINISH;
2426 }
2427
2428 static void *vl_api_pg_capture_t_print
2429   (vl_api_pg_capture_t * mp, void *handle)
2430 {
2431   u8 *s;
2432
2433   s = format (0, "SCRIPT: pg_capture ");
2434   s = format (s, "if_id %d ", (mp->interface_id));
2435   s = format (s, "pcap %s", mp->pcap_file_name);
2436   if (mp->count != ~0)
2437     s = format (s, "count %d ", (mp->count));
2438   if (!mp->is_enabled)
2439     s = format (s, "disable");
2440
2441   FINISH;
2442 }
2443
2444 static void *vl_api_pg_enable_disable_t_print
2445   (vl_api_pg_enable_disable_t * mp, void *handle)
2446 {
2447   u8 *s;
2448
2449   s = format (0, "SCRIPT: pg_enable_disable ");
2450   if (vl_api_string_len (&mp->stream_name) > 0)
2451     s =
2452       format (s, "stream %s",
2453               vl_api_from_api_to_new_c_string (&mp->stream_name));
2454   if (!mp->is_enabled)
2455     s = format (s, "disable");
2456
2457   FINISH;
2458 }
2459
2460 static void *vl_api_pg_interface_enable_disable_coalesce_t_print
2461   (vl_api_pg_interface_enable_disable_coalesce_t * mp, void *handle)
2462 {
2463   u8 *s;
2464
2465   s = format (0, "SCRIPT: pg_interface_enable_disable_coalesce ");
2466   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2467   if (!mp->coalesce_enabled)
2468     s = format (s, "disable");
2469   else
2470     s = format (s, "enable");
2471   FINISH;
2472 }
2473
2474
2475 static void *vl_api_ip_source_and_port_range_check_add_del_t_print
2476   (vl_api_ip_source_and_port_range_check_add_del_t * mp, void *handle)
2477 {
2478   u8 *s;
2479   int i;
2480
2481   s = format (0, "SCRIPT: ip_source_and_port_range_check_add_del ");
2482   s = format (s, "%U ", format_vl_api_prefix, &mp->prefix);
2483
2484   for (i = 0; i < mp->number_of_ranges; i++)
2485     {
2486       s = format (s, "range %d - %d ", mp->low_ports[i], mp->high_ports[i]);
2487     }
2488
2489   s = format (s, "vrf %d ", (mp->vrf_id));
2490
2491   if (mp->is_add == 0)
2492     s = format (s, "del ");
2493
2494   FINISH;
2495 }
2496
2497 static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
2498   (vl_api_ip_source_and_port_range_check_interface_add_del_t * mp,
2499    void *handle)
2500 {
2501   u8 *s;
2502
2503   s = format (0, "SCRIPT: ip_source_and_port_range_check_interface_add_del ");
2504
2505   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2506
2507   if (mp->tcp_out_vrf_id != ~0)
2508     s = format (s, "tcp-out-vrf %d ", (mp->tcp_out_vrf_id));
2509
2510   if (mp->udp_out_vrf_id != ~0)
2511     s = format (s, "udp-out-vrf %d ", (mp->udp_out_vrf_id));
2512
2513   if (mp->tcp_in_vrf_id != ~0)
2514     s = format (s, "tcp-in-vrf %d ", (mp->tcp_in_vrf_id));
2515
2516   if (mp->udp_in_vrf_id != ~0)
2517     s = format (s, "udp-in-vrf %d ", (mp->udp_in_vrf_id));
2518
2519   if (mp->is_add == 0)
2520     s = format (s, "del ");
2521
2522   FINISH;
2523 }
2524
2525 static void *vl_api_ipsec_tunnel_if_add_del_t_print
2526   (vl_api_ipsec_tunnel_if_add_del_t * mp, void *handle)
2527 {
2528   u8 *s;
2529
2530   s = format (0, "SCRIPT: ipsec_tunnel_if_add_del ");
2531
2532   if (mp->esn)
2533     s = format (s, "esn");
2534   if (mp->anti_replay)
2535     s = format (s, "anti-replay");
2536   if (mp->udp_encap)
2537     s = format (s, "udp-encap");
2538
2539   s = format (s, "local-ip %U ", format_vl_api_address, &mp->remote_ip);
2540
2541   s = format (s, "remote-ip %U ", format_vl_api_address, &mp->local_ip);
2542   s = format (s, "tx-table-id %d ", (mp->tx_table_id));
2543
2544   s = format (s, "local-spi %d ", (mp->local_spi));
2545
2546   s = format (s, "remote-spi %d ", (mp->remote_spi));
2547
2548   s = format (s, "local-crypto-key-len %d ", mp->local_crypto_key_len);
2549   s = format (s, "local-crypto-key %U ", format_hex_bytes,
2550               mp->local_crypto_key, mp->local_crypto_key_len, 0);
2551   s = format (s, "remote-crypto-key-len %d ", mp->remote_crypto_key_len);
2552   s = format (s, "remote-crypto-key %U ", format_hex_bytes,
2553               mp->remote_crypto_key, mp->remote_crypto_key_len, 0);
2554   s = format (s, "local-integ-key-len %d ", mp->local_integ_key_len);
2555   s = format (s, "local-integ-key %U ", format_hex_bytes,
2556               mp->local_integ_key, mp->local_integ_key_len, 0);
2557   s = format (s, "remote-integ-key-len %d ", mp->remote_integ_key_len);
2558   s = format (s, "remote-integ-key %U ", format_hex_bytes,
2559               mp->remote_integ_key, mp->remote_integ_key_len, 0);
2560
2561   if (mp->is_add == 0)
2562     s = format (s, "del ");
2563
2564   FINISH;
2565 }
2566
2567 /* static u8 * */
2568 /* format_nsh_address_vat (u8 * s, va_list * args) */
2569 /* { */
2570 /*   nsh_t *a = va_arg (*args, nsh_t *); */
2571 /*   return format (s, "SPI:%d SI:%d", clib_net_to_host_u32 (a->spi), a->si); */
2572 /* } */
2573
2574 static const char *policy_strs[] = {
2575   "BYPASS",
2576   "DISCARD",
2577   "RESOLVE",
2578   "PROTECT",
2579 };
2580
2581 static const char *algo_strs[] = {
2582   "NONE",
2583   "AES_CBC_128",
2584   "AES_CBC_192",
2585   "AES_CBC_256",
2586   "AES_CTR_128",
2587   "AES_CTR_192",
2588   "AES_CTR_256",
2589   "AES_GCM_128",
2590   "AES_GCM_192",
2591   "AES_GCM_256",
2592   "DES_CBC",
2593   "3DES_CBC",
2594 };
2595
2596
2597 static const char *integ_strs[] = {
2598   "NONE",
2599   "MD5_96",
2600   "SHA1_96",
2601   "SHA_256_96",
2602   "SHA_256_128",
2603   "SHA_384_192",
2604   "SHA_512_256",
2605 };
2606
2607 static void *vl_api_ipsec_spd_entry_add_del_t_print
2608   (vl_api_ipsec_spd_entry_add_del_t * mp, void *handle)
2609 {
2610   u8 *s;
2611   const char *str;
2612   vl_api_ipsec_spd_entry_t *ep;
2613   int policy_host_byte_order;
2614
2615   ep = (vl_api_ipsec_spd_entry_t *) & mp->entry;
2616
2617   s = format (0, "SCRIPT: ipsec_spd_entry ");
2618   s = format (s, "is_add %d spd_id %u priority %d is_outbound %d sa_id %u\n",
2619               mp->is_add,
2620               (ep->spd_id), ntohl (ep->priority), ep->is_outbound,
2621               (ep->sa_id));
2622
2623   policy_host_byte_order = (ep->policy);
2624
2625   if (policy_host_byte_order < ARRAY_LEN (policy_strs))
2626     str = policy_strs[policy_host_byte_order];
2627   else
2628     str = "BOGUS!";
2629
2630   s = format (s, "  policy: %s protocol %d\n", str, ep->protocol);
2631
2632   s = format (s, "  remote_address_start %U remote_address_stop %U\n",
2633               format_vl_api_address,
2634               &ep->remote_address_start,
2635               format_vl_api_address, &ep->remote_address_stop);
2636
2637   s = format (s, "  local_address_start %U local_address_stop %U\n",
2638               format_vl_api_address,
2639               &ep->local_address_start,
2640               format_vl_api_address, &ep->local_address_stop);
2641
2642   s = format (s, "  remote_port_start %d remote_port_stop %d\n",
2643               (ep->remote_port_start), ntohs (ep->remote_port_stop));
2644
2645   s = format (s, "  local_port_start %d local_port_stop %d ",
2646               (ep->local_port_start), ntohs (ep->local_port_stop));
2647
2648   FINISH;
2649 }
2650
2651 static void *vl_api_ipsec_interface_add_del_spd_t_print
2652   (vl_api_ipsec_interface_add_del_spd_t * mp, void *handle)
2653 {
2654   u8 *s;
2655
2656   s = format (0, "SCRIPT: ipsec_interface_add_del_spd ");
2657   s = format (s, "is_add %d sw_if_index %d spd_id %u ",
2658               mp->is_add, (mp->sw_if_index), ntohl (mp->spd_id));
2659   FINISH;
2660 }
2661
2662 static void *vl_api_ipsec_spd_add_del_t_print
2663   (vl_api_ipsec_spd_add_del_t * mp, void *handle)
2664 {
2665   u8 *s;
2666
2667   s = format (0, "SCRIPT: ipsec_spd_add_del ");
2668   s = format (s, "spd_id %u is_add %d ", (mp->spd_id), mp->is_add);
2669   FINISH;
2670 }
2671
2672 static void *vl_api_ipsec_sad_entry_add_del_t_print
2673   (vl_api_ipsec_sad_entry_add_del_t * mp, void *handle)
2674 {
2675   u8 *s;
2676   int tmp;
2677   vl_api_ipsec_sad_entry_t *ep;
2678   const char *protocol_str, *algo_str, *integ_str;
2679
2680   protocol_str = "BOGUS protocol!";
2681   algo_str = "BOGUS crypto_algorithm!";
2682   integ_str = "BOGUS integrity_algorithm!";
2683
2684   ep = (vl_api_ipsec_sad_entry_t *) & mp->entry;
2685
2686   s = format (0, "SCRIPT: ipsec_sad_entry_add_del is_add %d ", mp->is_add);
2687
2688   tmp = (ep->protocol);
2689   if (tmp == IPSEC_API_PROTO_ESP)
2690     protocol_str = "ESP";
2691   else if (tmp == IPSEC_API_PROTO_AH)
2692     protocol_str = "AH";
2693
2694   tmp = (ep->crypto_algorithm);
2695   if (tmp < ARRAY_LEN (algo_strs))
2696     algo_str = algo_strs[tmp];
2697
2698   tmp = (ep->integrity_algorithm);
2699   if (tmp < ARRAY_LEN (integ_strs))
2700     integ_str = integ_strs[tmp];
2701
2702   s = format (s, "proto %s crypto alg %s integ alg %s\n",
2703               protocol_str, algo_str, integ_str);
2704   s = format (s, " crypto_key len %d value %U\n",
2705               ep->crypto_key.length, format_hex_bytes, ep->crypto_key.data,
2706               (int) (ep->crypto_key.length));
2707   s = format (s, " integ_key len %d value %U\n",
2708               ep->integrity_key.length, format_hex_bytes,
2709               ep->integrity_key.data, (int) (ep->integrity_key.length));
2710   s = format (s, " flags 0x%x ", (ep->flags));
2711
2712   s = format (s, "tunnel_src %U tunnel_dst %U\n",
2713               format_vl_api_address,
2714               &ep->tunnel_src, format_vl_api_address, &ep->tunnel_dst);
2715   s = format (s, " tx_table_id %u salt %u ",
2716               (ep->tx_table_id), ntohl (ep->salt));
2717   FINISH;
2718 }
2719
2720
2721 static void *vl_api_l2_interface_pbb_tag_rewrite_t_print
2722   (vl_api_l2_interface_pbb_tag_rewrite_t * mp, void *handle)
2723 {
2724   u8 *s;
2725   u32 vtr_op = (mp->vtr_op);
2726
2727   s = format (0, "SCRIPT: l2_interface_pbb_tag_rewrite ");
2728
2729   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2730   s = format (s, "vtr_op %d ", vtr_op);
2731   if (vtr_op != L2_VTR_DISABLED && vtr_op != L2_VTR_POP_2)
2732     {
2733       if (vtr_op == L2_VTR_TRANSLATE_2_2)
2734         s = format (s, "%d ", (mp->outer_tag));
2735       s = format (s, "dmac %U ", format_ethernet_address, &mp->b_dmac);
2736       s = format (s, "smac %U ", format_ethernet_address, &mp->b_smac);
2737       s = format (s, "sid %d ", (mp->i_sid));
2738       s = format (s, "vlanid %d ", (mp->b_vlanid));
2739     }
2740   FINISH;
2741 }
2742
2743 static void *vl_api_flow_classify_set_interface_t_print
2744   (vl_api_flow_classify_set_interface_t * mp, void *handle)
2745 {
2746   u8 *s;
2747
2748   s = format (0, "SCRIPT: flow_classify_set_interface ");
2749   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2750   if (mp->ip4_table_index != ~0)
2751     s = format (s, "ip4-table %d ", (mp->ip4_table_index));
2752   if (mp->ip6_table_index != ~0)
2753     s = format (s, "ip6-table %d ", (mp->ip6_table_index));
2754   if (mp->is_add == 0)
2755     s = format (s, "del ");
2756
2757   FINISH;
2758 }
2759
2760 static void *
2761 vl_api_set_punt_t_print (vl_api_set_punt_t * mp, void *handle)
2762 {
2763   u8 *s;
2764
2765   s = format (0, "SCRIPT: punt ");
2766
2767   switch (mp->punt.type)
2768     {
2769     case PUNT_API_TYPE_L4:
2770       s = format (s, "%U", format_vl_api_address_family, mp->punt.punt.l4.af);
2771
2772       s = format (s, "protocol %d ", mp->punt.punt.l4.protocol);
2773
2774       if (mp->punt.punt.l4.port != (u16) ~ 0)
2775         s = format (s, "port %d ", (mp->punt.punt.l4.port));
2776       break;
2777     default:
2778       break;
2779
2780     }
2781
2782   if (!mp->is_add)
2783     s = format (s, "del ");
2784
2785   FINISH;
2786 }
2787
2788 static void *vl_api_flow_classify_dump_t_print
2789   (vl_api_flow_classify_dump_t * mp, void *handle)
2790 {
2791   u8 *s;
2792
2793   s = format (0, "SCRIPT: flow_classify_dump ");
2794   switch (mp->type)
2795     {
2796     case FLOW_CLASSIFY_API_TABLE_IP4:
2797       s = format (s, "type ip4 ");
2798       break;
2799     case FLOW_CLASSIFY_API_TABLE_IP6:
2800       s = format (s, "type ip6 ");
2801       break;
2802     default:
2803       break;
2804     }
2805
2806   FINISH;
2807 }
2808
2809 static void *vl_api_get_first_msg_id_t_print
2810   (vl_api_get_first_msg_id_t * mp, void *handle)
2811 {
2812   u8 *s;
2813
2814   s = format (0, "SCRIPT: get_first_msg_id %s ", mp->name);
2815
2816   FINISH;
2817 }
2818
2819 static void *vl_api_ioam_enable_t_print
2820   (vl_api_ioam_enable_t * mp, void *handle)
2821 {
2822   u8 *s;
2823
2824   s = format (0, "SCRIPT: ioam_enable ");
2825
2826   if (mp->trace_enable)
2827     s = format (s, "trace enabled");
2828
2829   if (mp->pot_enable)
2830     s = format (s, "POT enabled");
2831
2832   if (mp->seqno)
2833     s = format (s, "Seqno enabled");
2834
2835   if (mp->analyse)
2836     s = format (s, "Analyse enabled");
2837
2838   FINISH;
2839 }
2840
2841 static void *vl_api_ioam_disable_t_print
2842   (vl_api_ioam_disable_t * mp, void *handle)
2843 {
2844   u8 *s;
2845
2846   s = format (0, "SCRIPT: ioam_disable ");
2847   s = format (s, "trace disabled");
2848   s = format (s, "POT disabled");
2849   s = format (s, "Seqno disabled");
2850   s = format (s, "Analyse disabled");
2851
2852   FINISH;
2853 }
2854
2855 static void *vl_api_feature_enable_disable_t_print
2856   (vl_api_feature_enable_disable_t * mp, void *handle)
2857 {
2858   u8 *s;
2859
2860   s = format (0, "SCRIPT: feature_enable_disable ");
2861   s = format (s, "arc_name %s ", mp->arc_name);
2862   s = format (s, "feature_name %s ", mp->feature_name);
2863   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2864   if (!mp->enable)
2865     s = format (s, "disable");
2866
2867   FINISH;
2868 }
2869
2870 static void *vl_api_feature_gso_enable_disable_t_print
2871   (vl_api_feature_gso_enable_disable_t * mp, void *handle)
2872 {
2873   u8 *s;
2874
2875   s = format (0, "SCRIPT: feature_gso_enable_disable ");
2876   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
2877   if (mp->enable_disable)
2878     s = format (s, "enable");
2879   if (!mp->enable_disable)
2880     s = format (s, "disable");
2881
2882   FINISH;
2883 }
2884
2885 static void *vl_api_sw_interface_tag_add_del_t_print
2886   (vl_api_sw_interface_tag_add_del_t * mp, void *handle)
2887 {
2888   u8 *s;
2889
2890   s = format (0, "SCRIPT: sw_interface_tag_add_del ");
2891   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2892   if (mp->is_add)
2893     s = format (s, "tag %s ", mp->tag);
2894   else
2895     s = format (s, "del ");
2896
2897   FINISH;
2898 }
2899
2900 static void *vl_api_hw_interface_set_mtu_t_print
2901   (vl_api_hw_interface_set_mtu_t * mp, void *handle)
2902 {
2903   u8 *s;
2904
2905   s = format (0, "SCRIPT: sw_interface_set_mtu ");
2906   s = format (s, "sw_if_index %d ", (mp->sw_if_index));
2907   s = format (s, "tag %d ", (mp->mtu));
2908
2909   FINISH;
2910 }
2911
2912 static void *vl_api_p2p_ethernet_add_t_print
2913   (vl_api_p2p_ethernet_add_t * mp, void *handle)
2914 {
2915   u8 *s;
2916
2917   s = format (0, "SCRIPT: p2p_ethernet_add ");
2918   s = format (s, "sw_if_index %d ", (mp->parent_if_index));
2919   s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
2920
2921   FINISH;
2922 }
2923
2924 static void *vl_api_p2p_ethernet_del_t_print
2925   (vl_api_p2p_ethernet_del_t * mp, void *handle)
2926 {
2927   u8 *s;
2928
2929   s = format (0, "SCRIPT: p2p_ethernet_del ");
2930   s = format (s, "sw_if_index %d ", (mp->parent_if_index));
2931   s = format (s, "remote_mac %U ", format_ethernet_address, mp->remote_mac);
2932
2933   FINISH;
2934 }
2935
2936 static void *vl_api_tcp_configure_src_addresses_t_print
2937   (vl_api_tcp_configure_src_addresses_t * mp, void *handle)
2938 {
2939   u8 *s;
2940
2941   s = format (0, "SCRIPT: tcp_configure_src_addresses ");
2942   s = format (s, "%U - %U ",
2943               format_vl_api_address, &mp->first_address,
2944               format_vl_api_address, &mp->last_address);
2945
2946   if (mp->vrf_id)
2947     s = format (s, "vrf %d ", (mp->vrf_id));
2948
2949   FINISH;
2950 }
2951
2952 static void *vl_api_app_namespace_add_del_t_print
2953   (vl_api_app_namespace_add_del_t * mp, void *handle)
2954 {
2955   u8 *s;
2956
2957   s = format (0, "SCRIPT: app_namespace_add_del ");
2958   s = format (s, "ns-id %s secret %lu sw_if_index %d ipv4_fib_id %d "
2959               "ipv6_fib_id %d",
2960               vl_api_from_api_to_new_c_string (&mp->namespace_id),
2961               mp->secret, (mp->sw_if_index), (mp->ip4_fib_id),
2962               (mp->ip6_fib_id));
2963   FINISH;
2964 }
2965
2966 static void *vl_api_session_rule_add_del_t_print
2967   (vl_api_session_rule_add_del_t * mp, void *handle)
2968 {
2969   u8 *s;
2970   fib_prefix_t lcl, rmt;
2971   char *proto = mp->transport_proto == 0 ? "tcp" : "udp";
2972   s = format (0, "SCRIPT: session_rule_add_del ");
2973   mp->tag[sizeof (mp->tag) - 1] = 0;
2974   ip_prefix_decode (&mp->lcl, &lcl);
2975   ip_prefix_decode (&mp->rmt, &rmt);
2976
2977   if (lcl.fp_proto == FIB_PROTOCOL_IP4)
2978     s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
2979                 mp->appns_index, mp->scope, proto, format_ip4_address,
2980                 &lcl.fp_addr.ip4, lcl.fp_len,
2981                 format_ip4_address, &rmt.fp_addr.ip4,
2982                 rmt.fp_len, mp->action_index, mp->tag);
2983   else
2984     s = format (s, "appns %d scope %d %s %U/%d %d %U/%d %d action %u tag %s",
2985                 mp->appns_index, mp->scope, proto, format_ip6_address,
2986                 &lcl.fp_addr.ip6, lcl.fp_len,
2987                 format_ip6_address, &rmt.fp_addr.ip6,
2988                 rmt.fp_len, mp->action_index, mp->tag);
2989   FINISH;
2990 }
2991
2992 __clib_unused
2993   static void *vl_api_ip_container_proxy_add_del_t_print
2994   (vl_api_ip_container_proxy_add_del_t * mp, void *handle)
2995 {
2996   u8 *s;
2997   s = format (0, "SCRIPT: ip_container_proxy_add_del ");
2998   s = format (s, "is_add %d prefix %U sw_if_index %d",
2999               mp->is_add, format_vl_api_prefix, mp->sw_if_index);
3000
3001   FINISH;
3002 }
3003
3004 static void *vl_api_qos_record_enable_disable_t_print
3005   (vl_api_qos_record_enable_disable_t * mp, void *handle)
3006 {
3007   u8 *s;
3008
3009   s = format (0, "SCRIPT: qos_record_enable_disable ");
3010   s = format (s, "sw_if_index %d ", (mp->record.sw_if_index));
3011   s = format (s, "input_source %U ", format_qos_source,
3012               mp->record.input_source);
3013
3014   if (!mp->enable)
3015     s = format (s, "disable ");
3016
3017   FINISH;
3018 }
3019
3020 #define foreach_no_print_function               \
3021 _(memclnt_keepalive_reply)
3022
3023 #define _(f)                                    \
3024 static void * vl_api_ ## f ## _t_print          \
3025   (vl_api_ ## f ## _t * mp, void * handle)      \
3026 {                                               \
3027   return handle;                                \
3028 }
3029 foreach_no_print_function;
3030 #undef _
3031
3032 #define foreach_custom_print_function                                   \
3033 _(CREATE_LOOPBACK, create_loopback)                                     \
3034 _(CREATE_LOOPBACK_INSTANCE, create_loopback_instance)                   \
3035 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags)                       \
3036 _(SW_INTERFACE_EVENT, sw_interface_event)                               \
3037 _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address)           \
3038 _(SW_INTERFACE_SET_TABLE, sw_interface_set_table)                       \
3039 _(SW_INTERFACE_SET_MPLS_ENABLE, sw_interface_set_mpls_enable)           \
3040 _(SW_INTERFACE_SET_VPATH, sw_interface_set_vpath)                       \
3041 _(SW_INTERFACE_SET_VXLAN_BYPASS, sw_interface_set_vxlan_bypass)         \
3042 _(BOND_CREATE, bond_create)                                             \
3043 _(BOND_CREATE2, bond_create2)                                           \
3044 _(BOND_DELETE, bond_delete)                                             \
3045 _(BOND_ADD_MEMBER, bond_add_member)                                     \
3046 _(BOND_DETACH_MEMBER, bond_detach_member)                               \
3047 _(SW_INTERFACE_SET_BOND_WEIGHT, sw_interface_set_bond_weight)           \
3048 _(SW_MEMBER_INTERFACE_DUMP, sw_member_interface_dump)                   \
3049 _(SW_BOND_INTERFACE_DUMP, sw_bond_interface_dump)                       \
3050 _(SW_INTERFACE_RX_PLACEMENT_DUMP, sw_interface_rx_placement_dump)       \
3051 _(TAP_CREATE_V2, tap_create_v2)                                         \
3052 _(TAP_DELETE_V2, tap_delete_v2)                                         \
3053 _(SW_INTERFACE_TAP_V2_DUMP, sw_interface_tap_v2_dump)                   \
3054 _(IP_TABLE_ADD_DEL, ip_table_add_del)                                   \
3055 _(MPLS_ROUTE_ADD_DEL, mpls_route_add_del)                               \
3056 _(MPLS_TABLE_ADD_DEL, mpls_table_add_del)                               \
3057 _(IP_ROUTE_ADD_DEL, ip_route_add_del)                                   \
3058 _(MPLS_TUNNEL_ADD_DEL, mpls_tunnel_add_del)                             \
3059 _(SR_MPLS_POLICY_ADD, sr_mpls_policy_add)                               \
3060 _(SR_MPLS_POLICY_DEL, sr_mpls_policy_del)                               \
3061 _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered)             \
3062 _(CREATE_VLAN_SUBIF, create_vlan_subif)                                 \
3063 _(CREATE_SUBIF, create_subif)                                           \
3064 _(IP_TABLE_REPLACE_BEGIN, ip_table_replace_begin)                       \
3065 _(IP_TABLE_FLUSH, ip_table_flush)                                       \
3066 _(IP_TABLE_REPLACE_END, ip_table_replace_end)                           \
3067 _(SET_IP_FLOW_HASH, set_ip_flow_hash)                                   \
3068 _(L2_PATCH_ADD_DEL, l2_patch_add_del)                                   \
3069 _(SR_LOCALSID_ADD_DEL, sr_localsid_add_del)                             \
3070 _(SR_STEERING_ADD_DEL, sr_steering_add_del)                             \
3071 _(SR_POLICY_ADD, sr_policy_add)                                         \
3072 _(SR_POLICY_MOD, sr_policy_mod)                                         \
3073 _(SR_POLICY_DEL, sr_policy_del)                                         \
3074 _(SW_INTERFACE_SET_L2_XCONNECT, sw_interface_set_l2_xconnect)           \
3075 _(L2FIB_ADD_DEL, l2fib_add_del)                                         \
3076 _(L2FIB_FLUSH_ALL, l2fib_flush_all)                                     \
3077 _(L2FIB_FLUSH_BD, l2fib_flush_bd)                                       \
3078 _(L2FIB_FLUSH_INT, l2fib_flush_int)                                     \
3079 _(L2_FLAGS, l2_flags)                                                   \
3080 _(BRIDGE_FLAGS, bridge_flags)                                           \
3081 _(CLASSIFY_ADD_DEL_TABLE, classify_add_del_table)                       \
3082 _(CLASSIFY_ADD_DEL_SESSION, classify_add_del_session)                   \
3083 _(SW_INTERFACE_SET_L2_BRIDGE, sw_interface_set_l2_bridge)               \
3084 _(BRIDGE_DOMAIN_ADD_DEL, bridge_domain_add_del)                         \
3085 _(BRIDGE_DOMAIN_DUMP, bridge_domain_dump)                               \
3086 _(BRIDGE_DOMAIN_SET_MAC_AGE, bridge_domain_set_mac_age)                 \
3087 _(CLASSIFY_SET_INTERFACE_IP_TABLE, classify_set_interface_ip_table)     \
3088 _(CLASSIFY_SET_INTERFACE_L2_TABLES, classify_set_interface_l2_tables)   \
3089 _(ADD_NODE_NEXT, add_node_next)                                         \
3090 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel)                           \
3091 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump)                                 \
3092 _(VXLAN_OFFLOAD_RX, vxlan_offload_rx)                                   \
3093 _(GRE_TUNNEL_ADD_DEL, gre_tunnel_add_del)                               \
3094 _(GRE_TUNNEL_DUMP, gre_tunnel_dump)                                     \
3095 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table)                               \
3096 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter)                     \
3097 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite)         \
3098 _(CREATE_VHOST_USER_IF, create_vhost_user_if)                           \
3099 _(MODIFY_VHOST_USER_IF, modify_vhost_user_if)                           \
3100 _(DELETE_VHOST_USER_IF, delete_vhost_user_if)                           \
3101 _(SW_INTERFACE_DUMP, sw_interface_dump)                                 \
3102 _(CONTROL_PING, control_ping)                                           \
3103 _(WANT_INTERFACE_EVENTS, want_interface_events)                         \
3104 _(CLI, cli)                                                             \
3105 _(CLI_INBAND, cli_inband)                                               \
3106 _(MEMCLNT_CREATE, memclnt_create)                                       \
3107 _(SOCKCLNT_CREATE, sockclnt_create)                                     \
3108 _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump)           \
3109 _(SHOW_VERSION, show_version)                                           \
3110 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump)                                 \
3111 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel)                   \
3112 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump)                         \
3113 _(VXLAN_GBP_TUNNEL_ADD_DEL, vxlan_gbp_tunnel_add_del)                   \
3114 _(VXLAN_GBP_TUNNEL_DUMP, vxlan_gbp_tunnel_dump)                         \
3115 _(SW_INTERFACE_SET_VXLAN_GBP_BYPASS, sw_interface_set_vxlan_gbp_bypass) \
3116 _(INTERFACE_NAME_RENUMBER, interface_name_renumber)                     \
3117 _(WANT_L2_MACS_EVENTS, want_l2_macs_events)                             \
3118 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface)                     \
3119 _(IP_ADDRESS_DUMP, ip_address_dump)                                     \
3120 _(IP_DUMP, ip_dump)                                                     \
3121 _(DELETE_LOOPBACK, delete_loopback)                                     \
3122 _(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del)                                 \
3123 _(BD_IP_MAC_FLUSH, bd_ip_mac_flush)                                     \
3124 _(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable)           \
3125 _(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable)           \
3126 _(AF_PACKET_CREATE, af_packet_create)                                   \
3127 _(AF_PACKET_DELETE, af_packet_delete)                                   \
3128 _(AF_PACKET_DUMP, af_packet_dump)                                       \
3129 _(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats)                   \
3130 _(MPLS_TABLE_DUMP, mpls_table_dump)                                     \
3131 _(MPLS_ROUTE_DUMP, mpls_route_dump)                                     \
3132 _(MPLS_TUNNEL_DUMP, mpls_tunnel_dump)                                   \
3133 _(CLASSIFY_TABLE_IDS,classify_table_ids)                                \
3134 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface)             \
3135 _(CLASSIFY_TABLE_INFO,classify_table_info)                              \
3136 _(CLASSIFY_SESSION_DUMP,classify_session_dump)                          \
3137 _(SET_IPFIX_EXPORTER, set_ipfix_exporter)                               \
3138 _(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump)                             \
3139 _(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream)                 \
3140 _(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump)               \
3141 _(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del)           \
3142 _(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump)                 \
3143 _(SW_INTERFACE_SPAN_ENABLE_DISABLE, sw_interface_span_enable_disable)   \
3144 _(SW_INTERFACE_SPAN_DUMP, sw_interface_span_dump)                       \
3145 _(GET_NEXT_INDEX, get_next_index)                                       \
3146 _(PG_CREATE_INTERFACE,pg_create_interface)                              \
3147 _(PG_CAPTURE, pg_capture)                                               \
3148 _(PG_ENABLE_DISABLE, pg_enable_disable)                                 \
3149 _(PG_INTERFACE_ENABLE_DISABLE_COALESCE, pg_interface_enable_disable_coalesce) \
3150 _(POLICER_ADD_DEL, policer_add_del)                                     \
3151 _(POLICER_DUMP, policer_dump)                                           \
3152 _(POLICER_CLASSIFY_SET_INTERFACE, policer_classify_set_interface)       \
3153 _(POLICER_CLASSIFY_DUMP, policer_classify_dump)                         \
3154 _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL,                               \
3155   ip_source_and_port_range_check_add_del)                               \
3156 _(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL,                     \
3157   ip_source_and_port_range_check_interface_add_del)                     \
3158 _(IPSEC_INTERFACE_ADD_DEL_SPD, ipsec_interface_add_del_spd)             \
3159 _(IPSEC_SAD_ENTRY_ADD_DEL, ipsec_sad_entry_add_del)                     \
3160 _(IPSEC_SPD_ADD_DEL, ipsec_spd_add_del)                                 \
3161 _(IPSEC_SPD_ENTRY_ADD_DEL, ipsec_spd_entry_add_del)                     \
3162 _(IPSEC_TUNNEL_IF_ADD_DEL, ipsec_tunnel_if_add_del)                     \
3163 _(DELETE_SUBIF, delete_subif)                                           \
3164 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite)           \
3165 _(SET_PUNT, set_punt)                                                   \
3166 _(FLOW_CLASSIFY_SET_INTERFACE, flow_classify_set_interface)             \
3167 _(FLOW_CLASSIFY_DUMP, flow_classify_dump)                               \
3168 _(GET_FIRST_MSG_ID, get_first_msg_id)                                   \
3169 _(IOAM_ENABLE, ioam_enable)                                             \
3170 _(IOAM_DISABLE, ioam_disable)                                           \
3171 _(IP_TABLE_DUMP, ip_table_dump)                                         \
3172 _(IP_ROUTE_DUMP, ip_route_dump)                                         \
3173 _(FEATURE_ENABLE_DISABLE, feature_enable_disable)                       \
3174 _(FEATURE_GSO_ENABLE_DISABLE, feature_gso_enable_disable)               \
3175 _(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del)                   \
3176 _(HW_INTERFACE_SET_MTU, hw_interface_set_mtu)                           \
3177 _(P2P_ETHERNET_ADD, p2p_ethernet_add)                                   \
3178 _(P2P_ETHERNET_DEL, p2p_ethernet_del)                                   \
3179 _(TCP_CONFIGURE_SRC_ADDRESSES, tcp_configure_src_addresses)             \
3180 _(APP_NAMESPACE_ADD_DEL, app_namespace_add_del)                         \
3181 _(SESSION_RULE_ADD_DEL, session_rule_add_del)                           \
3182 _(OUTPUT_ACL_SET_INTERFACE, output_acl_set_interface)                   \
3183 _(QOS_RECORD_ENABLE_DISABLE, qos_record_enable_disable)                 \
3184 _(MEMCLNT_KEEPALIVE_REPLY, memclnt_keepalive_reply)
3185
3186 void
3187 vl_msg_api_custom_dump_configure (api_main_t * am)
3188 {
3189 #define _(n,f) am->msg_print_handlers[VL_API_##n]       \
3190     = (void *) vl_api_##f##_t_print;
3191   foreach_custom_print_function;
3192 #undef _
3193 }
3194
3195 /*
3196  * fd.io coding-style-patch-verification: ON
3197  *
3198  * Local Variables:
3199  * eval: (c-set-style "gnu")
3200  * End:
3201  */