From d1f24d37bd447b64e402298bb8eb2479681facf9 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Fri, 17 Jul 2020 10:36:28 +0200 Subject: Improve binapi generator - simplified Size/Marshal/Unmarshal methods - replace struc in unions with custom marshal/unmarshal - fix imports in generated files - fix mock adapter - generate rpc service using low-level stream API (dumps generate control ping or stream msg..) - move examples/binapi to binapi and generate all API for latest release - add binapigen.Plugin for developing custom generator plugins - optionally generate HTTP handlers (REST API) for RPC services - add govpp program for browsing VPP API Change-Id: I092e9ed2b0c17972b3476463c3d4b14dd76ed42b Signed-off-by: Ondrej Fabry --- Makefile | 16 +- adapter/mock/mock_vpp_adapter.go | 86 +- adapter/socketclient/binapi/gen.go | 5 - adapter/socketclient/binapi/memclnt/memclnt.ba.go | 1456 ----- adapter/socketclient/socketclient.go | 2 +- binapi/abf/abf.ba.go | 627 +++ binapi/abf/abf_rest.ba.go | 74 + binapi/abf/abf_rpc.ba.go | 133 + binapi/acl/acl.ba.go | 1900 +++++++ binapi/acl/acl_rest.ba.go | 300 + binapi/acl/acl_rpc.ba.go | 363 ++ binapi/acl_types/acl_types.ba.go | 78 + binapi/af_packet/af_packet.ba.go | 361 ++ binapi/af_packet/af_packet_rest.ba.go | 83 + binapi/af_packet/af_packet_rpc.ba.go | 93 + binapi/arp/arp.ba.go | 364 ++ binapi/arp/arp_rest.ba.go | 60 + binapi/arp/arp_rpc.ba.go | 123 + binapi/avf/avf.ba.go | 212 + binapi/avf/avf_rest.ba.go | 60 + binapi/avf/avf_rpc.ba.go | 40 + binapi/bfd/bfd.ba.go | 1346 +++++ binapi/bfd/bfd_rest.ba.go | 272 + binapi/bfd/bfd_rpc.ba.go | 223 + binapi/bier/bier.ba.go | 1343 +++++ binapi/bier/bier_rest.ba.go | 152 + binapi/bier/bier_rpc.ba.go | 283 + binapi/bond/bond.ba.go | 734 +++ binapi/bond/bond_rest.ba.go | 129 + binapi/bond/bond_rpc.ba.go | 153 + binapi/builtinurl/builtinurl.ba.go | 109 + binapi/builtinurl/builtinurl_rest.ba.go | 27 + binapi/builtinurl/builtinurl_rpc.ba.go | 30 + binapi/cdp/cdp.ba.go | 115 + binapi/cdp/cdp_rest.ba.go | 37 + binapi/cdp/cdp_rpc.ba.go | 30 + binapi/classify/classify.ba.go | 1487 +++++ binapi/classify/classify_rest.ba.go | 258 + binapi/classify/classify_rpc.ba.go | 253 + binapi/cop/cop.ba.go | 216 + binapi/cop/cop_rest.ba.go | 60 + binapi/cop/cop_rpc.ba.go | 40 + binapi/ct6/ct6.ba.go | 124 + binapi/ct6/ct6_rest.ba.go | 37 + binapi/ct6/ct6_rpc.ba.go | 30 + binapi/dhcp/dhcp.ba.go | 1845 +++++++ binapi/dhcp/dhcp_rest.ba.go | 249 + binapi/dhcp/dhcp_rpc.ba.go | 213 + .../dhcp6_ia_na_client_cp.ba.go | 122 + .../dhcp6_ia_na_client_cp_rest.ba.go | 37 + .../dhcp6_ia_na_client_cp_rpc.ba.go | 30 + binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go | 222 + .../dhcp6_pd_client_cp_rest.ba.go | 60 + .../dhcp6_pd_client_cp_rpc.ba.go | 40 + binapi/dns/dns.ba.go | 375 ++ binapi/dns/dns_rest.ba.go | 106 + binapi/dns/dns_rpc.ba.go | 60 + binapi/dslite/dslite.ba.go | 513 ++ binapi/dslite/dslite_rest.ba.go | 111 + binapi/dslite/dslite_rpc.ba.go | 113 + binapi/ethernet_types/ethernet_types.ba.go | 53 + binapi/feature/feature.ba.go | 128 + binapi/feature/feature_rest.ba.go | 37 + binapi/feature/feature_rpc.ba.go | 30 + binapi/fib_types/fib_types.ba.go | 198 + binapi/flowprobe/flowprobe.ba.go | 310 ++ binapi/flowprobe/flowprobe_rest.ba.go | 60 + binapi/flowprobe/flowprobe_rpc.ba.go | 40 + binapi/gbp/gbp.ba.go | 2681 +++++++++ binapi/gbp/gbp_rest.ba.go | 336 ++ binapi/gbp/gbp_rpc.ba.go | 523 ++ binapi/geneve/geneve.ba.go | 344 ++ binapi/geneve/geneve_rest.ba.go | 60 + binapi/geneve/geneve_rpc.ba.go | 83 + binapi/gre/gre.ba.go | 308 ++ binapi/gre/gre_rest.ba.go | 37 + binapi/gre/gre_rpc.ba.go | 73 + binapi/gso/gso.ba.go | 122 + binapi/gso/gso_rest.ba.go | 37 + binapi/gso/gso_rpc.ba.go | 30 + binapi/gtpu/gtpu.ba.go | 427 ++ binapi/gtpu/gtpu_rest.ba.go | 83 + binapi/gtpu/gtpu_rpc.ba.go | 93 + binapi/http_static/http_static.ba.go | 135 + binapi/http_static/http_static_rest.ba.go | 37 + binapi/http_static/http_static_rpc.ba.go | 30 + binapi/igmp/igmp.ba.go | 927 ++++ binapi/igmp/igmp_rest.ba.go | 175 + binapi/igmp/igmp_rpc.ba.go | 173 + binapi/ikev2/ikev2.ba.go | 1553 ++++++ binapi/ikev2/ikev2_rest.ba.go | 419 ++ binapi/ikev2/ikev2_rpc.ba.go | 200 + binapi/interface/interface.ba.go | 2542 +++++++++ binapi/interface/interface_rest.ba.go | 594 ++ binapi/interface/interface_rpc.ba.go | 363 ++ binapi/interface_types/interface_types.ba.go | 275 + binapi/ioam_cache/ioam_cache.ba.go | 117 + binapi/ioam_cache/ioam_cache_rest.ba.go | 37 + binapi/ioam_cache/ioam_cache_rpc.ba.go | 30 + binapi/ioam_export/ioam_export.ba.go | 126 + binapi/ioam_export/ioam_export_rest.ba.go | 37 + binapi/ioam_export/ioam_export_rpc.ba.go | 30 + binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go | 556 ++ binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go | 152 + binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go | 80 + binapi/ip/ip.ba.go | 3269 +++++++++++ binapi/ip/ip_rest.ba.go | 474 ++ binapi/ip/ip_rpc.ba.go | 623 +++ binapi/ip6_nd/ip6_nd.ba.go | 741 +++ binapi/ip6_nd/ip6_nd_rest.ba.go | 129 + binapi/ip6_nd/ip6_nd_rpc.ba.go | 113 + binapi/ip_neighbor/ip_neighbor.ba.go | 747 +++ binapi/ip_neighbor/ip_neighbor_rest.ba.go | 134 + binapi/ip_neighbor/ip_neighbor_rpc.ba.go | 123 + binapi/ip_types/ip_types.ba.go | 592 ++ binapi/ipfix_export/ipfix_export.ba.go | 638 +++ binapi/ipfix_export/ipfix_export_rest.ba.go | 97 + binapi/ipfix_export/ipfix_export_rpc.ba.go | 183 + binapi/ipip/ipip.ba.go | 527 ++ binapi/ipip/ipip_rest.ba.go | 106 + binapi/ipip/ipip_rpc.ba.go | 103 + binapi/ipsec/ipsec.ba.go | 1682 ++++++ binapi/ipsec/ipsec_rest.ba.go | 221 + binapi/ipsec/ipsec_rpc.ba.go | 353 ++ binapi/ipsec_types/ipsec_types.ba.go | 236 + binapi/l2/l2.ba.go | 2594 +++++++++ binapi/l2/l2_rest.ba.go | 502 ++ binapi/l2/l2_rpc.ba.go | 403 ++ binapi/l2e/l2e.ba.go | 120 + binapi/l2e/l2e_rest.ba.go | 37 + binapi/l2e/l2e_rpc.ba.go | 30 + binapi/l2tp/l2tp.ba.go | 549 ++ binapi/l2tp/l2tp_rest.ba.go | 106 + binapi/l2tp/l2tp_rpc.ba.go | 103 + binapi/l3xc/l3xc.ba.go | 537 ++ binapi/l3xc/l3xc_rest.ba.go | 74 + binapi/l3xc/l3xc_rpc.ba.go | 93 + binapi/lacp/lacp.ba.go | 183 + binapi/lacp/lacp_rest.ba.go | 12 + binapi/lacp/lacp_rpc.ba.go | 63 + binapi/lb/lb.ba.go | 849 +++ binapi/lb/lb_rest.ba.go | 152 + binapi/lb/lb_rpc.ba.go | 163 + binapi/lb_types/lb_types.ba.go | 209 + binapi/lisp/lisp.ba.go | 2701 +++++++++ binapi/lisp/lisp_rest.ba.go | 480 ++ binapi/lisp/lisp_rpc.ba.go | 533 ++ binapi/lisp_gpe/lisp_gpe.ba.go | 1019 ++++ binapi/lisp_gpe/lisp_gpe_rest.ba.go | 203 + binapi/lisp_gpe/lisp_gpe_rpc.ba.go | 153 + binapi/lisp_types/lisp_types.ba.go | 177 + binapi/lldp/lldp.ba.go | 221 + binapi/lldp/lldp_rest.ba.go | 60 + binapi/lldp/lldp_rpc.ba.go | 40 + binapi/mactime/mactime.ba.go | 430 ++ binapi/mactime/mactime_rest.ba.go | 60 + binapi/mactime/mactime_rpc.ba.go | 83 + binapi/map/map.ba.go | 1404 +++++ binapi/map/map_rest.ba.go | 295 + binapi/map/map_rpc.ba.go | 233 + binapi/mdata/mdata.ba.go | 116 + binapi/mdata/mdata_rest.ba.go | 37 + binapi/mdata/mdata_rpc.ba.go | 30 + binapi/memclnt/memclnt.ba.go | 1036 ++++ binapi/memclnt/memclnt_rest.ba.go | 203 + binapi/memclnt/memclnt_rpc.ba.go | 162 + binapi/memif/memif.ba.go | 566 ++ binapi/memif/memif_rest.ba.go | 83 + binapi/memif/memif_rpc.ba.go | 133 + binapi/mfib_types/mfib_types.ba.go | 90 + binapi/mpls/mpls.ba.go | 1126 ++++ binapi/mpls/mpls_rest.ba.go | 129 + binapi/mpls/mpls_rpc.ba.go | 193 + binapi/nat/nat.ba.go | 5713 +++++++++++++++++++ binapi/nat/nat_rest.ba.go | 913 ++++ binapi/nat/nat_rpc.ba.go | 1213 +++++ binapi/nsh/nsh.ba.go | 496 ++ binapi/nsh/nsh_rest.ba.go | 60 + binapi/nsh/nsh_rpc.ba.go | 123 + binapi/nsim/nsim.ba.go | 300 + binapi/nsim/nsim_rest.ba.go | 83 + binapi/nsim/nsim_rpc.ba.go | 50 + binapi/oddbuf/oddbuf.ba.go | 120 + binapi/oddbuf/oddbuf_rest.ba.go | 37 + binapi/oddbuf/oddbuf_rpc.ba.go | 30 + binapi/one/one.ba.go | 4690 ++++++++++++++++ binapi/one/one_rest.ba.go | 910 ++++ binapi/one/one_rpc.ba.go | 803 +++ binapi/p2p_ethernet/p2p_ethernet.ba.go | 209 + binapi/p2p_ethernet/p2p_ethernet_rest.ba.go | 60 + binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go | 40 + binapi/pci_types/pci_types.ba.go | 30 + binapi/pg/pg.ba.go | 296 + binapi/pg/pg_rest.ba.go | 83 + binapi/pg/pg_rpc.ba.go | 50 + binapi/pipe/pipe.ba.go | 312 ++ binapi/pipe/pipe_rest.ba.go | 60 + binapi/pipe/pipe_rpc.ba.go | 83 + binapi/policer/policer.ba.go | 346 ++ binapi/policer/policer_rest.ba.go | 37 + binapi/policer/policer_rpc.ba.go | 73 + binapi/policer_types/policer_types.ba.go | 162 + binapi/pot/pot.ba.go | 411 ++ binapi/pot/pot_rest.ba.go | 83 + binapi/pot/pot_rpc.ba.go | 93 + binapi/pppoe/pppoe.ba.go | 244 + binapi/pppoe/pppoe_rest.ba.go | 37 + binapi/pppoe/pppoe_rpc.ba.go | 73 + binapi/punt/punt.ba.go | 578 ++ binapi/punt/punt_rest.ba.go | 83 + binapi/punt/punt_rpc.ba.go | 133 + binapi/qos/qos.ba.go | 890 +++ binapi/qos/qos_rest.ba.go | 129 + binapi/qos/qos_rpc.ba.go | 233 + binapi/rd_cp/rd_cp.ba.go | 124 + binapi/rd_cp/rd_cp_rest.ba.go | 37 + binapi/rd_cp/rd_cp_rpc.ba.go | 30 + binapi/rdma/rdma.ba.go | 248 + binapi/rdma/rdma_rest.ba.go | 60 + binapi/rdma/rdma_rpc.ba.go | 40 + binapi/session/session.ba.go | 1158 ++++ binapi/session/session_rest.ba.go | 235 + binapi/session/session_rpc.ba.go | 163 + binapi/span/span.ba.go | 255 + binapi/span/span_rest.ba.go | 37 + binapi/span/span_rpc.ba.go | 73 + binapi/sr/sr.ba.go | 1049 ++++ binapi/sr/sr_rest.ba.go | 175 + binapi/sr/sr_rpc.ba.go | 213 + binapi/sr_mpls/sr_mpls.ba.go | 532 ++ binapi/sr_mpls/sr_mpls_rest.ba.go | 129 + binapi/sr_mpls/sr_mpls_rpc.ba.go | 70 + binapi/sr_types/sr_types.ba.go | 137 + binapi/stn/stn.ba.go | 205 + binapi/stn/stn_rest.ba.go | 37 + binapi/stn/stn_rpc.ba.go | 73 + binapi/svs/svs.ba.go | 459 ++ binapi/svs/svs_rest.ba.go | 97 + binapi/svs/svs_rpc.ba.go | 103 + binapi/syslog/syslog.ba.go | 419 ++ binapi/syslog/syslog_rest.ba.go | 88 + binapi/syslog/syslog_rpc.ba.go | 60 + binapi/tapv2/tapv2.ba.go | 494 ++ binapi/tapv2/tapv2_rest.ba.go | 60 + binapi/tapv2/tapv2_rpc.ba.go | 83 + binapi/tcp/tcp.ba.go | 132 + binapi/tcp/tcp_rest.ba.go | 37 + binapi/tcp/tcp_rpc.ba.go | 30 + binapi/teib/teib.ba.go | 230 + binapi/teib/teib_rest.ba.go | 37 + binapi/teib/teib_rpc.ba.go | 73 + binapi/tls_openssl/tls_openssl.ba.go | 127 + binapi/tls_openssl/tls_openssl_rest.ba.go | 37 + binapi/tls_openssl/tls_openssl_rpc.ba.go | 30 + binapi/trace/trace.ba.go | 291 + binapi/trace/trace_rest.ba.go | 65 + binapi/trace/trace_rpc.ba.go | 50 + binapi/tunnel_types/tunnel_types.ba.go | 108 + binapi/udp/udp.ba.go | 319 ++ binapi/udp/udp_rest.ba.go | 60 + binapi/udp/udp_rpc.ba.go | 83 + binapi/udp_ping/udp_ping.ba.go | 234 + binapi/udp_ping/udp_ping_rest.ba.go | 60 + binapi/udp_ping/udp_ping_rpc.ba.go | 40 + binapi/urpf/urpf.ba.go | 162 + binapi/urpf/urpf_rest.ba.go | 37 + binapi/urpf/urpf_rpc.ba.go | 30 + binapi/vhost_user/vhost_user.ba.go | 446 ++ binapi/vhost_user/vhost_user_rest.ba.go | 83 + binapi/vhost_user/vhost_user_rpc.ba.go | 93 + binapi/virtio/virtio.ba.go | 326 ++ binapi/virtio/virtio_rest.ba.go | 60 + binapi/virtio/virtio_rpc.ba.go | 83 + binapi/virtio_types/virtio_types.ba.go | 116 + binapi/vmxnet3/vmxnet3.ba.go | 427 ++ binapi/vmxnet3/vmxnet3_rest.ba.go | 60 + binapi/vmxnet3/vmxnet3_rpc.ba.go | 83 + binapi/vpe/vpe.ba.go | 1132 ++++ binapi/vpe/vpe_rest.ba.go | 245 + binapi/vpe/vpe_rpc.ba.go | 182 + binapi/vpe_types/vpe_types.ba.go | 88 + binapi/vrrp/vrrp.ba.go | 984 ++++ binapi/vrrp/vrrp_rest.ba.go | 106 + binapi/vrrp/vrrp_rpc.ba.go | 183 + binapi/vxlan/vxlan.ba.go | 435 ++ binapi/vxlan/vxlan_rest.ba.go | 83 + binapi/vxlan/vxlan_rpc.ba.go | 93 + binapi/vxlan_gbp/vxlan_gbp.ba.go | 385 ++ binapi/vxlan_gbp/vxlan_gbp_rest.ba.go | 60 + binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go | 83 + binapi/vxlan_gpe/vxlan_gpe.ba.go | 357 ++ binapi/vxlan_gpe/vxlan_gpe_rest.ba.go | 60 + binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go | 83 + .../vxlan_gpe_ioam_export.ba.go | 128 + .../vxlan_gpe_ioam_export_rest.ba.go | 37 + .../vxlan_gpe_ioam_export_rpc.ba.go | 30 + binapigen/binapigen.go | 572 +- binapigen/binapigen_test.go | 55 + binapigen/gen_encoding.go | 375 ++ binapigen/gen_helpers.go | 348 ++ binapigen/gen_helpers_test.go | 156 + binapigen/gen_rest.go | 103 + binapigen/gen_rpc.go | 204 + binapigen/generate.go | 1518 ++---- binapigen/generate_rpc.go | 203 - binapigen/generate_test.go | 175 +- binapigen/generator.go | 425 +- binapigen/generator_test.go | 76 +- binapigen/plugin.go | 51 + binapigen/run.go | 132 +- binapigen/types.go | 267 +- binapigen/validate.go | 67 - binapigen/vppapi.go | 211 + binapigen/vppapi/api.go | 94 - binapigen/vppapi/api_schema.go | 89 + binapigen/vppapi/parse_json.go | 210 +- binapigen/vppapi/parser.go | 111 - binapigen/vppapi/parser_test.go | 114 - binapigen/vppapi/util.go | 112 + binapigen/vppapi/vppapi.go | 116 + binapigen/vppapi/vppapi_test.go | 118 + cmd/binapi-generator/main.go | 87 +- cmd/binapi-generator/util.go | 81 - cmd/govpp/main.go | 265 + cmd/vpp-proxy/main.go | 24 +- codec/bench_test.go | 2 + codec/codec.go | 103 +- codec/marshaler_test.go | 444 +- codec/msg_codec.go | 29 +- codec/msg_codec_test.go | 30 +- codec/testdata/binapi2001/acl/acl.ba.go | 2885 ---------- codec/testdata/binapi2001/acl/acl_rpc.ba.go | 302 -- .../testdata/binapi2001/af_packet/af_packet.ba.go | 725 --- .../binapi2001/af_packet/af_packet_rpc.ba.go | 84 - .../binapi2001/interfaces/interfaces.ba.go | 3961 -------------- .../binapi2001/interfaces/interfaces_rpc.ba.go | 321 -- codec/testdata/binapi2001/ip/ip.ba.go | 5730 -------------------- codec/testdata/binapi2001/ip/ip_rpc.ba.go | 497 -- codec/testdata/binapi2001/memclnt/memclnt.ba.go | 1450 ----- .../testdata/binapi2001/memclnt/memclnt_rpc.ba.go | 141 - codec/testdata/binapi2001/memif/memif.ba.go | 1052 ---- codec/testdata/binapi2001/memif/memif_rpc.ba.go | 111 - codec/testdata/binapi2001/sr/sr.ba.go | 1716 ------ codec/testdata/binapi2001/sr/sr_rpc.ba.go | 178 - codec/testdata/binapi2001/vpe/vpe.ba.go | 1701 ------ codec/testdata/binapi2001/vpe/vpe_rpc.ba.go | 174 - core/channel_test.go | 8 +- core/connection_test.go | 11 +- core/stream.go | 19 +- examples/binapi-types/binapi_types.go | 137 + examples/binapi/acl/acl.ba.go | 2903 ---------- examples/binapi/acl/acl_rpc.ba.go | 302 -- examples/binapi/af_packet/af_packet.ba.go | 530 -- examples/binapi/af_packet/af_packet_rpc.ba.go | 84 - examples/binapi/fib_types/fib_types.ba.go | 255 - examples/binapi/gen.go | 5 - .../binapi/interface_types/interface_types.ba.go | 272 - examples/binapi/interfaces/interfaces.ba.go | 3640 ------------- examples/binapi/interfaces/interfaces_rpc.ba.go | 341 -- examples/binapi/ip/ip.ba.go | 5317 ------------------ examples/binapi/ip/ip_rpc.ba.go | 497 -- examples/binapi/ip_types/ip_types.ba.go | 436 -- examples/binapi/mactime/mactime.ba.go | 689 --- examples/binapi/mactime/mactime_rpc.ba.go | 74 - examples/binapi/memif/memif.ba.go | 857 --- examples/binapi/memif/memif_rpc.ba.go | 111 - examples/binapi/sr/sr.ba.go | 1784 ------ examples/binapi/sr/sr_rpc.ba.go | 178 - examples/binapi/vpe/vpe.ba.go | 1665 ------ examples/binapi/vpe/vpe_rpc.ba.go | 174 - examples/multi-vpp/multi_vpp.go | 18 +- examples/perf-bench/perf-bench.go | 2 +- examples/rpc-service/rpc_service.go | 25 +- examples/simple-client/simple_client.go | 29 +- examples/union-example/union_example.go | 130 - gen.go | 21 + internal/testbinapi/binapi2001/acl/acl.ba.go | 2885 ++++++++++ internal/testbinapi/binapi2001/acl/acl_rpc.ba.go | 302 ++ .../binapi2001/af_packet/af_packet.ba.go | 725 +++ .../binapi2001/af_packet/af_packet_rpc.ba.go | 84 + .../binapi2001/interfaces/interfaces.ba.go | 3961 ++++++++++++++ .../binapi2001/interfaces/interfaces_rpc.ba.go | 321 ++ internal/testbinapi/binapi2001/ip/ip.ba.go | 5730 ++++++++++++++++++++ internal/testbinapi/binapi2001/ip/ip_rpc.ba.go | 497 ++ .../testbinapi/binapi2001/memclnt/memclnt.ba.go | 1450 +++++ .../binapi2001/memclnt/memclnt_rpc.ba.go | 141 + internal/testbinapi/binapi2001/memif/memif.ba.go | 1052 ++++ .../testbinapi/binapi2001/memif/memif_rpc.ba.go | 111 + internal/testbinapi/binapi2001/sr/sr.ba.go | 1716 ++++++ internal/testbinapi/binapi2001/sr/sr_rpc.ba.go | 178 + internal/testbinapi/binapi2001/vpe/vpe.ba.go | 1701 ++++++ internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go | 174 + internal/version/version.go | 85 + version/version.go | 68 - 394 files changed, 122159 insertions(+), 46213 deletions(-) delete mode 100644 adapter/socketclient/binapi/gen.go delete mode 100644 adapter/socketclient/binapi/memclnt/memclnt.ba.go create mode 100644 binapi/abf/abf.ba.go create mode 100644 binapi/abf/abf_rest.ba.go create mode 100644 binapi/abf/abf_rpc.ba.go create mode 100644 binapi/acl/acl.ba.go create mode 100644 binapi/acl/acl_rest.ba.go create mode 100644 binapi/acl/acl_rpc.ba.go create mode 100644 binapi/acl_types/acl_types.ba.go create mode 100644 binapi/af_packet/af_packet.ba.go create mode 100644 binapi/af_packet/af_packet_rest.ba.go create mode 100644 binapi/af_packet/af_packet_rpc.ba.go create mode 100644 binapi/arp/arp.ba.go create mode 100644 binapi/arp/arp_rest.ba.go create mode 100644 binapi/arp/arp_rpc.ba.go create mode 100644 binapi/avf/avf.ba.go create mode 100644 binapi/avf/avf_rest.ba.go create mode 100644 binapi/avf/avf_rpc.ba.go create mode 100644 binapi/bfd/bfd.ba.go create mode 100644 binapi/bfd/bfd_rest.ba.go create mode 100644 binapi/bfd/bfd_rpc.ba.go create mode 100644 binapi/bier/bier.ba.go create mode 100644 binapi/bier/bier_rest.ba.go create mode 100644 binapi/bier/bier_rpc.ba.go create mode 100644 binapi/bond/bond.ba.go create mode 100644 binapi/bond/bond_rest.ba.go create mode 100644 binapi/bond/bond_rpc.ba.go create mode 100644 binapi/builtinurl/builtinurl.ba.go create mode 100644 binapi/builtinurl/builtinurl_rest.ba.go create mode 100644 binapi/builtinurl/builtinurl_rpc.ba.go create mode 100644 binapi/cdp/cdp.ba.go create mode 100644 binapi/cdp/cdp_rest.ba.go create mode 100644 binapi/cdp/cdp_rpc.ba.go create mode 100644 binapi/classify/classify.ba.go create mode 100644 binapi/classify/classify_rest.ba.go create mode 100644 binapi/classify/classify_rpc.ba.go create mode 100644 binapi/cop/cop.ba.go create mode 100644 binapi/cop/cop_rest.ba.go create mode 100644 binapi/cop/cop_rpc.ba.go create mode 100644 binapi/ct6/ct6.ba.go create mode 100644 binapi/ct6/ct6_rest.ba.go create mode 100644 binapi/ct6/ct6_rpc.ba.go create mode 100644 binapi/dhcp/dhcp.ba.go create mode 100644 binapi/dhcp/dhcp_rest.ba.go create mode 100644 binapi/dhcp/dhcp_rpc.ba.go create mode 100644 binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go create mode 100644 binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go create mode 100644 binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go create mode 100644 binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go create mode 100644 binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go create mode 100644 binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go create mode 100644 binapi/dns/dns.ba.go create mode 100644 binapi/dns/dns_rest.ba.go create mode 100644 binapi/dns/dns_rpc.ba.go create mode 100644 binapi/dslite/dslite.ba.go create mode 100644 binapi/dslite/dslite_rest.ba.go create mode 100644 binapi/dslite/dslite_rpc.ba.go create mode 100644 binapi/ethernet_types/ethernet_types.ba.go create mode 100644 binapi/feature/feature.ba.go create mode 100644 binapi/feature/feature_rest.ba.go create mode 100644 binapi/feature/feature_rpc.ba.go create mode 100644 binapi/fib_types/fib_types.ba.go create mode 100644 binapi/flowprobe/flowprobe.ba.go create mode 100644 binapi/flowprobe/flowprobe_rest.ba.go create mode 100644 binapi/flowprobe/flowprobe_rpc.ba.go create mode 100644 binapi/gbp/gbp.ba.go create mode 100644 binapi/gbp/gbp_rest.ba.go create mode 100644 binapi/gbp/gbp_rpc.ba.go create mode 100644 binapi/geneve/geneve.ba.go create mode 100644 binapi/geneve/geneve_rest.ba.go create mode 100644 binapi/geneve/geneve_rpc.ba.go create mode 100644 binapi/gre/gre.ba.go create mode 100644 binapi/gre/gre_rest.ba.go create mode 100644 binapi/gre/gre_rpc.ba.go create mode 100644 binapi/gso/gso.ba.go create mode 100644 binapi/gso/gso_rest.ba.go create mode 100644 binapi/gso/gso_rpc.ba.go create mode 100644 binapi/gtpu/gtpu.ba.go create mode 100644 binapi/gtpu/gtpu_rest.ba.go create mode 100644 binapi/gtpu/gtpu_rpc.ba.go create mode 100644 binapi/http_static/http_static.ba.go create mode 100644 binapi/http_static/http_static_rest.ba.go create mode 100644 binapi/http_static/http_static_rpc.ba.go create mode 100644 binapi/igmp/igmp.ba.go create mode 100644 binapi/igmp/igmp_rest.ba.go create mode 100644 binapi/igmp/igmp_rpc.ba.go create mode 100644 binapi/ikev2/ikev2.ba.go create mode 100644 binapi/ikev2/ikev2_rest.ba.go create mode 100644 binapi/ikev2/ikev2_rpc.ba.go create mode 100644 binapi/interface/interface.ba.go create mode 100644 binapi/interface/interface_rest.ba.go create mode 100644 binapi/interface/interface_rpc.ba.go create mode 100644 binapi/interface_types/interface_types.ba.go create mode 100644 binapi/ioam_cache/ioam_cache.ba.go create mode 100644 binapi/ioam_cache/ioam_cache_rest.ba.go create mode 100644 binapi/ioam_cache/ioam_cache_rpc.ba.go create mode 100644 binapi/ioam_export/ioam_export.ba.go create mode 100644 binapi/ioam_export/ioam_export_rest.ba.go create mode 100644 binapi/ioam_export/ioam_export_rpc.ba.go create mode 100644 binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go create mode 100644 binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go create mode 100644 binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rpc.ba.go create mode 100644 binapi/ip/ip.ba.go create mode 100644 binapi/ip/ip_rest.ba.go create mode 100644 binapi/ip/ip_rpc.ba.go create mode 100644 binapi/ip6_nd/ip6_nd.ba.go create mode 100644 binapi/ip6_nd/ip6_nd_rest.ba.go create mode 100644 binapi/ip6_nd/ip6_nd_rpc.ba.go create mode 100644 binapi/ip_neighbor/ip_neighbor.ba.go create mode 100644 binapi/ip_neighbor/ip_neighbor_rest.ba.go create mode 100644 binapi/ip_neighbor/ip_neighbor_rpc.ba.go create mode 100644 binapi/ip_types/ip_types.ba.go create mode 100644 binapi/ipfix_export/ipfix_export.ba.go create mode 100644 binapi/ipfix_export/ipfix_export_rest.ba.go create mode 100644 binapi/ipfix_export/ipfix_export_rpc.ba.go create mode 100644 binapi/ipip/ipip.ba.go create mode 100644 binapi/ipip/ipip_rest.ba.go create mode 100644 binapi/ipip/ipip_rpc.ba.go create mode 100644 binapi/ipsec/ipsec.ba.go create mode 100644 binapi/ipsec/ipsec_rest.ba.go create mode 100644 binapi/ipsec/ipsec_rpc.ba.go create mode 100644 binapi/ipsec_types/ipsec_types.ba.go create mode 100644 binapi/l2/l2.ba.go create mode 100644 binapi/l2/l2_rest.ba.go create mode 100644 binapi/l2/l2_rpc.ba.go create mode 100644 binapi/l2e/l2e.ba.go create mode 100644 binapi/l2e/l2e_rest.ba.go create mode 100644 binapi/l2e/l2e_rpc.ba.go create mode 100644 binapi/l2tp/l2tp.ba.go create mode 100644 binapi/l2tp/l2tp_rest.ba.go create mode 100644 binapi/l2tp/l2tp_rpc.ba.go create mode 100644 binapi/l3xc/l3xc.ba.go create mode 100644 binapi/l3xc/l3xc_rest.ba.go create mode 100644 binapi/l3xc/l3xc_rpc.ba.go create mode 100644 binapi/lacp/lacp.ba.go create mode 100644 binapi/lacp/lacp_rest.ba.go create mode 100644 binapi/lacp/lacp_rpc.ba.go create mode 100644 binapi/lb/lb.ba.go create mode 100644 binapi/lb/lb_rest.ba.go create mode 100644 binapi/lb/lb_rpc.ba.go create mode 100644 binapi/lb_types/lb_types.ba.go create mode 100644 binapi/lisp/lisp.ba.go create mode 100644 binapi/lisp/lisp_rest.ba.go create mode 100644 binapi/lisp/lisp_rpc.ba.go create mode 100644 binapi/lisp_gpe/lisp_gpe.ba.go create mode 100644 binapi/lisp_gpe/lisp_gpe_rest.ba.go create mode 100644 binapi/lisp_gpe/lisp_gpe_rpc.ba.go create mode 100644 binapi/lisp_types/lisp_types.ba.go create mode 100644 binapi/lldp/lldp.ba.go create mode 100644 binapi/lldp/lldp_rest.ba.go create mode 100644 binapi/lldp/lldp_rpc.ba.go create mode 100644 binapi/mactime/mactime.ba.go create mode 100644 binapi/mactime/mactime_rest.ba.go create mode 100644 binapi/mactime/mactime_rpc.ba.go create mode 100644 binapi/map/map.ba.go create mode 100644 binapi/map/map_rest.ba.go create mode 100644 binapi/map/map_rpc.ba.go create mode 100644 binapi/mdata/mdata.ba.go create mode 100644 binapi/mdata/mdata_rest.ba.go create mode 100644 binapi/mdata/mdata_rpc.ba.go create mode 100644 binapi/memclnt/memclnt.ba.go create mode 100644 binapi/memclnt/memclnt_rest.ba.go create mode 100644 binapi/memclnt/memclnt_rpc.ba.go create mode 100644 binapi/memif/memif.ba.go create mode 100644 binapi/memif/memif_rest.ba.go create mode 100644 binapi/memif/memif_rpc.ba.go create mode 100644 binapi/mfib_types/mfib_types.ba.go create mode 100644 binapi/mpls/mpls.ba.go create mode 100644 binapi/mpls/mpls_rest.ba.go create mode 100644 binapi/mpls/mpls_rpc.ba.go create mode 100644 binapi/nat/nat.ba.go create mode 100644 binapi/nat/nat_rest.ba.go create mode 100644 binapi/nat/nat_rpc.ba.go create mode 100644 binapi/nsh/nsh.ba.go create mode 100644 binapi/nsh/nsh_rest.ba.go create mode 100644 binapi/nsh/nsh_rpc.ba.go create mode 100644 binapi/nsim/nsim.ba.go create mode 100644 binapi/nsim/nsim_rest.ba.go create mode 100644 binapi/nsim/nsim_rpc.ba.go create mode 100644 binapi/oddbuf/oddbuf.ba.go create mode 100644 binapi/oddbuf/oddbuf_rest.ba.go create mode 100644 binapi/oddbuf/oddbuf_rpc.ba.go create mode 100644 binapi/one/one.ba.go create mode 100644 binapi/one/one_rest.ba.go create mode 100644 binapi/one/one_rpc.ba.go create mode 100644 binapi/p2p_ethernet/p2p_ethernet.ba.go create mode 100644 binapi/p2p_ethernet/p2p_ethernet_rest.ba.go create mode 100644 binapi/p2p_ethernet/p2p_ethernet_rpc.ba.go create mode 100644 binapi/pci_types/pci_types.ba.go create mode 100644 binapi/pg/pg.ba.go create mode 100644 binapi/pg/pg_rest.ba.go create mode 100644 binapi/pg/pg_rpc.ba.go create mode 100644 binapi/pipe/pipe.ba.go create mode 100644 binapi/pipe/pipe_rest.ba.go create mode 100644 binapi/pipe/pipe_rpc.ba.go create mode 100644 binapi/policer/policer.ba.go create mode 100644 binapi/policer/policer_rest.ba.go create mode 100644 binapi/policer/policer_rpc.ba.go create mode 100644 binapi/policer_types/policer_types.ba.go create mode 100644 binapi/pot/pot.ba.go create mode 100644 binapi/pot/pot_rest.ba.go create mode 100644 binapi/pot/pot_rpc.ba.go create mode 100644 binapi/pppoe/pppoe.ba.go create mode 100644 binapi/pppoe/pppoe_rest.ba.go create mode 100644 binapi/pppoe/pppoe_rpc.ba.go create mode 100644 binapi/punt/punt.ba.go create mode 100644 binapi/punt/punt_rest.ba.go create mode 100644 binapi/punt/punt_rpc.ba.go create mode 100644 binapi/qos/qos.ba.go create mode 100644 binapi/qos/qos_rest.ba.go create mode 100644 binapi/qos/qos_rpc.ba.go create mode 100644 binapi/rd_cp/rd_cp.ba.go create mode 100644 binapi/rd_cp/rd_cp_rest.ba.go create mode 100644 binapi/rd_cp/rd_cp_rpc.ba.go create mode 100644 binapi/rdma/rdma.ba.go create mode 100644 binapi/rdma/rdma_rest.ba.go create mode 100644 binapi/rdma/rdma_rpc.ba.go create mode 100644 binapi/session/session.ba.go create mode 100644 binapi/session/session_rest.ba.go create mode 100644 binapi/session/session_rpc.ba.go create mode 100644 binapi/span/span.ba.go create mode 100644 binapi/span/span_rest.ba.go create mode 100644 binapi/span/span_rpc.ba.go create mode 100644 binapi/sr/sr.ba.go create mode 100644 binapi/sr/sr_rest.ba.go create mode 100644 binapi/sr/sr_rpc.ba.go create mode 100644 binapi/sr_mpls/sr_mpls.ba.go create mode 100644 binapi/sr_mpls/sr_mpls_rest.ba.go create mode 100644 binapi/sr_mpls/sr_mpls_rpc.ba.go create mode 100644 binapi/sr_types/sr_types.ba.go create mode 100644 binapi/stn/stn.ba.go create mode 100644 binapi/stn/stn_rest.ba.go create mode 100644 binapi/stn/stn_rpc.ba.go create mode 100644 binapi/svs/svs.ba.go create mode 100644 binapi/svs/svs_rest.ba.go create mode 100644 binapi/svs/svs_rpc.ba.go create mode 100644 binapi/syslog/syslog.ba.go create mode 100644 binapi/syslog/syslog_rest.ba.go create mode 100644 binapi/syslog/syslog_rpc.ba.go create mode 100644 binapi/tapv2/tapv2.ba.go create mode 100644 binapi/tapv2/tapv2_rest.ba.go create mode 100644 binapi/tapv2/tapv2_rpc.ba.go create mode 100644 binapi/tcp/tcp.ba.go create mode 100644 binapi/tcp/tcp_rest.ba.go create mode 100644 binapi/tcp/tcp_rpc.ba.go create mode 100644 binapi/teib/teib.ba.go create mode 100644 binapi/teib/teib_rest.ba.go create mode 100644 binapi/teib/teib_rpc.ba.go create mode 100644 binapi/tls_openssl/tls_openssl.ba.go create mode 100644 binapi/tls_openssl/tls_openssl_rest.ba.go create mode 100644 binapi/tls_openssl/tls_openssl_rpc.ba.go create mode 100644 binapi/trace/trace.ba.go create mode 100644 binapi/trace/trace_rest.ba.go create mode 100644 binapi/trace/trace_rpc.ba.go create mode 100644 binapi/tunnel_types/tunnel_types.ba.go create mode 100644 binapi/udp/udp.ba.go create mode 100644 binapi/udp/udp_rest.ba.go create mode 100644 binapi/udp/udp_rpc.ba.go create mode 100644 binapi/udp_ping/udp_ping.ba.go create mode 100644 binapi/udp_ping/udp_ping_rest.ba.go create mode 100644 binapi/udp_ping/udp_ping_rpc.ba.go create mode 100644 binapi/urpf/urpf.ba.go create mode 100644 binapi/urpf/urpf_rest.ba.go create mode 100644 binapi/urpf/urpf_rpc.ba.go create mode 100644 binapi/vhost_user/vhost_user.ba.go create mode 100644 binapi/vhost_user/vhost_user_rest.ba.go create mode 100644 binapi/vhost_user/vhost_user_rpc.ba.go create mode 100644 binapi/virtio/virtio.ba.go create mode 100644 binapi/virtio/virtio_rest.ba.go create mode 100644 binapi/virtio/virtio_rpc.ba.go create mode 100644 binapi/virtio_types/virtio_types.ba.go create mode 100644 binapi/vmxnet3/vmxnet3.ba.go create mode 100644 binapi/vmxnet3/vmxnet3_rest.ba.go create mode 100644 binapi/vmxnet3/vmxnet3_rpc.ba.go create mode 100644 binapi/vpe/vpe.ba.go create mode 100644 binapi/vpe/vpe_rest.ba.go create mode 100644 binapi/vpe/vpe_rpc.ba.go create mode 100644 binapi/vpe_types/vpe_types.ba.go create mode 100644 binapi/vrrp/vrrp.ba.go create mode 100644 binapi/vrrp/vrrp_rest.ba.go create mode 100644 binapi/vrrp/vrrp_rpc.ba.go create mode 100644 binapi/vxlan/vxlan.ba.go create mode 100644 binapi/vxlan/vxlan_rest.ba.go create mode 100644 binapi/vxlan/vxlan_rpc.ba.go create mode 100644 binapi/vxlan_gbp/vxlan_gbp.ba.go create mode 100644 binapi/vxlan_gbp/vxlan_gbp_rest.ba.go create mode 100644 binapi/vxlan_gbp/vxlan_gbp_rpc.ba.go create mode 100644 binapi/vxlan_gpe/vxlan_gpe.ba.go create mode 100644 binapi/vxlan_gpe/vxlan_gpe_rest.ba.go create mode 100644 binapi/vxlan_gpe/vxlan_gpe_rpc.ba.go create mode 100644 binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go create mode 100644 binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rest.ba.go create mode 100644 binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export_rpc.ba.go create mode 100644 binapigen/binapigen_test.go create mode 100644 binapigen/gen_encoding.go create mode 100644 binapigen/gen_helpers.go create mode 100644 binapigen/gen_helpers_test.go create mode 100644 binapigen/gen_rest.go create mode 100644 binapigen/gen_rpc.go delete mode 100644 binapigen/generate_rpc.go create mode 100644 binapigen/plugin.go delete mode 100644 binapigen/validate.go create mode 100644 binapigen/vppapi.go delete mode 100644 binapigen/vppapi/api.go create mode 100644 binapigen/vppapi/api_schema.go delete mode 100644 binapigen/vppapi/parser.go delete mode 100644 binapigen/vppapi/parser_test.go create mode 100644 binapigen/vppapi/util.go create mode 100644 binapigen/vppapi/vppapi.go create mode 100644 binapigen/vppapi/vppapi_test.go delete mode 100644 cmd/binapi-generator/util.go create mode 100644 cmd/govpp/main.go delete mode 100644 codec/testdata/binapi2001/acl/acl.ba.go delete mode 100644 codec/testdata/binapi2001/acl/acl_rpc.ba.go delete mode 100644 codec/testdata/binapi2001/af_packet/af_packet.ba.go delete mode 100644 codec/testdata/binapi2001/af_packet/af_packet_rpc.ba.go delete mode 100644 codec/testdata/binapi2001/interfaces/interfaces.ba.go delete mode 100644 codec/testdata/binapi2001/interfaces/interfaces_rpc.ba.go delete mode 100644 codec/testdata/binapi2001/ip/ip.ba.go delete mode 100644 codec/testdata/binapi2001/ip/ip_rpc.ba.go delete mode 100644 codec/testdata/binapi2001/memclnt/memclnt.ba.go delete mode 100644 codec/testdata/binapi2001/memclnt/memclnt_rpc.ba.go delete mode 100644 codec/testdata/binapi2001/memif/memif.ba.go delete mode 100644 codec/testdata/binapi2001/memif/memif_rpc.ba.go delete mode 100644 codec/testdata/binapi2001/sr/sr.ba.go delete mode 100644 codec/testdata/binapi2001/sr/sr_rpc.ba.go delete mode 100644 codec/testdata/binapi2001/vpe/vpe.ba.go delete mode 100644 codec/testdata/binapi2001/vpe/vpe_rpc.ba.go create mode 100644 examples/binapi-types/binapi_types.go delete mode 100644 examples/binapi/acl/acl.ba.go delete mode 100644 examples/binapi/acl/acl_rpc.ba.go delete mode 100644 examples/binapi/af_packet/af_packet.ba.go delete mode 100644 examples/binapi/af_packet/af_packet_rpc.ba.go delete mode 100644 examples/binapi/fib_types/fib_types.ba.go delete mode 100644 examples/binapi/gen.go delete mode 100644 examples/binapi/interface_types/interface_types.ba.go delete mode 100644 examples/binapi/interfaces/interfaces.ba.go delete mode 100644 examples/binapi/interfaces/interfaces_rpc.ba.go delete mode 100644 examples/binapi/ip/ip.ba.go delete mode 100644 examples/binapi/ip/ip_rpc.ba.go delete mode 100644 examples/binapi/ip_types/ip_types.ba.go delete mode 100644 examples/binapi/mactime/mactime.ba.go delete mode 100644 examples/binapi/mactime/mactime_rpc.ba.go delete mode 100644 examples/binapi/memif/memif.ba.go delete mode 100644 examples/binapi/memif/memif_rpc.ba.go delete mode 100644 examples/binapi/sr/sr.ba.go delete mode 100644 examples/binapi/sr/sr_rpc.ba.go delete mode 100644 examples/binapi/vpe/vpe.ba.go delete mode 100644 examples/binapi/vpe/vpe_rpc.ba.go delete mode 100644 examples/union-example/union_example.go create mode 100644 gen.go create mode 100644 internal/testbinapi/binapi2001/acl/acl.ba.go create mode 100644 internal/testbinapi/binapi2001/acl/acl_rpc.ba.go create mode 100644 internal/testbinapi/binapi2001/af_packet/af_packet.ba.go create mode 100644 internal/testbinapi/binapi2001/af_packet/af_packet_rpc.ba.go create mode 100644 internal/testbinapi/binapi2001/interfaces/interfaces.ba.go create mode 100644 internal/testbinapi/binapi2001/interfaces/interfaces_rpc.ba.go create mode 100644 internal/testbinapi/binapi2001/ip/ip.ba.go create mode 100644 internal/testbinapi/binapi2001/ip/ip_rpc.ba.go create mode 100644 internal/testbinapi/binapi2001/memclnt/memclnt.ba.go create mode 100644 internal/testbinapi/binapi2001/memclnt/memclnt_rpc.ba.go create mode 100644 internal/testbinapi/binapi2001/memif/memif.ba.go create mode 100644 internal/testbinapi/binapi2001/memif/memif_rpc.ba.go create mode 100644 internal/testbinapi/binapi2001/sr/sr.ba.go create mode 100644 internal/testbinapi/binapi2001/sr/sr_rpc.ba.go create mode 100644 internal/testbinapi/binapi2001/vpe/vpe.ba.go create mode 100644 internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go create mode 100644 internal/version/version.go delete mode 100644 version/version.go diff --git a/Makefile b/Makefile index c2ae179..bd11c26 100644 --- a/Makefile +++ b/Makefile @@ -38,13 +38,7 @@ endif VPP_VERSION = $(shell dpkg-query -f '\${Version}' -W vpp) VPP_IMG ?= ligato/vpp-base:latest -BINAPI_DIR ?= ./examples/binapi - -help: - @echo "List of make targets:" - grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' - -.DEFAULT = help +BINAPI_DIR ?= ./binapi bin: mkdir -p bin @@ -64,6 +58,7 @@ clean: ## Clean all $(GO) clean -v ./... test: ## Run unit tests + $(GO) version @echo "# running tests" $(GO) test -tags="${GO_BUILD_TAGS}" ./... @@ -79,7 +74,7 @@ install: install-generator install-proxy ## Install all install-generator: ## Install binapi-generator @echo "# installing binapi-generator ${VERSION}" - $(GO) install ${GO_BUILD_ARGS} ./cmd/binapi-generator + @$(GO) install ${GO_BUILD_ARGS} ./cmd/binapi-generator install-proxy: ## Install vpp-proxy @echo "# installing vpp-proxy ${VERSION}" @@ -107,6 +102,11 @@ gen-binapi-docker: install-generator ## Generate binapi code (using Docker) extras: @make -C extras +help: + @echo "List of make targets:" + grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +.DEFAULT = help .PHONY: help \ build cmd examples clean \ diff --git a/adapter/mock/mock_vpp_adapter.go b/adapter/mock/mock_vpp_adapter.go index c05148d..b7fa002 100644 --- a/adapter/mock/mock_vpp_adapter.go +++ b/adapter/mock/mock_vpp_adapter.go @@ -17,7 +17,7 @@ package mock import ( - "bytes" + "encoding/binary" "log" "reflect" "sync" @@ -26,7 +26,6 @@ import ( "git.fd.io/govpp.git/adapter/mock/binapi" "git.fd.io/govpp.git/api" "git.fd.io/govpp.git/codec" - "github.com/lunixbochs/struc" ) type replyMode int @@ -58,6 +57,38 @@ type defaultReply struct { Retval int32 } +func (*defaultReply) GetMessageName() string { return "mock_default_reply" } +func (*defaultReply) GetCrcString() string { return "xxxxxxxx" } +func (*defaultReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} +func (m *defaultReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *defaultReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + // field[1] m.Retval + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *defaultReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + // field[1] m.Retval + m.Retval = int32(buf.DecodeUint32()) + return nil +} + // MessageDTO is a structure used for propagating information to ReplyHandlers. type MessageDTO struct { MsgID uint16 @@ -178,19 +209,16 @@ func (a *VppAdapter) ReplyBytes(request MessageDTO, reply api.Message) ([]byte, } log.Println("ReplyBytes ", replyMsgID, " ", reply.GetMessageName(), " clientId: ", request.ClientID) - buf := new(bytes.Buffer) - err = struc.Pack(buf, &codec.VppReplyHeader{ - VlMsgID: replyMsgID, - Context: request.ClientID, - }) + data, err := codec.DefaultCodec.EncodeMsg(reply, replyMsgID) if err != nil { return nil, err } - if err = struc.Pack(buf, reply); err != nil { - return nil, err + if reply.GetMessageType() == api.ReplyMessage { + binary.BigEndian.PutUint32(data[2:6], request.ClientID) + } else if reply.GetMessageType() == api.RequestMessage { + binary.BigEndian.PutUint32(data[6:10], request.ClientID) } - - return buf.Bytes(), nil + return data, nil } // GetMsgID returns mocked message ID for the given message name and CRC. @@ -229,16 +257,14 @@ func (a *VppAdapter) SendMsg(clientID uint32, data []byte) error { for i := len(a.replyHandlers) - 1; i >= 0; i-- { replyHandler := a.replyHandlers[i] - buf := bytes.NewReader(data) - reqHeader := codec.VppRequestHeader{} - struc.Unpack(buf, &reqHeader) + msgID := binary.BigEndian.Uint16(data[0:2]) a.access.Lock() - reqMsgName := a.msgIDsToName[reqHeader.VlMsgID] + reqMsgName := a.msgIDsToName[msgID] a.access.Unlock() reply, msgID, finished := replyHandler(MessageDTO{ - MsgID: reqHeader.VlMsgID, + MsgID: msgID, MsgName: reqMsgName, ClientID: clientID, Data: data, @@ -259,23 +285,21 @@ func (a *VppAdapter) SendMsg(clientID uint32, data []byte) error { reply := a.replies[0] for _, msg := range reply.msgs { msgID, _ := a.GetMsgID(msg.Msg.GetMessageName(), msg.Msg.GetCrcString()) - buf := new(bytes.Buffer) context := clientID if msg.hasCtx { context = setMultipart(context, msg.Multipart) context = setSeqNum(context, msg.SeqNum) } + data, err := codec.DefaultCodec.EncodeMsg(msg.Msg, msgID) + if err != nil { + panic(err) + } if msg.Msg.GetMessageType() == api.ReplyMessage { - struc.Pack(buf, &codec.VppReplyHeader{VlMsgID: msgID, Context: context}) + binary.BigEndian.PutUint32(data[2:6], context) } else if msg.Msg.GetMessageType() == api.RequestMessage { - struc.Pack(buf, &codec.VppRequestHeader{VlMsgID: msgID, Context: context}) - } else if msg.Msg.GetMessageType() == api.EventMessage { - struc.Pack(buf, &codec.VppEventHeader{VlMsgID: msgID}) - } else { - struc.Pack(buf, &codec.VppOtherHeader{VlMsgID: msgID}) + binary.BigEndian.PutUint32(data[6:10], context) } - struc.Pack(buf, msg.Msg) - a.callback(msgID, buf.Bytes()) + a.callback(msgID, data) } a.replies = a.replies[1:] @@ -290,11 +314,13 @@ func (a *VppAdapter) SendMsg(clientID uint32, data []byte) error { //fallthrough default: // return default reply - buf := new(bytes.Buffer) msgID := uint16(defaultReplyMsgID) - struc.Pack(buf, &codec.VppReplyHeader{VlMsgID: msgID, Context: clientID}) - struc.Pack(buf, &defaultReply{}) - a.callback(msgID, buf.Bytes()) + data, err := codec.DefaultCodec.EncodeMsg(&defaultReply{}, msgID) + if err != nil { + panic(err) + } + binary.BigEndian.PutUint32(data[2:6], clientID) + a.callback(msgID, data) } return nil } @@ -374,7 +400,7 @@ func (a *VppAdapter) MockReplyHandler(replyHandler ReplyHandler) { // MockClearReplyHanders clears all reply handlers that were registered // Will also set the mode to useReplyHandlers -func (a *VppAdapter) MockClearReplyHandlers () { +func (a *VppAdapter) MockClearReplyHandlers() { a.repliesLock.Lock() defer a.repliesLock.Unlock() diff --git a/adapter/socketclient/binapi/gen.go b/adapter/socketclient/binapi/gen.go deleted file mode 100644 index eb64401..0000000 --- a/adapter/socketclient/binapi/gen.go +++ /dev/null @@ -1,5 +0,0 @@ -package binapi - -// Generate Go code from the VPP APIs located in the /usr/share/vpp/api directory. - -//go:generate binapi-generator -include-services=false memclnt diff --git a/adapter/socketclient/binapi/memclnt/memclnt.ba.go b/adapter/socketclient/binapi/memclnt/memclnt.ba.go deleted file mode 100644 index 7dba64e..0000000 --- a/adapter/socketclient/binapi/memclnt/memclnt.ba.go +++ /dev/null @@ -1,1456 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/memclnt.api.json - -/* -Package memclnt contains generated code for VPP API file memclnt.api (2.1.0). - -It consists of: - 22 messages - 2 types -*/ -package memclnt - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "memclnt" - // APIVersion is the API version of this module. - APIVersion = "2.1.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0x8d3dd881 -) - -// MessageTableEntry represents VPP binary API type 'message_table_entry'. -type MessageTableEntry struct { - Index uint16 `binapi:"u16,name=index" json:"index,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (*MessageTableEntry) GetTypeName() string { return "message_table_entry" } - -// ModuleVersion represents VPP binary API type 'module_version'. -type ModuleVersion struct { - Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` - Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` - Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (*ModuleVersion) GetTypeName() string { return "module_version" } - -// APIVersions represents VPP binary API message 'api_versions'. -type APIVersions struct{} - -func (m *APIVersions) Reset() { *m = APIVersions{} } -func (*APIVersions) GetMessageName() string { return "api_versions" } -func (*APIVersions) GetCrcString() string { return "51077d14" } -func (*APIVersions) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *APIVersions) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *APIVersions) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *APIVersions) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// APIVersionsReply represents VPP binary API message 'api_versions_reply'. -type APIVersionsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=APIVersions"` - APIVersions []ModuleVersion `binapi:"module_version[count],name=api_versions" json:"api_versions,omitempty"` -} - -func (m *APIVersionsReply) Reset() { *m = APIVersionsReply{} } -func (*APIVersionsReply) GetMessageName() string { return "api_versions_reply" } -func (*APIVersionsReply) GetCrcString() string { return "5f0d99d6" } -func (*APIVersionsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *APIVersionsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.Count - size += 4 - // field[1] m.APIVersions - for j1 := 0; j1 < len(m.APIVersions); j1++ { - var s1 ModuleVersion - _ = s1 - if j1 < len(m.APIVersions) { - s1 = m.APIVersions[j1] - } - // field[2] s1.Major - size += 4 - // field[2] s1.Minor - size += 4 - // field[2] s1.Patch - size += 4 - // field[2] s1.Name - size += 64 - } - return size -} -func (m *APIVersionsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.APIVersions))) - pos += 4 - // field[1] m.APIVersions - for j1 := 0; j1 < len(m.APIVersions); j1++ { - var v1 ModuleVersion - if j1 < len(m.APIVersions) { - v1 = m.APIVersions[j1] - } - // field[2] v1.Major - o.PutUint32(buf[pos:pos+4], uint32(v1.Major)) - pos += 4 - // field[2] v1.Minor - o.PutUint32(buf[pos:pos+4], uint32(v1.Minor)) - pos += 4 - // field[2] v1.Patch - o.PutUint32(buf[pos:pos+4], uint32(v1.Patch)) - pos += 4 - // field[2] v1.Name - copy(buf[pos:pos+64], v1.Name) - pos += 64 - } - return buf, nil -} -func (m *APIVersionsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.APIVersions - m.APIVersions = make([]ModuleVersion, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.APIVersions[j1].Major - m.APIVersions[j1].Major = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.APIVersions[j1].Minor - m.APIVersions[j1].Minor = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.APIVersions[j1].Patch - m.APIVersions[j1].Patch = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.APIVersions[j1].Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.APIVersions[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - } - return nil -} - -// GetFirstMsgID represents VPP binary API message 'get_first_msg_id'. -type GetFirstMsgID struct { - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (m *GetFirstMsgID) Reset() { *m = GetFirstMsgID{} } -func (*GetFirstMsgID) GetMessageName() string { return "get_first_msg_id" } -func (*GetFirstMsgID) GetCrcString() string { return "ebf79a66" } -func (*GetFirstMsgID) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetFirstMsgID) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Name - size += 64 - return size -} -func (m *GetFirstMsgID) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Name - copy(buf[pos:pos+64], m.Name) - pos += 64 - return buf, nil -} -func (m *GetFirstMsgID) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply'. -type GetFirstMsgIDReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` -} - -func (m *GetFirstMsgIDReply) Reset() { *m = GetFirstMsgIDReply{} } -func (*GetFirstMsgIDReply) GetMessageName() string { return "get_first_msg_id_reply" } -func (*GetFirstMsgIDReply) GetCrcString() string { return "7d337472" } -func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetFirstMsgIDReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.FirstMsgID - size += 2 - return size -} -func (m *GetFirstMsgIDReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.FirstMsgID - o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) - pos += 2 - return buf, nil -} -func (m *GetFirstMsgIDReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.FirstMsgID - m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -// MemclntCreate represents VPP binary API message 'memclnt_create'. -type MemclntCreate struct { - CtxQuota int32 `binapi:"i32,name=ctx_quota" json:"ctx_quota,omitempty"` - InputQueue uint64 `binapi:"u64,name=input_queue" json:"input_queue,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` - APIVersions []uint32 `binapi:"u32[8],name=api_versions" json:"api_versions,omitempty" struc:"[8]uint32"` -} - -func (m *MemclntCreate) Reset() { *m = MemclntCreate{} } -func (*MemclntCreate) GetMessageName() string { return "memclnt_create" } -func (*MemclntCreate) GetCrcString() string { return "9c5e1c2f" } -func (*MemclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemclntCreate) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.CtxQuota - size += 4 - // field[1] m.InputQueue - size += 8 - // field[1] m.Name - size += 64 - // field[1] m.APIVersions - size += 32 - return size -} -func (m *MemclntCreate) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.CtxQuota - o.PutUint32(buf[pos:pos+4], uint32(m.CtxQuota)) - pos += 4 - // field[1] m.InputQueue - o.PutUint64(buf[pos:pos+8], uint64(m.InputQueue)) - pos += 8 - // field[1] m.Name - copy(buf[pos:pos+64], m.Name) - pos += 64 - // field[1] m.APIVersions - for i := 0; i < 8; i++ { - var x uint32 - if i < len(m.APIVersions) { - x = uint32(m.APIVersions[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *MemclntCreate) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.CtxQuota - m.CtxQuota = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.InputQueue - m.InputQueue = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.APIVersions - m.APIVersions = make([]uint32, 8) - for i := 0; i < len(m.APIVersions); i++ { - m.APIVersions[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply'. -type MemclntCreateReply struct { - Response int32 `binapi:"i32,name=response" json:"response,omitempty"` - Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` - MessageTable uint64 `binapi:"u64,name=message_table" json:"message_table,omitempty"` -} - -func (m *MemclntCreateReply) Reset() { *m = MemclntCreateReply{} } -func (*MemclntCreateReply) GetMessageName() string { return "memclnt_create_reply" } -func (*MemclntCreateReply) GetCrcString() string { return "42ec4560" } -func (*MemclntCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemclntCreateReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Response - size += 4 - // field[1] m.Handle - size += 8 - // field[1] m.Index - size += 4 - // field[1] m.MessageTable - size += 8 - return size -} -func (m *MemclntCreateReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Response - o.PutUint32(buf[pos:pos+4], uint32(m.Response)) - pos += 4 - // field[1] m.Handle - o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) - pos += 8 - // field[1] m.Index - o.PutUint32(buf[pos:pos+4], uint32(m.Index)) - pos += 4 - // field[1] m.MessageTable - o.PutUint64(buf[pos:pos+8], uint64(m.MessageTable)) - pos += 8 - return buf, nil -} -func (m *MemclntCreateReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Response - m.Response = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Handle - m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.Index - m.Index = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MessageTable - m.MessageTable = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// MemclntDelete represents VPP binary API message 'memclnt_delete'. -type MemclntDelete struct { - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` - Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` - DoCleanup bool `binapi:"bool,name=do_cleanup" json:"do_cleanup,omitempty"` -} - -func (m *MemclntDelete) Reset() { *m = MemclntDelete{} } -func (*MemclntDelete) GetMessageName() string { return "memclnt_delete" } -func (*MemclntDelete) GetCrcString() string { return "7e1c04e3" } -func (*MemclntDelete) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *MemclntDelete) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Index - size += 4 - // field[1] m.Handle - size += 8 - // field[1] m.DoCleanup - size += 1 - return size -} -func (m *MemclntDelete) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Index - o.PutUint32(buf[pos:pos+4], uint32(m.Index)) - pos += 4 - // field[1] m.Handle - o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) - pos += 8 - // field[1] m.DoCleanup - if m.DoCleanup { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *MemclntDelete) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Index - m.Index = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Handle - m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.DoCleanup - m.DoCleanup = tmp[pos] != 0 - pos += 1 - return nil -} - -// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply'. -type MemclntDeleteReply struct { - Response int32 `binapi:"i32,name=response" json:"response,omitempty"` - Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` -} - -func (m *MemclntDeleteReply) Reset() { *m = MemclntDeleteReply{} } -func (*MemclntDeleteReply) GetMessageName() string { return "memclnt_delete_reply" } -func (*MemclntDeleteReply) GetCrcString() string { return "3d3b6312" } -func (*MemclntDeleteReply) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *MemclntDeleteReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Response - size += 4 - // field[1] m.Handle - size += 8 - return size -} -func (m *MemclntDeleteReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Response - o.PutUint32(buf[pos:pos+4], uint32(m.Response)) - pos += 4 - // field[1] m.Handle - o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) - pos += 8 - return buf, nil -} -func (m *MemclntDeleteReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Response - m.Response = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Handle - m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive'. -type MemclntKeepalive struct{} - -func (m *MemclntKeepalive) Reset() { *m = MemclntKeepalive{} } -func (*MemclntKeepalive) GetMessageName() string { return "memclnt_keepalive" } -func (*MemclntKeepalive) GetCrcString() string { return "51077d14" } -func (*MemclntKeepalive) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemclntKeepalive) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MemclntKeepalive) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MemclntKeepalive) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply'. -type MemclntKeepaliveReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MemclntKeepaliveReply) Reset() { *m = MemclntKeepaliveReply{} } -func (*MemclntKeepaliveReply) GetMessageName() string { return "memclnt_keepalive_reply" } -func (*MemclntKeepaliveReply) GetCrcString() string { return "e8d4e804" } -func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemclntKeepaliveReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MemclntKeepaliveReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MemclntKeepaliveReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout'. -type MemclntReadTimeout struct { - Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` -} - -func (m *MemclntReadTimeout) Reset() { *m = MemclntReadTimeout{} } -func (*MemclntReadTimeout) GetMessageName() string { return "memclnt_read_timeout" } -func (*MemclntReadTimeout) GetCrcString() string { return "c3a3a452" } -func (*MemclntReadTimeout) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *MemclntReadTimeout) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Dummy - size += 1 - return size -} -func (m *MemclntReadTimeout) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Dummy - buf[pos] = uint8(m.Dummy) - pos += 1 - return buf, nil -} -func (m *MemclntReadTimeout) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Dummy - m.Dummy = uint8(tmp[pos]) - pos += 1 - return nil -} - -// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend'. -type MemclntRxThreadSuspend struct { - Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` -} - -func (m *MemclntRxThreadSuspend) Reset() { *m = MemclntRxThreadSuspend{} } -func (*MemclntRxThreadSuspend) GetMessageName() string { return "memclnt_rx_thread_suspend" } -func (*MemclntRxThreadSuspend) GetCrcString() string { return "c3a3a452" } -func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *MemclntRxThreadSuspend) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Dummy - size += 1 - return size -} -func (m *MemclntRxThreadSuspend) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Dummy - buf[pos] = uint8(m.Dummy) - pos += 1 - return buf, nil -} -func (m *MemclntRxThreadSuspend) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Dummy - m.Dummy = uint8(tmp[pos]) - pos += 1 - return nil -} - -// RPCCall represents VPP binary API message 'rpc_call'. -type RPCCall struct { - Function uint64 `binapi:"u64,name=function" json:"function,omitempty"` - Multicast uint8 `binapi:"u8,name=multicast" json:"multicast,omitempty"` - NeedBarrierSync uint8 `binapi:"u8,name=need_barrier_sync" json:"need_barrier_sync,omitempty"` - SendReply uint8 `binapi:"u8,name=send_reply" json:"send_reply,omitempty"` - DataLen uint32 `binapi:"u32,name=data_len" json:"data_len,omitempty" struc:"sizeof=Data"` - Data []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"` -} - -func (m *RPCCall) Reset() { *m = RPCCall{} } -func (*RPCCall) GetMessageName() string { return "rpc_call" } -func (*RPCCall) GetCrcString() string { return "7e8a2c95" } -func (*RPCCall) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *RPCCall) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Function - size += 8 - // field[1] m.Multicast - size += 1 - // field[1] m.NeedBarrierSync - size += 1 - // field[1] m.SendReply - size += 1 - // field[1] m.DataLen - size += 4 - // field[1] m.Data - size += 1 * len(m.Data) - return size -} -func (m *RPCCall) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Function - o.PutUint64(buf[pos:pos+8], uint64(m.Function)) - pos += 8 - // field[1] m.Multicast - buf[pos] = uint8(m.Multicast) - pos += 1 - // field[1] m.NeedBarrierSync - buf[pos] = uint8(m.NeedBarrierSync) - pos += 1 - // field[1] m.SendReply - buf[pos] = uint8(m.SendReply) - pos += 1 - // field[1] m.DataLen - o.PutUint32(buf[pos:pos+4], uint32(len(m.Data))) - pos += 4 - // field[1] m.Data - for i := 0; i < len(m.Data); i++ { - var x uint8 - if i < len(m.Data) { - x = uint8(m.Data[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *RPCCall) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Function - m.Function = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.Multicast - m.Multicast = uint8(tmp[pos]) - pos += 1 - // field[1] m.NeedBarrierSync - m.NeedBarrierSync = uint8(tmp[pos]) - pos += 1 - // field[1] m.SendReply - m.SendReply = uint8(tmp[pos]) - pos += 1 - // field[1] m.DataLen - m.DataLen = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Data - m.Data = make([]uint8, m.DataLen) - for i := 0; i < len(m.Data); i++ { - m.Data[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// RPCCallReply represents VPP binary API message 'rpc_call_reply'. -type RPCCallReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *RPCCallReply) Reset() { *m = RPCCallReply{} } -func (*RPCCallReply) GetMessageName() string { return "rpc_call_reply" } -func (*RPCCallReply) GetCrcString() string { return "e8d4e804" } -func (*RPCCallReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *RPCCallReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *RPCCallReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *RPCCallReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// RxThreadExit represents VPP binary API message 'rx_thread_exit'. -type RxThreadExit struct { - Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` -} - -func (m *RxThreadExit) Reset() { *m = RxThreadExit{} } -func (*RxThreadExit) GetMessageName() string { return "rx_thread_exit" } -func (*RxThreadExit) GetCrcString() string { return "c3a3a452" } -func (*RxThreadExit) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *RxThreadExit) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Dummy - size += 1 - return size -} -func (m *RxThreadExit) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Dummy - buf[pos] = uint8(m.Dummy) - pos += 1 - return buf, nil -} -func (m *RxThreadExit) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Dummy - m.Dummy = uint8(tmp[pos]) - pos += 1 - return nil -} - -// SockInitShm represents VPP binary API message 'sock_init_shm'. -type SockInitShm struct { - RequestedSize uint32 `binapi:"u32,name=requested_size" json:"requested_size,omitempty"` - Nitems uint8 `binapi:"u8,name=nitems" json:"nitems,omitempty" struc:"sizeof=Configs"` - Configs []uint64 `binapi:"u64[nitems],name=configs" json:"configs,omitempty"` -} - -func (m *SockInitShm) Reset() { *m = SockInitShm{} } -func (*SockInitShm) GetMessageName() string { return "sock_init_shm" } -func (*SockInitShm) GetCrcString() string { return "51646d92" } -func (*SockInitShm) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SockInitShm) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.RequestedSize - size += 4 - // field[1] m.Nitems - size += 1 - // field[1] m.Configs - size += 8 * len(m.Configs) - return size -} -func (m *SockInitShm) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.RequestedSize - o.PutUint32(buf[pos:pos+4], uint32(m.RequestedSize)) - pos += 4 - // field[1] m.Nitems - buf[pos] = uint8(len(m.Configs)) - pos += 1 - // field[1] m.Configs - for i := 0; i < len(m.Configs); i++ { - var x uint64 - if i < len(m.Configs) { - x = uint64(m.Configs[i]) - } - o.PutUint64(buf[pos:pos+8], uint64(x)) - pos += 8 - } - return buf, nil -} -func (m *SockInitShm) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.RequestedSize - m.RequestedSize = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Nitems - m.Nitems = uint8(tmp[pos]) - pos += 1 - // field[1] m.Configs - m.Configs = make([]uint64, m.Nitems) - for i := 0; i < len(m.Configs); i++ { - m.Configs[i] = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - } - return nil -} - -// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply'. -type SockInitShmReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SockInitShmReply) Reset() { *m = SockInitShmReply{} } -func (*SockInitShmReply) GetMessageName() string { return "sock_init_shm_reply" } -func (*SockInitShmReply) GetCrcString() string { return "e8d4e804" } -func (*SockInitShmReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SockInitShmReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SockInitShmReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SockInitShmReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SockclntCreate represents VPP binary API message 'sockclnt_create'. -type SockclntCreate struct { - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (m *SockclntCreate) Reset() { *m = SockclntCreate{} } -func (*SockclntCreate) GetMessageName() string { return "sockclnt_create" } -func (*SockclntCreate) GetCrcString() string { return "455fb9c4" } -func (*SockclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SockclntCreate) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Name - size += 64 - return size -} -func (m *SockclntCreate) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Name - copy(buf[pos:pos+64], m.Name) - pos += 64 - return buf, nil -} -func (m *SockclntCreate) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'. -type SockclntCreateReply struct { - Response int32 `binapi:"i32,name=response" json:"response,omitempty"` - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` - Count uint16 `binapi:"u16,name=count" json:"count,omitempty" struc:"sizeof=MessageTable"` - MessageTable []MessageTableEntry `binapi:"message_table_entry[count],name=message_table" json:"message_table,omitempty"` -} - -func (m *SockclntCreateReply) Reset() { *m = SockclntCreateReply{} } -func (*SockclntCreateReply) GetMessageName() string { return "sockclnt_create_reply" } -func (*SockclntCreateReply) GetCrcString() string { return "35166268" } -func (*SockclntCreateReply) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SockclntCreateReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Response - size += 4 - // field[1] m.Index - size += 4 - // field[1] m.Count - size += 2 - // field[1] m.MessageTable - for j1 := 0; j1 < len(m.MessageTable); j1++ { - var s1 MessageTableEntry - _ = s1 - if j1 < len(m.MessageTable) { - s1 = m.MessageTable[j1] - } - // field[2] s1.Index - size += 2 - // field[2] s1.Name - size += 64 - } - return size -} -func (m *SockclntCreateReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Response - o.PutUint32(buf[pos:pos+4], uint32(m.Response)) - pos += 4 - // field[1] m.Index - o.PutUint32(buf[pos:pos+4], uint32(m.Index)) - pos += 4 - // field[1] m.Count - o.PutUint16(buf[pos:pos+2], uint16(len(m.MessageTable))) - pos += 2 - // field[1] m.MessageTable - for j1 := 0; j1 < len(m.MessageTable); j1++ { - var v1 MessageTableEntry - if j1 < len(m.MessageTable) { - v1 = m.MessageTable[j1] - } - // field[2] v1.Index - o.PutUint16(buf[pos:pos+2], uint16(v1.Index)) - pos += 2 - // field[2] v1.Name - copy(buf[pos:pos+64], v1.Name) - pos += 64 - } - return buf, nil -} -func (m *SockclntCreateReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Response - m.Response = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Index - m.Index = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.MessageTable - m.MessageTable = make([]MessageTableEntry, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.MessageTable[j1].Index - m.MessageTable[j1].Index = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.MessageTable[j1].Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.MessageTable[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - } - return nil -} - -// SockclntDelete represents VPP binary API message 'sockclnt_delete'. -type SockclntDelete struct { - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` -} - -func (m *SockclntDelete) Reset() { *m = SockclntDelete{} } -func (*SockclntDelete) GetMessageName() string { return "sockclnt_delete" } -func (*SockclntDelete) GetCrcString() string { return "8ac76db6" } -func (*SockclntDelete) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SockclntDelete) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Index - size += 4 - return size -} -func (m *SockclntDelete) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Index - o.PutUint32(buf[pos:pos+4], uint32(m.Index)) - pos += 4 - return buf, nil -} -func (m *SockclntDelete) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Index - m.Index = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'. -type SockclntDeleteReply struct { - Response int32 `binapi:"i32,name=response" json:"response,omitempty"` -} - -func (m *SockclntDeleteReply) Reset() { *m = SockclntDeleteReply{} } -func (*SockclntDeleteReply) GetMessageName() string { return "sockclnt_delete_reply" } -func (*SockclntDeleteReply) GetCrcString() string { return "8f38b1ee" } -func (*SockclntDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SockclntDeleteReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Response - size += 4 - return size -} -func (m *SockclntDeleteReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Response - o.PutUint32(buf[pos:pos+4], uint32(m.Response)) - pos += 4 - return buf, nil -} -func (m *SockclntDeleteReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Response - m.Response = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids'. -type TracePluginMsgIds struct { - PluginName string `binapi:"string[128],name=plugin_name" json:"plugin_name,omitempty" struc:"[128]byte"` - FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` - LastMsgID uint16 `binapi:"u16,name=last_msg_id" json:"last_msg_id,omitempty"` -} - -func (m *TracePluginMsgIds) Reset() { *m = TracePluginMsgIds{} } -func (*TracePluginMsgIds) GetMessageName() string { return "trace_plugin_msg_ids" } -func (*TracePluginMsgIds) GetCrcString() string { return "f476d3ce" } -func (*TracePluginMsgIds) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *TracePluginMsgIds) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.PluginName - size += 128 - // field[1] m.FirstMsgID - size += 2 - // field[1] m.LastMsgID - size += 2 - return size -} -func (m *TracePluginMsgIds) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.PluginName - copy(buf[pos:pos+128], m.PluginName) - pos += 128 - // field[1] m.FirstMsgID - o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) - pos += 2 - // field[1] m.LastMsgID - o.PutUint16(buf[pos:pos+2], uint16(m.LastMsgID)) - pos += 2 - return buf, nil -} -func (m *TracePluginMsgIds) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.PluginName - { - nul := bytes.Index(tmp[pos:pos+128], []byte{0x00}) - m.PluginName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 128 - } - // field[1] m.FirstMsgID - m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.LastMsgID - m.LastMsgID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -func init() { file_memclnt_binapi_init() } -func file_memclnt_binapi_init() { - api.RegisterMessage((*APIVersions)(nil), "memclnt.APIVersions") - api.RegisterMessage((*APIVersionsReply)(nil), "memclnt.APIVersionsReply") - api.RegisterMessage((*GetFirstMsgID)(nil), "memclnt.GetFirstMsgID") - api.RegisterMessage((*GetFirstMsgIDReply)(nil), "memclnt.GetFirstMsgIDReply") - api.RegisterMessage((*MemclntCreate)(nil), "memclnt.MemclntCreate") - api.RegisterMessage((*MemclntCreateReply)(nil), "memclnt.MemclntCreateReply") - api.RegisterMessage((*MemclntDelete)(nil), "memclnt.MemclntDelete") - api.RegisterMessage((*MemclntDeleteReply)(nil), "memclnt.MemclntDeleteReply") - api.RegisterMessage((*MemclntKeepalive)(nil), "memclnt.MemclntKeepalive") - api.RegisterMessage((*MemclntKeepaliveReply)(nil), "memclnt.MemclntKeepaliveReply") - api.RegisterMessage((*MemclntReadTimeout)(nil), "memclnt.MemclntReadTimeout") - api.RegisterMessage((*MemclntRxThreadSuspend)(nil), "memclnt.MemclntRxThreadSuspend") - api.RegisterMessage((*RPCCall)(nil), "memclnt.RPCCall") - api.RegisterMessage((*RPCCallReply)(nil), "memclnt.RPCCallReply") - api.RegisterMessage((*RxThreadExit)(nil), "memclnt.RxThreadExit") - api.RegisterMessage((*SockInitShm)(nil), "memclnt.SockInitShm") - api.RegisterMessage((*SockInitShmReply)(nil), "memclnt.SockInitShmReply") - api.RegisterMessage((*SockclntCreate)(nil), "memclnt.SockclntCreate") - api.RegisterMessage((*SockclntCreateReply)(nil), "memclnt.SockclntCreateReply") - api.RegisterMessage((*SockclntDelete)(nil), "memclnt.SockclntDelete") - api.RegisterMessage((*SockclntDeleteReply)(nil), "memclnt.SockclntDeleteReply") - api.RegisterMessage((*TracePluginMsgIds)(nil), "memclnt.TracePluginMsgIds") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*APIVersions)(nil), - (*APIVersionsReply)(nil), - (*GetFirstMsgID)(nil), - (*GetFirstMsgIDReply)(nil), - (*MemclntCreate)(nil), - (*MemclntCreateReply)(nil), - (*MemclntDelete)(nil), - (*MemclntDeleteReply)(nil), - (*MemclntKeepalive)(nil), - (*MemclntKeepaliveReply)(nil), - (*MemclntReadTimeout)(nil), - (*MemclntRxThreadSuspend)(nil), - (*RPCCall)(nil), - (*RPCCallReply)(nil), - (*RxThreadExit)(nil), - (*SockInitShm)(nil), - (*SockInitShmReply)(nil), - (*SockclntCreate)(nil), - (*SockclntCreateReply)(nil), - (*SockclntDelete)(nil), - (*SockclntDeleteReply)(nil), - (*TracePluginMsgIds)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/adapter/socketclient/socketclient.go b/adapter/socketclient/socketclient.go index f63e8b8..574ae06 100644 --- a/adapter/socketclient/socketclient.go +++ b/adapter/socketclient/socketclient.go @@ -19,7 +19,6 @@ import ( "encoding/binary" "errors" "fmt" - "git.fd.io/govpp.git/adapter/socketclient/binapi/memclnt" "io" "net" "os" @@ -32,6 +31,7 @@ import ( "github.com/sirupsen/logrus" "git.fd.io/govpp.git/adapter" + "git.fd.io/govpp.git/binapi/memclnt" "git.fd.io/govpp.git/codec" ) diff --git a/binapi/abf/abf.ba.go b/binapi/abf/abf.ba.go new file mode 100644 index 0000000..2cea604 --- /dev/null +++ b/binapi/abf/abf.ba.go @@ -0,0 +1,627 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/abf.api.json + +// Package abf contains generated bindings for API file abf.api. +// +// Contents: +// 2 structs +// 10 messages +// +package abf + +import ( + api "git.fd.io/govpp.git/api" + fib_types "git.fd.io/govpp.git/binapi/fib_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + _ "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "abf" + APIVersion = "1.0.0" + VersionCrc = 0x460b09b9 +) + +// AbfItfAttach defines type 'abf_itf_attach'. +type AbfItfAttach struct { + PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Priority uint32 `binapi:"u32,name=priority" json:"priority,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +// AbfPolicy defines type 'abf_policy'. +type AbfPolicy struct { + PolicyID uint32 `binapi:"u32,name=policy_id" json:"policy_id,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"-"` + Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +// AbfItfAttachAddDel defines message 'abf_itf_attach_add_del'. +type AbfItfAttachAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"` +} + +func (m *AbfItfAttachAddDel) Reset() { *m = AbfItfAttachAddDel{} } +func (*AbfItfAttachAddDel) GetMessageName() string { return "abf_itf_attach_add_del" } +func (*AbfItfAttachAddDel) GetCrcString() string { return "25c8621b" } +func (*AbfItfAttachAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfItfAttachAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Attach.PolicyID + size += 4 // m.Attach.SwIfIndex + size += 4 // m.Attach.Priority + size += 1 // m.Attach.IsIPv6 + return size +} +func (m *AbfItfAttachAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Attach.PolicyID)) + buf.EncodeUint32(uint32(m.Attach.SwIfIndex)) + buf.EncodeUint32(uint32(m.Attach.Priority)) + buf.EncodeBool(m.Attach.IsIPv6) + return buf.Bytes(), nil +} +func (m *AbfItfAttachAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Attach.PolicyID = buf.DecodeUint32() + m.Attach.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Attach.Priority = buf.DecodeUint32() + m.Attach.IsIPv6 = buf.DecodeBool() + return nil +} + +// AbfItfAttachAddDelReply defines message 'abf_itf_attach_add_del_reply'. +type AbfItfAttachAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AbfItfAttachAddDelReply) Reset() { *m = AbfItfAttachAddDelReply{} } +func (*AbfItfAttachAddDelReply) GetMessageName() string { return "abf_itf_attach_add_del_reply" } +func (*AbfItfAttachAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfItfAttachAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AbfItfAttachAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AbfItfAttachAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// AbfItfAttachDetails defines message 'abf_itf_attach_details'. +type AbfItfAttachDetails struct { + Attach AbfItfAttach `binapi:"abf_itf_attach,name=attach" json:"attach,omitempty"` +} + +func (m *AbfItfAttachDetails) Reset() { *m = AbfItfAttachDetails{} } +func (*AbfItfAttachDetails) GetMessageName() string { return "abf_itf_attach_details" } +func (*AbfItfAttachDetails) GetCrcString() string { return "7819523e" } +func (*AbfItfAttachDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfItfAttachDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Attach.PolicyID + size += 4 // m.Attach.SwIfIndex + size += 4 // m.Attach.Priority + size += 1 // m.Attach.IsIPv6 + return size +} +func (m *AbfItfAttachDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Attach.PolicyID)) + buf.EncodeUint32(uint32(m.Attach.SwIfIndex)) + buf.EncodeUint32(uint32(m.Attach.Priority)) + buf.EncodeBool(m.Attach.IsIPv6) + return buf.Bytes(), nil +} +func (m *AbfItfAttachDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Attach.PolicyID = buf.DecodeUint32() + m.Attach.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Attach.Priority = buf.DecodeUint32() + m.Attach.IsIPv6 = buf.DecodeBool() + return nil +} + +// AbfItfAttachDump defines message 'abf_itf_attach_dump'. +type AbfItfAttachDump struct{} + +func (m *AbfItfAttachDump) Reset() { *m = AbfItfAttachDump{} } +func (*AbfItfAttachDump) GetMessageName() string { return "abf_itf_attach_dump" } +func (*AbfItfAttachDump) GetCrcString() string { return "51077d14" } +func (*AbfItfAttachDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfItfAttachDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AbfItfAttachDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *AbfItfAttachDump) Unmarshal(b []byte) error { + return nil +} + +// AbfPluginGetVersion defines message 'abf_plugin_get_version'. +type AbfPluginGetVersion struct{} + +func (m *AbfPluginGetVersion) Reset() { *m = AbfPluginGetVersion{} } +func (*AbfPluginGetVersion) GetMessageName() string { return "abf_plugin_get_version" } +func (*AbfPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*AbfPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AbfPluginGetVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *AbfPluginGetVersion) Unmarshal(b []byte) error { + return nil +} + +// AbfPluginGetVersionReply defines message 'abf_plugin_get_version_reply'. +type AbfPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *AbfPluginGetVersionReply) Reset() { *m = AbfPluginGetVersionReply{} } +func (*AbfPluginGetVersionReply) GetMessageName() string { return "abf_plugin_get_version_reply" } +func (*AbfPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Major + size += 4 // m.Minor + return size +} +func (m *AbfPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Major)) + buf.EncodeUint32(uint32(m.Minor)) + return buf.Bytes(), nil +} +func (m *AbfPluginGetVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Major = buf.DecodeUint32() + m.Minor = buf.DecodeUint32() + return nil +} + +// AbfPolicyAddDel defines message 'abf_policy_add_del'. +type AbfPolicyAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"` +} + +func (m *AbfPolicyAddDel) Reset() { *m = AbfPolicyAddDel{} } +func (*AbfPolicyAddDel) GetMessageName() string { return "abf_policy_add_del" } +func (*AbfPolicyAddDel) GetCrcString() string { return "ee66f93e" } +func (*AbfPolicyAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfPolicyAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Policy.PolicyID + size += 4 // m.Policy.ACLIndex + size += 1 // m.Policy.NPaths + for j2 := 0; j2 < len(m.Policy.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Policy.Paths) { + s2 = m.Policy.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *AbfPolicyAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Policy.PolicyID)) + buf.EncodeUint32(uint32(m.Policy.ACLIndex)) + buf.EncodeUint8(uint8(len(m.Policy.Paths))) + for j1 := 0; j1 < len(m.Policy.Paths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.Policy.Paths) { + v1 = m.Policy.Paths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *AbfPolicyAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Policy.PolicyID = buf.DecodeUint32() + m.Policy.ACLIndex = buf.DecodeUint32() + m.Policy.NPaths = buf.DecodeUint8() + m.Policy.Paths = make([]fib_types.FibPath, int(m.Policy.NPaths)) + for j1 := 0; j1 < len(m.Policy.Paths); j1++ { + m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Policy.Paths[j1].TableID = buf.DecodeUint32() + m.Policy.Paths[j1].RpfID = buf.DecodeUint32() + m.Policy.Paths[j1].Weight = buf.DecodeUint8() + m.Policy.Paths[j1].Preference = buf.DecodeUint8() + m.Policy.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Policy.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Policy.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Policy.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// AbfPolicyAddDelReply defines message 'abf_policy_add_del_reply'. +type AbfPolicyAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AbfPolicyAddDelReply) Reset() { *m = AbfPolicyAddDelReply{} } +func (*AbfPolicyAddDelReply) GetMessageName() string { return "abf_policy_add_del_reply" } +func (*AbfPolicyAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfPolicyAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AbfPolicyAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AbfPolicyAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// AbfPolicyDetails defines message 'abf_policy_details'. +type AbfPolicyDetails struct { + Policy AbfPolicy `binapi:"abf_policy,name=policy" json:"policy,omitempty"` +} + +func (m *AbfPolicyDetails) Reset() { *m = AbfPolicyDetails{} } +func (*AbfPolicyDetails) GetMessageName() string { return "abf_policy_details" } +func (*AbfPolicyDetails) GetCrcString() string { return "6769e504" } +func (*AbfPolicyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AbfPolicyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Policy.PolicyID + size += 4 // m.Policy.ACLIndex + size += 1 // m.Policy.NPaths + for j2 := 0; j2 < len(m.Policy.Paths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.Policy.Paths) { + s2 = m.Policy.Paths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *AbfPolicyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Policy.PolicyID)) + buf.EncodeUint32(uint32(m.Policy.ACLIndex)) + buf.EncodeUint8(uint8(len(m.Policy.Paths))) + for j1 := 0; j1 < len(m.Policy.Paths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.Policy.Paths) { + v1 = m.Policy.Paths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *AbfPolicyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Policy.PolicyID = buf.DecodeUint32() + m.Policy.ACLIndex = buf.DecodeUint32() + m.Policy.NPaths = buf.DecodeUint8() + m.Policy.Paths = make([]fib_types.FibPath, int(m.Policy.NPaths)) + for j1 := 0; j1 < len(m.Policy.Paths); j1++ { + m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32() + m.Policy.Paths[j1].TableID = buf.DecodeUint32() + m.Policy.Paths[j1].RpfID = buf.DecodeUint32() + m.Policy.Paths[j1].Weight = buf.DecodeUint8() + m.Policy.Paths[j1].Preference = buf.DecodeUint8() + m.Policy.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.Policy.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.Policy.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.Policy.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Policy.Paths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.Policy.Paths[j1].Nh.ObjID = buf.DecodeUint32() + m.Policy.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.Policy.Paths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.Policy.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.Policy.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.Policy.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.Policy.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// AbfPolicyDump defines message 'abf_policy_dump'. +type AbfPolicyDump struct{} + +func (m *AbfPolicyDump) Reset() { *m = AbfPolicyDump{} } +func (*AbfPolicyDump) GetMessageName() string { return "abf_policy_dump" } +func (*AbfPolicyDump) GetCrcString() string { return "51077d14" } +func (*AbfPolicyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AbfPolicyDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AbfPolicyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *AbfPolicyDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_abf_binapi_init() } +func file_abf_binapi_init() { + api.RegisterMessage((*AbfItfAttachAddDel)(nil), "abf_itf_attach_add_del_25c8621b") + api.RegisterMessage((*AbfItfAttachAddDelReply)(nil), "abf_itf_attach_add_del_reply_e8d4e804") + api.RegisterMessage((*AbfItfAttachDetails)(nil), "abf_itf_attach_details_7819523e") + api.RegisterMessage((*AbfItfAttachDump)(nil), "abf_itf_attach_dump_51077d14") + api.RegisterMessage((*AbfPluginGetVersion)(nil), "abf_plugin_get_version_51077d14") + api.RegisterMessage((*AbfPluginGetVersionReply)(nil), "abf_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*AbfPolicyAddDel)(nil), "abf_policy_add_del_ee66f93e") + api.RegisterMessage((*AbfPolicyAddDelReply)(nil), "abf_policy_add_del_reply_e8d4e804") + api.RegisterMessage((*AbfPolicyDetails)(nil), "abf_policy_details_6769e504") + api.RegisterMessage((*AbfPolicyDump)(nil), "abf_policy_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AbfItfAttachAddDel)(nil), + (*AbfItfAttachAddDelReply)(nil), + (*AbfItfAttachDetails)(nil), + (*AbfItfAttachDump)(nil), + (*AbfPluginGetVersion)(nil), + (*AbfPluginGetVersionReply)(nil), + (*AbfPolicyAddDel)(nil), + (*AbfPolicyAddDelReply)(nil), + (*AbfPolicyDetails)(nil), + (*AbfPolicyDump)(nil), + } +} diff --git a/binapi/abf/abf_rest.ba.go b/binapi/abf/abf_rest.ba.go new file mode 100644 index 0000000..e05e834 --- /dev/null +++ b/binapi/abf/abf_rest.ba.go @@ -0,0 +1,74 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package abf + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/abf_itf_attach_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(AbfItfAttachAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AbfItfAttachAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/abf_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(AbfPluginGetVersion) + reply, err := rpc.AbfPluginGetVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/abf_policy_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(AbfPolicyAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AbfPolicyAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/abf/abf_rpc.ba.go b/binapi/abf/abf_rpc.ba.go new file mode 100644 index 0000000..76a88c6 --- /dev/null +++ b/binapi/abf/abf_rpc.ba.go @@ -0,0 +1,133 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package abf + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service abf. +type RPCService interface { + AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) + AbfItfAttachDump(ctx context.Context, in *AbfItfAttachDump) (RPCService_AbfItfAttachDumpClient, error) + AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) + AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) + AbfPolicyDump(ctx context.Context, in *AbfPolicyDump) (RPCService_AbfPolicyDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AbfItfAttachAddDel(ctx context.Context, in *AbfItfAttachAddDel) (*AbfItfAttachAddDelReply, error) { + out := new(AbfItfAttachAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfItfAttachDump(ctx context.Context, in *AbfItfAttachDump) (RPCService_AbfItfAttachDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_AbfItfAttachDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_AbfItfAttachDumpClient interface { + Recv() (*AbfItfAttachDetails, error) + api.Stream +} + +type serviceClient_AbfItfAttachDumpClient struct { + api.Stream +} + +func (c *serviceClient_AbfItfAttachDumpClient) Recv() (*AbfItfAttachDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *AbfItfAttachDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) AbfPluginGetVersion(ctx context.Context, in *AbfPluginGetVersion) (*AbfPluginGetVersionReply, error) { + out := new(AbfPluginGetVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPolicyAddDel(ctx context.Context, in *AbfPolicyAddDel) (*AbfPolicyAddDelReply, error) { + out := new(AbfPolicyAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AbfPolicyDump(ctx context.Context, in *AbfPolicyDump) (RPCService_AbfPolicyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_AbfPolicyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_AbfPolicyDumpClient interface { + Recv() (*AbfPolicyDetails, error) + api.Stream +} + +type serviceClient_AbfPolicyDumpClient struct { + api.Stream +} + +func (c *serviceClient_AbfPolicyDumpClient) Recv() (*AbfPolicyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *AbfPolicyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/acl/acl.ba.go b/binapi/acl/acl.ba.go new file mode 100644 index 0000000..3fac5ee --- /dev/null +++ b/binapi/acl/acl.ba.go @@ -0,0 +1,1900 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/acl.api.json + +// Package acl contains generated bindings for API file acl.api. +// +// Contents: +// 38 messages +// +package acl + +import ( + api "git.fd.io/govpp.git/api" + acl_types "git.fd.io/govpp.git/binapi/acl_types" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "acl" + APIVersion = "2.0.0" + VersionCrc = 0x68c4cb37 +) + +// ACLAddReplace defines message 'acl_add_replace'. +type ACLAddReplace struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } +func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } +func (*ACLAddReplace) GetCrcString() string { return "1cabdeab" } +func (*ACLAddReplace) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + size += 1 // s1.DstPrefix.Address.Af + size += 1 * 16 // s1.DstPrefix.Address.Un + size += 1 // s1.DstPrefix.Len + size += 1 // s1.Proto + size += 2 // s1.SrcportOrIcmptypeFirst + size += 2 // s1.SrcportOrIcmptypeLast + size += 2 // s1.DstportOrIcmpcodeFirst + size += 2 // s1.DstportOrIcmpcodeLast + size += 1 // s1.TCPFlagsMask + size += 1 // s1.TCPFlagsValue + } + return size +} +func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.ACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + buf.EncodeUint8(uint8(v0.DstPrefix.Address.Af)) + buf.EncodeBytes(v0.DstPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.DstPrefix.Len)) + buf.EncodeUint8(uint8(v0.Proto)) + buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeFirst)) + buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeLast)) + buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeFirst)) + buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeLast)) + buf.EncodeUint8(uint8(v0.TCPFlagsMask)) + buf.EncodeUint8(uint8(v0.TCPFlagsValue)) + } + return buf.Bytes(), nil +} +func (m *ACLAddReplace) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.ACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + m.R[j0].DstPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].DstPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].DstPrefix.Len = buf.DecodeUint8() + m.R[j0].Proto = ip_types.IPProto(buf.DecodeUint8()) + m.R[j0].SrcportOrIcmptypeFirst = buf.DecodeUint16() + m.R[j0].SrcportOrIcmptypeLast = buf.DecodeUint16() + m.R[j0].DstportOrIcmpcodeFirst = buf.DecodeUint16() + m.R[j0].DstportOrIcmpcodeLast = buf.DecodeUint16() + m.R[j0].TCPFlagsMask = buf.DecodeUint8() + m.R[j0].TCPFlagsValue = buf.DecodeUint8() + } + return nil +} + +// ACLAddReplaceReply defines message 'acl_add_replace_reply'. +type ACLAddReplaceReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLAddReplaceReply) Reset() { *m = ACLAddReplaceReply{} } +func (*ACLAddReplaceReply) GetMessageName() string { return "acl_add_replace_reply" } +func (*ACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*ACLAddReplaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 4 // m.Retval + return size +} +func (m *ACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLAddReplaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLDel defines message 'acl_del'. +type ACLDel struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLDel) Reset() { *m = ACLDel{} } +func (*ACLDel) GetMessageName() string { return "acl_del" } +func (*ACLDel) GetCrcString() string { return "ef34fea4" } +func (*ACLDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + return size +} +func (m *ACLDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *ACLDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// ACLDelReply defines message 'acl_del_reply'. +type ACLDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLDelReply) Reset() { *m = ACLDelReply{} } +func (*ACLDelReply) GetMessageName() string { return "acl_del_reply" } +func (*ACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLDetails defines message 'acl_details'. +type ACLDetails struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *ACLDetails) Reset() { *m = ACLDetails{} } +func (*ACLDetails) GetMessageName() string { return "acl_details" } +func (*ACLDetails) GetCrcString() string { return "7a97f21c" } +func (*ACLDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + size += 1 // s1.DstPrefix.Address.Af + size += 1 * 16 // s1.DstPrefix.Address.Un + size += 1 // s1.DstPrefix.Len + size += 1 // s1.Proto + size += 2 // s1.SrcportOrIcmptypeFirst + size += 2 // s1.SrcportOrIcmptypeLast + size += 2 // s1.DstportOrIcmpcodeFirst + size += 2 // s1.DstportOrIcmpcodeLast + size += 1 // s1.TCPFlagsMask + size += 1 // s1.TCPFlagsValue + } + return size +} +func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.ACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + buf.EncodeUint8(uint8(v0.DstPrefix.Address.Af)) + buf.EncodeBytes(v0.DstPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.DstPrefix.Len)) + buf.EncodeUint8(uint8(v0.Proto)) + buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeFirst)) + buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeLast)) + buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeFirst)) + buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeLast)) + buf.EncodeUint8(uint8(v0.TCPFlagsMask)) + buf.EncodeUint8(uint8(v0.TCPFlagsValue)) + } + return buf.Bytes(), nil +} +func (m *ACLDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.ACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + m.R[j0].DstPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].DstPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].DstPrefix.Len = buf.DecodeUint8() + m.R[j0].Proto = ip_types.IPProto(buf.DecodeUint8()) + m.R[j0].SrcportOrIcmptypeFirst = buf.DecodeUint16() + m.R[j0].SrcportOrIcmptypeLast = buf.DecodeUint16() + m.R[j0].DstportOrIcmpcodeFirst = buf.DecodeUint16() + m.R[j0].DstportOrIcmpcodeLast = buf.DecodeUint16() + m.R[j0].TCPFlagsMask = buf.DecodeUint8() + m.R[j0].TCPFlagsValue = buf.DecodeUint8() + } + return nil +} + +// ACLDump defines message 'acl_dump'. +type ACLDump struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLDump) Reset() { *m = ACLDump{} } +func (*ACLDump) GetMessageName() string { return "acl_dump" } +func (*ACLDump) GetCrcString() string { return "ef34fea4" } +func (*ACLDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + return size +} +func (m *ACLDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *ACLDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// ACLInterfaceAddDel defines message 'acl_interface_add_del'. +type ACLInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsInput bool `binapi:"bool,name=is_input" json:"is_input,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } +func (*ACLInterfaceAddDel) GetMessageName() string { return "acl_interface_add_del" } +func (*ACLInterfaceAddDel) GetCrcString() string { return "4b54bebd" } +func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.IsInput + size += 4 // m.SwIfIndex + size += 4 // m.ACLIndex + return size +} +func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.IsInput) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.IsInput = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// ACLInterfaceAddDelReply defines message 'acl_interface_add_del_reply'. +type ACLInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceAddDelReply) Reset() { *m = ACLInterfaceAddDelReply{} } +func (*ACLInterfaceAddDelReply) GetMessageName() string { return "acl_interface_add_del_reply" } +func (*ACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLInterfaceEtypeWhitelistDetails defines message 'acl_interface_etype_whitelist_details'. +type ACLInterfaceEtypeWhitelistDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` +} + +func (m *ACLInterfaceEtypeWhitelistDetails) Reset() { *m = ACLInterfaceEtypeWhitelistDetails{} } +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageName() string { + return "acl_interface_etype_whitelist_details" +} +func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { return "cc2bfded" } +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceEtypeWhitelistDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 1 // m.NInput + size += 2 * len(m.Whitelist) // m.Whitelist + return size +} +func (m *ACLInterfaceEtypeWhitelistDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Whitelist))) + buf.EncodeUint8(uint8(m.NInput)) + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + buf.EncodeUint16(uint16(x)) + } + return buf.Bytes(), nil +} +func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.NInput = buf.DecodeUint8() + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = buf.DecodeUint16() + } + return nil +} + +// ACLInterfaceEtypeWhitelistDump defines message 'acl_interface_etype_whitelist_dump'. +type ACLInterfaceEtypeWhitelistDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ACLInterfaceEtypeWhitelistDump) Reset() { *m = ACLInterfaceEtypeWhitelistDump{} } +func (*ACLInterfaceEtypeWhitelistDump) GetMessageName() string { + return "acl_interface_etype_whitelist_dump" +} +func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { return "f9e6675e" } +func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceEtypeWhitelistDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *ACLInterfaceEtypeWhitelistDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// ACLInterfaceListDetails defines message 'acl_interface_list_details'. +type ACLInterfaceListDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } +func (*ACLInterfaceListDetails) GetMessageName() string { return "acl_interface_list_details" } +func (*ACLInterfaceListDetails) GetCrcString() string { return "e695d256" } +func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 1 // m.NInput + size += 4 * len(m.Acls) // m.Acls + return size +} +func (m *ACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Acls))) + buf.EncodeUint8(uint8(m.NInput)) + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *ACLInterfaceListDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.NInput = buf.DecodeUint8() + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = buf.DecodeUint32() + } + return nil +} + +// ACLInterfaceListDump defines message 'acl_interface_list_dump'. +type ACLInterfaceListDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"` +} + +func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } +func (*ACLInterfaceListDump) GetMessageName() string { return "acl_interface_list_dump" } +func (*ACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } +func (*ACLInterfaceListDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *ACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceListDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// ACLInterfaceSetACLList defines message 'acl_interface_set_acl_list'. +type ACLInterfaceSetACLList struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } +func (*ACLInterfaceSetACLList) GetMessageName() string { return "acl_interface_set_acl_list" } +func (*ACLInterfaceSetACLList) GetCrcString() string { return "473982bd" } +func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceSetACLList) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 1 // m.NInput + size += 4 * len(m.Acls) // m.Acls + return size +} +func (m *ACLInterfaceSetACLList) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Acls))) + buf.EncodeUint8(uint8(m.NInput)) + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *ACLInterfaceSetACLList) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.NInput = buf.DecodeUint8() + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = buf.DecodeUint32() + } + return nil +} + +// ACLInterfaceSetACLListReply defines message 'acl_interface_set_acl_list_reply'. +type ACLInterfaceSetACLListReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceSetACLListReply) Reset() { *m = ACLInterfaceSetACLListReply{} } +func (*ACLInterfaceSetACLListReply) GetMessageName() string { + return "acl_interface_set_acl_list_reply" +} +func (*ACLInterfaceSetACLListReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceSetACLListReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLInterfaceSetACLListReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceSetACLListReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLInterfaceSetEtypeWhitelist defines message 'acl_interface_set_etype_whitelist'. +type ACLInterfaceSetEtypeWhitelist struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` +} + +func (m *ACLInterfaceSetEtypeWhitelist) Reset() { *m = ACLInterfaceSetEtypeWhitelist{} } +func (*ACLInterfaceSetEtypeWhitelist) GetMessageName() string { + return "acl_interface_set_etype_whitelist" +} +func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { return "3f5c2d2d" } +func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLInterfaceSetEtypeWhitelist) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 1 // m.NInput + size += 2 * len(m.Whitelist) // m.Whitelist + return size +} +func (m *ACLInterfaceSetEtypeWhitelist) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Whitelist))) + buf.EncodeUint8(uint8(m.NInput)) + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + buf.EncodeUint16(uint16(x)) + } + return buf.Bytes(), nil +} +func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.NInput = buf.DecodeUint8() + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = buf.DecodeUint16() + } + return nil +} + +// ACLInterfaceSetEtypeWhitelistReply defines message 'acl_interface_set_etype_whitelist_reply'. +type ACLInterfaceSetEtypeWhitelistReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceSetEtypeWhitelistReply) Reset() { *m = ACLInterfaceSetEtypeWhitelistReply{} } +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageName() string { + return "acl_interface_set_etype_whitelist_reply" +} +func (*ACLInterfaceSetEtypeWhitelistReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLInterfaceSetEtypeWhitelistReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ACLPluginControlPing defines message 'acl_plugin_control_ping'. +type ACLPluginControlPing struct{} + +func (m *ACLPluginControlPing) Reset() { *m = ACLPluginControlPing{} } +func (*ACLPluginControlPing) GetMessageName() string { return "acl_plugin_control_ping" } +func (*ACLPluginControlPing) GetCrcString() string { return "51077d14" } +func (*ACLPluginControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLPluginControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginControlPing) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ACLPluginControlPing) Unmarshal(b []byte) error { + return nil +} + +// ACLPluginControlPingReply defines message 'acl_plugin_control_ping_reply'. +type ACLPluginControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *ACLPluginControlPingReply) Reset() { *m = ACLPluginControlPingReply{} } +func (*ACLPluginControlPingReply) GetMessageName() string { return "acl_plugin_control_ping_reply" } +func (*ACLPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.ClientIndex + size += 4 // m.VpePID + return size +} +func (m *ACLPluginControlPingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.ClientIndex)) + buf.EncodeUint32(uint32(m.VpePID)) + return buf.Bytes(), nil +} +func (m *ACLPluginControlPingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ClientIndex = buf.DecodeUint32() + m.VpePID = buf.DecodeUint32() + return nil +} + +// ACLPluginGetConnTableMaxEntries defines message 'acl_plugin_get_conn_table_max_entries'. +type ACLPluginGetConnTableMaxEntries struct{} + +func (m *ACLPluginGetConnTableMaxEntries) Reset() { *m = ACLPluginGetConnTableMaxEntries{} } +func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries" +} +func (*ACLPluginGetConnTableMaxEntries) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLPluginGetConnTableMaxEntries) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetConnTableMaxEntries) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ACLPluginGetConnTableMaxEntries) Unmarshal(b []byte) error { + return nil +} + +// ACLPluginGetConnTableMaxEntriesReply defines message 'acl_plugin_get_conn_table_max_entries_reply'. +type ACLPluginGetConnTableMaxEntriesReply struct { + ConnTableMaxEntries uint64 `binapi:"u64,name=conn_table_max_entries" json:"conn_table_max_entries,omitempty"` +} + +func (m *ACLPluginGetConnTableMaxEntriesReply) Reset() { *m = ACLPluginGetConnTableMaxEntriesReply{} } +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries_reply" +} +func (*ACLPluginGetConnTableMaxEntriesReply) GetCrcString() string { return "7a096d3d" } +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginGetConnTableMaxEntriesReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 8 // m.ConnTableMaxEntries + return size +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint64(uint64(m.ConnTableMaxEntries)) + return buf.Bytes(), nil +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ConnTableMaxEntries = buf.DecodeUint64() + return nil +} + +// ACLPluginGetVersion defines message 'acl_plugin_get_version'. +type ACLPluginGetVersion struct{} + +func (m *ACLPluginGetVersion) Reset() { *m = ACLPluginGetVersion{} } +func (*ACLPluginGetVersion) GetMessageName() string { return "acl_plugin_get_version" } +func (*ACLPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ACLPluginGetVersion) Unmarshal(b []byte) error { + return nil +} + +// ACLPluginGetVersionReply defines message 'acl_plugin_get_version_reply'. +type ACLPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *ACLPluginGetVersionReply) Reset() { *m = ACLPluginGetVersionReply{} } +func (*ACLPluginGetVersionReply) GetMessageName() string { return "acl_plugin_get_version_reply" } +func (*ACLPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Major + size += 4 // m.Minor + return size +} +func (m *ACLPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Major)) + buf.EncodeUint32(uint32(m.Minor)) + return buf.Bytes(), nil +} +func (m *ACLPluginGetVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Major = buf.DecodeUint32() + m.Minor = buf.DecodeUint32() + return nil +} + +// ACLStatsIntfCountersEnable defines message 'acl_stats_intf_counters_enable'. +type ACLStatsIntfCountersEnable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *ACLStatsIntfCountersEnable) Reset() { *m = ACLStatsIntfCountersEnable{} } +func (*ACLStatsIntfCountersEnable) GetMessageName() string { return "acl_stats_intf_counters_enable" } +func (*ACLStatsIntfCountersEnable) GetCrcString() string { return "b3e225d2" } +func (*ACLStatsIntfCountersEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ACLStatsIntfCountersEnable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + return size +} +func (m *ACLStatsIntfCountersEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *ACLStatsIntfCountersEnable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + return nil +} + +// ACLStatsIntfCountersEnableReply defines message 'acl_stats_intf_counters_enable_reply'. +type ACLStatsIntfCountersEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLStatsIntfCountersEnableReply) Reset() { *m = ACLStatsIntfCountersEnableReply{} } +func (*ACLStatsIntfCountersEnableReply) GetMessageName() string { + return "acl_stats_intf_counters_enable_reply" +} +func (*ACLStatsIntfCountersEnableReply) GetCrcString() string { return "e8d4e804" } +func (*ACLStatsIntfCountersEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLStatsIntfCountersEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ACLStatsIntfCountersEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ACLStatsIntfCountersEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLAdd defines message 'macip_acl_add'. +type MacipACLAdd struct { + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } +func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } +func (*MacipACLAdd) GetCrcString() string { return "d648fd0a" } +func (*MacipACLAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 * 6 // s1.SrcMac + size += 1 * 6 // s1.SrcMacMask + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + } + return size +} +func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.MacipACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeBytes(v0.SrcMac[:], 6) + buf.EncodeBytes(v0.SrcMacMask[:], 6) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + } + return buf.Bytes(), nil +} +func (m *MacipACLAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.MacipACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + copy(m.R[j0].SrcMac[:], buf.DecodeBytes(6)) + copy(m.R[j0].SrcMacMask[:], buf.DecodeBytes(6)) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + } + return nil +} + +// MacipACLAddReplace defines message 'macip_acl_add_replace'. +type MacipACLAddReplace struct { + ACLIndex uint32 `binapi:"u32,name=acl_index,default=%!s(float64=4.294967295e+09)" json:"acl_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } +func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } +func (*MacipACLAddReplace) GetCrcString() string { return "e34402a7" } +func (*MacipACLAddReplace) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 * 6 // s1.SrcMac + size += 1 * 6 // s1.SrcMacMask + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + } + return size +} +func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.MacipACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeBytes(v0.SrcMac[:], 6) + buf.EncodeBytes(v0.SrcMacMask[:], 6) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + } + return buf.Bytes(), nil +} +func (m *MacipACLAddReplace) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.MacipACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + copy(m.R[j0].SrcMac[:], buf.DecodeBytes(6)) + copy(m.R[j0].SrcMacMask[:], buf.DecodeBytes(6)) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + } + return nil +} + +// MacipACLAddReplaceReply defines message 'macip_acl_add_replace_reply'. +type MacipACLAddReplaceReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLAddReplaceReply) Reset() { *m = MacipACLAddReplaceReply{} } +func (*MacipACLAddReplaceReply) GetMessageName() string { return "macip_acl_add_replace_reply" } +func (*MacipACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 4 // m.Retval + return size +} +func (m *MacipACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MacipACLAddReplaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLAddReply defines message 'macip_acl_add_reply'. +type MacipACLAddReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLAddReply) Reset() { *m = MacipACLAddReply{} } +func (*MacipACLAddReply) GetMessageName() string { return "macip_acl_add_reply" } +func (*MacipACLAddReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 4 // m.Retval + return size +} +func (m *MacipACLAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MacipACLAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLDel defines message 'macip_acl_del'. +type MacipACLDel struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLDel) Reset() { *m = MacipACLDel{} } +func (*MacipACLDel) GetMessageName() string { return "macip_acl_del" } +func (*MacipACLDel) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + return size +} +func (m *MacipACLDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *MacipACLDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// MacipACLDelReply defines message 'macip_acl_del_reply'. +type MacipACLDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLDelReply) Reset() { *m = MacipACLDelReply{} } +func (*MacipACLDelReply) GetMessageName() string { return "macip_acl_del_reply" } +func (*MacipACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MacipACLDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MacipACLDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLDetails defines message 'macip_acl_details'. +type MacipACLDetails struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + R []acl_types.MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } +func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } +func (*MacipACLDetails) GetCrcString() string { return "57c7482f" } +func (*MacipACLDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + size += 64 // m.Tag + size += 4 // m.Count + for j1 := 0; j1 < len(m.R); j1++ { + var s1 acl_types.MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + size += 1 // s1.IsPermit + size += 1 * 6 // s1.SrcMac + size += 1 * 6 // s1.SrcMacMask + size += 1 // s1.SrcPrefix.Address.Af + size += 1 * 16 // s1.SrcPrefix.Address.Un + size += 1 // s1.SrcPrefix.Len + } + return size +} +func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + buf.EncodeString(m.Tag, 64) + buf.EncodeUint32(uint32(len(m.R))) + for j0 := 0; j0 < len(m.R); j0++ { + var v0 acl_types.MacipACLRule + if j0 < len(m.R) { + v0 = m.R[j0] + } + buf.EncodeUint8(uint8(v0.IsPermit)) + buf.EncodeBytes(v0.SrcMac[:], 6) + buf.EncodeBytes(v0.SrcMacMask[:], 6) + buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af)) + buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(v0.SrcPrefix.Len)) + } + return buf.Bytes(), nil +} +func (m *MacipACLDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + m.Tag = buf.DecodeString(64) + m.Count = buf.DecodeUint32() + m.R = make([]acl_types.MacipACLRule, int(m.Count)) + for j0 := 0; j0 < len(m.R); j0++ { + m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8()) + copy(m.R[j0].SrcMac[:], buf.DecodeBytes(6)) + copy(m.R[j0].SrcMacMask[:], buf.DecodeBytes(6)) + m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.R[j0].SrcPrefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.R[j0].SrcPrefix.Len = buf.DecodeUint8() + } + return nil +} + +// MacipACLDump defines message 'macip_acl_dump'. +type MacipACLDump struct { + ACLIndex uint32 `binapi:"u32,name=acl_index,default=%!s(float64=4.294967295e+09)" json:"acl_index,omitempty"` +} + +func (m *MacipACLDump) Reset() { *m = MacipACLDump{} } +func (*MacipACLDump) GetMessageName() string { return "macip_acl_dump" } +func (*MacipACLDump) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ACLIndex + return size +} +func (m *MacipACLDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *MacipACLDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// MacipACLInterfaceAddDel defines message 'macip_acl_interface_add_del'. +type MacipACLInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } +func (*MacipACLInterfaceAddDel) GetMessageName() string { return "macip_acl_interface_add_del" } +func (*MacipACLInterfaceAddDel) GetCrcString() string { return "4b8690b1" } +func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.SwIfIndex + size += 4 // m.ACLIndex + return size +} +func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ACLIndex)) + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ACLIndex = buf.DecodeUint32() + return nil +} + +// MacipACLInterfaceAddDelReply defines message 'macip_acl_interface_add_del_reply'. +type MacipACLInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLInterfaceAddDelReply) Reset() { *m = MacipACLInterfaceAddDelReply{} } +func (*MacipACLInterfaceAddDelReply) GetMessageName() string { + return "macip_acl_interface_add_del_reply" +} +func (*MacipACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *MacipACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// MacipACLInterfaceGet defines message 'macip_acl_interface_get'. +type MacipACLInterfaceGet struct{} + +func (m *MacipACLInterfaceGet) Reset() { *m = MacipACLInterfaceGet{} } +func (*MacipACLInterfaceGet) GetMessageName() string { return "macip_acl_interface_get" } +func (*MacipACLInterfaceGet) GetCrcString() string { return "51077d14" } +func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLInterfaceGet) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MacipACLInterfaceGet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceGet) Unmarshal(b []byte) error { + return nil +} + +// MacipACLInterfaceGetReply defines message 'macip_acl_interface_get_reply'. +type MacipACLInterfaceGetReply struct { + Count uint32 `binapi:"u32,name=count" json:"-"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *MacipACLInterfaceGetReply) Reset() { *m = MacipACLInterfaceGetReply{} } +func (*MacipACLInterfaceGetReply) GetMessageName() string { return "macip_acl_interface_get_reply" } +func (*MacipACLInterfaceGetReply) GetCrcString() string { return "accf9b05" } +func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLInterfaceGetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Count + size += 4 * len(m.Acls) // m.Acls + return size +} +func (m *MacipACLInterfaceGetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(len(m.Acls))) + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceGetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Count = buf.DecodeUint32() + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = buf.DecodeUint32() + } + return nil +} + +// MacipACLInterfaceListDetails defines message 'macip_acl_interface_list_details'. +type MacipACLInterfaceListDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *MacipACLInterfaceListDetails) Reset() { *m = MacipACLInterfaceListDetails{} } +func (*MacipACLInterfaceListDetails) GetMessageName() string { + return "macip_acl_interface_list_details" +} +func (*MacipACLInterfaceListDetails) GetCrcString() string { return "a0c5d56d" } +func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *MacipACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Count + size += 4 * len(m.Acls) // m.Acls + return size +} +func (m *MacipACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(len(m.Acls))) + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceListDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Count = buf.DecodeUint8() + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = buf.DecodeUint32() + } + return nil +} + +// MacipACLInterfaceListDump defines message 'macip_acl_interface_list_dump'. +type MacipACLInterfaceListDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } +func (*MacipACLInterfaceListDump) GetMessageName() string { return "macip_acl_interface_list_dump" } +func (*MacipACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } +func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *MacipACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *MacipACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MacipACLInterfaceListDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_acl_binapi_init() } +func file_acl_binapi_init() { + api.RegisterMessage((*ACLAddReplace)(nil), "acl_add_replace_1cabdeab") + api.RegisterMessage((*ACLAddReplaceReply)(nil), "acl_add_replace_reply_ac407b0c") + api.RegisterMessage((*ACLDel)(nil), "acl_del_ef34fea4") + api.RegisterMessage((*ACLDelReply)(nil), "acl_del_reply_e8d4e804") + api.RegisterMessage((*ACLDetails)(nil), "acl_details_7a97f21c") + api.RegisterMessage((*ACLDump)(nil), "acl_dump_ef34fea4") + api.RegisterMessage((*ACLInterfaceAddDel)(nil), "acl_interface_add_del_4b54bebd") + api.RegisterMessage((*ACLInterfaceAddDelReply)(nil), "acl_interface_add_del_reply_e8d4e804") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDetails)(nil), "acl_interface_etype_whitelist_details_cc2bfded") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDump)(nil), "acl_interface_etype_whitelist_dump_f9e6675e") + api.RegisterMessage((*ACLInterfaceListDetails)(nil), "acl_interface_list_details_e695d256") + api.RegisterMessage((*ACLInterfaceListDump)(nil), "acl_interface_list_dump_f9e6675e") + api.RegisterMessage((*ACLInterfaceSetACLList)(nil), "acl_interface_set_acl_list_473982bd") + api.RegisterMessage((*ACLInterfaceSetACLListReply)(nil), "acl_interface_set_acl_list_reply_e8d4e804") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelist)(nil), "acl_interface_set_etype_whitelist_3f5c2d2d") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelistReply)(nil), "acl_interface_set_etype_whitelist_reply_e8d4e804") + api.RegisterMessage((*ACLPluginControlPing)(nil), "acl_plugin_control_ping_51077d14") + api.RegisterMessage((*ACLPluginControlPingReply)(nil), "acl_plugin_control_ping_reply_f6b0b8ca") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntries)(nil), "acl_plugin_get_conn_table_max_entries_51077d14") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntriesReply)(nil), "acl_plugin_get_conn_table_max_entries_reply_7a096d3d") + api.RegisterMessage((*ACLPluginGetVersion)(nil), "acl_plugin_get_version_51077d14") + api.RegisterMessage((*ACLPluginGetVersionReply)(nil), "acl_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*ACLStatsIntfCountersEnable)(nil), "acl_stats_intf_counters_enable_b3e225d2") + api.RegisterMessage((*ACLStatsIntfCountersEnableReply)(nil), "acl_stats_intf_counters_enable_reply_e8d4e804") + api.RegisterMessage((*MacipACLAdd)(nil), "macip_acl_add_d648fd0a") + api.RegisterMessage((*MacipACLAddReplace)(nil), "macip_acl_add_replace_e34402a7") + api.RegisterMessage((*MacipACLAddReplaceReply)(nil), "macip_acl_add_replace_reply_ac407b0c") + api.RegisterMessage((*MacipACLAddReply)(nil), "macip_acl_add_reply_ac407b0c") + api.RegisterMessage((*MacipACLDel)(nil), "macip_acl_del_ef34fea4") + api.RegisterMessage((*MacipACLDelReply)(nil), "macip_acl_del_reply_e8d4e804") + api.RegisterMessage((*MacipACLDetails)(nil), "macip_acl_details_57c7482f") + api.RegisterMessage((*MacipACLDump)(nil), "macip_acl_dump_ef34fea4") + api.RegisterMessage((*MacipACLInterfaceAddDel)(nil), "macip_acl_interface_add_del_4b8690b1") + api.RegisterMessage((*MacipACLInterfaceAddDelReply)(nil), "macip_acl_interface_add_del_reply_e8d4e804") + api.RegisterMessage((*MacipACLInterfaceGet)(nil), "macip_acl_interface_get_51077d14") + api.RegisterMessage((*MacipACLInterfaceGetReply)(nil), "macip_acl_interface_get_reply_accf9b05") + api.RegisterMessage((*MacipACLInterfaceListDetails)(nil), "macip_acl_interface_list_details_a0c5d56d") + api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "macip_acl_interface_list_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ACLAddReplace)(nil), + (*ACLAddReplaceReply)(nil), + (*ACLDel)(nil), + (*ACLDelReply)(nil), + (*ACLDetails)(nil), + (*ACLDump)(nil), + (*ACLInterfaceAddDel)(nil), + (*ACLInterfaceAddDelReply)(nil), + (*ACLInterfaceEtypeWhitelistDetails)(nil), + (*ACLInterfaceEtypeWhitelistDump)(nil), + (*ACLInterfaceListDetails)(nil), + (*ACLInterfaceListDump)(nil), + (*ACLInterfaceSetACLList)(nil), + (*ACLInterfaceSetACLListReply)(nil), + (*ACLInterfaceSetEtypeWhitelist)(nil), + (*ACLInterfaceSetEtypeWhitelistReply)(nil), + (*ACLPluginControlPing)(nil), + (*ACLPluginControlPingReply)(nil), + (*ACLPluginGetConnTableMaxEntries)(nil), + (*ACLPluginGetConnTableMaxEntriesReply)(nil), + (*ACLPluginGetVersion)(nil), + (*ACLPluginGetVersionReply)(nil), + (*ACLStatsIntfCountersEnable)(nil), + (*ACLStatsIntfCountersEnableReply)(nil), + (*MacipACLAdd)(nil), + (*MacipACLAddReplace)(nil), + (*MacipACLAddReplaceReply)(nil), + (*MacipACLAddReply)(nil), + (*MacipACLDel)(nil), + (*MacipACLDelReply)(nil), + (*MacipACLDetails)(nil), + (*MacipACLDump)(nil), + (*MacipACLInterfaceAddDel)(nil), + (*MacipACLInterfaceAddDelReply)(nil), + (*MacipACLInterfaceGet)(nil), + (*MacipACLInterfaceGetReply)(nil), + (*MacipACLInterfaceListDetails)(nil), + (*MacipACLInterfaceListDump)(nil), + } +} diff --git a/binapi/acl/acl_rest.ba.go b/binapi/acl/acl_rest.ba.go new file mode 100644 index 0000000..0dd8c94 --- /dev/null +++ b/binapi/acl/acl_rest.ba.go @@ -0,0 +1,300 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package acl + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/acl_add_replace", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLAddReplace) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLAddReplace(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLInterfaceAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLInterfaceAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_interface_set_acl_list", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLInterfaceSetACLList) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLInterfaceSetACLList(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_interface_set_etype_whitelist", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLInterfaceSetEtypeWhitelist) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLInterfaceSetEtypeWhitelist(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLPluginControlPing) + reply, err := rpc.ACLPluginControlPing(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_plugin_get_conn_table_max_entries", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLPluginGetConnTableMaxEntries) + reply, err := rpc.ACLPluginGetConnTableMaxEntries(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLPluginGetVersion) + reply, err := rpc.ACLPluginGetVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/acl_stats_intf_counters_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(ACLStatsIntfCountersEnable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ACLStatsIntfCountersEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MacipACLAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_add_replace", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLAddReplace) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MacipACLAddReplace(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MacipACLDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLInterfaceAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.MacipACLInterfaceAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/macip_acl_interface_get", func(w http.ResponseWriter, req *http.Request) { + var request = new(MacipACLInterfaceGet) + reply, err := rpc.MacipACLInterfaceGet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/acl/acl_rpc.ba.go b/binapi/acl/acl_rpc.ba.go new file mode 100644 index 0000000..a69df27 --- /dev/null +++ b/binapi/acl/acl_rpc.ba.go @@ -0,0 +1,363 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package acl + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service acl. +type RPCService interface { + ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) + ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) + ACLDump(ctx context.Context, in *ACLDump) (RPCService_ACLDumpClient, error) + ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) + ACLInterfaceEtypeWhitelistDump(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_ACLInterfaceEtypeWhitelistDumpClient, error) + ACLInterfaceListDump(ctx context.Context, in *ACLInterfaceListDump) (RPCService_ACLInterfaceListDumpClient, error) + ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) + ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) + ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) + ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) + ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) + ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) + MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) + MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) + MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) + MacipACLDump(ctx context.Context, in *MacipACLDump) (RPCService_MacipACLDumpClient, error) + MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) + MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) + MacipACLInterfaceListDump(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_MacipACLInterfaceListDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { + out := new(ACLAddReplaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { + out := new(ACLDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDump(ctx context.Context, in *ACLDump) (RPCService_ACLDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ACLDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ACLDumpClient interface { + Recv() (*ACLDetails, error) + api.Stream +} + +type serviceClient_ACLDumpClient struct { + api.Stream +} + +func (c *serviceClient_ACLDumpClient) Recv() (*ACLDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ACLDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { + out := new(ACLInterfaceAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceEtypeWhitelistDump(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_ACLInterfaceEtypeWhitelistDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ACLInterfaceEtypeWhitelistDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ACLInterfaceEtypeWhitelistDumpClient interface { + Recv() (*ACLInterfaceEtypeWhitelistDetails, error) + api.Stream +} + +type serviceClient_ACLInterfaceEtypeWhitelistDumpClient struct { + api.Stream +} + +func (c *serviceClient_ACLInterfaceEtypeWhitelistDumpClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ACLInterfaceEtypeWhitelistDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ACLInterfaceListDump(ctx context.Context, in *ACLInterfaceListDump) (RPCService_ACLInterfaceListDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ACLInterfaceListDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ACLInterfaceListDumpClient interface { + Recv() (*ACLInterfaceListDetails, error) + api.Stream +} + +type serviceClient_ACLInterfaceListDumpClient struct { + api.Stream +} + +func (c *serviceClient_ACLInterfaceListDumpClient) Recv() (*ACLInterfaceListDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ACLInterfaceListDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { + out := new(ACLInterfaceSetACLListReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { + out := new(ACLInterfaceSetEtypeWhitelistReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { + out := new(ACLPluginControlPingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { + out := new(ACLPluginGetConnTableMaxEntriesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { + out := new(ACLPluginGetVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) { + out := new(ACLStatsIntfCountersEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { + out := new(MacipACLAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { + out := new(MacipACLAddReplaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { + out := new(MacipACLDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDump(ctx context.Context, in *MacipACLDump) (RPCService_MacipACLDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MacipACLDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MacipACLDumpClient interface { + Recv() (*MacipACLDetails, error) + api.Stream +} + +type serviceClient_MacipACLDumpClient struct { + api.Stream +} + +func (c *serviceClient_MacipACLDumpClient) Recv() (*MacipACLDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MacipACLDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { + out := new(MacipACLInterfaceAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { + out := new(MacipACLInterfaceGetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceListDump(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_MacipACLInterfaceListDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_MacipACLInterfaceListDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_MacipACLInterfaceListDumpClient interface { + Recv() (*MacipACLInterfaceListDetails, error) + api.Stream +} + +type serviceClient_MacipACLInterfaceListDumpClient struct { + api.Stream +} + +func (c *serviceClient_MacipACLInterfaceListDumpClient) Recv() (*MacipACLInterfaceListDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *MacipACLInterfaceListDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/acl_types/acl_types.ba.go b/binapi/acl_types/acl_types.ba.go new file mode 100644 index 0000000..5371e22 --- /dev/null +++ b/binapi/acl_types/acl_types.ba.go @@ -0,0 +1,78 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/acl_types.api.json + +// Package acl_types contains generated bindings for API file acl_types.api. +// +// Contents: +// 1 enum +// 2 structs +// +package acl_types + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// ACLAction defines enum 'acl_action'. +type ACLAction uint8 + +const ( + ACL_ACTION_API_DENY ACLAction = 0 + ACL_ACTION_API_PERMIT ACLAction = 1 + ACL_ACTION_API_PERMIT_REFLECT ACLAction = 2 +) + +var ( + ACLAction_name = map[uint8]string{ + 0: "ACL_ACTION_API_DENY", + 1: "ACL_ACTION_API_PERMIT", + 2: "ACL_ACTION_API_PERMIT_REFLECT", + } + ACLAction_value = map[string]uint8{ + "ACL_ACTION_API_DENY": 0, + "ACL_ACTION_API_PERMIT": 1, + "ACL_ACTION_API_PERMIT_REFLECT": 2, + } +) + +func (x ACLAction) String() string { + s, ok := ACLAction_name[uint8(x)] + if ok { + return s + } + return "ACLAction(" + strconv.Itoa(int(x)) + ")" +} + +// ACLRule defines type 'acl_rule'. +type ACLRule struct { + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` + DstPrefix ip_types.Prefix `binapi:"prefix,name=dst_prefix" json:"dst_prefix,omitempty"` + Proto ip_types.IPProto `binapi:"ip_proto,name=proto" json:"proto,omitempty"` + SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` + SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` + DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` + DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` + TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` + TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` +} + +// MacipACLRule defines type 'macip_acl_rule'. +type MacipACLRule struct { + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcMac ethernet_types.MacAddress `binapi:"mac_address,name=src_mac" json:"src_mac,omitempty"` + SrcMacMask ethernet_types.MacAddress `binapi:"mac_address,name=src_mac_mask" json:"src_mac_mask,omitempty"` + SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` +} diff --git a/binapi/af_packet/af_packet.ba.go b/binapi/af_packet/af_packet.ba.go new file mode 100644 index 0000000..646636e --- /dev/null +++ b/binapi/af_packet/af_packet.ba.go @@ -0,0 +1,361 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/af_packet.api.json + +// Package af_packet contains generated bindings for API file af_packet.api. +// +// Contents: +// 8 messages +// +package af_packet + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "af_packet" + APIVersion = "2.0.0" + VersionCrc = 0xe0b6c022 +) + +// AfPacketCreate defines message 'af_packet_create'. +type AfPacketCreate struct { + HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` +} + +func (m *AfPacketCreate) Reset() { *m = AfPacketCreate{} } +func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" } +func (*AfPacketCreate) GetCrcString() string { return "a190415f" } +func (*AfPacketCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 6 // m.HwAddr + size += 1 // m.UseRandomHwAddr + size += 64 // m.HostIfName + return size +} +func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.HwAddr[:], 6) + buf.EncodeBool(m.UseRandomHwAddr) + buf.EncodeString(m.HostIfName, 64) + return buf.Bytes(), nil +} +func (m *AfPacketCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.UseRandomHwAddr = buf.DecodeBool() + m.HostIfName = buf.DecodeString(64) + return nil +} + +// AfPacketCreateReply defines message 'af_packet_create_reply'. +type AfPacketCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AfPacketCreateReply) Reset() { *m = AfPacketCreateReply{} } +func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" } +func (*AfPacketCreateReply) GetCrcString() string { return "5383d31f" } +func (*AfPacketCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AfPacketCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// AfPacketDelete defines message 'af_packet_delete'. +type AfPacketDelete struct { + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` +} + +func (m *AfPacketDelete) Reset() { *m = AfPacketDelete{} } +func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" } +func (*AfPacketDelete) GetCrcString() string { return "863fa648" } +func (*AfPacketDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 64 // m.HostIfName + return size +} +func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeString(m.HostIfName, 64) + return buf.Bytes(), nil +} +func (m *AfPacketDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HostIfName = buf.DecodeString(64) + return nil +} + +// AfPacketDeleteReply defines message 'af_packet_delete_reply'. +type AfPacketDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AfPacketDeleteReply) Reset() { *m = AfPacketDeleteReply{} } +func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" } +func (*AfPacketDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*AfPacketDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AfPacketDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// AfPacketDetails defines message 'af_packet_details'. +type AfPacketDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` +} + +func (m *AfPacketDetails) Reset() { *m = AfPacketDetails{} } +func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" } +func (*AfPacketDetails) GetCrcString() string { return "58c7c042" } +func (*AfPacketDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.HostIfName + return size +} +func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.HostIfName, 64) + return buf.Bytes(), nil +} +func (m *AfPacketDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.HostIfName = buf.DecodeString(64) + return nil +} + +// AfPacketDump defines message 'af_packet_dump'. +type AfPacketDump struct{} + +func (m *AfPacketDump) Reset() { *m = AfPacketDump{} } +func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" } +func (*AfPacketDump) GetCrcString() string { return "51077d14" } +func (*AfPacketDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *AfPacketDump) Unmarshal(b []byte) error { + return nil +} + +// AfPacketSetL4CksumOffload defines message 'af_packet_set_l4_cksum_offload'. +type AfPacketSetL4CksumOffload struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Set bool `binapi:"bool,name=set" json:"set,omitempty"` +} + +func (m *AfPacketSetL4CksumOffload) Reset() { *m = AfPacketSetL4CksumOffload{} } +func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" } +func (*AfPacketSetL4CksumOffload) GetCrcString() string { return "319cd5c8" } +func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketSetL4CksumOffload) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Set + return size +} +func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Set) + return buf.Bytes(), nil +} +func (m *AfPacketSetL4CksumOffload) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Set = buf.DecodeBool() + return nil +} + +// AfPacketSetL4CksumOffloadReply defines message 'af_packet_set_l4_cksum_offload_reply'. +type AfPacketSetL4CksumOffloadReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} } +func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string { + return "af_packet_set_l4_cksum_offload_reply" +} +func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" } +func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketSetL4CksumOffloadReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_af_packet_binapi_init() } +func file_af_packet_binapi_init() { + api.RegisterMessage((*AfPacketCreate)(nil), "af_packet_create_a190415f") + api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet_create_reply_5383d31f") + api.RegisterMessage((*AfPacketDelete)(nil), "af_packet_delete_863fa648") + api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet_delete_reply_e8d4e804") + api.RegisterMessage((*AfPacketDetails)(nil), "af_packet_details_58c7c042") + api.RegisterMessage((*AfPacketDump)(nil), "af_packet_dump_51077d14") + api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet_set_l4_cksum_offload_319cd5c8") + api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet_set_l4_cksum_offload_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AfPacketCreate)(nil), + (*AfPacketCreateReply)(nil), + (*AfPacketDelete)(nil), + (*AfPacketDeleteReply)(nil), + (*AfPacketDetails)(nil), + (*AfPacketDump)(nil), + (*AfPacketSetL4CksumOffload)(nil), + (*AfPacketSetL4CksumOffloadReply)(nil), + } +} diff --git a/binapi/af_packet/af_packet_rest.ba.go b/binapi/af_packet/af_packet_rest.ba.go new file mode 100644 index 0000000..e6c498c --- /dev/null +++ b/binapi/af_packet/af_packet_rest.ba.go @@ -0,0 +1,83 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package af_packet + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/af_packet_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(AfPacketCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AfPacketCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/af_packet_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(AfPacketDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AfPacketDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/af_packet_set_l4_cksum_offload", func(w http.ResponseWriter, req *http.Request) { + var request = new(AfPacketSetL4CksumOffload) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AfPacketSetL4CksumOffload(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/af_packet/af_packet_rpc.ba.go b/binapi/af_packet/af_packet_rpc.ba.go new file mode 100644 index 0000000..72fea67 --- /dev/null +++ b/binapi/af_packet/af_packet_rpc.ba.go @@ -0,0 +1,93 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package af_packet + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service af_packet. +type RPCService interface { + AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) + AfPacketDump(ctx context.Context, in *AfPacketDump) (RPCService_AfPacketDumpClient, error) + AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { + out := new(AfPacketCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { + out := new(AfPacketDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDump(ctx context.Context, in *AfPacketDump) (RPCService_AfPacketDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_AfPacketDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_AfPacketDumpClient interface { + Recv() (*AfPacketDetails, error) + api.Stream +} + +type serviceClient_AfPacketDumpClient struct { + api.Stream +} + +func (c *serviceClient_AfPacketDumpClient) Recv() (*AfPacketDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *AfPacketDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { + out := new(AfPacketSetL4CksumOffloadReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/arp/arp.ba.go b/binapi/arp/arp.ba.go new file mode 100644 index 0000000..deb5180 --- /dev/null +++ b/binapi/arp/arp.ba.go @@ -0,0 +1,364 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/arp.api.json + +// Package arp contains generated bindings for API file arp.api. +// +// Contents: +// 1 struct +// 8 messages +// +package arp + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "arp" + APIVersion = "1.0.0" + VersionCrc = 0x79ca86f2 +) + +// ProxyArp defines type 'proxy_arp'. +type ProxyArp struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Low ip_types.IP4Address `binapi:"ip4_address,name=low" json:"low,omitempty"` + Hi ip_types.IP4Address `binapi:"ip4_address,name=hi" json:"hi,omitempty"` +} + +// ProxyArpAddDel defines message 'proxy_arp_add_del'. +type ProxyArpAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Proxy ProxyArp `binapi:"proxy_arp,name=proxy" json:"proxy,omitempty"` +} + +func (m *ProxyArpAddDel) Reset() { *m = ProxyArpAddDel{} } +func (*ProxyArpAddDel) GetMessageName() string { return "proxy_arp_add_del" } +func (*ProxyArpAddDel) GetCrcString() string { return "85486cbd" } +func (*ProxyArpAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ProxyArpAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Proxy.TableID + size += 1 * 4 // m.Proxy.Low + size += 1 * 4 // m.Proxy.Hi + return size +} +func (m *ProxyArpAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Proxy.TableID)) + buf.EncodeBytes(m.Proxy.Low[:], 4) + buf.EncodeBytes(m.Proxy.Hi[:], 4) + return buf.Bytes(), nil +} +func (m *ProxyArpAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Proxy.TableID = buf.DecodeUint32() + copy(m.Proxy.Low[:], buf.DecodeBytes(4)) + copy(m.Proxy.Hi[:], buf.DecodeBytes(4)) + return nil +} + +// ProxyArpAddDelReply defines message 'proxy_arp_add_del_reply'. +type ProxyArpAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ProxyArpAddDelReply) Reset() { *m = ProxyArpAddDelReply{} } +func (*ProxyArpAddDelReply) GetMessageName() string { return "proxy_arp_add_del_reply" } +func (*ProxyArpAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*ProxyArpAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ProxyArpAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ProxyArpAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ProxyArpAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ProxyArpDetails defines message 'proxy_arp_details'. +type ProxyArpDetails struct { + Proxy ProxyArp `binapi:"proxy_arp,name=proxy" json:"proxy,omitempty"` +} + +func (m *ProxyArpDetails) Reset() { *m = ProxyArpDetails{} } +func (*ProxyArpDetails) GetMessageName() string { return "proxy_arp_details" } +func (*ProxyArpDetails) GetCrcString() string { return "9228c150" } +func (*ProxyArpDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ProxyArpDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Proxy.TableID + size += 1 * 4 // m.Proxy.Low + size += 1 * 4 // m.Proxy.Hi + return size +} +func (m *ProxyArpDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Proxy.TableID)) + buf.EncodeBytes(m.Proxy.Low[:], 4) + buf.EncodeBytes(m.Proxy.Hi[:], 4) + return buf.Bytes(), nil +} +func (m *ProxyArpDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Proxy.TableID = buf.DecodeUint32() + copy(m.Proxy.Low[:], buf.DecodeBytes(4)) + copy(m.Proxy.Hi[:], buf.DecodeBytes(4)) + return nil +} + +// ProxyArpDump defines message 'proxy_arp_dump'. +type ProxyArpDump struct{} + +func (m *ProxyArpDump) Reset() { *m = ProxyArpDump{} } +func (*ProxyArpDump) GetMessageName() string { return "proxy_arp_dump" } +func (*ProxyArpDump) GetCrcString() string { return "51077d14" } +func (*ProxyArpDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ProxyArpDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ProxyArpDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ProxyArpDump) Unmarshal(b []byte) error { + return nil +} + +// ProxyArpIntfcDetails defines message 'proxy_arp_intfc_details'. +type ProxyArpIntfcDetails struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ProxyArpIntfcDetails) Reset() { *m = ProxyArpIntfcDetails{} } +func (*ProxyArpIntfcDetails) GetMessageName() string { return "proxy_arp_intfc_details" } +func (*ProxyArpIntfcDetails) GetCrcString() string { return "f6458e5f" } +func (*ProxyArpIntfcDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ProxyArpIntfcDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *ProxyArpIntfcDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *ProxyArpIntfcDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = buf.DecodeUint32() + return nil +} + +// ProxyArpIntfcDump defines message 'proxy_arp_intfc_dump'. +type ProxyArpIntfcDump struct{} + +func (m *ProxyArpIntfcDump) Reset() { *m = ProxyArpIntfcDump{} } +func (*ProxyArpIntfcDump) GetMessageName() string { return "proxy_arp_intfc_dump" } +func (*ProxyArpIntfcDump) GetCrcString() string { return "51077d14" } +func (*ProxyArpIntfcDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ProxyArpIntfcDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ProxyArpIntfcDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ProxyArpIntfcDump) Unmarshal(b []byte) error { + return nil +} + +// ProxyArpIntfcEnableDisable defines message 'proxy_arp_intfc_enable_disable'. +type ProxyArpIntfcEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *ProxyArpIntfcEnableDisable) Reset() { *m = ProxyArpIntfcEnableDisable{} } +func (*ProxyArpIntfcEnableDisable) GetMessageName() string { return "proxy_arp_intfc_enable_disable" } +func (*ProxyArpIntfcEnableDisable) GetCrcString() string { return "ae6cfcfb" } +func (*ProxyArpIntfcEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ProxyArpIntfcEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *ProxyArpIntfcEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *ProxyArpIntfcEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// ProxyArpIntfcEnableDisableReply defines message 'proxy_arp_intfc_enable_disable_reply'. +type ProxyArpIntfcEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ProxyArpIntfcEnableDisableReply) Reset() { *m = ProxyArpIntfcEnableDisableReply{} } +func (*ProxyArpIntfcEnableDisableReply) GetMessageName() string { + return "proxy_arp_intfc_enable_disable_reply" +} +func (*ProxyArpIntfcEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*ProxyArpIntfcEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ProxyArpIntfcEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ProxyArpIntfcEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ProxyArpIntfcEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_arp_binapi_init() } +func file_arp_binapi_init() { + api.RegisterMessage((*ProxyArpAddDel)(nil), "proxy_arp_add_del_85486cbd") + api.RegisterMessage((*ProxyArpAddDelReply)(nil), "proxy_arp_add_del_reply_e8d4e804") + api.RegisterMessage((*ProxyArpDetails)(nil), "proxy_arp_details_9228c150") + api.RegisterMessage((*ProxyArpDump)(nil), "proxy_arp_dump_51077d14") + api.RegisterMessage((*ProxyArpIntfcDetails)(nil), "proxy_arp_intfc_details_f6458e5f") + api.RegisterMessage((*ProxyArpIntfcDump)(nil), "proxy_arp_intfc_dump_51077d14") + api.RegisterMessage((*ProxyArpIntfcEnableDisable)(nil), "proxy_arp_intfc_enable_disable_ae6cfcfb") + api.RegisterMessage((*ProxyArpIntfcEnableDisableReply)(nil), "proxy_arp_intfc_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ProxyArpAddDel)(nil), + (*ProxyArpAddDelReply)(nil), + (*ProxyArpDetails)(nil), + (*ProxyArpDump)(nil), + (*ProxyArpIntfcDetails)(nil), + (*ProxyArpIntfcDump)(nil), + (*ProxyArpIntfcEnableDisable)(nil), + (*ProxyArpIntfcEnableDisableReply)(nil), + } +} diff --git a/binapi/arp/arp_rest.ba.go b/binapi/arp/arp_rest.ba.go new file mode 100644 index 0000000..71a07d9 --- /dev/null +++ b/binapi/arp/arp_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package arp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/proxy_arp_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(ProxyArpAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ProxyArpAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/proxy_arp_intfc_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(ProxyArpIntfcEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ProxyArpIntfcEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/arp/arp_rpc.ba.go b/binapi/arp/arp_rpc.ba.go new file mode 100644 index 0000000..8ccfa75 --- /dev/null +++ b/binapi/arp/arp_rpc.ba.go @@ -0,0 +1,123 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package arp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service arp. +type RPCService interface { + ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) + ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error) + ProxyArpIntfcDump(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_ProxyArpIntfcDumpClient, error) + ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) ProxyArpAddDel(ctx context.Context, in *ProxyArpAddDel) (*ProxyArpAddDelReply, error) { + out := new(ProxyArpAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ProxyArpDump(ctx context.Context, in *ProxyArpDump) (RPCService_ProxyArpDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ProxyArpDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ProxyArpDumpClient interface { + Recv() (*ProxyArpDetails, error) + api.Stream +} + +type serviceClient_ProxyArpDumpClient struct { + api.Stream +} + +func (c *serviceClient_ProxyArpDumpClient) Recv() (*ProxyArpDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ProxyArpDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ProxyArpIntfcDump(ctx context.Context, in *ProxyArpIntfcDump) (RPCService_ProxyArpIntfcDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ProxyArpIntfcDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ProxyArpIntfcDumpClient interface { + Recv() (*ProxyArpIntfcDetails, error) + api.Stream +} + +type serviceClient_ProxyArpIntfcDumpClient struct { + api.Stream +} + +func (c *serviceClient_ProxyArpIntfcDumpClient) Recv() (*ProxyArpIntfcDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ProxyArpIntfcDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ProxyArpIntfcEnableDisable(ctx context.Context, in *ProxyArpIntfcEnableDisable) (*ProxyArpIntfcEnableDisableReply, error) { + out := new(ProxyArpIntfcEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/avf/avf.ba.go b/binapi/avf/avf.ba.go new file mode 100644 index 0000000..436223b --- /dev/null +++ b/binapi/avf/avf.ba.go @@ -0,0 +1,212 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/avf.api.json + +// Package avf contains generated bindings for API file avf.api. +// +// Contents: +// 4 messages +// +package avf + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "avf" + APIVersion = "1.0.0" + VersionCrc = 0xbaaa7124 +) + +// AvfCreate defines message 'avf_create'. +type AvfCreate struct { + PciAddr uint32 `binapi:"u32,name=pci_addr" json:"pci_addr,omitempty"` + EnableElog int32 `binapi:"i32,name=enable_elog" json:"enable_elog,omitempty"` + RxqNum uint16 `binapi:"u16,name=rxq_num" json:"rxq_num,omitempty"` + RxqSize uint16 `binapi:"u16,name=rxq_size" json:"rxq_size,omitempty"` + TxqSize uint16 `binapi:"u16,name=txq_size" json:"txq_size,omitempty"` +} + +func (m *AvfCreate) Reset() { *m = AvfCreate{} } +func (*AvfCreate) GetMessageName() string { return "avf_create" } +func (*AvfCreate) GetCrcString() string { return "daab8ae2" } +func (*AvfCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AvfCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PciAddr + size += 4 // m.EnableElog + size += 2 // m.RxqNum + size += 2 // m.RxqSize + size += 2 // m.TxqSize + return size +} +func (m *AvfCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PciAddr)) + buf.EncodeUint32(uint32(m.EnableElog)) + buf.EncodeUint16(uint16(m.RxqNum)) + buf.EncodeUint16(uint16(m.RxqSize)) + buf.EncodeUint16(uint16(m.TxqSize)) + return buf.Bytes(), nil +} +func (m *AvfCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PciAddr = buf.DecodeUint32() + m.EnableElog = int32(buf.DecodeUint32()) + m.RxqNum = buf.DecodeUint16() + m.RxqSize = buf.DecodeUint16() + m.TxqSize = buf.DecodeUint16() + return nil +} + +// AvfCreateReply defines message 'avf_create_reply'. +type AvfCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AvfCreateReply) Reset() { *m = AvfCreateReply{} } +func (*AvfCreateReply) GetMessageName() string { return "avf_create_reply" } +func (*AvfCreateReply) GetCrcString() string { return "5383d31f" } +func (*AvfCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AvfCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *AvfCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AvfCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// AvfDelete defines message 'avf_delete'. +type AvfDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AvfDelete) Reset() { *m = AvfDelete{} } +func (*AvfDelete) GetMessageName() string { return "avf_delete" } +func (*AvfDelete) GetCrcString() string { return "f9e6675e" } +func (*AvfDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AvfDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *AvfDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *AvfDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// AvfDeleteReply defines message 'avf_delete_reply'. +type AvfDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AvfDeleteReply) Reset() { *m = AvfDeleteReply{} } +func (*AvfDeleteReply) GetMessageName() string { return "avf_delete_reply" } +func (*AvfDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*AvfDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AvfDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *AvfDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *AvfDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_avf_binapi_init() } +func file_avf_binapi_init() { + api.RegisterMessage((*AvfCreate)(nil), "avf_create_daab8ae2") + api.RegisterMessage((*AvfCreateReply)(nil), "avf_create_reply_5383d31f") + api.RegisterMessage((*AvfDelete)(nil), "avf_delete_f9e6675e") + api.RegisterMessage((*AvfDeleteReply)(nil), "avf_delete_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AvfCreate)(nil), + (*AvfCreateReply)(nil), + (*AvfDelete)(nil), + (*AvfDeleteReply)(nil), + } +} diff --git a/binapi/avf/avf_rest.ba.go b/binapi/avf/avf_rest.ba.go new file mode 100644 index 0000000..1a9d7f3 --- /dev/null +++ b/binapi/avf/avf_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package avf + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/avf_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(AvfCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AvfCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/avf_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(AvfDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.AvfDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/avf/avf_rpc.ba.go b/binapi/avf/avf_rpc.ba.go new file mode 100644 index 0000000..90f854e --- /dev/null +++ b/binapi/avf/avf_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package avf + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service avf. +type RPCService interface { + AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreateReply, error) + AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) AvfCreate(ctx context.Context, in *AvfCreate) (*AvfCreateReply, error) { + out := new(AvfCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AvfDelete(ctx context.Context, in *AvfDelete) (*AvfDeleteReply, error) { + out := new(AvfDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/bfd/bfd.ba.go b/binapi/bfd/bfd.ba.go new file mode 100644 index 0000000..2b4f5f0 --- /dev/null +++ b/binapi/bfd/bfd.ba.go @@ -0,0 +1,1346 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/bfd.api.json + +// Package bfd contains generated bindings for API file bfd.api. +// +// Contents: +// 1 enum +// 28 messages +// +package bfd + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "bfd" + APIVersion = "2.0.0" + VersionCrc = 0xc92fd028 +) + +// BfdState defines enum 'bfd_state'. +type BfdState uint32 + +const ( + BFD_STATE_API_ADMIN_DOWN BfdState = 0 + BFD_STATE_API_DOWN BfdState = 1 + BFD_STATE_API_INIT BfdState = 2 + BFD_STATE_API_UP BfdState = 3 +) + +var ( + BfdState_name = map[uint32]string{ + 0: "BFD_STATE_API_ADMIN_DOWN", + 1: "BFD_STATE_API_DOWN", + 2: "BFD_STATE_API_INIT", + 3: "BFD_STATE_API_UP", + } + BfdState_value = map[string]uint32{ + "BFD_STATE_API_ADMIN_DOWN": 0, + "BFD_STATE_API_DOWN": 1, + "BFD_STATE_API_INIT": 2, + "BFD_STATE_API_UP": 3, + } +) + +func (x BfdState) String() string { + s, ok := BfdState_name[uint32(x)] + if ok { + return s + } + return "BfdState(" + strconv.Itoa(int(x)) + ")" +} + +// BfdAuthDelKey defines message 'bfd_auth_del_key'. +type BfdAuthDelKey struct { + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` +} + +func (m *BfdAuthDelKey) Reset() { *m = BfdAuthDelKey{} } +func (*BfdAuthDelKey) GetMessageName() string { return "bfd_auth_del_key" } +func (*BfdAuthDelKey) GetCrcString() string { return "65310b22" } +func (*BfdAuthDelKey) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdAuthDelKey) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ConfKeyID + return size +} +func (m *BfdAuthDelKey) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ConfKeyID)) + return buf.Bytes(), nil +} +func (m *BfdAuthDelKey) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ConfKeyID = buf.DecodeUint32() + return nil +} + +// BfdAuthDelKeyReply defines message 'bfd_auth_del_key_reply'. +type BfdAuthDelKeyReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdAuthDelKeyReply) Reset() { *m = BfdAuthDelKeyReply{} } +func (*BfdAuthDelKeyReply) GetMessageName() string { return "bfd_auth_del_key_reply" } +func (*BfdAuthDelKeyReply) GetCrcString() string { return "e8d4e804" } +func (*BfdAuthDelKeyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdAuthDelKeyReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdAuthDelKeyReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdAuthDelKeyReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdAuthKeysDetails defines message 'bfd_auth_keys_details'. +type BfdAuthKeysDetails struct { + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` + UseCount uint32 `binapi:"u32,name=use_count" json:"use_count,omitempty"` + AuthType uint8 `binapi:"u8,name=auth_type" json:"auth_type,omitempty"` +} + +func (m *BfdAuthKeysDetails) Reset() { *m = BfdAuthKeysDetails{} } +func (*BfdAuthKeysDetails) GetMessageName() string { return "bfd_auth_keys_details" } +func (*BfdAuthKeysDetails) GetCrcString() string { return "84130e9f" } +func (*BfdAuthKeysDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdAuthKeysDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ConfKeyID + size += 4 // m.UseCount + size += 1 // m.AuthType + return size +} +func (m *BfdAuthKeysDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ConfKeyID)) + buf.EncodeUint32(uint32(m.UseCount)) + buf.EncodeUint8(uint8(m.AuthType)) + return buf.Bytes(), nil +} +func (m *BfdAuthKeysDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ConfKeyID = buf.DecodeUint32() + m.UseCount = buf.DecodeUint32() + m.AuthType = buf.DecodeUint8() + return nil +} + +// BfdAuthKeysDump defines message 'bfd_auth_keys_dump'. +type BfdAuthKeysDump struct{} + +func (m *BfdAuthKeysDump) Reset() { *m = BfdAuthKeysDump{} } +func (*BfdAuthKeysDump) GetMessageName() string { return "bfd_auth_keys_dump" } +func (*BfdAuthKeysDump) GetCrcString() string { return "51077d14" } +func (*BfdAuthKeysDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdAuthKeysDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BfdAuthKeysDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BfdAuthKeysDump) Unmarshal(b []byte) error { + return nil +} + +// BfdAuthSetKey defines message 'bfd_auth_set_key'. +type BfdAuthSetKey struct { + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` + KeyLen uint8 `binapi:"u8,name=key_len" json:"key_len,omitempty"` + AuthType uint8 `binapi:"u8,name=auth_type" json:"auth_type,omitempty"` + Key []byte `binapi:"u8[20],name=key" json:"key,omitempty"` +} + +func (m *BfdAuthSetKey) Reset() { *m = BfdAuthSetKey{} } +func (*BfdAuthSetKey) GetMessageName() string { return "bfd_auth_set_key" } +func (*BfdAuthSetKey) GetCrcString() string { return "690b8877" } +func (*BfdAuthSetKey) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdAuthSetKey) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ConfKeyID + size += 1 // m.KeyLen + size += 1 // m.AuthType + size += 1 * 20 // m.Key + return size +} +func (m *BfdAuthSetKey) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ConfKeyID)) + buf.EncodeUint8(uint8(m.KeyLen)) + buf.EncodeUint8(uint8(m.AuthType)) + buf.EncodeBytes(m.Key[:], 20) + return buf.Bytes(), nil +} +func (m *BfdAuthSetKey) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ConfKeyID = buf.DecodeUint32() + m.KeyLen = buf.DecodeUint8() + m.AuthType = buf.DecodeUint8() + copy(m.Key[:], buf.DecodeBytes(20)) + return nil +} + +// BfdAuthSetKeyReply defines message 'bfd_auth_set_key_reply'. +type BfdAuthSetKeyReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdAuthSetKeyReply) Reset() { *m = BfdAuthSetKeyReply{} } +func (*BfdAuthSetKeyReply) GetMessageName() string { return "bfd_auth_set_key_reply" } +func (*BfdAuthSetKeyReply) GetCrcString() string { return "e8d4e804" } +func (*BfdAuthSetKeyReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdAuthSetKeyReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdAuthSetKeyReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdAuthSetKeyReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPAdd defines message 'bfd_udp_add'. +type BfdUDPAdd struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` + RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` + IsAuthenticated bool `binapi:"bool,name=is_authenticated" json:"is_authenticated,omitempty"` + BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` +} + +func (m *BfdUDPAdd) Reset() { *m = BfdUDPAdd{} } +func (*BfdUDPAdd) GetMessageName() string { return "bfd_udp_add" } +func (*BfdUDPAdd) GetCrcString() string { return "7a6d1185" } +func (*BfdUDPAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.DesiredMinTx + size += 4 // m.RequiredMinRx + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 1 // m.DetectMult + size += 1 // m.IsAuthenticated + size += 1 // m.BfdKeyID + size += 4 // m.ConfKeyID + return size +} +func (m *BfdUDPAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.DesiredMinTx)) + buf.EncodeUint32(uint32(m.RequiredMinRx)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DetectMult)) + buf.EncodeBool(m.IsAuthenticated) + buf.EncodeUint8(uint8(m.BfdKeyID)) + buf.EncodeUint32(uint32(m.ConfKeyID)) + return buf.Bytes(), nil +} +func (m *BfdUDPAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.DesiredMinTx = buf.DecodeUint32() + m.RequiredMinRx = buf.DecodeUint32() + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DetectMult = buf.DecodeUint8() + m.IsAuthenticated = buf.DecodeBool() + m.BfdKeyID = buf.DecodeUint8() + m.ConfKeyID = buf.DecodeUint32() + return nil +} + +// BfdUDPAddReply defines message 'bfd_udp_add_reply'. +type BfdUDPAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPAddReply) Reset() { *m = BfdUDPAddReply{} } +func (*BfdUDPAddReply) GetMessageName() string { return "bfd_udp_add_reply" } +func (*BfdUDPAddReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPAuthActivate defines message 'bfd_udp_auth_activate'. +type BfdUDPAuthActivate struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + IsDelayed bool `binapi:"bool,name=is_delayed" json:"is_delayed,omitempty"` + BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` +} + +func (m *BfdUDPAuthActivate) Reset() { *m = BfdUDPAuthActivate{} } +func (*BfdUDPAuthActivate) GetMessageName() string { return "bfd_udp_auth_activate" } +func (*BfdUDPAuthActivate) GetCrcString() string { return "493ee0ec" } +func (*BfdUDPAuthActivate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPAuthActivate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 1 // m.IsDelayed + size += 1 // m.BfdKeyID + size += 4 // m.ConfKeyID + return size +} +func (m *BfdUDPAuthActivate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeBool(m.IsDelayed) + buf.EncodeUint8(uint8(m.BfdKeyID)) + buf.EncodeUint32(uint32(m.ConfKeyID)) + return buf.Bytes(), nil +} +func (m *BfdUDPAuthActivate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.IsDelayed = buf.DecodeBool() + m.BfdKeyID = buf.DecodeUint8() + m.ConfKeyID = buf.DecodeUint32() + return nil +} + +// BfdUDPAuthActivateReply defines message 'bfd_udp_auth_activate_reply'. +type BfdUDPAuthActivateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPAuthActivateReply) Reset() { *m = BfdUDPAuthActivateReply{} } +func (*BfdUDPAuthActivateReply) GetMessageName() string { return "bfd_udp_auth_activate_reply" } +func (*BfdUDPAuthActivateReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPAuthActivateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPAuthActivateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPAuthActivateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPAuthActivateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPAuthDeactivate defines message 'bfd_udp_auth_deactivate'. +type BfdUDPAuthDeactivate struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + IsDelayed bool `binapi:"bool,name=is_delayed" json:"is_delayed,omitempty"` +} + +func (m *BfdUDPAuthDeactivate) Reset() { *m = BfdUDPAuthDeactivate{} } +func (*BfdUDPAuthDeactivate) GetMessageName() string { return "bfd_udp_auth_deactivate" } +func (*BfdUDPAuthDeactivate) GetCrcString() string { return "99978c32" } +func (*BfdUDPAuthDeactivate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPAuthDeactivate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 1 // m.IsDelayed + return size +} +func (m *BfdUDPAuthDeactivate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeBool(m.IsDelayed) + return buf.Bytes(), nil +} +func (m *BfdUDPAuthDeactivate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.IsDelayed = buf.DecodeBool() + return nil +} + +// BfdUDPAuthDeactivateReply defines message 'bfd_udp_auth_deactivate_reply'. +type BfdUDPAuthDeactivateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPAuthDeactivateReply) Reset() { *m = BfdUDPAuthDeactivateReply{} } +func (*BfdUDPAuthDeactivateReply) GetMessageName() string { return "bfd_udp_auth_deactivate_reply" } +func (*BfdUDPAuthDeactivateReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPAuthDeactivateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPAuthDeactivateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPAuthDeactivateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPAuthDeactivateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPDel defines message 'bfd_udp_del'. +type BfdUDPDel struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` +} + +func (m *BfdUDPDel) Reset() { *m = BfdUDPDel{} } +func (*BfdUDPDel) GetMessageName() string { return "bfd_udp_del" } +func (*BfdUDPDel) GetCrcString() string { return "8096514d" } +func (*BfdUDPDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + return size +} +func (m *BfdUDPDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *BfdUDPDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// BfdUDPDelEchoSource defines message 'bfd_udp_del_echo_source'. +type BfdUDPDelEchoSource struct{} + +func (m *BfdUDPDelEchoSource) Reset() { *m = BfdUDPDelEchoSource{} } +func (*BfdUDPDelEchoSource) GetMessageName() string { return "bfd_udp_del_echo_source" } +func (*BfdUDPDelEchoSource) GetCrcString() string { return "51077d14" } +func (*BfdUDPDelEchoSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPDelEchoSource) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BfdUDPDelEchoSource) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BfdUDPDelEchoSource) Unmarshal(b []byte) error { + return nil +} + +// BfdUDPDelEchoSourceReply defines message 'bfd_udp_del_echo_source_reply'. +type BfdUDPDelEchoSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPDelEchoSourceReply) Reset() { *m = BfdUDPDelEchoSourceReply{} } +func (*BfdUDPDelEchoSourceReply) GetMessageName() string { return "bfd_udp_del_echo_source_reply" } +func (*BfdUDPDelEchoSourceReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPDelEchoSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPDelEchoSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPDelEchoSourceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPDelEchoSourceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPDelReply defines message 'bfd_udp_del_reply'. +type BfdUDPDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPDelReply) Reset() { *m = BfdUDPDelReply{} } +func (*BfdUDPDelReply) GetMessageName() string { return "bfd_udp_del_reply" } +func (*BfdUDPDelReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPGetEchoSource defines message 'bfd_udp_get_echo_source'. +type BfdUDPGetEchoSource struct{} + +func (m *BfdUDPGetEchoSource) Reset() { *m = BfdUDPGetEchoSource{} } +func (*BfdUDPGetEchoSource) GetMessageName() string { return "bfd_udp_get_echo_source" } +func (*BfdUDPGetEchoSource) GetCrcString() string { return "51077d14" } +func (*BfdUDPGetEchoSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPGetEchoSource) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BfdUDPGetEchoSource) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BfdUDPGetEchoSource) Unmarshal(b []byte) error { + return nil +} + +// BfdUDPGetEchoSourceReply defines message 'bfd_udp_get_echo_source_reply'. +type BfdUDPGetEchoSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsSet bool `binapi:"bool,name=is_set" json:"is_set,omitempty"` + HaveUsableIP4 bool `binapi:"bool,name=have_usable_ip4" json:"have_usable_ip4,omitempty"` + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + HaveUsableIP6 bool `binapi:"bool,name=have_usable_ip6" json:"have_usable_ip6,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *BfdUDPGetEchoSourceReply) Reset() { *m = BfdUDPGetEchoSourceReply{} } +func (*BfdUDPGetEchoSourceReply) GetMessageName() string { return "bfd_udp_get_echo_source_reply" } +func (*BfdUDPGetEchoSourceReply) GetCrcString() string { return "1e00cfce" } +func (*BfdUDPGetEchoSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPGetEchoSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + size += 1 // m.IsSet + size += 1 // m.HaveUsableIP4 + size += 1 * 4 // m.IP4Addr + size += 1 // m.HaveUsableIP6 + size += 1 * 16 // m.IP6Addr + return size +} +func (m *BfdUDPGetEchoSourceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.IsSet) + buf.EncodeBool(m.HaveUsableIP4) + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBool(m.HaveUsableIP6) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *BfdUDPGetEchoSourceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsSet = buf.DecodeBool() + m.HaveUsableIP4 = buf.DecodeBool() + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + m.HaveUsableIP6 = buf.DecodeBool() + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// BfdUDPMod defines message 'bfd_udp_mod'. +type BfdUDPMod struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` + RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` +} + +func (m *BfdUDPMod) Reset() { *m = BfdUDPMod{} } +func (*BfdUDPMod) GetMessageName() string { return "bfd_udp_mod" } +func (*BfdUDPMod) GetCrcString() string { return "783a3ff6" } +func (*BfdUDPMod) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPMod) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.DesiredMinTx + size += 4 // m.RequiredMinRx + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 1 // m.DetectMult + return size +} +func (m *BfdUDPMod) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.DesiredMinTx)) + buf.EncodeUint32(uint32(m.RequiredMinRx)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DetectMult)) + return buf.Bytes(), nil +} +func (m *BfdUDPMod) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.DesiredMinTx = buf.DecodeUint32() + m.RequiredMinRx = buf.DecodeUint32() + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DetectMult = buf.DecodeUint8() + return nil +} + +// BfdUDPModReply defines message 'bfd_udp_mod_reply'. +type BfdUDPModReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPModReply) Reset() { *m = BfdUDPModReply{} } +func (*BfdUDPModReply) GetMessageName() string { return "bfd_udp_mod_reply" } +func (*BfdUDPModReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPModReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPModReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPModReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPModReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPSessionDetails defines message 'bfd_udp_session_details'. +type BfdUDPSessionDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + State BfdState `binapi:"bfd_state,name=state" json:"state,omitempty"` + IsAuthenticated bool `binapi:"bool,name=is_authenticated" json:"is_authenticated,omitempty"` + BfdKeyID uint8 `binapi:"u8,name=bfd_key_id" json:"bfd_key_id,omitempty"` + ConfKeyID uint32 `binapi:"u32,name=conf_key_id" json:"conf_key_id,omitempty"` + RequiredMinRx uint32 `binapi:"u32,name=required_min_rx" json:"required_min_rx,omitempty"` + DesiredMinTx uint32 `binapi:"u32,name=desired_min_tx" json:"desired_min_tx,omitempty"` + DetectMult uint8 `binapi:"u8,name=detect_mult" json:"detect_mult,omitempty"` +} + +func (m *BfdUDPSessionDetails) Reset() { *m = BfdUDPSessionDetails{} } +func (*BfdUDPSessionDetails) GetMessageName() string { return "bfd_udp_session_details" } +func (*BfdUDPSessionDetails) GetCrcString() string { return "60653c02" } +func (*BfdUDPSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPSessionDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 4 // m.State + size += 1 // m.IsAuthenticated + size += 1 // m.BfdKeyID + size += 4 // m.ConfKeyID + size += 4 // m.RequiredMinRx + size += 4 // m.DesiredMinTx + size += 1 // m.DetectMult + return size +} +func (m *BfdUDPSessionDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.State)) + buf.EncodeBool(m.IsAuthenticated) + buf.EncodeUint8(uint8(m.BfdKeyID)) + buf.EncodeUint32(uint32(m.ConfKeyID)) + buf.EncodeUint32(uint32(m.RequiredMinRx)) + buf.EncodeUint32(uint32(m.DesiredMinTx)) + buf.EncodeUint8(uint8(m.DetectMult)) + return buf.Bytes(), nil +} +func (m *BfdUDPSessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.State = BfdState(buf.DecodeUint32()) + m.IsAuthenticated = buf.DecodeBool() + m.BfdKeyID = buf.DecodeUint8() + m.ConfKeyID = buf.DecodeUint32() + m.RequiredMinRx = buf.DecodeUint32() + m.DesiredMinTx = buf.DecodeUint32() + m.DetectMult = buf.DecodeUint8() + return nil +} + +// BfdUDPSessionDump defines message 'bfd_udp_session_dump'. +type BfdUDPSessionDump struct{} + +func (m *BfdUDPSessionDump) Reset() { *m = BfdUDPSessionDump{} } +func (*BfdUDPSessionDump) GetMessageName() string { return "bfd_udp_session_dump" } +func (*BfdUDPSessionDump) GetCrcString() string { return "51077d14" } +func (*BfdUDPSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPSessionDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BfdUDPSessionDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BfdUDPSessionDump) Unmarshal(b []byte) error { + return nil +} + +// BfdUDPSessionSetFlags defines message 'bfd_udp_session_set_flags'. +type BfdUDPSessionSetFlags struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + LocalAddr ip_types.Address `binapi:"address,name=local_addr" json:"local_addr,omitempty"` + PeerAddr ip_types.Address `binapi:"address,name=peer_addr" json:"peer_addr,omitempty"` + Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` +} + +func (m *BfdUDPSessionSetFlags) Reset() { *m = BfdUDPSessionSetFlags{} } +func (*BfdUDPSessionSetFlags) GetMessageName() string { return "bfd_udp_session_set_flags" } +func (*BfdUDPSessionSetFlags) GetCrcString() string { return "cf313851" } +func (*BfdUDPSessionSetFlags) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPSessionSetFlags) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.LocalAddr.Af + size += 1 * 16 // m.LocalAddr.Un + size += 1 // m.PeerAddr.Af + size += 1 * 16 // m.PeerAddr.Un + size += 4 // m.Flags + return size +} +func (m *BfdUDPSessionSetFlags) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint8(uint8(m.LocalAddr.Af)) + buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.PeerAddr.Af)) + buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.Flags)) + return buf.Bytes(), nil +} +func (m *BfdUDPSessionSetFlags) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.LocalAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.LocalAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.PeerAddr.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.PeerAddr.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Flags = interface_types.IfStatusFlags(buf.DecodeUint32()) + return nil +} + +// BfdUDPSessionSetFlagsReply defines message 'bfd_udp_session_set_flags_reply'. +type BfdUDPSessionSetFlagsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPSessionSetFlagsReply) Reset() { *m = BfdUDPSessionSetFlagsReply{} } +func (*BfdUDPSessionSetFlagsReply) GetMessageName() string { return "bfd_udp_session_set_flags_reply" } +func (*BfdUDPSessionSetFlagsReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPSessionSetFlagsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPSessionSetFlagsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPSessionSetFlagsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPSessionSetFlagsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BfdUDPSetEchoSource defines message 'bfd_udp_set_echo_source'. +type BfdUDPSetEchoSource struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BfdUDPSetEchoSource) Reset() { *m = BfdUDPSetEchoSource{} } +func (*BfdUDPSetEchoSource) GetMessageName() string { return "bfd_udp_set_echo_source" } +func (*BfdUDPSetEchoSource) GetCrcString() string { return "f9e6675e" } +func (*BfdUDPSetEchoSource) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BfdUDPSetEchoSource) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *BfdUDPSetEchoSource) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BfdUDPSetEchoSource) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BfdUDPSetEchoSourceReply defines message 'bfd_udp_set_echo_source_reply'. +type BfdUDPSetEchoSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BfdUDPSetEchoSourceReply) Reset() { *m = BfdUDPSetEchoSourceReply{} } +func (*BfdUDPSetEchoSourceReply) GetMessageName() string { return "bfd_udp_set_echo_source_reply" } +func (*BfdUDPSetEchoSourceReply) GetCrcString() string { return "e8d4e804" } +func (*BfdUDPSetEchoSourceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BfdUDPSetEchoSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BfdUDPSetEchoSourceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BfdUDPSetEchoSourceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantBfdEvents defines message 'want_bfd_events'. +type WantBfdEvents struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantBfdEvents) Reset() { *m = WantBfdEvents{} } +func (*WantBfdEvents) GetMessageName() string { return "want_bfd_events" } +func (*WantBfdEvents) GetCrcString() string { return "c5e2af94" } +func (*WantBfdEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantBfdEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantBfdEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantBfdEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + return nil +} + +// WantBfdEventsReply defines message 'want_bfd_events_reply'. +type WantBfdEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantBfdEventsReply) Reset() { *m = WantBfdEventsReply{} } +func (*WantBfdEventsReply) GetMessageName() string { return "want_bfd_events_reply" } +func (*WantBfdEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantBfdEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantBfdEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantBfdEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantBfdEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_bfd_binapi_init() } +func file_bfd_binapi_init() { + api.RegisterMessage((*BfdAuthDelKey)(nil), "bfd_auth_del_key_65310b22") + api.RegisterMessage((*BfdAuthDelKeyReply)(nil), "bfd_auth_del_key_reply_e8d4e804") + api.RegisterMessage((*BfdAuthKeysDetails)(nil), "bfd_auth_keys_details_84130e9f") + api.RegisterMessage((*BfdAuthKeysDump)(nil), "bfd_auth_keys_dump_51077d14") + api.RegisterMessage((*BfdAuthSetKey)(nil), "bfd_auth_set_key_690b8877") + api.RegisterMessage((*BfdAuthSetKeyReply)(nil), "bfd_auth_set_key_reply_e8d4e804") + api.RegisterMessage((*BfdUDPAdd)(nil), "bfd_udp_add_7a6d1185") + api.RegisterMessage((*BfdUDPAddReply)(nil), "bfd_udp_add_reply_e8d4e804") + api.RegisterMessage((*BfdUDPAuthActivate)(nil), "bfd_udp_auth_activate_493ee0ec") + api.RegisterMessage((*BfdUDPAuthActivateReply)(nil), "bfd_udp_auth_activate_reply_e8d4e804") + api.RegisterMessage((*BfdUDPAuthDeactivate)(nil), "bfd_udp_auth_deactivate_99978c32") + api.RegisterMessage((*BfdUDPAuthDeactivateReply)(nil), "bfd_udp_auth_deactivate_reply_e8d4e804") + api.RegisterMessage((*BfdUDPDel)(nil), "bfd_udp_del_8096514d") + api.RegisterMessage((*BfdUDPDelEchoSource)(nil), "bfd_udp_del_echo_source_51077d14") + api.RegisterMessage((*BfdUDPDelEchoSourceReply)(nil), "bfd_udp_del_echo_source_reply_e8d4e804") + api.RegisterMessage((*BfdUDPDelReply)(nil), "bfd_udp_del_reply_e8d4e804") + api.RegisterMessage((*BfdUDPGetEchoSource)(nil), "bfd_udp_get_echo_source_51077d14") + api.RegisterMessage((*BfdUDPGetEchoSourceReply)(nil), "bfd_udp_get_echo_source_reply_1e00cfce") + api.RegisterMessage((*BfdUDPMod)(nil), "bfd_udp_mod_783a3ff6") + api.RegisterMessage((*BfdUDPModReply)(nil), "bfd_udp_mod_reply_e8d4e804") + api.RegisterMessage((*BfdUDPSessionDetails)(nil), "bfd_udp_session_details_60653c02") + api.RegisterMessage((*BfdUDPSessionDump)(nil), "bfd_udp_session_dump_51077d14") + api.RegisterMessage((*BfdUDPSessionSetFlags)(nil), "bfd_udp_session_set_flags_cf313851") + api.RegisterMessage((*BfdUDPSessionSetFlagsReply)(nil), "bfd_udp_session_set_flags_reply_e8d4e804") + api.RegisterMessage((*BfdUDPSetEchoSource)(nil), "bfd_udp_set_echo_source_f9e6675e") + api.RegisterMessage((*BfdUDPSetEchoSourceReply)(nil), "bfd_udp_set_echo_source_reply_e8d4e804") + api.RegisterMessage((*WantBfdEvents)(nil), "want_bfd_events_c5e2af94") + api.RegisterMessage((*WantBfdEventsReply)(nil), "want_bfd_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BfdAuthDelKey)(nil), + (*BfdAuthDelKeyReply)(nil), + (*BfdAuthKeysDetails)(nil), + (*BfdAuthKeysDump)(nil), + (*BfdAuthSetKey)(nil), + (*BfdAuthSetKeyReply)(nil), + (*BfdUDPAdd)(nil), + (*BfdUDPAddReply)(nil), + (*BfdUDPAuthActivate)(nil), + (*BfdUDPAuthActivateReply)(nil), + (*BfdUDPAuthDeactivate)(nil), + (*BfdUDPAuthDeactivateReply)(nil), + (*BfdUDPDel)(nil), + (*BfdUDPDelEchoSource)(nil), + (*BfdUDPDelEchoSourceReply)(nil), + (*BfdUDPDelReply)(nil), + (*BfdUDPGetEchoSource)(nil), + (*BfdUDPGetEchoSourceReply)(nil), + (*BfdUDPMod)(nil), + (*BfdUDPModReply)(nil), + (*BfdUDPSessionDetails)(nil), + (*BfdUDPSessionDump)(nil), + (*BfdUDPSessionSetFlags)(nil), + (*BfdUDPSessionSetFlagsReply)(nil), + (*BfdUDPSetEchoSource)(nil), + (*BfdUDPSetEchoSourceReply)(nil), + (*WantBfdEvents)(nil), + (*WantBfdEventsReply)(nil), + } +} diff --git a/binapi/bfd/bfd_rest.ba.go b/binapi/bfd/bfd_rest.ba.go new file mode 100644 index 0000000..2f25f8b --- /dev/null +++ b/binapi/bfd/bfd_rest.ba.go @@ -0,0 +1,272 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bfd + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/bfd_auth_del_key", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdAuthDelKey) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdAuthDelKey(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_auth_set_key", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdAuthSetKey) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdAuthSetKey(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_auth_activate", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPAuthActivate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPAuthActivate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_auth_deactivate", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPAuthDeactivate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPAuthDeactivate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_del_echo_source", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPDelEchoSource) + reply, err := rpc.BfdUDPDelEchoSource(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_get_echo_source", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPGetEchoSource) + reply, err := rpc.BfdUDPGetEchoSource(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_mod", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPMod) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPMod(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_session_set_flags", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPSessionSetFlags) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPSessionSetFlags(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bfd_udp_set_echo_source", func(w http.ResponseWriter, req *http.Request) { + var request = new(BfdUDPSetEchoSource) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BfdUDPSetEchoSource(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_bfd_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantBfdEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantBfdEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/bfd/bfd_rpc.ba.go b/binapi/bfd/bfd_rpc.ba.go new file mode 100644 index 0000000..78cbd3a --- /dev/null +++ b/binapi/bfd/bfd_rpc.ba.go @@ -0,0 +1,223 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bfd + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service bfd. +type RPCService interface { + BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) + BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) + BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) + BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) + BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) + BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) + BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) + BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) + BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) + BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) + BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error) + BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) + BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) + WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) BfdAuthDelKey(ctx context.Context, in *BfdAuthDelKey) (*BfdAuthDelKeyReply, error) { + out := new(BfdAuthDelKeyReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdAuthKeysDump(ctx context.Context, in *BfdAuthKeysDump) (RPCService_BfdAuthKeysDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BfdAuthKeysDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BfdAuthKeysDumpClient interface { + Recv() (*BfdAuthKeysDetails, error) + api.Stream +} + +type serviceClient_BfdAuthKeysDumpClient struct { + api.Stream +} + +func (c *serviceClient_BfdAuthKeysDumpClient) Recv() (*BfdAuthKeysDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BfdAuthKeysDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BfdAuthSetKey(ctx context.Context, in *BfdAuthSetKey) (*BfdAuthSetKeyReply, error) { + out := new(BfdAuthSetKeyReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAdd(ctx context.Context, in *BfdUDPAdd) (*BfdUDPAddReply, error) { + out := new(BfdUDPAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAuthActivate(ctx context.Context, in *BfdUDPAuthActivate) (*BfdUDPAuthActivateReply, error) { + out := new(BfdUDPAuthActivateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPAuthDeactivate(ctx context.Context, in *BfdUDPAuthDeactivate) (*BfdUDPAuthDeactivateReply, error) { + out := new(BfdUDPAuthDeactivateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDel(ctx context.Context, in *BfdUDPDel) (*BfdUDPDelReply, error) { + out := new(BfdUDPDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPDelEchoSource(ctx context.Context, in *BfdUDPDelEchoSource) (*BfdUDPDelEchoSourceReply, error) { + out := new(BfdUDPDelEchoSourceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPGetEchoSource(ctx context.Context, in *BfdUDPGetEchoSource) (*BfdUDPGetEchoSourceReply, error) { + out := new(BfdUDPGetEchoSourceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPMod(ctx context.Context, in *BfdUDPMod) (*BfdUDPModReply, error) { + out := new(BfdUDPModReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSessionDump(ctx context.Context, in *BfdUDPSessionDump) (RPCService_BfdUDPSessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BfdUDPSessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BfdUDPSessionDumpClient interface { + Recv() (*BfdUDPSessionDetails, error) + api.Stream +} + +type serviceClient_BfdUDPSessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_BfdUDPSessionDumpClient) Recv() (*BfdUDPSessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BfdUDPSessionDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BfdUDPSessionSetFlags(ctx context.Context, in *BfdUDPSessionSetFlags) (*BfdUDPSessionSetFlagsReply, error) { + out := new(BfdUDPSessionSetFlagsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BfdUDPSetEchoSource(ctx context.Context, in *BfdUDPSetEchoSource) (*BfdUDPSetEchoSourceReply, error) { + out := new(BfdUDPSetEchoSourceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantBfdEvents(ctx context.Context, in *WantBfdEvents) (*WantBfdEventsReply, error) { + out := new(WantBfdEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/bier/bier.ba.go b/binapi/bier/bier.ba.go new file mode 100644 index 0000000..456e25c --- /dev/null +++ b/binapi/bier/bier.ba.go @@ -0,0 +1,1343 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/bier.api.json + +// Package bier contains generated bindings for API file bier.api. +// +// Contents: +// 2 structs +// 22 messages +// +package bier + +import ( + api "git.fd.io/govpp.git/api" + fib_types "git.fd.io/govpp.git/binapi/fib_types" + _ "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "bier" + APIVersion = "1.2.1" + VersionCrc = 0x9196a2d4 +) + +// BierRoute defines type 'bier_route'. +type BierRoute struct { + BrBp uint32 `binapi:"u32,name=br_bp" json:"br_bp,omitempty"` + BrTblID BierTableID `binapi:"bier_table_id,name=br_tbl_id" json:"br_tbl_id,omitempty"` + BrNPaths uint8 `binapi:"u8,name=br_n_paths" json:"-"` + BrPaths []fib_types.FibPath `binapi:"fib_path[br_n_paths],name=br_paths" json:"br_paths,omitempty"` +} + +// BierTableID defines type 'bier_table_id'. +type BierTableID struct { + BtSet uint8 `binapi:"u8,name=bt_set" json:"bt_set,omitempty"` + BtSubDomain uint8 `binapi:"u8,name=bt_sub_domain" json:"bt_sub_domain,omitempty"` + BtHdrLenID uint8 `binapi:"u8,name=bt_hdr_len_id" json:"bt_hdr_len_id,omitempty"` +} + +// BierDispEntryAddDel defines message 'bier_disp_entry_add_del'. +type BierDispEntryAddDel struct { + BdeBp uint16 `binapi:"u16,name=bde_bp" json:"bde_bp,omitempty"` + BdeTblID uint32 `binapi:"u32,name=bde_tbl_id" json:"bde_tbl_id,omitempty"` + BdeIsAdd bool `binapi:"bool,name=bde_is_add" json:"bde_is_add,omitempty"` + BdePayloadProto uint8 `binapi:"u8,name=bde_payload_proto" json:"bde_payload_proto,omitempty"` + BdeNPaths uint8 `binapi:"u8,name=bde_n_paths" json:"-"` + BdePaths []fib_types.FibPath `binapi:"fib_path[bde_n_paths],name=bde_paths" json:"bde_paths,omitempty"` +} + +func (m *BierDispEntryAddDel) Reset() { *m = BierDispEntryAddDel{} } +func (*BierDispEntryAddDel) GetMessageName() string { return "bier_disp_entry_add_del" } +func (*BierDispEntryAddDel) GetCrcString() string { return "648323eb" } +func (*BierDispEntryAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierDispEntryAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.BdeBp + size += 4 // m.BdeTblID + size += 1 // m.BdeIsAdd + size += 1 // m.BdePayloadProto + size += 1 // m.BdeNPaths + for j1 := 0; j1 < len(m.BdePaths); j1++ { + var s1 fib_types.FibPath + _ = s1 + if j1 < len(m.BdePaths) { + s1 = m.BdePaths[j1] + } + size += 4 // s1.SwIfIndex + size += 4 // s1.TableID + size += 4 // s1.RpfID + size += 1 // s1.Weight + size += 1 // s1.Preference + size += 4 // s1.Type + size += 4 // s1.Flags + size += 4 // s1.Proto + size += 1 * 16 // s1.Nh.Address + size += 4 // s1.Nh.ViaLabel + size += 4 // s1.Nh.ObjID + size += 4 // s1.Nh.ClassifyTableIndex + size += 1 // s1.NLabels + for j2 := 0; j2 < 16; j2++ { + var s2 fib_types.FibMplsLabel + _ = s2 + if j2 < len(s1.LabelStack) { + s2 = s1.LabelStack[j2] + } + size += 1 // s2.IsUniform + size += 4 // s2.Label + size += 1 // s2.TTL + size += 1 // s2.Exp + } + } + return size +} +func (m *BierDispEntryAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.BdeBp)) + buf.EncodeUint32(uint32(m.BdeTblID)) + buf.EncodeBool(m.BdeIsAdd) + buf.EncodeUint8(uint8(m.BdePayloadProto)) + buf.EncodeUint8(uint8(len(m.BdePaths))) + for j0 := 0; j0 < len(m.BdePaths); j0++ { + var v0 fib_types.FibPath + if j0 < len(m.BdePaths) { + v0 = m.BdePaths[j0] + } + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeUint32(uint32(v0.TableID)) + buf.EncodeUint32(uint32(v0.RpfID)) + buf.EncodeUint8(uint8(v0.Weight)) + buf.EncodeUint8(uint8(v0.Preference)) + buf.EncodeUint32(uint32(v0.Type)) + buf.EncodeUint32(uint32(v0.Flags)) + buf.EncodeUint32(uint32(v0.Proto)) + buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v0.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v0.Nh.ObjID)) + buf.EncodeUint32(uint32(v0.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v0.NLabels)) + for j1 := 0; j1 < 16; j1++ { + var v1 fib_types.FibMplsLabel + if j1 < len(v0.LabelStack) { + v1 = v0.LabelStack[j1] + } + buf.EncodeUint8(uint8(v1.IsUniform)) + buf.EncodeUint32(uint32(v1.Label)) + buf.EncodeUint8(uint8(v1.TTL)) + buf.EncodeUint8(uint8(v1.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *BierDispEntryAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdeBp = buf.DecodeUint16() + m.BdeTblID = buf.DecodeUint32() + m.BdeIsAdd = buf.DecodeBool() + m.BdePayloadProto = buf.DecodeUint8() + m.BdeNPaths = buf.DecodeUint8() + m.BdePaths = make([]fib_types.FibPath, int(m.BdeNPaths)) + for j0 := 0; j0 < len(m.BdePaths); j0++ { + m.BdePaths[j0].SwIfIndex = buf.DecodeUint32() + m.BdePaths[j0].TableID = buf.DecodeUint32() + m.BdePaths[j0].RpfID = buf.DecodeUint32() + m.BdePaths[j0].Weight = buf.DecodeUint8() + m.BdePaths[j0].Preference = buf.DecodeUint8() + m.BdePaths[j0].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.BdePaths[j0].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.BdePaths[j0].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.BdePaths[j0].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.BdePaths[j0].Nh.ViaLabel = buf.DecodeUint32() + m.BdePaths[j0].Nh.ObjID = buf.DecodeUint32() + m.BdePaths[j0].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.BdePaths[j0].NLabels = buf.DecodeUint8() + for j1 := 0; j1 < 16; j1++ { + m.BdePaths[j0].LabelStack[j1].IsUniform = buf.DecodeUint8() + m.BdePaths[j0].LabelStack[j1].Label = buf.DecodeUint32() + m.BdePaths[j0].LabelStack[j1].TTL = buf.DecodeUint8() + m.BdePaths[j0].LabelStack[j1].Exp = buf.DecodeUint8() + } + } + return nil +} + +// BierDispEntryAddDelReply defines message 'bier_disp_entry_add_del_reply'. +type BierDispEntryAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierDispEntryAddDelReply) Reset() { *m = BierDispEntryAddDelReply{} } +func (*BierDispEntryAddDelReply) GetMessageName() string { return "bier_disp_entry_add_del_reply" } +func (*BierDispEntryAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierDispEntryAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierDispEntryAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierDispEntryAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierDispEntryAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierDispEntryDetails defines message 'bier_disp_entry_details'. +type BierDispEntryDetails struct { + BdeBp uint16 `binapi:"u16,name=bde_bp" json:"bde_bp,omitempty"` + BdeTblID uint32 `binapi:"u32,name=bde_tbl_id" json:"bde_tbl_id,omitempty"` + BdeIsAdd bool `binapi:"bool,name=bde_is_add" json:"bde_is_add,omitempty"` + BdePayloadProto uint8 `binapi:"u8,name=bde_payload_proto" json:"bde_payload_proto,omitempty"` + BdeNPaths uint8 `binapi:"u8,name=bde_n_paths" json:"-"` + BdePaths []fib_types.FibPath `binapi:"fib_path[bde_n_paths],name=bde_paths" json:"bde_paths,omitempty"` +} + +func (m *BierDispEntryDetails) Reset() { *m = BierDispEntryDetails{} } +func (*BierDispEntryDetails) GetMessageName() string { return "bier_disp_entry_details" } +func (*BierDispEntryDetails) GetCrcString() string { return "e5b039a9" } +func (*BierDispEntryDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierDispEntryDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 2 // m.BdeBp + size += 4 // m.BdeTblID + size += 1 // m.BdeIsAdd + size += 1 // m.BdePayloadProto + size += 1 // m.BdeNPaths + for j1 := 0; j1 < len(m.BdePaths); j1++ { + var s1 fib_types.FibPath + _ = s1 + if j1 < len(m.BdePaths) { + s1 = m.BdePaths[j1] + } + size += 4 // s1.SwIfIndex + size += 4 // s1.TableID + size += 4 // s1.RpfID + size += 1 // s1.Weight + size += 1 // s1.Preference + size += 4 // s1.Type + size += 4 // s1.Flags + size += 4 // s1.Proto + size += 1 * 16 // s1.Nh.Address + size += 4 // s1.Nh.ViaLabel + size += 4 // s1.Nh.ObjID + size += 4 // s1.Nh.ClassifyTableIndex + size += 1 // s1.NLabels + for j2 := 0; j2 < 16; j2++ { + var s2 fib_types.FibMplsLabel + _ = s2 + if j2 < len(s1.LabelStack) { + s2 = s1.LabelStack[j2] + } + size += 1 // s2.IsUniform + size += 4 // s2.Label + size += 1 // s2.TTL + size += 1 // s2.Exp + } + } + return size +} +func (m *BierDispEntryDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint16(uint16(m.BdeBp)) + buf.EncodeUint32(uint32(m.BdeTblID)) + buf.EncodeBool(m.BdeIsAdd) + buf.EncodeUint8(uint8(m.BdePayloadProto)) + buf.EncodeUint8(uint8(len(m.BdePaths))) + for j0 := 0; j0 < len(m.BdePaths); j0++ { + var v0 fib_types.FibPath + if j0 < len(m.BdePaths) { + v0 = m.BdePaths[j0] + } + buf.EncodeUint32(uint32(v0.SwIfIndex)) + buf.EncodeUint32(uint32(v0.TableID)) + buf.EncodeUint32(uint32(v0.RpfID)) + buf.EncodeUint8(uint8(v0.Weight)) + buf.EncodeUint8(uint8(v0.Preference)) + buf.EncodeUint32(uint32(v0.Type)) + buf.EncodeUint32(uint32(v0.Flags)) + buf.EncodeUint32(uint32(v0.Proto)) + buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v0.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v0.Nh.ObjID)) + buf.EncodeUint32(uint32(v0.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v0.NLabels)) + for j1 := 0; j1 < 16; j1++ { + var v1 fib_types.FibMplsLabel + if j1 < len(v0.LabelStack) { + v1 = v0.LabelStack[j1] + } + buf.EncodeUint8(uint8(v1.IsUniform)) + buf.EncodeUint32(uint32(v1.Label)) + buf.EncodeUint8(uint8(v1.TTL)) + buf.EncodeUint8(uint8(v1.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *BierDispEntryDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdeBp = buf.DecodeUint16() + m.BdeTblID = buf.DecodeUint32() + m.BdeIsAdd = buf.DecodeBool() + m.BdePayloadProto = buf.DecodeUint8() + m.BdeNPaths = buf.DecodeUint8() + m.BdePaths = make([]fib_types.FibPath, int(m.BdeNPaths)) + for j0 := 0; j0 < len(m.BdePaths); j0++ { + m.BdePaths[j0].SwIfIndex = buf.DecodeUint32() + m.BdePaths[j0].TableID = buf.DecodeUint32() + m.BdePaths[j0].RpfID = buf.DecodeUint32() + m.BdePaths[j0].Weight = buf.DecodeUint8() + m.BdePaths[j0].Preference = buf.DecodeUint8() + m.BdePaths[j0].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.BdePaths[j0].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.BdePaths[j0].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.BdePaths[j0].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.BdePaths[j0].Nh.ViaLabel = buf.DecodeUint32() + m.BdePaths[j0].Nh.ObjID = buf.DecodeUint32() + m.BdePaths[j0].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.BdePaths[j0].NLabels = buf.DecodeUint8() + for j1 := 0; j1 < 16; j1++ { + m.BdePaths[j0].LabelStack[j1].IsUniform = buf.DecodeUint8() + m.BdePaths[j0].LabelStack[j1].Label = buf.DecodeUint32() + m.BdePaths[j0].LabelStack[j1].TTL = buf.DecodeUint8() + m.BdePaths[j0].LabelStack[j1].Exp = buf.DecodeUint8() + } + } + return nil +} + +// BierDispEntryDump defines message 'bier_disp_entry_dump'. +type BierDispEntryDump struct { + BdeTblID uint32 `binapi:"u32,name=bde_tbl_id" json:"bde_tbl_id,omitempty"` +} + +func (m *BierDispEntryDump) Reset() { *m = BierDispEntryDump{} } +func (*BierDispEntryDump) GetMessageName() string { return "bier_disp_entry_dump" } +func (*BierDispEntryDump) GetCrcString() string { return "b5fa54ad" } +func (*BierDispEntryDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierDispEntryDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdeTblID + return size +} +func (m *BierDispEntryDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdeTblID)) + return buf.Bytes(), nil +} +func (m *BierDispEntryDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdeTblID = buf.DecodeUint32() + return nil +} + +// BierDispTableAddDel defines message 'bier_disp_table_add_del'. +type BierDispTableAddDel struct { + BdtTblID uint32 `binapi:"u32,name=bdt_tbl_id" json:"bdt_tbl_id,omitempty"` + BdtIsAdd bool `binapi:"bool,name=bdt_is_add" json:"bdt_is_add,omitempty"` +} + +func (m *BierDispTableAddDel) Reset() { *m = BierDispTableAddDel{} } +func (*BierDispTableAddDel) GetMessageName() string { return "bier_disp_table_add_del" } +func (*BierDispTableAddDel) GetCrcString() string { return "889657ac" } +func (*BierDispTableAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierDispTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdtTblID + size += 1 // m.BdtIsAdd + return size +} +func (m *BierDispTableAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdtTblID)) + buf.EncodeBool(m.BdtIsAdd) + return buf.Bytes(), nil +} +func (m *BierDispTableAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdtTblID = buf.DecodeUint32() + m.BdtIsAdd = buf.DecodeBool() + return nil +} + +// BierDispTableAddDelReply defines message 'bier_disp_table_add_del_reply'. +type BierDispTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierDispTableAddDelReply) Reset() { *m = BierDispTableAddDelReply{} } +func (*BierDispTableAddDelReply) GetMessageName() string { return "bier_disp_table_add_del_reply" } +func (*BierDispTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierDispTableAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierDispTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierDispTableAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierDispTableAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierDispTableDetails defines message 'bier_disp_table_details'. +type BierDispTableDetails struct { + BdtTblID uint32 `binapi:"u32,name=bdt_tbl_id" json:"bdt_tbl_id,omitempty"` +} + +func (m *BierDispTableDetails) Reset() { *m = BierDispTableDetails{} } +func (*BierDispTableDetails) GetMessageName() string { return "bier_disp_table_details" } +func (*BierDispTableDetails) GetCrcString() string { return "d27942c0" } +func (*BierDispTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierDispTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BdtTblID + return size +} +func (m *BierDispTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BdtTblID)) + return buf.Bytes(), nil +} +func (m *BierDispTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BdtTblID = buf.DecodeUint32() + return nil +} + +// BierDispTableDump defines message 'bier_disp_table_dump'. +type BierDispTableDump struct{} + +func (m *BierDispTableDump) Reset() { *m = BierDispTableDump{} } +func (*BierDispTableDump) GetMessageName() string { return "bier_disp_table_dump" } +func (*BierDispTableDump) GetCrcString() string { return "51077d14" } +func (*BierDispTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierDispTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BierDispTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BierDispTableDump) Unmarshal(b []byte) error { + return nil +} + +// BierImpAdd defines message 'bier_imp_add'. +type BierImpAdd struct { + BiTblID BierTableID `binapi:"bier_table_id,name=bi_tbl_id" json:"bi_tbl_id,omitempty"` + BiSrc uint16 `binapi:"u16,name=bi_src" json:"bi_src,omitempty"` + BiNBytes uint8 `binapi:"u8,name=bi_n_bytes" json:"-"` + BiBytes []byte `binapi:"u8[bi_n_bytes],name=bi_bytes" json:"bi_bytes,omitempty"` +} + +func (m *BierImpAdd) Reset() { *m = BierImpAdd{} } +func (*BierImpAdd) GetMessageName() string { return "bier_imp_add" } +func (*BierImpAdd) GetCrcString() string { return "3856dc3d" } +func (*BierImpAdd) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierImpAdd) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BiTblID.BtSet + size += 1 // m.BiTblID.BtSubDomain + size += 1 // m.BiTblID.BtHdrLenID + size += 2 // m.BiSrc + size += 1 // m.BiNBytes + size += 1 * len(m.BiBytes) // m.BiBytes + return size +} +func (m *BierImpAdd) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.BiTblID.BtSet)) + buf.EncodeUint8(uint8(m.BiTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BiTblID.BtHdrLenID)) + buf.EncodeUint16(uint16(m.BiSrc)) + buf.EncodeUint8(uint8(len(m.BiBytes))) + buf.EncodeBytes(m.BiBytes[:], 0) + return buf.Bytes(), nil +} +func (m *BierImpAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BiTblID.BtSet = buf.DecodeUint8() + m.BiTblID.BtSubDomain = buf.DecodeUint8() + m.BiTblID.BtHdrLenID = buf.DecodeUint8() + m.BiSrc = buf.DecodeUint16() + m.BiNBytes = buf.DecodeUint8() + copy(m.BiBytes[:], buf.DecodeBytes(0)) + return nil +} + +// BierImpAddReply defines message 'bier_imp_add_reply'. +type BierImpAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + BiIndex uint32 `binapi:"u32,name=bi_index" json:"bi_index,omitempty"` +} + +func (m *BierImpAddReply) Reset() { *m = BierImpAddReply{} } +func (*BierImpAddReply) GetMessageName() string { return "bier_imp_add_reply" } +func (*BierImpAddReply) GetCrcString() string { return "d49c5793" } +func (*BierImpAddReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierImpAddReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.BiIndex + return size +} +func (m *BierImpAddReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.BiIndex)) + return buf.Bytes(), nil +} +func (m *BierImpAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.BiIndex = buf.DecodeUint32() + return nil +} + +// BierImpDel defines message 'bier_imp_del'. +type BierImpDel struct { + BiIndex uint32 `binapi:"u32,name=bi_index" json:"bi_index,omitempty"` +} + +func (m *BierImpDel) Reset() { *m = BierImpDel{} } +func (*BierImpDel) GetMessageName() string { return "bier_imp_del" } +func (*BierImpDel) GetCrcString() string { return "7d45edf6" } +func (*BierImpDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierImpDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BiIndex + return size +} +func (m *BierImpDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BiIndex)) + return buf.Bytes(), nil +} +func (m *BierImpDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BiIndex = buf.DecodeUint32() + return nil +} + +// BierImpDelReply defines message 'bier_imp_del_reply'. +type BierImpDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierImpDelReply) Reset() { *m = BierImpDelReply{} } +func (*BierImpDelReply) GetMessageName() string { return "bier_imp_del_reply" } +func (*BierImpDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierImpDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierImpDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierImpDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierImpDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierImpDetails defines message 'bier_imp_details'. +type BierImpDetails struct { + BiTblID BierTableID `binapi:"bier_table_id,name=bi_tbl_id" json:"bi_tbl_id,omitempty"` + BiSrc uint16 `binapi:"u16,name=bi_src" json:"bi_src,omitempty"` + BiNBytes uint8 `binapi:"u8,name=bi_n_bytes" json:"-"` + BiBytes []byte `binapi:"u8[bi_n_bytes],name=bi_bytes" json:"bi_bytes,omitempty"` +} + +func (m *BierImpDetails) Reset() { *m = BierImpDetails{} } +func (*BierImpDetails) GetMessageName() string { return "bier_imp_details" } +func (*BierImpDetails) GetCrcString() string { return "b76192df" } +func (*BierImpDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierImpDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BiTblID.BtSet + size += 1 // m.BiTblID.BtSubDomain + size += 1 // m.BiTblID.BtHdrLenID + size += 2 // m.BiSrc + size += 1 // m.BiNBytes + size += 1 * len(m.BiBytes) // m.BiBytes + return size +} +func (m *BierImpDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.BiTblID.BtSet)) + buf.EncodeUint8(uint8(m.BiTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BiTblID.BtHdrLenID)) + buf.EncodeUint16(uint16(m.BiSrc)) + buf.EncodeUint8(uint8(len(m.BiBytes))) + buf.EncodeBytes(m.BiBytes[:], 0) + return buf.Bytes(), nil +} +func (m *BierImpDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BiTblID.BtSet = buf.DecodeUint8() + m.BiTblID.BtSubDomain = buf.DecodeUint8() + m.BiTblID.BtHdrLenID = buf.DecodeUint8() + m.BiSrc = buf.DecodeUint16() + m.BiNBytes = buf.DecodeUint8() + copy(m.BiBytes[:], buf.DecodeBytes(0)) + return nil +} + +// BierImpDump defines message 'bier_imp_dump'. +type BierImpDump struct{} + +func (m *BierImpDump) Reset() { *m = BierImpDump{} } +func (*BierImpDump) GetMessageName() string { return "bier_imp_dump" } +func (*BierImpDump) GetCrcString() string { return "51077d14" } +func (*BierImpDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierImpDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BierImpDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BierImpDump) Unmarshal(b []byte) error { + return nil +} + +// BierRouteAddDel defines message 'bier_route_add_del'. +type BierRouteAddDel struct { + BrIsAdd bool `binapi:"bool,name=br_is_add" json:"br_is_add,omitempty"` + BrIsReplace bool `binapi:"bool,name=br_is_replace" json:"br_is_replace,omitempty"` + BrRoute BierRoute `binapi:"bier_route,name=br_route" json:"br_route,omitempty"` +} + +func (m *BierRouteAddDel) Reset() { *m = BierRouteAddDel{} } +func (*BierRouteAddDel) GetMessageName() string { return "bier_route_add_del" } +func (*BierRouteAddDel) GetCrcString() string { return "f29edca0" } +func (*BierRouteAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierRouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BrIsAdd + size += 1 // m.BrIsReplace + size += 4 // m.BrRoute.BrBp + size += 1 // m.BrRoute.BrTblID.BtSet + size += 1 // m.BrRoute.BrTblID.BtSubDomain + size += 1 // m.BrRoute.BrTblID.BtHdrLenID + size += 1 // m.BrRoute.BrNPaths + for j2 := 0; j2 < len(m.BrRoute.BrPaths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.BrRoute.BrPaths) { + s2 = m.BrRoute.BrPaths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *BierRouteAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.BrIsAdd) + buf.EncodeBool(m.BrIsReplace) + buf.EncodeUint32(uint32(m.BrRoute.BrBp)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSet)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtHdrLenID)) + buf.EncodeUint8(uint8(len(m.BrRoute.BrPaths))) + for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.BrRoute.BrPaths) { + v1 = m.BrRoute.BrPaths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *BierRouteAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BrIsAdd = buf.DecodeBool() + m.BrIsReplace = buf.DecodeBool() + m.BrRoute.BrBp = buf.DecodeUint32() + m.BrRoute.BrTblID.BtSet = buf.DecodeUint8() + m.BrRoute.BrTblID.BtSubDomain = buf.DecodeUint8() + m.BrRoute.BrTblID.BtHdrLenID = buf.DecodeUint8() + m.BrRoute.BrNPaths = buf.DecodeUint8() + m.BrRoute.BrPaths = make([]fib_types.FibPath, int(m.BrRoute.BrNPaths)) + for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ { + m.BrRoute.BrPaths[j1].SwIfIndex = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].TableID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].RpfID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Weight = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].Preference = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.BrRoute.BrPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.BrRoute.BrPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.BrRoute.BrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.BrRoute.BrPaths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Nh.ObjID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.BrRoute.BrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// BierRouteAddDelReply defines message 'bier_route_add_del_reply'. +type BierRouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierRouteAddDelReply) Reset() { *m = BierRouteAddDelReply{} } +func (*BierRouteAddDelReply) GetMessageName() string { return "bier_route_add_del_reply" } +func (*BierRouteAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierRouteAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierRouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierRouteAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierRouteAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierRouteDetails defines message 'bier_route_details'. +type BierRouteDetails struct { + BrRoute BierRoute `binapi:"bier_route,name=br_route" json:"br_route,omitempty"` +} + +func (m *BierRouteDetails) Reset() { *m = BierRouteDetails{} } +func (*BierRouteDetails) GetMessageName() string { return "bier_route_details" } +func (*BierRouteDetails) GetCrcString() string { return "39ee6a56" } +func (*BierRouteDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierRouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BrRoute.BrBp + size += 1 // m.BrRoute.BrTblID.BtSet + size += 1 // m.BrRoute.BrTblID.BtSubDomain + size += 1 // m.BrRoute.BrTblID.BtHdrLenID + size += 1 // m.BrRoute.BrNPaths + for j2 := 0; j2 < len(m.BrRoute.BrPaths); j2++ { + var s2 fib_types.FibPath + _ = s2 + if j2 < len(m.BrRoute.BrPaths) { + s2 = m.BrRoute.BrPaths[j2] + } + size += 4 // s2.SwIfIndex + size += 4 // s2.TableID + size += 4 // s2.RpfID + size += 1 // s2.Weight + size += 1 // s2.Preference + size += 4 // s2.Type + size += 4 // s2.Flags + size += 4 // s2.Proto + size += 1 * 16 // s2.Nh.Address + size += 4 // s2.Nh.ViaLabel + size += 4 // s2.Nh.ObjID + size += 4 // s2.Nh.ClassifyTableIndex + size += 1 // s2.NLabels + for j3 := 0; j3 < 16; j3++ { + var s3 fib_types.FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + size += 1 // s3.IsUniform + size += 4 // s3.Label + size += 1 // s3.TTL + size += 1 // s3.Exp + } + } + return size +} +func (m *BierRouteDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BrRoute.BrBp)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSet)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtHdrLenID)) + buf.EncodeUint8(uint8(len(m.BrRoute.BrPaths))) + for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ { + var v1 fib_types.FibPath + if j1 < len(m.BrRoute.BrPaths) { + v1 = m.BrRoute.BrPaths[j1] + } + buf.EncodeUint32(uint32(v1.SwIfIndex)) + buf.EncodeUint32(uint32(v1.TableID)) + buf.EncodeUint32(uint32(v1.RpfID)) + buf.EncodeUint8(uint8(v1.Weight)) + buf.EncodeUint8(uint8(v1.Preference)) + buf.EncodeUint32(uint32(v1.Type)) + buf.EncodeUint32(uint32(v1.Flags)) + buf.EncodeUint32(uint32(v1.Proto)) + buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(v1.Nh.ViaLabel)) + buf.EncodeUint32(uint32(v1.Nh.ObjID)) + buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex)) + buf.EncodeUint8(uint8(v1.NLabels)) + for j2 := 0; j2 < 16; j2++ { + var v2 fib_types.FibMplsLabel + if j2 < len(v1.LabelStack) { + v2 = v1.LabelStack[j2] + } + buf.EncodeUint8(uint8(v2.IsUniform)) + buf.EncodeUint32(uint32(v2.Label)) + buf.EncodeUint8(uint8(v2.TTL)) + buf.EncodeUint8(uint8(v2.Exp)) + } + } + return buf.Bytes(), nil +} +func (m *BierRouteDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BrRoute.BrBp = buf.DecodeUint32() + m.BrRoute.BrTblID.BtSet = buf.DecodeUint8() + m.BrRoute.BrTblID.BtSubDomain = buf.DecodeUint8() + m.BrRoute.BrTblID.BtHdrLenID = buf.DecodeUint8() + m.BrRoute.BrNPaths = buf.DecodeUint8() + m.BrRoute.BrPaths = make([]fib_types.FibPath, int(m.BrRoute.BrNPaths)) + for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ { + m.BrRoute.BrPaths[j1].SwIfIndex = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].TableID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].RpfID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Weight = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].Preference = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].Type = fib_types.FibPathType(buf.DecodeUint32()) + m.BrRoute.BrPaths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32()) + m.BrRoute.BrPaths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32()) + copy(m.BrRoute.BrPaths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16)) + m.BrRoute.BrPaths[j1].Nh.ViaLabel = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Nh.ObjID = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].NLabels = buf.DecodeUint8() + for j2 := 0; j2 < 16; j2++ { + m.BrRoute.BrPaths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].LabelStack[j2].Label = buf.DecodeUint32() + m.BrRoute.BrPaths[j1].LabelStack[j2].TTL = buf.DecodeUint8() + m.BrRoute.BrPaths[j1].LabelStack[j2].Exp = buf.DecodeUint8() + } + } + return nil +} + +// BierRouteDump defines message 'bier_route_dump'. +type BierRouteDump struct { + BrTblID BierTableID `binapi:"bier_table_id,name=br_tbl_id" json:"br_tbl_id,omitempty"` +} + +func (m *BierRouteDump) Reset() { *m = BierRouteDump{} } +func (*BierRouteDump) GetMessageName() string { return "bier_route_dump" } +func (*BierRouteDump) GetCrcString() string { return "38339846" } +func (*BierRouteDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierRouteDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BrTblID.BtSet + size += 1 // m.BrTblID.BtSubDomain + size += 1 // m.BrTblID.BtHdrLenID + return size +} +func (m *BierRouteDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.BrTblID.BtSet)) + buf.EncodeUint8(uint8(m.BrTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BrTblID.BtHdrLenID)) + return buf.Bytes(), nil +} +func (m *BierRouteDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BrTblID.BtSet = buf.DecodeUint8() + m.BrTblID.BtSubDomain = buf.DecodeUint8() + m.BrTblID.BtHdrLenID = buf.DecodeUint8() + return nil +} + +// BierTableAddDel defines message 'bier_table_add_del'. +type BierTableAddDel struct { + BtTblID BierTableID `binapi:"bier_table_id,name=bt_tbl_id" json:"bt_tbl_id,omitempty"` + BtLabel uint32 `binapi:"u32,name=bt_label" json:"bt_label,omitempty"` + BtIsAdd bool `binapi:"bool,name=bt_is_add" json:"bt_is_add,omitempty"` +} + +func (m *BierTableAddDel) Reset() { *m = BierTableAddDel{} } +func (*BierTableAddDel) GetMessageName() string { return "bier_table_add_del" } +func (*BierTableAddDel) GetCrcString() string { return "35e59209" } +func (*BierTableAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.BtTblID.BtSet + size += 1 // m.BtTblID.BtSubDomain + size += 1 // m.BtTblID.BtHdrLenID + size += 4 // m.BtLabel + size += 1 // m.BtIsAdd + return size +} +func (m *BierTableAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.BtTblID.BtSet)) + buf.EncodeUint8(uint8(m.BtTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BtTblID.BtHdrLenID)) + buf.EncodeUint32(uint32(m.BtLabel)) + buf.EncodeBool(m.BtIsAdd) + return buf.Bytes(), nil +} +func (m *BierTableAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BtTblID.BtSet = buf.DecodeUint8() + m.BtTblID.BtSubDomain = buf.DecodeUint8() + m.BtTblID.BtHdrLenID = buf.DecodeUint8() + m.BtLabel = buf.DecodeUint32() + m.BtIsAdd = buf.DecodeBool() + return nil +} + +// BierTableAddDelReply defines message 'bier_table_add_del_reply'. +type BierTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BierTableAddDelReply) Reset() { *m = BierTableAddDelReply{} } +func (*BierTableAddDelReply) GetMessageName() string { return "bier_table_add_del_reply" } +func (*BierTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*BierTableAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BierTableAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BierTableAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BierTableDetails defines message 'bier_table_details'. +type BierTableDetails struct { + BtLabel uint32 `binapi:"u32,name=bt_label" json:"bt_label,omitempty"` + BtTblID BierTableID `binapi:"bier_table_id,name=bt_tbl_id" json:"bt_tbl_id,omitempty"` +} + +func (m *BierTableDetails) Reset() { *m = BierTableDetails{} } +func (*BierTableDetails) GetMessageName() string { return "bier_table_details" } +func (*BierTableDetails) GetCrcString() string { return "fc44a9dd" } +func (*BierTableDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BierTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.BtLabel + size += 1 // m.BtTblID.BtSet + size += 1 // m.BtTblID.BtSubDomain + size += 1 // m.BtTblID.BtHdrLenID + return size +} +func (m *BierTableDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.BtLabel)) + buf.EncodeUint8(uint8(m.BtTblID.BtSet)) + buf.EncodeUint8(uint8(m.BtTblID.BtSubDomain)) + buf.EncodeUint8(uint8(m.BtTblID.BtHdrLenID)) + return buf.Bytes(), nil +} +func (m *BierTableDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BtLabel = buf.DecodeUint32() + m.BtTblID.BtSet = buf.DecodeUint8() + m.BtTblID.BtSubDomain = buf.DecodeUint8() + m.BtTblID.BtHdrLenID = buf.DecodeUint8() + return nil +} + +// BierTableDump defines message 'bier_table_dump'. +type BierTableDump struct{} + +func (m *BierTableDump) Reset() { *m = BierTableDump{} } +func (*BierTableDump) GetMessageName() string { return "bier_table_dump" } +func (*BierTableDump) GetCrcString() string { return "51077d14" } +func (*BierTableDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BierTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BierTableDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BierTableDump) Unmarshal(b []byte) error { + return nil +} + +func init() { file_bier_binapi_init() } +func file_bier_binapi_init() { + api.RegisterMessage((*BierDispEntryAddDel)(nil), "bier_disp_entry_add_del_648323eb") + api.RegisterMessage((*BierDispEntryAddDelReply)(nil), "bier_disp_entry_add_del_reply_e8d4e804") + api.RegisterMessage((*BierDispEntryDetails)(nil), "bier_disp_entry_details_e5b039a9") + api.RegisterMessage((*BierDispEntryDump)(nil), "bier_disp_entry_dump_b5fa54ad") + api.RegisterMessage((*BierDispTableAddDel)(nil), "bier_disp_table_add_del_889657ac") + api.RegisterMessage((*BierDispTableAddDelReply)(nil), "bier_disp_table_add_del_reply_e8d4e804") + api.RegisterMessage((*BierDispTableDetails)(nil), "bier_disp_table_details_d27942c0") + api.RegisterMessage((*BierDispTableDump)(nil), "bier_disp_table_dump_51077d14") + api.RegisterMessage((*BierImpAdd)(nil), "bier_imp_add_3856dc3d") + api.RegisterMessage((*BierImpAddReply)(nil), "bier_imp_add_reply_d49c5793") + api.RegisterMessage((*BierImpDel)(nil), "bier_imp_del_7d45edf6") + api.RegisterMessage((*BierImpDelReply)(nil), "bier_imp_del_reply_e8d4e804") + api.RegisterMessage((*BierImpDetails)(nil), "bier_imp_details_b76192df") + api.RegisterMessage((*BierImpDump)(nil), "bier_imp_dump_51077d14") + api.RegisterMessage((*BierRouteAddDel)(nil), "bier_route_add_del_f29edca0") + api.RegisterMessage((*BierRouteAddDelReply)(nil), "bier_route_add_del_reply_e8d4e804") + api.RegisterMessage((*BierRouteDetails)(nil), "bier_route_details_39ee6a56") + api.RegisterMessage((*BierRouteDump)(nil), "bier_route_dump_38339846") + api.RegisterMessage((*BierTableAddDel)(nil), "bier_table_add_del_35e59209") + api.RegisterMessage((*BierTableAddDelReply)(nil), "bier_table_add_del_reply_e8d4e804") + api.RegisterMessage((*BierTableDetails)(nil), "bier_table_details_fc44a9dd") + api.RegisterMessage((*BierTableDump)(nil), "bier_table_dump_51077d14") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BierDispEntryAddDel)(nil), + (*BierDispEntryAddDelReply)(nil), + (*BierDispEntryDetails)(nil), + (*BierDispEntryDump)(nil), + (*BierDispTableAddDel)(nil), + (*BierDispTableAddDelReply)(nil), + (*BierDispTableDetails)(nil), + (*BierDispTableDump)(nil), + (*BierImpAdd)(nil), + (*BierImpAddReply)(nil), + (*BierImpDel)(nil), + (*BierImpDelReply)(nil), + (*BierImpDetails)(nil), + (*BierImpDump)(nil), + (*BierRouteAddDel)(nil), + (*BierRouteAddDelReply)(nil), + (*BierRouteDetails)(nil), + (*BierRouteDump)(nil), + (*BierTableAddDel)(nil), + (*BierTableAddDelReply)(nil), + (*BierTableDetails)(nil), + (*BierTableDump)(nil), + } +} diff --git a/binapi/bier/bier_rest.ba.go b/binapi/bier/bier_rest.ba.go new file mode 100644 index 0000000..f65f8f3 --- /dev/null +++ b/binapi/bier/bier_rest.ba.go @@ -0,0 +1,152 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bier + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/bier_disp_entry_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierDispEntryAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierDispEntryAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_disp_table_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierDispTableAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierDispTableAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_imp_add", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierImpAdd) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierImpAdd(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_imp_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierImpDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierImpDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_route_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierRouteAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierRouteAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bier_table_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(BierTableAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BierTableAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/bier/bier_rpc.ba.go b/binapi/bier/bier_rpc.ba.go new file mode 100644 index 0000000..c744153 --- /dev/null +++ b/binapi/bier/bier_rpc.ba.go @@ -0,0 +1,283 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bier + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service bier. +type RPCService interface { + BierDispEntryAddDel(ctx context.Context, in *BierDispEntryAddDel) (*BierDispEntryAddDelReply, error) + BierDispEntryDump(ctx context.Context, in *BierDispEntryDump) (RPCService_BierDispEntryDumpClient, error) + BierDispTableAddDel(ctx context.Context, in *BierDispTableAddDel) (*BierDispTableAddDelReply, error) + BierDispTableDump(ctx context.Context, in *BierDispTableDump) (RPCService_BierDispTableDumpClient, error) + BierImpAdd(ctx context.Context, in *BierImpAdd) (*BierImpAddReply, error) + BierImpDel(ctx context.Context, in *BierImpDel) (*BierImpDelReply, error) + BierImpDump(ctx context.Context, in *BierImpDump) (RPCService_BierImpDumpClient, error) + BierRouteAddDel(ctx context.Context, in *BierRouteAddDel) (*BierRouteAddDelReply, error) + BierRouteDump(ctx context.Context, in *BierRouteDump) (RPCService_BierRouteDumpClient, error) + BierTableAddDel(ctx context.Context, in *BierTableAddDel) (*BierTableAddDelReply, error) + BierTableDump(ctx context.Context, in *BierTableDump) (RPCService_BierTableDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) BierDispEntryAddDel(ctx context.Context, in *BierDispEntryAddDel) (*BierDispEntryAddDelReply, error) { + out := new(BierDispEntryAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierDispEntryDump(ctx context.Context, in *BierDispEntryDump) (RPCService_BierDispEntryDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierDispEntryDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierDispEntryDumpClient interface { + Recv() (*BierDispEntryDetails, error) + api.Stream +} + +type serviceClient_BierDispEntryDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierDispEntryDumpClient) Recv() (*BierDispEntryDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierDispEntryDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BierDispTableAddDel(ctx context.Context, in *BierDispTableAddDel) (*BierDispTableAddDelReply, error) { + out := new(BierDispTableAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierDispTableDump(ctx context.Context, in *BierDispTableDump) (RPCService_BierDispTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierDispTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierDispTableDumpClient interface { + Recv() (*BierDispTableDetails, error) + api.Stream +} + +type serviceClient_BierDispTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierDispTableDumpClient) Recv() (*BierDispTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierDispTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BierImpAdd(ctx context.Context, in *BierImpAdd) (*BierImpAddReply, error) { + out := new(BierImpAddReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierImpDel(ctx context.Context, in *BierImpDel) (*BierImpDelReply, error) { + out := new(BierImpDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierImpDump(ctx context.Context, in *BierImpDump) (RPCService_BierImpDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierImpDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierImpDumpClient interface { + Recv() (*BierImpDetails, error) + api.Stream +} + +type serviceClient_BierImpDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierImpDumpClient) Recv() (*BierImpDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierImpDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BierRouteAddDel(ctx context.Context, in *BierRouteAddDel) (*BierRouteAddDelReply, error) { + out := new(BierRouteAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierRouteDump(ctx context.Context, in *BierRouteDump) (RPCService_BierRouteDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierRouteDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierRouteDumpClient interface { + Recv() (*BierRouteDetails, error) + api.Stream +} + +type serviceClient_BierRouteDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierRouteDumpClient) Recv() (*BierRouteDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierRouteDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) BierTableAddDel(ctx context.Context, in *BierTableAddDel) (*BierTableAddDelReply, error) { + out := new(BierTableAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BierTableDump(ctx context.Context, in *BierTableDump) (RPCService_BierTableDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_BierTableDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_BierTableDumpClient interface { + Recv() (*BierTableDetails, error) + api.Stream +} + +type serviceClient_BierTableDumpClient struct { + api.Stream +} + +func (c *serviceClient_BierTableDumpClient) Recv() (*BierTableDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *BierTableDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/bond/bond.ba.go b/binapi/bond/bond.ba.go new file mode 100644 index 0000000..378a8f3 --- /dev/null +++ b/binapi/bond/bond.ba.go @@ -0,0 +1,734 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/bond.api.json + +// Package bond contains generated bindings for API file bond.api. +// +// Contents: +// 2 enums +// 14 messages +// +package bond + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "bond" + APIVersion = "2.0.0" + VersionCrc = 0xa65a4a1e +) + +// BondLbAlgo defines enum 'bond_lb_algo'. +type BondLbAlgo uint32 + +const ( + BOND_API_LB_ALGO_L2 BondLbAlgo = 0 + BOND_API_LB_ALGO_L34 BondLbAlgo = 1 + BOND_API_LB_ALGO_L23 BondLbAlgo = 2 + BOND_API_LB_ALGO_RR BondLbAlgo = 3 + BOND_API_LB_ALGO_BC BondLbAlgo = 4 + BOND_API_LB_ALGO_AB BondLbAlgo = 5 +) + +var ( + BondLbAlgo_name = map[uint32]string{ + 0: "BOND_API_LB_ALGO_L2", + 1: "BOND_API_LB_ALGO_L34", + 2: "BOND_API_LB_ALGO_L23", + 3: "BOND_API_LB_ALGO_RR", + 4: "BOND_API_LB_ALGO_BC", + 5: "BOND_API_LB_ALGO_AB", + } + BondLbAlgo_value = map[string]uint32{ + "BOND_API_LB_ALGO_L2": 0, + "BOND_API_LB_ALGO_L34": 1, + "BOND_API_LB_ALGO_L23": 2, + "BOND_API_LB_ALGO_RR": 3, + "BOND_API_LB_ALGO_BC": 4, + "BOND_API_LB_ALGO_AB": 5, + } +) + +func (x BondLbAlgo) String() string { + s, ok := BondLbAlgo_name[uint32(x)] + if ok { + return s + } + return "BondLbAlgo(" + strconv.Itoa(int(x)) + ")" +} + +// BondMode defines enum 'bond_mode'. +type BondMode uint32 + +const ( + BOND_API_MODE_ROUND_ROBIN BondMode = 1 + BOND_API_MODE_ACTIVE_BACKUP BondMode = 2 + BOND_API_MODE_XOR BondMode = 3 + BOND_API_MODE_BROADCAST BondMode = 4 + BOND_API_MODE_LACP BondMode = 5 +) + +var ( + BondMode_name = map[uint32]string{ + 1: "BOND_API_MODE_ROUND_ROBIN", + 2: "BOND_API_MODE_ACTIVE_BACKUP", + 3: "BOND_API_MODE_XOR", + 4: "BOND_API_MODE_BROADCAST", + 5: "BOND_API_MODE_LACP", + } + BondMode_value = map[string]uint32{ + "BOND_API_MODE_ROUND_ROBIN": 1, + "BOND_API_MODE_ACTIVE_BACKUP": 2, + "BOND_API_MODE_XOR": 3, + "BOND_API_MODE_BROADCAST": 4, + "BOND_API_MODE_LACP": 5, + } +) + +func (x BondMode) String() string { + s, ok := BondMode_name[uint32(x)] + if ok { + return s + } + return "BondMode(" + strconv.Itoa(int(x)) + ")" +} + +// BondCreate defines message 'bond_create'. +type BondCreate struct { + ID uint32 `binapi:"u32,name=id,default=%!s(float64=4.294967295e+09)" json:"id,omitempty"` + UseCustomMac bool `binapi:"bool,name=use_custom_mac" json:"use_custom_mac,omitempty"` + MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + Mode BondMode `binapi:"bond_mode,name=mode" json:"mode,omitempty"` + Lb BondLbAlgo `binapi:"bond_lb_algo,name=lb" json:"lb,omitempty"` + NumaOnly bool `binapi:"bool,name=numa_only" json:"numa_only,omitempty"` +} + +func (m *BondCreate) Reset() { *m = BondCreate{} } +func (*BondCreate) GetMessageName() string { return "bond_create" } +func (*BondCreate) GetCrcString() string { return "48883c7e" } +func (*BondCreate) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondCreate) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.ID + size += 1 // m.UseCustomMac + size += 1 * 6 // m.MacAddress + size += 4 // m.Mode + size += 4 // m.Lb + size += 1 // m.NumaOnly + return size +} +func (m *BondCreate) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.ID)) + buf.EncodeBool(m.UseCustomMac) + buf.EncodeBytes(m.MacAddress[:], 6) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeUint32(uint32(m.Lb)) + buf.EncodeBool(m.NumaOnly) + return buf.Bytes(), nil +} +func (m *BondCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.ID = buf.DecodeUint32() + m.UseCustomMac = buf.DecodeBool() + copy(m.MacAddress[:], buf.DecodeBytes(6)) + m.Mode = BondMode(buf.DecodeUint32()) + m.Lb = BondLbAlgo(buf.DecodeUint32()) + m.NumaOnly = buf.DecodeBool() + return nil +} + +// BondCreateReply defines message 'bond_create_reply'. +type BondCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BondCreateReply) Reset() { *m = BondCreateReply{} } +func (*BondCreateReply) GetMessageName() string { return "bond_create_reply" } +func (*BondCreateReply) GetCrcString() string { return "5383d31f" } +func (*BondCreateReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *BondCreateReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BondCreateReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BondDelete defines message 'bond_delete'. +type BondDelete struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BondDelete) Reset() { *m = BondDelete{} } +func (*BondDelete) GetMessageName() string { return "bond_delete" } +func (*BondDelete) GetCrcString() string { return "f9e6675e" } +func (*BondDelete) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondDelete) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *BondDelete) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BondDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BondDeleteReply defines message 'bond_delete_reply'. +type BondDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BondDeleteReply) Reset() { *m = BondDeleteReply{} } +func (*BondDeleteReply) GetMessageName() string { return "bond_delete_reply" } +func (*BondDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*BondDeleteReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BondDeleteReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BondDeleteReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BondDetachSlave defines message 'bond_detach_slave'. +type BondDetachSlave struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *BondDetachSlave) Reset() { *m = BondDetachSlave{} } +func (*BondDetachSlave) GetMessageName() string { return "bond_detach_slave" } +func (*BondDetachSlave) GetCrcString() string { return "f9e6675e" } +func (*BondDetachSlave) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondDetachSlave) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *BondDetachSlave) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *BondDetachSlave) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// BondDetachSlaveReply defines message 'bond_detach_slave_reply'. +type BondDetachSlaveReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BondDetachSlaveReply) Reset() { *m = BondDetachSlaveReply{} } +func (*BondDetachSlaveReply) GetMessageName() string { return "bond_detach_slave_reply" } +func (*BondDetachSlaveReply) GetCrcString() string { return "e8d4e804" } +func (*BondDetachSlaveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondDetachSlaveReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BondDetachSlaveReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BondDetachSlaveReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// BondEnslave defines message 'bond_enslave'. +type BondEnslave struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + BondSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=bond_sw_if_index" json:"bond_sw_if_index,omitempty"` + IsPassive bool `binapi:"bool,name=is_passive" json:"is_passive,omitempty"` + IsLongTimeout bool `binapi:"bool,name=is_long_timeout" json:"is_long_timeout,omitempty"` +} + +func (m *BondEnslave) Reset() { *m = BondEnslave{} } +func (*BondEnslave) GetMessageName() string { return "bond_enslave" } +func (*BondEnslave) GetCrcString() string { return "076ecfa7" } +func (*BondEnslave) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BondEnslave) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.BondSwIfIndex + size += 1 // m.IsPassive + size += 1 // m.IsLongTimeout + return size +} +func (m *BondEnslave) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.BondSwIfIndex)) + buf.EncodeBool(m.IsPassive) + buf.EncodeBool(m.IsLongTimeout) + return buf.Bytes(), nil +} +func (m *BondEnslave) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.BondSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IsPassive = buf.DecodeBool() + m.IsLongTimeout = buf.DecodeBool() + return nil +} + +// BondEnslaveReply defines message 'bond_enslave_reply'. +type BondEnslaveReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BondEnslaveReply) Reset() { *m = BondEnslaveReply{} } +func (*BondEnslaveReply) GetMessageName() string { return "bond_enslave_reply" } +func (*BondEnslaveReply) GetCrcString() string { return "e8d4e804" } +func (*BondEnslaveReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BondEnslaveReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BondEnslaveReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BondEnslaveReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceBondDetails defines message 'sw_interface_bond_details'. +type SwInterfaceBondDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Mode BondMode `binapi:"bond_mode,name=mode" json:"mode,omitempty"` + Lb BondLbAlgo `binapi:"bond_lb_algo,name=lb" json:"lb,omitempty"` + NumaOnly bool `binapi:"bool,name=numa_only" json:"numa_only,omitempty"` + ActiveSlaves uint32 `binapi:"u32,name=active_slaves" json:"active_slaves,omitempty"` + Slaves uint32 `binapi:"u32,name=slaves" json:"slaves,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` +} + +func (m *SwInterfaceBondDetails) Reset() { *m = SwInterfaceBondDetails{} } +func (*SwInterfaceBondDetails) GetMessageName() string { return "sw_interface_bond_details" } +func (*SwInterfaceBondDetails) GetCrcString() string { return "f5ef2106" } +func (*SwInterfaceBondDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceBondDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.ID + size += 4 // m.Mode + size += 4 // m.Lb + size += 1 // m.NumaOnly + size += 4 // m.ActiveSlaves + size += 4 // m.Slaves + size += 64 // m.InterfaceName + return size +} +func (m *SwInterfaceBondDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ID)) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeUint32(uint32(m.Lb)) + buf.EncodeBool(m.NumaOnly) + buf.EncodeUint32(uint32(m.ActiveSlaves)) + buf.EncodeUint32(uint32(m.Slaves)) + buf.EncodeString(m.InterfaceName, 64) + return buf.Bytes(), nil +} +func (m *SwInterfaceBondDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ID = buf.DecodeUint32() + m.Mode = BondMode(buf.DecodeUint32()) + m.Lb = BondLbAlgo(buf.DecodeUint32()) + m.NumaOnly = buf.DecodeBool() + m.ActiveSlaves = buf.DecodeUint32() + m.Slaves = buf.DecodeUint32() + m.InterfaceName = buf.DecodeString(64) + return nil +} + +// SwInterfaceBondDump defines message 'sw_interface_bond_dump'. +type SwInterfaceBondDump struct{} + +func (m *SwInterfaceBondDump) Reset() { *m = SwInterfaceBondDump{} } +func (*SwInterfaceBondDump) GetMessageName() string { return "sw_interface_bond_dump" } +func (*SwInterfaceBondDump) GetCrcString() string { return "51077d14" } +func (*SwInterfaceBondDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceBondDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SwInterfaceBondDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *SwInterfaceBondDump) Unmarshal(b []byte) error { + return nil +} + +// SwInterfaceSetBondWeight defines message 'sw_interface_set_bond_weight'. +type SwInterfaceSetBondWeight struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` +} + +func (m *SwInterfaceSetBondWeight) Reset() { *m = SwInterfaceSetBondWeight{} } +func (*SwInterfaceSetBondWeight) GetMessageName() string { return "sw_interface_set_bond_weight" } +func (*SwInterfaceSetBondWeight) GetCrcString() string { return "deb510a0" } +func (*SwInterfaceSetBondWeight) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSetBondWeight) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.Weight + return size +} +func (m *SwInterfaceSetBondWeight) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.Weight)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetBondWeight) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Weight = buf.DecodeUint32() + return nil +} + +// SwInterfaceSetBondWeightReply defines message 'sw_interface_set_bond_weight_reply'. +type SwInterfaceSetBondWeightReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetBondWeightReply) Reset() { *m = SwInterfaceSetBondWeightReply{} } +func (*SwInterfaceSetBondWeightReply) GetMessageName() string { + return "sw_interface_set_bond_weight_reply" +} +func (*SwInterfaceSetBondWeightReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetBondWeightReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetBondWeightReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *SwInterfaceSetBondWeightReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSetBondWeightReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// SwInterfaceSlaveDetails defines message 'sw_interface_slave_details'. +type SwInterfaceSlaveDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"` + IsPassive bool `binapi:"bool,name=is_passive" json:"is_passive,omitempty"` + IsLongTimeout bool `binapi:"bool,name=is_long_timeout" json:"is_long_timeout,omitempty"` + IsLocalNuma bool `binapi:"bool,name=is_local_numa" json:"is_local_numa,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` +} + +func (m *SwInterfaceSlaveDetails) Reset() { *m = SwInterfaceSlaveDetails{} } +func (*SwInterfaceSlaveDetails) GetMessageName() string { return "sw_interface_slave_details" } +func (*SwInterfaceSlaveDetails) GetCrcString() string { return "3c4a0e23" } +func (*SwInterfaceSlaveDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSlaveDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.InterfaceName + size += 1 // m.IsPassive + size += 1 // m.IsLongTimeout + size += 1 // m.IsLocalNuma + size += 4 // m.Weight + return size +} +func (m *SwInterfaceSlaveDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.InterfaceName, 64) + buf.EncodeBool(m.IsPassive) + buf.EncodeBool(m.IsLongTimeout) + buf.EncodeBool(m.IsLocalNuma) + buf.EncodeUint32(uint32(m.Weight)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSlaveDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.InterfaceName = buf.DecodeString(64) + m.IsPassive = buf.DecodeBool() + m.IsLongTimeout = buf.DecodeBool() + m.IsLocalNuma = buf.DecodeBool() + m.Weight = buf.DecodeUint32() + return nil +} + +// SwInterfaceSlaveDump defines message 'sw_interface_slave_dump'. +type SwInterfaceSlaveDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceSlaveDump) Reset() { *m = SwInterfaceSlaveDump{} } +func (*SwInterfaceSlaveDump) GetMessageName() string { return "sw_interface_slave_dump" } +func (*SwInterfaceSlaveDump) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceSlaveDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *SwInterfaceSlaveDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *SwInterfaceSlaveDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *SwInterfaceSlaveDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_bond_binapi_init() } +func file_bond_binapi_init() { + api.RegisterMessage((*BondCreate)(nil), "bond_create_48883c7e") + api.RegisterMessage((*BondCreateReply)(nil), "bond_create_reply_5383d31f") + api.RegisterMessage((*BondDelete)(nil), "bond_delete_f9e6675e") + api.RegisterMessage((*BondDeleteReply)(nil), "bond_delete_reply_e8d4e804") + api.RegisterMessage((*BondDetachSlave)(nil), "bond_detach_slave_f9e6675e") + api.RegisterMessage((*BondDetachSlaveReply)(nil), "bond_detach_slave_reply_e8d4e804") + api.RegisterMessage((*BondEnslave)(nil), "bond_enslave_076ecfa7") + api.RegisterMessage((*BondEnslaveReply)(nil), "bond_enslave_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceBondDetails)(nil), "sw_interface_bond_details_f5ef2106") + api.RegisterMessage((*SwInterfaceBondDump)(nil), "sw_interface_bond_dump_51077d14") + api.RegisterMessage((*SwInterfaceSetBondWeight)(nil), "sw_interface_set_bond_weight_deb510a0") + api.RegisterMessage((*SwInterfaceSetBondWeightReply)(nil), "sw_interface_set_bond_weight_reply_e8d4e804") + api.RegisterMessage((*SwInterfaceSlaveDetails)(nil), "sw_interface_slave_details_3c4a0e23") + api.RegisterMessage((*SwInterfaceSlaveDump)(nil), "sw_interface_slave_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BondCreate)(nil), + (*BondCreateReply)(nil), + (*BondDelete)(nil), + (*BondDeleteReply)(nil), + (*BondDetachSlave)(nil), + (*BondDetachSlaveReply)(nil), + (*BondEnslave)(nil), + (*BondEnslaveReply)(nil), + (*SwInterfaceBondDetails)(nil), + (*SwInterfaceBondDump)(nil), + (*SwInterfaceSetBondWeight)(nil), + (*SwInterfaceSetBondWeightReply)(nil), + (*SwInterfaceSlaveDetails)(nil), + (*SwInterfaceSlaveDump)(nil), + } +} diff --git a/binapi/bond/bond_rest.ba.go b/binapi/bond/bond_rest.ba.go new file mode 100644 index 0000000..c1893d5 --- /dev/null +++ b/binapi/bond/bond_rest.ba.go @@ -0,0 +1,129 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bond + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/bond_create", func(w http.ResponseWriter, req *http.Request) { + var request = new(BondCreate) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BondCreate(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bond_delete", func(w http.ResponseWriter, req *http.Request) { + var request = new(BondDelete) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BondDelete(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bond_detach_slave", func(w http.ResponseWriter, req *http.Request) { + var request = new(BondDetachSlave) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BondDetachSlave(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/bond_enslave", func(w http.ResponseWriter, req *http.Request) { + var request = new(BondEnslave) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.BondEnslave(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/sw_interface_set_bond_weight", func(w http.ResponseWriter, req *http.Request) { + var request = new(SwInterfaceSetBondWeight) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.SwInterfaceSetBondWeight(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/bond/bond_rpc.ba.go b/binapi/bond/bond_rpc.ba.go new file mode 100644 index 0000000..5e60f84 --- /dev/null +++ b/binapi/bond/bond_rpc.ba.go @@ -0,0 +1,153 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package bond + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service bond. +type RPCService interface { + BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) + BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) + BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) + BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) + SwInterfaceBondDump(ctx context.Context, in *SwInterfaceBondDump) (RPCService_SwInterfaceBondDumpClient, error) + SwInterfaceSetBondWeight(ctx context.Context, in *SwInterfaceSetBondWeight) (*SwInterfaceSetBondWeightReply, error) + SwInterfaceSlaveDump(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_SwInterfaceSlaveDumpClient, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) BondCreate(ctx context.Context, in *BondCreate) (*BondCreateReply, error) { + out := new(BondCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDelete(ctx context.Context, in *BondDelete) (*BondDeleteReply, error) { + out := new(BondDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondDetachSlave(ctx context.Context, in *BondDetachSlave) (*BondDetachSlaveReply, error) { + out := new(BondDetachSlaveReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) BondEnslave(ctx context.Context, in *BondEnslave) (*BondEnslaveReply, error) { + out := new(BondEnslaveReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceBondDump(ctx context.Context, in *SwInterfaceBondDump) (RPCService_SwInterfaceBondDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceBondDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceBondDumpClient interface { + Recv() (*SwInterfaceBondDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceBondDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceBondDumpClient) Recv() (*SwInterfaceBondDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceBondDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) SwInterfaceSetBondWeight(ctx context.Context, in *SwInterfaceSetBondWeight) (*SwInterfaceSetBondWeightReply, error) { + out := new(SwInterfaceSetBondWeightReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSlaveDump(ctx context.Context, in *SwInterfaceSlaveDump) (RPCService_SwInterfaceSlaveDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_SwInterfaceSlaveDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_SwInterfaceSlaveDumpClient interface { + Recv() (*SwInterfaceSlaveDetails, error) + api.Stream +} + +type serviceClient_SwInterfaceSlaveDumpClient struct { + api.Stream +} + +func (c *serviceClient_SwInterfaceSlaveDumpClient) Recv() (*SwInterfaceSlaveDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *SwInterfaceSlaveDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} diff --git a/binapi/builtinurl/builtinurl.ba.go b/binapi/builtinurl/builtinurl.ba.go new file mode 100644 index 0000000..bfc593f --- /dev/null +++ b/binapi/builtinurl/builtinurl.ba.go @@ -0,0 +1,109 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/builtinurl.api.json + +// Package builtinurl contains generated bindings for API file builtinurl.api. +// +// Contents: +// 2 messages +// +package builtinurl + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "builtinurl" + APIVersion = "1.0.0" + VersionCrc = 0x25045d63 +) + +// BuiltinurlEnable defines message 'builtinurl_enable'. +type BuiltinurlEnable struct{} + +func (m *BuiltinurlEnable) Reset() { *m = BuiltinurlEnable{} } +func (*BuiltinurlEnable) GetMessageName() string { return "builtinurl_enable" } +func (*BuiltinurlEnable) GetCrcString() string { return "51077d14" } +func (*BuiltinurlEnable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *BuiltinurlEnable) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *BuiltinurlEnable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *BuiltinurlEnable) Unmarshal(b []byte) error { + return nil +} + +// BuiltinurlEnableReply defines message 'builtinurl_enable_reply'. +type BuiltinurlEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *BuiltinurlEnableReply) Reset() { *m = BuiltinurlEnableReply{} } +func (*BuiltinurlEnableReply) GetMessageName() string { return "builtinurl_enable_reply" } +func (*BuiltinurlEnableReply) GetCrcString() string { return "e8d4e804" } +func (*BuiltinurlEnableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *BuiltinurlEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *BuiltinurlEnableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *BuiltinurlEnableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_builtinurl_binapi_init() } +func file_builtinurl_binapi_init() { + api.RegisterMessage((*BuiltinurlEnable)(nil), "builtinurl_enable_51077d14") + api.RegisterMessage((*BuiltinurlEnableReply)(nil), "builtinurl_enable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*BuiltinurlEnable)(nil), + (*BuiltinurlEnableReply)(nil), + } +} diff --git a/binapi/builtinurl/builtinurl_rest.ba.go b/binapi/builtinurl/builtinurl_rest.ba.go new file mode 100644 index 0000000..a4373f1 --- /dev/null +++ b/binapi/builtinurl/builtinurl_rest.ba.go @@ -0,0 +1,27 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package builtinurl + +import ( + "encoding/json" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/builtinurl_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(BuiltinurlEnable) + reply, err := rpc.BuiltinurlEnable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/builtinurl/builtinurl_rpc.ba.go b/binapi/builtinurl/builtinurl_rpc.ba.go new file mode 100644 index 0000000..6857de2 --- /dev/null +++ b/binapi/builtinurl/builtinurl_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package builtinurl + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service builtinurl. +type RPCService interface { + BuiltinurlEnable(ctx context.Context, in *BuiltinurlEnable) (*BuiltinurlEnableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) BuiltinurlEnable(ctx context.Context, in *BuiltinurlEnable) (*BuiltinurlEnableReply, error) { + out := new(BuiltinurlEnableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/cdp/cdp.ba.go b/binapi/cdp/cdp.ba.go new file mode 100644 index 0000000..afd8c46 --- /dev/null +++ b/binapi/cdp/cdp.ba.go @@ -0,0 +1,115 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/cdp.api.json + +// Package cdp contains generated bindings for API file cdp.api. +// +// Contents: +// 2 messages +// +package cdp + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "cdp" + APIVersion = "1.0.0" + VersionCrc = 0x8cfa825e +) + +// CdpEnableDisable defines message 'cdp_enable_disable'. +type CdpEnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *CdpEnableDisable) Reset() { *m = CdpEnableDisable{} } +func (*CdpEnableDisable) GetMessageName() string { return "cdp_enable_disable" } +func (*CdpEnableDisable) GetCrcString() string { return "2e7b47df" } +func (*CdpEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CdpEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + return size +} +func (m *CdpEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *CdpEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// CdpEnableDisableReply defines message 'cdp_enable_disable_reply'. +type CdpEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CdpEnableDisableReply) Reset() { *m = CdpEnableDisableReply{} } +func (*CdpEnableDisableReply) GetMessageName() string { return "cdp_enable_disable_reply" } +func (*CdpEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*CdpEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CdpEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *CdpEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *CdpEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_cdp_binapi_init() } +func file_cdp_binapi_init() { + api.RegisterMessage((*CdpEnableDisable)(nil), "cdp_enable_disable_2e7b47df") + api.RegisterMessage((*CdpEnableDisableReply)(nil), "cdp_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CdpEnableDisable)(nil), + (*CdpEnableDisableReply)(nil), + } +} diff --git a/binapi/cdp/cdp_rest.ba.go b/binapi/cdp/cdp_rest.ba.go new file mode 100644 index 0000000..b414757 --- /dev/null +++ b/binapi/cdp/cdp_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package cdp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/cdp_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(CdpEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CdpEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/cdp/cdp_rpc.ba.go b/binapi/cdp/cdp_rpc.ba.go new file mode 100644 index 0000000..a910833 --- /dev/null +++ b/binapi/cdp/cdp_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package cdp + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service cdp. +type RPCService interface { + CdpEnableDisable(ctx context.Context, in *CdpEnableDisable) (*CdpEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CdpEnableDisable(ctx context.Context, in *CdpEnableDisable) (*CdpEnableDisableReply, error) { + out := new(CdpEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/classify/classify.ba.go b/binapi/classify/classify.ba.go new file mode 100644 index 0000000..f1696aa --- /dev/null +++ b/binapi/classify/classify.ba.go @@ -0,0 +1,1487 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/classify.api.json + +// Package classify contains generated bindings for API file classify.api. +// +// Contents: +// 3 enums +// 28 messages +// +package classify + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "classify" + APIVersion = "3.0.0" + VersionCrc = 0x1298bdec +) + +// ClassifyAction defines enum 'classify_action'. +type ClassifyAction uint8 + +const ( + CLASSIFY_API_ACTION_NONE ClassifyAction = 0 + CLASSIFY_API_ACTION_SET_IP4_FIB_INDEX ClassifyAction = 1 + CLASSIFY_API_ACTION_SET_IP6_FIB_INDEX ClassifyAction = 2 + CLASSIFY_API_ACTION_SET_METADATA ClassifyAction = 3 +) + +var ( + ClassifyAction_name = map[uint8]string{ + 0: "CLASSIFY_API_ACTION_NONE", + 1: "CLASSIFY_API_ACTION_SET_IP4_FIB_INDEX", + 2: "CLASSIFY_API_ACTION_SET_IP6_FIB_INDEX", + 3: "CLASSIFY_API_ACTION_SET_METADATA", + } + ClassifyAction_value = map[string]uint8{ + "CLASSIFY_API_ACTION_NONE": 0, + "CLASSIFY_API_ACTION_SET_IP4_FIB_INDEX": 1, + "CLASSIFY_API_ACTION_SET_IP6_FIB_INDEX": 2, + "CLASSIFY_API_ACTION_SET_METADATA": 3, + } +) + +func (x ClassifyAction) String() string { + s, ok := ClassifyAction_name[uint8(x)] + if ok { + return s + } + return "ClassifyAction(" + strconv.Itoa(int(x)) + ")" +} + +// FlowClassifyTable defines enum 'flow_classify_table'. +type FlowClassifyTable uint8 + +const ( + FLOW_CLASSIFY_API_TABLE_IP4 FlowClassifyTable = 1 + FLOW_CLASSIFY_API_TABLE_IP6 FlowClassifyTable = 2 +) + +var ( + FlowClassifyTable_name = map[uint8]string{ + 1: "FLOW_CLASSIFY_API_TABLE_IP4", + 2: "FLOW_CLASSIFY_API_TABLE_IP6", + } + FlowClassifyTable_value = map[string]uint8{ + "FLOW_CLASSIFY_API_TABLE_IP4": 1, + "FLOW_CLASSIFY_API_TABLE_IP6": 2, + } +) + +func (x FlowClassifyTable) String() string { + s, ok := FlowClassifyTable_name[uint8(x)] + if ok { + return s + } + return "FlowClassifyTable(" + strconv.Itoa(int(x)) + ")" +} + +// PolicerClassifyTable defines enum 'policer_classify_table'. +type PolicerClassifyTable uint8 + +const ( + POLICER_CLASSIFY_API_TABLE_IP4 PolicerClassifyTable = 1 + POLICER_CLASSIFY_API_TABLE_IP6 PolicerClassifyTable = 2 + POLICER_CLASSIFY_API_TABLE_L2 PolicerClassifyTable = 3 +) + +var ( + PolicerClassifyTable_name = map[uint8]string{ + 1: "POLICER_CLASSIFY_API_TABLE_IP4", + 2: "POLICER_CLASSIFY_API_TABLE_IP6", + 3: "POLICER_CLASSIFY_API_TABLE_L2", + } + PolicerClassifyTable_value = map[string]uint8{ + "POLICER_CLASSIFY_API_TABLE_IP4": 1, + "POLICER_CLASSIFY_API_TABLE_IP6": 2, + "POLICER_CLASSIFY_API_TABLE_L2": 3, + } +) + +func (x PolicerClassifyTable) String() string { + s, ok := PolicerClassifyTable_name[uint8(x)] + if ok { + return s + } + return "PolicerClassifyTable(" + strconv.Itoa(int(x)) + ")" +} + +// ClassifyAddDelSession defines message 'classify_add_del_session'. +type ClassifyAddDelSession struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` + HitNextIndex uint32 `binapi:"u32,name=hit_next_index,default=%!s(float64=4.294967295e+09)" json:"hit_next_index,omitempty"` + OpaqueIndex uint32 `binapi:"u32,name=opaque_index,default=%!s(float64=4.294967295e+09)" json:"opaque_index,omitempty"` + Advance int32 `binapi:"i32,name=advance,default=%!s(float64=0)" json:"advance,omitempty"` + Action ClassifyAction `binapi:"classify_action,name=action,default=%!s(float64=0)" json:"action,omitempty"` + Metadata uint32 `binapi:"u32,name=metadata,default=%!s(float64=0)" json:"metadata,omitempty"` + MatchLen uint32 `binapi:"u32,name=match_len" json:"-"` + Match []byte `binapi:"u8[match_len],name=match" json:"match,omitempty"` +} + +func (m *ClassifyAddDelSession) Reset() { *m = ClassifyAddDelSession{} } +func (*ClassifyAddDelSession) GetMessageName() string { return "classify_add_del_session" } +func (*ClassifyAddDelSession) GetCrcString() string { return "f20879f0" } +func (*ClassifyAddDelSession) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyAddDelSession) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.TableIndex + size += 4 // m.HitNextIndex + size += 4 // m.OpaqueIndex + size += 4 // m.Advance + size += 1 // m.Action + size += 4 // m.Metadata + size += 4 // m.MatchLen + size += 1 * len(m.Match) // m.Match + return size +} +func (m *ClassifyAddDelSession) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.TableIndex)) + buf.EncodeUint32(uint32(m.HitNextIndex)) + buf.EncodeUint32(uint32(m.OpaqueIndex)) + buf.EncodeUint32(uint32(m.Advance)) + buf.EncodeUint8(uint8(m.Action)) + buf.EncodeUint32(uint32(m.Metadata)) + buf.EncodeUint32(uint32(len(m.Match))) + buf.EncodeBytes(m.Match[:], 0) + return buf.Bytes(), nil +} +func (m *ClassifyAddDelSession) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.TableIndex = buf.DecodeUint32() + m.HitNextIndex = buf.DecodeUint32() + m.OpaqueIndex = buf.DecodeUint32() + m.Advance = int32(buf.DecodeUint32()) + m.Action = ClassifyAction(buf.DecodeUint8()) + m.Metadata = buf.DecodeUint32() + m.MatchLen = buf.DecodeUint32() + copy(m.Match[:], buf.DecodeBytes(0)) + return nil +} + +// ClassifyAddDelSessionReply defines message 'classify_add_del_session_reply'. +type ClassifyAddDelSessionReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ClassifyAddDelSessionReply) Reset() { *m = ClassifyAddDelSessionReply{} } +func (*ClassifyAddDelSessionReply) GetMessageName() string { return "classify_add_del_session_reply" } +func (*ClassifyAddDelSessionReply) GetCrcString() string { return "e8d4e804" } +func (*ClassifyAddDelSessionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyAddDelSessionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ClassifyAddDelSessionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ClassifyAddDelSessionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ClassifyAddDelTable defines message 'classify_add_del_table'. +type ClassifyAddDelTable struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DelChain bool `binapi:"bool,name=del_chain" json:"del_chain,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index,default=%!s(float64=4.294967295e+09)" json:"table_index,omitempty"` + Nbuckets uint32 `binapi:"u32,name=nbuckets,default=%!s(float64=2)" json:"nbuckets,omitempty"` + MemorySize uint32 `binapi:"u32,name=memory_size,default=%!s(float64=2.097152e+06)" json:"memory_size,omitempty"` + SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors,default=%!s(float64=0)" json:"skip_n_vectors,omitempty"` + MatchNVectors uint32 `binapi:"u32,name=match_n_vectors,default=%!s(float64=1)" json:"match_n_vectors,omitempty"` + NextTableIndex uint32 `binapi:"u32,name=next_table_index,default=%!s(float64=4.294967295e+09)" json:"next_table_index,omitempty"` + MissNextIndex uint32 `binapi:"u32,name=miss_next_index,default=%!s(float64=4.294967295e+09)" json:"miss_next_index,omitempty"` + CurrentDataFlag uint8 `binapi:"u8,name=current_data_flag,default=%!s(float64=0)" json:"current_data_flag,omitempty"` + CurrentDataOffset int16 `binapi:"i16,name=current_data_offset,default=%!s(float64=0)" json:"current_data_offset,omitempty"` + MaskLen uint32 `binapi:"u32,name=mask_len" json:"-"` + Mask []byte `binapi:"u8[mask_len],name=mask" json:"mask,omitempty"` +} + +func (m *ClassifyAddDelTable) Reset() { *m = ClassifyAddDelTable{} } +func (*ClassifyAddDelTable) GetMessageName() string { return "classify_add_del_table" } +func (*ClassifyAddDelTable) GetCrcString() string { return "6849e39e" } +func (*ClassifyAddDelTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyAddDelTable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 1 // m.DelChain + size += 4 // m.TableIndex + size += 4 // m.Nbuckets + size += 4 // m.MemorySize + size += 4 // m.SkipNVectors + size += 4 // m.MatchNVectors + size += 4 // m.NextTableIndex + size += 4 // m.MissNextIndex + size += 1 // m.CurrentDataFlag + size += 2 // m.CurrentDataOffset + size += 4 // m.MaskLen + size += 1 * len(m.Mask) // m.Mask + return size +} +func (m *ClassifyAddDelTable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeBool(m.DelChain) + buf.EncodeUint32(uint32(m.TableIndex)) + buf.EncodeUint32(uint32(m.Nbuckets)) + buf.EncodeUint32(uint32(m.MemorySize)) + buf.EncodeUint32(uint32(m.SkipNVectors)) + buf.EncodeUint32(uint32(m.MatchNVectors)) + buf.EncodeUint32(uint32(m.NextTableIndex)) + buf.EncodeUint32(uint32(m.MissNextIndex)) + buf.EncodeUint8(uint8(m.CurrentDataFlag)) + buf.EncodeUint16(uint16(m.CurrentDataOffset)) + buf.EncodeUint32(uint32(len(m.Mask))) + buf.EncodeBytes(m.Mask[:], 0) + return buf.Bytes(), nil +} +func (m *ClassifyAddDelTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.DelChain = buf.DecodeBool() + m.TableIndex = buf.DecodeUint32() + m.Nbuckets = buf.DecodeUint32() + m.MemorySize = buf.DecodeUint32() + m.SkipNVectors = buf.DecodeUint32() + m.MatchNVectors = buf.DecodeUint32() + m.NextTableIndex = buf.DecodeUint32() + m.MissNextIndex = buf.DecodeUint32() + m.CurrentDataFlag = buf.DecodeUint8() + m.CurrentDataOffset = int16(buf.DecodeUint16()) + m.MaskLen = buf.DecodeUint32() + copy(m.Mask[:], buf.DecodeBytes(0)) + return nil +} + +// ClassifyAddDelTableReply defines message 'classify_add_del_table_reply'. +type ClassifyAddDelTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NewTableIndex uint32 `binapi:"u32,name=new_table_index" json:"new_table_index,omitempty"` + SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors" json:"skip_n_vectors,omitempty"` + MatchNVectors uint32 `binapi:"u32,name=match_n_vectors" json:"match_n_vectors,omitempty"` +} + +func (m *ClassifyAddDelTableReply) Reset() { *m = ClassifyAddDelTableReply{} } +func (*ClassifyAddDelTableReply) GetMessageName() string { return "classify_add_del_table_reply" } +func (*ClassifyAddDelTableReply) GetCrcString() string { return "05486349" } +func (*ClassifyAddDelTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyAddDelTableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.NewTableIndex + size += 4 // m.SkipNVectors + size += 4 // m.MatchNVectors + return size +} +func (m *ClassifyAddDelTableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.NewTableIndex)) + buf.EncodeUint32(uint32(m.SkipNVectors)) + buf.EncodeUint32(uint32(m.MatchNVectors)) + return buf.Bytes(), nil +} +func (m *ClassifyAddDelTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.NewTableIndex = buf.DecodeUint32() + m.SkipNVectors = buf.DecodeUint32() + m.MatchNVectors = buf.DecodeUint32() + return nil +} + +// ClassifySessionDetails defines message 'classify_session_details'. +type ClassifySessionDetails struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + HitNextIndex uint32 `binapi:"u32,name=hit_next_index" json:"hit_next_index,omitempty"` + Advance int32 `binapi:"i32,name=advance" json:"advance,omitempty"` + OpaqueIndex uint32 `binapi:"u32,name=opaque_index" json:"opaque_index,omitempty"` + MatchLength uint32 `binapi:"u32,name=match_length" json:"-"` + Match []byte `binapi:"u8[match_length],name=match" json:"match,omitempty"` +} + +func (m *ClassifySessionDetails) Reset() { *m = ClassifySessionDetails{} } +func (*ClassifySessionDetails) GetMessageName() string { return "classify_session_details" } +func (*ClassifySessionDetails) GetCrcString() string { return "60e3ef94" } +func (*ClassifySessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifySessionDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.TableID + size += 4 // m.HitNextIndex + size += 4 // m.Advance + size += 4 // m.OpaqueIndex + size += 4 // m.MatchLength + size += 1 * len(m.Match) // m.Match + return size +} +func (m *ClassifySessionDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint32(uint32(m.HitNextIndex)) + buf.EncodeUint32(uint32(m.Advance)) + buf.EncodeUint32(uint32(m.OpaqueIndex)) + buf.EncodeUint32(uint32(len(m.Match))) + buf.EncodeBytes(m.Match[:], 0) + return buf.Bytes(), nil +} +func (m *ClassifySessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.TableID = buf.DecodeUint32() + m.HitNextIndex = buf.DecodeUint32() + m.Advance = int32(buf.DecodeUint32()) + m.OpaqueIndex = buf.DecodeUint32() + m.MatchLength = buf.DecodeUint32() + copy(m.Match[:], buf.DecodeBytes(0)) + return nil +} + +// ClassifySessionDump defines message 'classify_session_dump'. +type ClassifySessionDump struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` +} + +func (m *ClassifySessionDump) Reset() { *m = ClassifySessionDump{} } +func (*ClassifySessionDump) GetMessageName() string { return "classify_session_dump" } +func (*ClassifySessionDump) GetCrcString() string { return "0cca2cd9" } +func (*ClassifySessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifySessionDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TableID + return size +} +func (m *ClassifySessionDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TableID)) + return buf.Bytes(), nil +} +func (m *ClassifySessionDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + return nil +} + +// ClassifySetInterfaceIPTable defines message 'classify_set_interface_ip_table'. +type ClassifySetInterfaceIPTable struct { + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *ClassifySetInterfaceIPTable) Reset() { *m = ClassifySetInterfaceIPTable{} } +func (*ClassifySetInterfaceIPTable) GetMessageName() string { return "classify_set_interface_ip_table" } +func (*ClassifySetInterfaceIPTable) GetCrcString() string { return "e0b097c7" } +func (*ClassifySetInterfaceIPTable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifySetInterfaceIPTable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIPv6 + size += 4 // m.SwIfIndex + size += 4 // m.TableIndex + return size +} +func (m *ClassifySetInterfaceIPTable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsIPv6) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.TableIndex)) + return buf.Bytes(), nil +} +func (m *ClassifySetInterfaceIPTable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIPv6 = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TableIndex = buf.DecodeUint32() + return nil +} + +// ClassifySetInterfaceIPTableReply defines message 'classify_set_interface_ip_table_reply'. +type ClassifySetInterfaceIPTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ClassifySetInterfaceIPTableReply) Reset() { *m = ClassifySetInterfaceIPTableReply{} } +func (*ClassifySetInterfaceIPTableReply) GetMessageName() string { + return "classify_set_interface_ip_table_reply" +} +func (*ClassifySetInterfaceIPTableReply) GetCrcString() string { return "e8d4e804" } +func (*ClassifySetInterfaceIPTableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifySetInterfaceIPTableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ClassifySetInterfaceIPTableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ClassifySetInterfaceIPTableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ClassifySetInterfaceL2Tables defines message 'classify_set_interface_l2_tables'. +type ClassifySetInterfaceL2Tables struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + OtherTableIndex uint32 `binapi:"u32,name=other_table_index" json:"other_table_index,omitempty"` + IsInput bool `binapi:"bool,name=is_input" json:"is_input,omitempty"` +} + +func (m *ClassifySetInterfaceL2Tables) Reset() { *m = ClassifySetInterfaceL2Tables{} } +func (*ClassifySetInterfaceL2Tables) GetMessageName() string { + return "classify_set_interface_l2_tables" +} +func (*ClassifySetInterfaceL2Tables) GetCrcString() string { return "5a6ddf65" } +func (*ClassifySetInterfaceL2Tables) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifySetInterfaceL2Tables) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 4 // m.OtherTableIndex + size += 1 // m.IsInput + return size +} +func (m *ClassifySetInterfaceL2Tables) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeUint32(uint32(m.OtherTableIndex)) + buf.EncodeBool(m.IsInput) + return buf.Bytes(), nil +} +func (m *ClassifySetInterfaceL2Tables) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.OtherTableIndex = buf.DecodeUint32() + m.IsInput = buf.DecodeBool() + return nil +} + +// ClassifySetInterfaceL2TablesReply defines message 'classify_set_interface_l2_tables_reply'. +type ClassifySetInterfaceL2TablesReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ClassifySetInterfaceL2TablesReply) Reset() { *m = ClassifySetInterfaceL2TablesReply{} } +func (*ClassifySetInterfaceL2TablesReply) GetMessageName() string { + return "classify_set_interface_l2_tables_reply" +} +func (*ClassifySetInterfaceL2TablesReply) GetCrcString() string { return "e8d4e804" } +func (*ClassifySetInterfaceL2TablesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifySetInterfaceL2TablesReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *ClassifySetInterfaceL2TablesReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *ClassifySetInterfaceL2TablesReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// ClassifyTableByInterface defines message 'classify_table_by_interface'. +type ClassifyTableByInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ClassifyTableByInterface) Reset() { *m = ClassifyTableByInterface{} } +func (*ClassifyTableByInterface) GetMessageName() string { return "classify_table_by_interface" } +func (*ClassifyTableByInterface) GetCrcString() string { return "f9e6675e" } +func (*ClassifyTableByInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyTableByInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *ClassifyTableByInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *ClassifyTableByInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// ClassifyTableByInterfaceReply defines message 'classify_table_by_interface_reply'. +type ClassifyTableByInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + L2TableID uint32 `binapi:"u32,name=l2_table_id" json:"l2_table_id,omitempty"` + IP4TableID uint32 `binapi:"u32,name=ip4_table_id" json:"ip4_table_id,omitempty"` + IP6TableID uint32 `binapi:"u32,name=ip6_table_id" json:"ip6_table_id,omitempty"` +} + +func (m *ClassifyTableByInterfaceReply) Reset() { *m = ClassifyTableByInterfaceReply{} } +func (*ClassifyTableByInterfaceReply) GetMessageName() string { + return "classify_table_by_interface_reply" +} +func (*ClassifyTableByInterfaceReply) GetCrcString() string { return "ed4197db" } +func (*ClassifyTableByInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyTableByInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + size += 4 // m.L2TableID + size += 4 // m.IP4TableID + size += 4 // m.IP6TableID + return size +} +func (m *ClassifyTableByInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.L2TableID)) + buf.EncodeUint32(uint32(m.IP4TableID)) + buf.EncodeUint32(uint32(m.IP6TableID)) + return buf.Bytes(), nil +} +func (m *ClassifyTableByInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.L2TableID = buf.DecodeUint32() + m.IP4TableID = buf.DecodeUint32() + m.IP6TableID = buf.DecodeUint32() + return nil +} + +// ClassifyTableIds defines message 'classify_table_ids'. +type ClassifyTableIds struct{} + +func (m *ClassifyTableIds) Reset() { *m = ClassifyTableIds{} } +func (*ClassifyTableIds) GetMessageName() string { return "classify_table_ids" } +func (*ClassifyTableIds) GetCrcString() string { return "51077d14" } +func (*ClassifyTableIds) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyTableIds) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ClassifyTableIds) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *ClassifyTableIds) Unmarshal(b []byte) error { + return nil +} + +// ClassifyTableIdsReply defines message 'classify_table_ids_reply'. +type ClassifyTableIdsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"-"` + Ids []uint32 `binapi:"u32[count],name=ids" json:"ids,omitempty"` +} + +func (m *ClassifyTableIdsReply) Reset() { *m = ClassifyTableIdsReply{} } +func (*ClassifyTableIdsReply) GetMessageName() string { return "classify_table_ids_reply" } +func (*ClassifyTableIdsReply) GetCrcString() string { return "d1d20e1d" } +func (*ClassifyTableIdsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyTableIdsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.Count + size += 4 * len(m.Ids) // m.Ids + return size +} +func (m *ClassifyTableIdsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(len(m.Ids))) + for i := 0; i < len(m.Ids); i++ { + var x uint32 + if i < len(m.Ids) { + x = uint32(m.Ids[i]) + } + buf.EncodeUint32(uint32(x)) + } + return buf.Bytes(), nil +} +func (m *ClassifyTableIdsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.Count = buf.DecodeUint32() + m.Ids = make([]uint32, m.Count) + for i := 0; i < len(m.Ids); i++ { + m.Ids[i] = buf.DecodeUint32() + } + return nil +} + +// ClassifyTableInfo defines message 'classify_table_info'. +type ClassifyTableInfo struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` +} + +func (m *ClassifyTableInfo) Reset() { *m = ClassifyTableInfo{} } +func (*ClassifyTableInfo) GetMessageName() string { return "classify_table_info" } +func (*ClassifyTableInfo) GetCrcString() string { return "0cca2cd9" } +func (*ClassifyTableInfo) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *ClassifyTableInfo) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TableID + return size +} +func (m *ClassifyTableInfo) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TableID)) + return buf.Bytes(), nil +} +func (m *ClassifyTableInfo) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TableID = buf.DecodeUint32() + return nil +} + +// ClassifyTableInfoReply defines message 'classify_table_info_reply'. +type ClassifyTableInfoReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Nbuckets uint32 `binapi:"u32,name=nbuckets" json:"nbuckets,omitempty"` + MatchNVectors uint32 `binapi:"u32,name=match_n_vectors" json:"match_n_vectors,omitempty"` + SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors" json:"skip_n_vectors,omitempty"` + ActiveSessions uint32 `binapi:"u32,name=active_sessions" json:"active_sessions,omitempty"` + NextTableIndex uint32 `binapi:"u32,name=next_table_index" json:"next_table_index,omitempty"` + MissNextIndex uint32 `binapi:"u32,name=miss_next_index" json:"miss_next_index,omitempty"` + MaskLength uint32 `binapi:"u32,name=mask_length" json:"-"` + Mask []byte `binapi:"u8[mask_length],name=mask" json:"mask,omitempty"` +} + +func (m *ClassifyTableInfoReply) Reset() { *m = ClassifyTableInfoReply{} } +func (*ClassifyTableInfoReply) GetMessageName() string { return "classify_table_info_reply" } +func (*ClassifyTableInfoReply) GetCrcString() string { return "4a573c0e" } +func (*ClassifyTableInfoReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ClassifyTableInfoReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.TableID + size += 4 // m.Nbuckets + size += 4 // m.MatchNVectors + size += 4 // m.SkipNVectors + size += 4 // m.ActiveSessions + size += 4 // m.NextTableIndex + size += 4 // m.MissNextIndex + size += 4 // m.MaskLength + size += 1 * len(m.Mask) // m.Mask + return size +} +func (m *ClassifyTableInfoReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.TableID)) + buf.EncodeUint32(uint32(m.Nbuckets)) + buf.EncodeUint32(uint32(m.MatchNVectors)) + buf.EncodeUint32(uint32(m.SkipNVectors)) + buf.EncodeUint32(uint32(m.ActiveSessions)) + buf.EncodeUint32(uint32(m.NextTableIndex)) + buf.EncodeUint32(uint32(m.MissNextIndex)) + buf.EncodeUint32(uint32(len(m.Mask))) + buf.EncodeBytes(m.Mask[:], 0) + return buf.Bytes(), nil +} +func (m *ClassifyTableInfoReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.TableID = buf.DecodeUint32() + m.Nbuckets = buf.DecodeUint32() + m.MatchNVectors = buf.DecodeUint32() + m.SkipNVectors = buf.DecodeUint32() + m.ActiveSessions = buf.DecodeUint32() + m.NextTableIndex = buf.DecodeUint32() + m.MissNextIndex = buf.DecodeUint32() + m.MaskLength = buf.DecodeUint32() + copy(m.Mask[:], buf.DecodeBytes(0)) + return nil +} + +// FlowClassifyDetails defines message 'flow_classify_details'. +type FlowClassifyDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *FlowClassifyDetails) Reset() { *m = FlowClassifyDetails{} } +func (*FlowClassifyDetails) GetMessageName() string { return "flow_classify_details" } +func (*FlowClassifyDetails) GetCrcString() string { return "dfd08765" } +func (*FlowClassifyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowClassifyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.TableIndex + return size +} +func (m *FlowClassifyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.TableIndex)) + return buf.Bytes(), nil +} +func (m *FlowClassifyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TableIndex = buf.DecodeUint32() + return nil +} + +// FlowClassifyDump defines message 'flow_classify_dump'. +type FlowClassifyDump struct { + Type FlowClassifyTable `binapi:"flow_classify_table,name=type" json:"type,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *FlowClassifyDump) Reset() { *m = FlowClassifyDump{} } +func (*FlowClassifyDump) GetMessageName() string { return "flow_classify_dump" } +func (*FlowClassifyDump) GetCrcString() string { return "8a6ad43d" } +func (*FlowClassifyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowClassifyDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Type + size += 4 // m.SwIfIndex + return size +} +func (m *FlowClassifyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Type)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *FlowClassifyDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Type = FlowClassifyTable(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// FlowClassifySetInterface defines message 'flow_classify_set_interface'. +type FlowClassifySetInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *FlowClassifySetInterface) Reset() { *m = FlowClassifySetInterface{} } +func (*FlowClassifySetInterface) GetMessageName() string { return "flow_classify_set_interface" } +func (*FlowClassifySetInterface) GetCrcString() string { return "b6192f1c" } +func (*FlowClassifySetInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FlowClassifySetInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 1 // m.IsAdd + return size +} +func (m *FlowClassifySetInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *FlowClassifySetInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// FlowClassifySetInterfaceReply defines message 'flow_classify_set_interface_reply'. +type FlowClassifySetInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FlowClassifySetInterfaceReply) Reset() { *m = FlowClassifySetInterfaceReply{} } +func (*FlowClassifySetInterfaceReply) GetMessageName() string { + return "flow_classify_set_interface_reply" +} +func (*FlowClassifySetInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*FlowClassifySetInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FlowClassifySetInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *FlowClassifySetInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *FlowClassifySetInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// InputACLSetInterface defines message 'input_acl_set_interface'. +type InputACLSetInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + L2TableIndex uint32 `binapi:"u32,name=l2_table_index" json:"l2_table_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *InputACLSetInterface) Reset() { *m = InputACLSetInterface{} } +func (*InputACLSetInterface) GetMessageName() string { return "input_acl_set_interface" } +func (*InputACLSetInterface) GetCrcString() string { return "de7ad708" } +func (*InputACLSetInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *InputACLSetInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 4 // m.L2TableIndex + size += 1 // m.IsAdd + return size +} +func (m *InputACLSetInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeUint32(uint32(m.L2TableIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *InputACLSetInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.L2TableIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// InputACLSetInterfaceReply defines message 'input_acl_set_interface_reply'. +type InputACLSetInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *InputACLSetInterfaceReply) Reset() { *m = InputACLSetInterfaceReply{} } +func (*InputACLSetInterfaceReply) GetMessageName() string { return "input_acl_set_interface_reply" } +func (*InputACLSetInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*InputACLSetInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *InputACLSetInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *InputACLSetInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *InputACLSetInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// OutputACLSetInterface defines message 'output_acl_set_interface'. +type OutputACLSetInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + L2TableIndex uint32 `binapi:"u32,name=l2_table_index" json:"l2_table_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *OutputACLSetInterface) Reset() { *m = OutputACLSetInterface{} } +func (*OutputACLSetInterface) GetMessageName() string { return "output_acl_set_interface" } +func (*OutputACLSetInterface) GetCrcString() string { return "de7ad708" } +func (*OutputACLSetInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *OutputACLSetInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 4 // m.L2TableIndex + size += 1 // m.IsAdd + return size +} +func (m *OutputACLSetInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeUint32(uint32(m.L2TableIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *OutputACLSetInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.L2TableIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// OutputACLSetInterfaceReply defines message 'output_acl_set_interface_reply'. +type OutputACLSetInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *OutputACLSetInterfaceReply) Reset() { *m = OutputACLSetInterfaceReply{} } +func (*OutputACLSetInterfaceReply) GetMessageName() string { return "output_acl_set_interface_reply" } +func (*OutputACLSetInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*OutputACLSetInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *OutputACLSetInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *OutputACLSetInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *OutputACLSetInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// PolicerClassifyDetails defines message 'policer_classify_details'. +type PolicerClassifyDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"` +} + +func (m *PolicerClassifyDetails) Reset() { *m = PolicerClassifyDetails{} } +func (*PolicerClassifyDetails) GetMessageName() string { return "policer_classify_details" } +func (*PolicerClassifyDetails) GetCrcString() string { return "dfd08765" } +func (*PolicerClassifyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PolicerClassifyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.TableIndex + return size +} +func (m *PolicerClassifyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.TableIndex)) + return buf.Bytes(), nil +} +func (m *PolicerClassifyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.TableIndex = buf.DecodeUint32() + return nil +} + +// PolicerClassifyDump defines message 'policer_classify_dump'. +type PolicerClassifyDump struct { + Type PolicerClassifyTable `binapi:"policer_classify_table,name=type" json:"type,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *PolicerClassifyDump) Reset() { *m = PolicerClassifyDump{} } +func (*PolicerClassifyDump) GetMessageName() string { return "policer_classify_dump" } +func (*PolicerClassifyDump) GetCrcString() string { return "6bfe6603" } +func (*PolicerClassifyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PolicerClassifyDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Type + size += 4 // m.SwIfIndex + return size +} +func (m *PolicerClassifyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Type)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *PolicerClassifyDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Type = PolicerClassifyTable(buf.DecodeUint8()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// PolicerClassifySetInterface defines message 'policer_classify_set_interface'. +type PolicerClassifySetInterface struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP4TableIndex uint32 `binapi:"u32,name=ip4_table_index" json:"ip4_table_index,omitempty"` + IP6TableIndex uint32 `binapi:"u32,name=ip6_table_index" json:"ip6_table_index,omitempty"` + L2TableIndex uint32 `binapi:"u32,name=l2_table_index" json:"l2_table_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *PolicerClassifySetInterface) Reset() { *m = PolicerClassifySetInterface{} } +func (*PolicerClassifySetInterface) GetMessageName() string { return "policer_classify_set_interface" } +func (*PolicerClassifySetInterface) GetCrcString() string { return "de7ad708" } +func (*PolicerClassifySetInterface) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PolicerClassifySetInterface) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.IP4TableIndex + size += 4 // m.IP6TableIndex + size += 4 // m.L2TableIndex + size += 1 // m.IsAdd + return size +} +func (m *PolicerClassifySetInterface) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.IP4TableIndex)) + buf.EncodeUint32(uint32(m.IP6TableIndex)) + buf.EncodeUint32(uint32(m.L2TableIndex)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *PolicerClassifySetInterface) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.IP4TableIndex = buf.DecodeUint32() + m.IP6TableIndex = buf.DecodeUint32() + m.L2TableIndex = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + return nil +} + +// PolicerClassifySetInterfaceReply defines message 'policer_classify_set_interface_reply'. +type PolicerClassifySetInterfaceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *PolicerClassifySetInterfaceReply) Reset() { *m = PolicerClassifySetInterfaceReply{} } +func (*PolicerClassifySetInterfaceReply) GetMessageName() string { + return "policer_classify_set_interface_reply" +} +func (*PolicerClassifySetInterfaceReply) GetCrcString() string { return "e8d4e804" } +func (*PolicerClassifySetInterfaceReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PolicerClassifySetInterfaceReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *PolicerClassifySetInterfaceReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *PolicerClassifySetInterfaceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_classify_binapi_init() } +func file_classify_binapi_init() { + api.RegisterMessage((*ClassifyAddDelSession)(nil), "classify_add_del_session_f20879f0") + api.RegisterMessage((*ClassifyAddDelSessionReply)(nil), "classify_add_del_session_reply_e8d4e804") + api.RegisterMessage((*ClassifyAddDelTable)(nil), "classify_add_del_table_6849e39e") + api.RegisterMessage((*ClassifyAddDelTableReply)(nil), "classify_add_del_table_reply_05486349") + api.RegisterMessage((*ClassifySessionDetails)(nil), "classify_session_details_60e3ef94") + api.RegisterMessage((*ClassifySessionDump)(nil), "classify_session_dump_0cca2cd9") + api.RegisterMessage((*ClassifySetInterfaceIPTable)(nil), "classify_set_interface_ip_table_e0b097c7") + api.RegisterMessage((*ClassifySetInterfaceIPTableReply)(nil), "classify_set_interface_ip_table_reply_e8d4e804") + api.RegisterMessage((*ClassifySetInterfaceL2Tables)(nil), "classify_set_interface_l2_tables_5a6ddf65") + api.RegisterMessage((*ClassifySetInterfaceL2TablesReply)(nil), "classify_set_interface_l2_tables_reply_e8d4e804") + api.RegisterMessage((*ClassifyTableByInterface)(nil), "classify_table_by_interface_f9e6675e") + api.RegisterMessage((*ClassifyTableByInterfaceReply)(nil), "classify_table_by_interface_reply_ed4197db") + api.RegisterMessage((*ClassifyTableIds)(nil), "classify_table_ids_51077d14") + api.RegisterMessage((*ClassifyTableIdsReply)(nil), "classify_table_ids_reply_d1d20e1d") + api.RegisterMessage((*ClassifyTableInfo)(nil), "classify_table_info_0cca2cd9") + api.RegisterMessage((*ClassifyTableInfoReply)(nil), "classify_table_info_reply_4a573c0e") + api.RegisterMessage((*FlowClassifyDetails)(nil), "flow_classify_details_dfd08765") + api.RegisterMessage((*FlowClassifyDump)(nil), "flow_classify_dump_8a6ad43d") + api.RegisterMessage((*FlowClassifySetInterface)(nil), "flow_classify_set_interface_b6192f1c") + api.RegisterMessage((*FlowClassifySetInterfaceReply)(nil), "flow_classify_set_interface_reply_e8d4e804") + api.RegisterMessage((*InputACLSetInterface)(nil), "input_acl_set_interface_de7ad708") + api.RegisterMessage((*InputACLSetInterfaceReply)(nil), "input_acl_set_interface_reply_e8d4e804") + api.RegisterMessage((*OutputACLSetInterface)(nil), "output_acl_set_interface_de7ad708") + api.RegisterMessage((*OutputACLSetInterfaceReply)(nil), "output_acl_set_interface_reply_e8d4e804") + api.RegisterMessage((*PolicerClassifyDetails)(nil), "policer_classify_details_dfd08765") + api.RegisterMessage((*PolicerClassifyDump)(nil), "policer_classify_dump_6bfe6603") + api.RegisterMessage((*PolicerClassifySetInterface)(nil), "policer_classify_set_interface_de7ad708") + api.RegisterMessage((*PolicerClassifySetInterfaceReply)(nil), "policer_classify_set_interface_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ClassifyAddDelSession)(nil), + (*ClassifyAddDelSessionReply)(nil), + (*ClassifyAddDelTable)(nil), + (*ClassifyAddDelTableReply)(nil), + (*ClassifySessionDetails)(nil), + (*ClassifySessionDump)(nil), + (*ClassifySetInterfaceIPTable)(nil), + (*ClassifySetInterfaceIPTableReply)(nil), + (*ClassifySetInterfaceL2Tables)(nil), + (*ClassifySetInterfaceL2TablesReply)(nil), + (*ClassifyTableByInterface)(nil), + (*ClassifyTableByInterfaceReply)(nil), + (*ClassifyTableIds)(nil), + (*ClassifyTableIdsReply)(nil), + (*ClassifyTableInfo)(nil), + (*ClassifyTableInfoReply)(nil), + (*FlowClassifyDetails)(nil), + (*FlowClassifyDump)(nil), + (*FlowClassifySetInterface)(nil), + (*FlowClassifySetInterfaceReply)(nil), + (*InputACLSetInterface)(nil), + (*InputACLSetInterfaceReply)(nil), + (*OutputACLSetInterface)(nil), + (*OutputACLSetInterfaceReply)(nil), + (*PolicerClassifyDetails)(nil), + (*PolicerClassifyDump)(nil), + (*PolicerClassifySetInterface)(nil), + (*PolicerClassifySetInterfaceReply)(nil), + } +} diff --git a/binapi/classify/classify_rest.ba.go b/binapi/classify/classify_rest.ba.go new file mode 100644 index 0000000..f50fefd --- /dev/null +++ b/binapi/classify/classify_rest.ba.go @@ -0,0 +1,258 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package classify + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/classify_add_del_session", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyAddDelSession) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifyAddDelSession(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_add_del_table", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyAddDelTable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifyAddDelTable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_set_interface_ip_table", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifySetInterfaceIPTable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifySetInterfaceIPTable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_set_interface_l2_tables", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifySetInterfaceL2Tables) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifySetInterfaceL2Tables(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_table_by_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyTableByInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifyTableByInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_table_ids", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyTableIds) + reply, err := rpc.ClassifyTableIds(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/classify_table_info", func(w http.ResponseWriter, req *http.Request) { + var request = new(ClassifyTableInfo) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.ClassifyTableInfo(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/flow_classify_set_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(FlowClassifySetInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.FlowClassifySetInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/input_acl_set_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(InputACLSetInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.InputACLSetInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/output_acl_set_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(OutputACLSetInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.OutputACLSetInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/policer_classify_set_interface", func(w http.ResponseWriter, req *http.Request) { + var request = new(PolicerClassifySetInterface) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.PolicerClassifySetInterface(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/classify/classify_rpc.ba.go b/binapi/classify/classify_rpc.ba.go new file mode 100644 index 0000000..8893db8 --- /dev/null +++ b/binapi/classify/classify_rpc.ba.go @@ -0,0 +1,253 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package classify + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service classify. +type RPCService interface { + ClassifyAddDelSession(ctx context.Context, in *ClassifyAddDelSession) (*ClassifyAddDelSessionReply, error) + ClassifyAddDelTable(ctx context.Context, in *ClassifyAddDelTable) (*ClassifyAddDelTableReply, error) + ClassifySessionDump(ctx context.Context, in *ClassifySessionDump) (RPCService_ClassifySessionDumpClient, error) + ClassifySetInterfaceIPTable(ctx context.Context, in *ClassifySetInterfaceIPTable) (*ClassifySetInterfaceIPTableReply, error) + ClassifySetInterfaceL2Tables(ctx context.Context, in *ClassifySetInterfaceL2Tables) (*ClassifySetInterfaceL2TablesReply, error) + ClassifyTableByInterface(ctx context.Context, in *ClassifyTableByInterface) (*ClassifyTableByInterfaceReply, error) + ClassifyTableIds(ctx context.Context, in *ClassifyTableIds) (*ClassifyTableIdsReply, error) + ClassifyTableInfo(ctx context.Context, in *ClassifyTableInfo) (*ClassifyTableInfoReply, error) + FlowClassifyDump(ctx context.Context, in *FlowClassifyDump) (RPCService_FlowClassifyDumpClient, error) + FlowClassifySetInterface(ctx context.Context, in *FlowClassifySetInterface) (*FlowClassifySetInterfaceReply, error) + InputACLSetInterface(ctx context.Context, in *InputACLSetInterface) (*InputACLSetInterfaceReply, error) + OutputACLSetInterface(ctx context.Context, in *OutputACLSetInterface) (*OutputACLSetInterfaceReply, error) + PolicerClassifyDump(ctx context.Context, in *PolicerClassifyDump) (RPCService_PolicerClassifyDumpClient, error) + PolicerClassifySetInterface(ctx context.Context, in *PolicerClassifySetInterface) (*PolicerClassifySetInterfaceReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) ClassifyAddDelSession(ctx context.Context, in *ClassifyAddDelSession) (*ClassifyAddDelSessionReply, error) { + out := new(ClassifyAddDelSessionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifyAddDelTable(ctx context.Context, in *ClassifyAddDelTable) (*ClassifyAddDelTableReply, error) { + out := new(ClassifyAddDelTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifySessionDump(ctx context.Context, in *ClassifySessionDump) (RPCService_ClassifySessionDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_ClassifySessionDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_ClassifySessionDumpClient interface { + Recv() (*ClassifySessionDetails, error) + api.Stream +} + +type serviceClient_ClassifySessionDumpClient struct { + api.Stream +} + +func (c *serviceClient_ClassifySessionDumpClient) Recv() (*ClassifySessionDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *ClassifySessionDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) ClassifySetInterfaceIPTable(ctx context.Context, in *ClassifySetInterfaceIPTable) (*ClassifySetInterfaceIPTableReply, error) { + out := new(ClassifySetInterfaceIPTableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifySetInterfaceL2Tables(ctx context.Context, in *ClassifySetInterfaceL2Tables) (*ClassifySetInterfaceL2TablesReply, error) { + out := new(ClassifySetInterfaceL2TablesReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifyTableByInterface(ctx context.Context, in *ClassifyTableByInterface) (*ClassifyTableByInterfaceReply, error) { + out := new(ClassifyTableByInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifyTableIds(ctx context.Context, in *ClassifyTableIds) (*ClassifyTableIdsReply, error) { + out := new(ClassifyTableIdsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ClassifyTableInfo(ctx context.Context, in *ClassifyTableInfo) (*ClassifyTableInfoReply, error) { + out := new(ClassifyTableInfoReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) FlowClassifyDump(ctx context.Context, in *FlowClassifyDump) (RPCService_FlowClassifyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_FlowClassifyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_FlowClassifyDumpClient interface { + Recv() (*FlowClassifyDetails, error) + api.Stream +} + +type serviceClient_FlowClassifyDumpClient struct { + api.Stream +} + +func (c *serviceClient_FlowClassifyDumpClient) Recv() (*FlowClassifyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *FlowClassifyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) FlowClassifySetInterface(ctx context.Context, in *FlowClassifySetInterface) (*FlowClassifySetInterfaceReply, error) { + out := new(FlowClassifySetInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InputACLSetInterface(ctx context.Context, in *InputACLSetInterface) (*InputACLSetInterfaceReply, error) { + out := new(InputACLSetInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) OutputACLSetInterface(ctx context.Context, in *OutputACLSetInterface) (*OutputACLSetInterfaceReply, error) { + out := new(OutputACLSetInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) PolicerClassifyDump(ctx context.Context, in *PolicerClassifyDump) (RPCService_PolicerClassifyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_PolicerClassifyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_PolicerClassifyDumpClient interface { + Recv() (*PolicerClassifyDetails, error) + api.Stream +} + +type serviceClient_PolicerClassifyDumpClient struct { + api.Stream +} + +func (c *serviceClient_PolicerClassifyDumpClient) Recv() (*PolicerClassifyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *PolicerClassifyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) PolicerClassifySetInterface(ctx context.Context, in *PolicerClassifySetInterface) (*PolicerClassifySetInterfaceReply, error) { + out := new(PolicerClassifySetInterfaceReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/cop/cop.ba.go b/binapi/cop/cop.ba.go new file mode 100644 index 0000000..a252c9a --- /dev/null +++ b/binapi/cop/cop.ba.go @@ -0,0 +1,216 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/cop.api.json + +// Package cop contains generated bindings for API file cop.api. +// +// Contents: +// 4 messages +// +package cop + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "cop" + APIVersion = "1.0.1" + VersionCrc = 0xfd7e767d +) + +// CopInterfaceEnableDisable defines message 'cop_interface_enable_disable'. +type CopInterfaceEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *CopInterfaceEnableDisable) Reset() { *m = CopInterfaceEnableDisable{} } +func (*CopInterfaceEnableDisable) GetMessageName() string { return "cop_interface_enable_disable" } +func (*CopInterfaceEnableDisable) GetCrcString() string { return "5501adee" } +func (*CopInterfaceEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CopInterfaceEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.EnableDisable + return size +} +func (m *CopInterfaceEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.EnableDisable) + return buf.Bytes(), nil +} +func (m *CopInterfaceEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.EnableDisable = buf.DecodeBool() + return nil +} + +// CopInterfaceEnableDisableReply defines message 'cop_interface_enable_disable_reply'. +type CopInterfaceEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CopInterfaceEnableDisableReply) Reset() { *m = CopInterfaceEnableDisableReply{} } +func (*CopInterfaceEnableDisableReply) GetMessageName() string { + return "cop_interface_enable_disable_reply" +} +func (*CopInterfaceEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*CopInterfaceEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CopInterfaceEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *CopInterfaceEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *CopInterfaceEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// CopWhitelistEnableDisable defines message 'cop_whitelist_enable_disable'. +type CopWhitelistEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + FibID uint32 `binapi:"u32,name=fib_id" json:"fib_id,omitempty"` + IP4 bool `binapi:"bool,name=ip4" json:"ip4,omitempty"` + IP6 bool `binapi:"bool,name=ip6" json:"ip6,omitempty"` + DefaultCop bool `binapi:"bool,name=default_cop" json:"default_cop,omitempty"` +} + +func (m *CopWhitelistEnableDisable) Reset() { *m = CopWhitelistEnableDisable{} } +func (*CopWhitelistEnableDisable) GetMessageName() string { return "cop_whitelist_enable_disable" } +func (*CopWhitelistEnableDisable) GetCrcString() string { return "debe13ea" } +func (*CopWhitelistEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *CopWhitelistEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.FibID + size += 1 // m.IP4 + size += 1 // m.IP6 + size += 1 // m.DefaultCop + return size +} +func (m *CopWhitelistEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.FibID)) + buf.EncodeBool(m.IP4) + buf.EncodeBool(m.IP6) + buf.EncodeBool(m.DefaultCop) + return buf.Bytes(), nil +} +func (m *CopWhitelistEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.FibID = buf.DecodeUint32() + m.IP4 = buf.DecodeBool() + m.IP6 = buf.DecodeBool() + m.DefaultCop = buf.DecodeBool() + return nil +} + +// CopWhitelistEnableDisableReply defines message 'cop_whitelist_enable_disable_reply'. +type CopWhitelistEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CopWhitelistEnableDisableReply) Reset() { *m = CopWhitelistEnableDisableReply{} } +func (*CopWhitelistEnableDisableReply) GetMessageName() string { + return "cop_whitelist_enable_disable_reply" +} +func (*CopWhitelistEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*CopWhitelistEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *CopWhitelistEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *CopWhitelistEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *CopWhitelistEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_cop_binapi_init() } +func file_cop_binapi_init() { + api.RegisterMessage((*CopInterfaceEnableDisable)(nil), "cop_interface_enable_disable_5501adee") + api.RegisterMessage((*CopInterfaceEnableDisableReply)(nil), "cop_interface_enable_disable_reply_e8d4e804") + api.RegisterMessage((*CopWhitelistEnableDisable)(nil), "cop_whitelist_enable_disable_debe13ea") + api.RegisterMessage((*CopWhitelistEnableDisableReply)(nil), "cop_whitelist_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CopInterfaceEnableDisable)(nil), + (*CopInterfaceEnableDisableReply)(nil), + (*CopWhitelistEnableDisable)(nil), + (*CopWhitelistEnableDisableReply)(nil), + } +} diff --git a/binapi/cop/cop_rest.ba.go b/binapi/cop/cop_rest.ba.go new file mode 100644 index 0000000..d9ed487 --- /dev/null +++ b/binapi/cop/cop_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package cop + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/cop_interface_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(CopInterfaceEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CopInterfaceEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/cop_whitelist_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(CopWhitelistEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.CopWhitelistEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/cop/cop_rpc.ba.go b/binapi/cop/cop_rpc.ba.go new file mode 100644 index 0000000..9f6f84e --- /dev/null +++ b/binapi/cop/cop_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package cop + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service cop. +type RPCService interface { + CopInterfaceEnableDisable(ctx context.Context, in *CopInterfaceEnableDisable) (*CopInterfaceEnableDisableReply, error) + CopWhitelistEnableDisable(ctx context.Context, in *CopWhitelistEnableDisable) (*CopWhitelistEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) CopInterfaceEnableDisable(ctx context.Context, in *CopInterfaceEnableDisable) (*CopInterfaceEnableDisableReply, error) { + out := new(CopInterfaceEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CopWhitelistEnableDisable(ctx context.Context, in *CopWhitelistEnableDisable) (*CopWhitelistEnableDisableReply, error) { + out := new(CopWhitelistEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ct6/ct6.ba.go b/binapi/ct6/ct6.ba.go new file mode 100644 index 0000000..fbcc0bc --- /dev/null +++ b/binapi/ct6/ct6.ba.go @@ -0,0 +1,124 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/ct6.api.json + +// Package ct6 contains generated bindings for API file ct6.api. +// +// Contents: +// 2 messages +// +package ct6 + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "ct6" + APIVersion = "1.0.0" + VersionCrc = 0xd9691434 +) + +// Ct6EnableDisable defines message 'ct6_enable_disable'. +type Ct6EnableDisable struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + IsInside bool `binapi:"bool,name=is_inside" json:"is_inside,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *Ct6EnableDisable) Reset() { *m = Ct6EnableDisable{} } +func (*Ct6EnableDisable) GetMessageName() string { return "ct6_enable_disable" } +func (*Ct6EnableDisable) GetCrcString() string { return "5d02ac02" } +func (*Ct6EnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *Ct6EnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 1 // m.IsInside + size += 4 // m.SwIfIndex + return size +} +func (m *Ct6EnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeBool(m.IsInside) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *Ct6EnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.IsInside = buf.DecodeBool() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// Ct6EnableDisableReply defines message 'ct6_enable_disable_reply'. +type Ct6EnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *Ct6EnableDisableReply) Reset() { *m = Ct6EnableDisableReply{} } +func (*Ct6EnableDisableReply) GetMessageName() string { return "ct6_enable_disable_reply" } +func (*Ct6EnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*Ct6EnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *Ct6EnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *Ct6EnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *Ct6EnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_ct6_binapi_init() } +func file_ct6_binapi_init() { + api.RegisterMessage((*Ct6EnableDisable)(nil), "ct6_enable_disable_5d02ac02") + api.RegisterMessage((*Ct6EnableDisableReply)(nil), "ct6_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*Ct6EnableDisable)(nil), + (*Ct6EnableDisableReply)(nil), + } +} diff --git a/binapi/ct6/ct6_rest.ba.go b/binapi/ct6/ct6_rest.ba.go new file mode 100644 index 0000000..a3ffcde --- /dev/null +++ b/binapi/ct6/ct6_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ct6 + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/ct6_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(Ct6EnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.Ct6EnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/ct6/ct6_rpc.ba.go b/binapi/ct6/ct6_rpc.ba.go new file mode 100644 index 0000000..888fd32 --- /dev/null +++ b/binapi/ct6/ct6_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ct6 + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service ct6. +type RPCService interface { + Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisable) (*Ct6EnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) Ct6EnableDisable(ctx context.Context, in *Ct6EnableDisable) (*Ct6EnableDisableReply, error) { + out := new(Ct6EnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dhcp/dhcp.ba.go b/binapi/dhcp/dhcp.ba.go new file mode 100644 index 0000000..cb18b48 --- /dev/null +++ b/binapi/dhcp/dhcp.ba.go @@ -0,0 +1,1845 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dhcp.api.json + +// Package dhcp contains generated bindings for API file dhcp.api. +// +// Contents: +// 3 enums +// 6 structs +// 29 messages +// +package dhcp + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dhcp" + APIVersion = "3.0.1" + VersionCrc = 0x96274cae +) + +// DHCPClientState defines enum 'dhcp_client_state'. +type DHCPClientState uint32 + +const ( + DHCP_CLIENT_STATE_API_DISCOVER DHCPClientState = 1 + DHCP_CLIENT_STATE_API_REQUEST DHCPClientState = 2 + DHCP_CLIENT_STATE_API_BOUND DHCPClientState = 3 +) + +var ( + DHCPClientState_name = map[uint32]string{ + 1: "DHCP_CLIENT_STATE_API_DISCOVER", + 2: "DHCP_CLIENT_STATE_API_REQUEST", + 3: "DHCP_CLIENT_STATE_API_BOUND", + } + DHCPClientState_value = map[string]uint32{ + "DHCP_CLIENT_STATE_API_DISCOVER": 1, + "DHCP_CLIENT_STATE_API_REQUEST": 2, + "DHCP_CLIENT_STATE_API_BOUND": 3, + } +) + +func (x DHCPClientState) String() string { + s, ok := DHCPClientState_name[uint32(x)] + if ok { + return s + } + return "DHCPClientState(" + strconv.Itoa(int(x)) + ")" +} + +// Dhcpv6MsgType defines enum 'dhcpv6_msg_type'. +type Dhcpv6MsgType uint32 + +const ( + DHCPV6_MSG_API_SOLICIT Dhcpv6MsgType = 1 + DHCPV6_MSG_API_ADVERTISE Dhcpv6MsgType = 2 + DHCPV6_MSG_API_REQUEST Dhcpv6MsgType = 3 + DHCPV6_MSG_API_CONFIRM Dhcpv6MsgType = 4 + DHCPV6_MSG_API_RENEW Dhcpv6MsgType = 5 + DHCPV6_MSG_API_REBIND Dhcpv6MsgType = 6 + DHCPV6_MSG_API_REPLY Dhcpv6MsgType = 7 + DHCPV6_MSG_API_RELEASE Dhcpv6MsgType = 8 + DHCPV6_MSG_API_DECLINE Dhcpv6MsgType = 9 + DHCPV6_MSG_API_RECONFIGURE Dhcpv6MsgType = 10 + DHCPV6_MSG_API_INFORMATION_REQUEST Dhcpv6MsgType = 11 + DHCPV6_MSG_API_RELAY_FORW Dhcpv6MsgType = 12 + DHCPV6_MSG_API_RELAY_REPL Dhcpv6MsgType = 13 +) + +var ( + Dhcpv6MsgType_name = map[uint32]string{ + 1: "DHCPV6_MSG_API_SOLICIT", + 2: "DHCPV6_MSG_API_ADVERTISE", + 3: "DHCPV6_MSG_API_REQUEST", + 4: "DHCPV6_MSG_API_CONFIRM", + 5: "DHCPV6_MSG_API_RENEW", + 6: "DHCPV6_MSG_API_REBIND", + 7: "DHCPV6_MSG_API_REPLY", + 8: "DHCPV6_MSG_API_RELEASE", + 9: "DHCPV6_MSG_API_DECLINE", + 10: "DHCPV6_MSG_API_RECONFIGURE", + 11: "DHCPV6_MSG_API_INFORMATION_REQUEST", + 12: "DHCPV6_MSG_API_RELAY_FORW", + 13: "DHCPV6_MSG_API_RELAY_REPL", + } + Dhcpv6MsgType_value = map[string]uint32{ + "DHCPV6_MSG_API_SOLICIT": 1, + "DHCPV6_MSG_API_ADVERTISE": 2, + "DHCPV6_MSG_API_REQUEST": 3, + "DHCPV6_MSG_API_CONFIRM": 4, + "DHCPV6_MSG_API_RENEW": 5, + "DHCPV6_MSG_API_REBIND": 6, + "DHCPV6_MSG_API_REPLY": 7, + "DHCPV6_MSG_API_RELEASE": 8, + "DHCPV6_MSG_API_DECLINE": 9, + "DHCPV6_MSG_API_RECONFIGURE": 10, + "DHCPV6_MSG_API_INFORMATION_REQUEST": 11, + "DHCPV6_MSG_API_RELAY_FORW": 12, + "DHCPV6_MSG_API_RELAY_REPL": 13, + } +) + +func (x Dhcpv6MsgType) String() string { + s, ok := Dhcpv6MsgType_name[uint32(x)] + if ok { + return s + } + return "Dhcpv6MsgType(" + strconv.Itoa(int(x)) + ")" +} + +// VssType defines enum 'vss_type'. +type VssType uint32 + +const ( + VSS_TYPE_API_ASCII VssType = 0 + VSS_TYPE_API_VPN_ID VssType = 1 + VSS_TYPE_API_INVALID VssType = 123 + VSS_TYPE_API_DEFAULT VssType = 255 +) + +var ( + VssType_name = map[uint32]string{ + 0: "VSS_TYPE_API_ASCII", + 1: "VSS_TYPE_API_VPN_ID", + 123: "VSS_TYPE_API_INVALID", + 255: "VSS_TYPE_API_DEFAULT", + } + VssType_value = map[string]uint32{ + "VSS_TYPE_API_ASCII": 0, + "VSS_TYPE_API_VPN_ID": 1, + "VSS_TYPE_API_INVALID": 123, + "VSS_TYPE_API_DEFAULT": 255, + } +) + +func (x VssType) String() string { + s, ok := VssType_name[uint32(x)] + if ok { + return s + } + return "VssType(" + strconv.Itoa(int(x)) + ")" +} + +// DHCP6AddressInfo defines type 'dhcp6_address_info'. +type DHCP6AddressInfo struct { + Address ip_types.IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + ValidTime uint32 `binapi:"u32,name=valid_time" json:"valid_time,omitempty"` + PreferredTime uint32 `binapi:"u32,name=preferred_time" json:"preferred_time,omitempty"` +} + +// DHCP6PdPrefixInfo defines type 'dhcp6_pd_prefix_info'. +type DHCP6PdPrefixInfo struct { + Prefix ip_types.IP6Prefix `binapi:"ip6_prefix,name=prefix" json:"prefix,omitempty"` + ValidTime uint32 `binapi:"u32,name=valid_time" json:"valid_time,omitempty"` + PreferredTime uint32 `binapi:"u32,name=preferred_time" json:"preferred_time,omitempty"` +} + +// DHCPClient defines type 'dhcp_client'. +type DHCPClient struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Hostname string `binapi:"string[64],name=hostname" json:"hostname,omitempty"` + ID []byte `binapi:"u8[64],name=id" json:"id,omitempty"` + WantDHCPEvent bool `binapi:"bool,name=want_dhcp_event" json:"want_dhcp_event,omitempty"` + SetBroadcastFlag bool `binapi:"bool,name=set_broadcast_flag" json:"set_broadcast_flag,omitempty"` + Dscp ip_types.IPDscp `binapi:"ip_dscp,name=dscp" json:"dscp,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +// DHCPLease defines type 'dhcp_lease'. +type DHCPLease struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + State DHCPClientState `binapi:"dhcp_client_state,name=state" json:"state,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Hostname string `binapi:"string[64],name=hostname" json:"hostname,omitempty"` + MaskWidth uint8 `binapi:"u8,name=mask_width" json:"mask_width,omitempty"` + HostAddress ip_types.Address `binapi:"address,name=host_address" json:"host_address,omitempty"` + RouterAddress ip_types.Address `binapi:"address,name=router_address" json:"router_address,omitempty"` + HostMac ethernet_types.MacAddress `binapi:"mac_address,name=host_mac" json:"host_mac,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + DomainServer []DomainServer `binapi:"domain_server[count],name=domain_server" json:"domain_server,omitempty"` +} + +// DHCPServer defines type 'dhcp_server'. +type DHCPServer struct { + ServerVrfID uint32 `binapi:"u32,name=server_vrf_id" json:"server_vrf_id,omitempty"` + DHCPServer ip_types.Address `binapi:"address,name=dhcp_server" json:"dhcp_server,omitempty"` +} + +// DomainServer defines type 'domain_server'. +type DomainServer struct { + Address ip_types.Address `binapi:"address,name=address" json:"address,omitempty"` +} + +// DHCP6ClientsEnableDisable defines message 'dhcp6_clients_enable_disable'. +type DHCP6ClientsEnableDisable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *DHCP6ClientsEnableDisable) Reset() { *m = DHCP6ClientsEnableDisable{} } +func (*DHCP6ClientsEnableDisable) GetMessageName() string { return "dhcp6_clients_enable_disable" } +func (*DHCP6ClientsEnableDisable) GetCrcString() string { return "b3e225d2" } +func (*DHCP6ClientsEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6ClientsEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + return size +} +func (m *DHCP6ClientsEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *DHCP6ClientsEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeBool() + return nil +} + +// DHCP6ClientsEnableDisableReply defines message 'dhcp6_clients_enable_disable_reply'. +type DHCP6ClientsEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6ClientsEnableDisableReply) Reset() { *m = DHCP6ClientsEnableDisableReply{} } +func (*DHCP6ClientsEnableDisableReply) GetMessageName() string { + return "dhcp6_clients_enable_disable_reply" +} +func (*DHCP6ClientsEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6ClientsEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6ClientsEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6ClientsEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6ClientsEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCP6DuidLlSet defines message 'dhcp6_duid_ll_set'. +type DHCP6DuidLlSet struct { + DuidLl []byte `binapi:"u8[10],name=duid_ll" json:"duid_ll,omitempty"` +} + +func (m *DHCP6DuidLlSet) Reset() { *m = DHCP6DuidLlSet{} } +func (*DHCP6DuidLlSet) GetMessageName() string { return "dhcp6_duid_ll_set" } +func (*DHCP6DuidLlSet) GetCrcString() string { return "0f6ca323" } +func (*DHCP6DuidLlSet) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6DuidLlSet) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 10 // m.DuidLl + return size +} +func (m *DHCP6DuidLlSet) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.DuidLl[:], 10) + return buf.Bytes(), nil +} +func (m *DHCP6DuidLlSet) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.DuidLl[:], buf.DecodeBytes(10)) + return nil +} + +// DHCP6DuidLlSetReply defines message 'dhcp6_duid_ll_set_reply'. +type DHCP6DuidLlSetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6DuidLlSetReply) Reset() { *m = DHCP6DuidLlSetReply{} } +func (*DHCP6DuidLlSetReply) GetMessageName() string { return "dhcp6_duid_ll_set_reply" } +func (*DHCP6DuidLlSetReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6DuidLlSetReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6DuidLlSetReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6DuidLlSetReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6DuidLlSetReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCP6PdReplyEvent defines message 'dhcp6_pd_reply_event'. +type DHCP6PdReplyEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` + MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` + T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` + T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` + InnerStatusCode uint16 `binapi:"u16,name=inner_status_code" json:"inner_status_code,omitempty"` + StatusCode uint16 `binapi:"u16,name=status_code" json:"status_code,omitempty"` + Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` + NPrefixes uint32 `binapi:"u32,name=n_prefixes" json:"-"` + Prefixes []DHCP6PdPrefixInfo `binapi:"dhcp6_pd_prefix_info[n_prefixes],name=prefixes" json:"prefixes,omitempty"` +} + +func (m *DHCP6PdReplyEvent) Reset() { *m = DHCP6PdReplyEvent{} } +func (*DHCP6PdReplyEvent) GetMessageName() string { return "dhcp6_pd_reply_event" } +func (*DHCP6PdReplyEvent) GetCrcString() string { return "cb3e462b" } +func (*DHCP6PdReplyEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *DHCP6PdReplyEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.SwIfIndex + size += 4 // m.ServerIndex + size += 4 // m.MsgType + size += 4 // m.T1 + size += 4 // m.T2 + size += 2 // m.InnerStatusCode + size += 2 // m.StatusCode + size += 1 // m.Preference + size += 4 // m.NPrefixes + for j1 := 0; j1 < len(m.Prefixes); j1++ { + var s1 DHCP6PdPrefixInfo + _ = s1 + if j1 < len(m.Prefixes) { + s1 = m.Prefixes[j1] + } + size += 1 * 16 // s1.Prefix.Address + size += 1 // s1.Prefix.Len + size += 4 // s1.ValidTime + size += 4 // s1.PreferredTime + } + return size +} +func (m *DHCP6PdReplyEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ServerIndex)) + buf.EncodeUint32(uint32(m.MsgType)) + buf.EncodeUint32(uint32(m.T1)) + buf.EncodeUint32(uint32(m.T2)) + buf.EncodeUint16(uint16(m.InnerStatusCode)) + buf.EncodeUint16(uint16(m.StatusCode)) + buf.EncodeUint8(uint8(m.Preference)) + buf.EncodeUint32(uint32(len(m.Prefixes))) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + var v0 DHCP6PdPrefixInfo + if j0 < len(m.Prefixes) { + v0 = m.Prefixes[j0] + } + buf.EncodeBytes(v0.Prefix.Address[:], 16) + buf.EncodeUint8(uint8(v0.Prefix.Len)) + buf.EncodeUint32(uint32(v0.ValidTime)) + buf.EncodeUint32(uint32(v0.PreferredTime)) + } + return buf.Bytes(), nil +} +func (m *DHCP6PdReplyEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ServerIndex = buf.DecodeUint32() + m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) + m.T1 = buf.DecodeUint32() + m.T2 = buf.DecodeUint32() + m.InnerStatusCode = buf.DecodeUint16() + m.StatusCode = buf.DecodeUint16() + m.Preference = buf.DecodeUint8() + m.NPrefixes = buf.DecodeUint32() + m.Prefixes = make([]DHCP6PdPrefixInfo, int(m.NPrefixes)) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + copy(m.Prefixes[j0].Prefix.Address[:], buf.DecodeBytes(16)) + m.Prefixes[j0].Prefix.Len = buf.DecodeUint8() + m.Prefixes[j0].ValidTime = buf.DecodeUint32() + m.Prefixes[j0].PreferredTime = buf.DecodeUint32() + } + return nil +} + +// DHCP6PdSendClientMessage defines message 'dhcp6_pd_send_client_message'. +type DHCP6PdSendClientMessage struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` + Irt uint32 `binapi:"u32,name=irt" json:"irt,omitempty"` + Mrt uint32 `binapi:"u32,name=mrt" json:"mrt,omitempty"` + Mrc uint32 `binapi:"u32,name=mrc" json:"mrc,omitempty"` + Mrd uint32 `binapi:"u32,name=mrd" json:"mrd,omitempty"` + Stop bool `binapi:"bool,name=stop" json:"stop,omitempty"` + MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` + T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` + T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` + NPrefixes uint32 `binapi:"u32,name=n_prefixes" json:"-"` + Prefixes []DHCP6PdPrefixInfo `binapi:"dhcp6_pd_prefix_info[n_prefixes],name=prefixes" json:"prefixes,omitempty"` +} + +func (m *DHCP6PdSendClientMessage) Reset() { *m = DHCP6PdSendClientMessage{} } +func (*DHCP6PdSendClientMessage) GetMessageName() string { return "dhcp6_pd_send_client_message" } +func (*DHCP6PdSendClientMessage) GetCrcString() string { return "064badb8" } +func (*DHCP6PdSendClientMessage) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6PdSendClientMessage) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.ServerIndex + size += 4 // m.Irt + size += 4 // m.Mrt + size += 4 // m.Mrc + size += 4 // m.Mrd + size += 1 // m.Stop + size += 4 // m.MsgType + size += 4 // m.T1 + size += 4 // m.T2 + size += 4 // m.NPrefixes + for j1 := 0; j1 < len(m.Prefixes); j1++ { + var s1 DHCP6PdPrefixInfo + _ = s1 + if j1 < len(m.Prefixes) { + s1 = m.Prefixes[j1] + } + size += 1 * 16 // s1.Prefix.Address + size += 1 // s1.Prefix.Len + size += 4 // s1.ValidTime + size += 4 // s1.PreferredTime + } + return size +} +func (m *DHCP6PdSendClientMessage) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ServerIndex)) + buf.EncodeUint32(uint32(m.Irt)) + buf.EncodeUint32(uint32(m.Mrt)) + buf.EncodeUint32(uint32(m.Mrc)) + buf.EncodeUint32(uint32(m.Mrd)) + buf.EncodeBool(m.Stop) + buf.EncodeUint32(uint32(m.MsgType)) + buf.EncodeUint32(uint32(m.T1)) + buf.EncodeUint32(uint32(m.T2)) + buf.EncodeUint32(uint32(len(m.Prefixes))) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + var v0 DHCP6PdPrefixInfo + if j0 < len(m.Prefixes) { + v0 = m.Prefixes[j0] + } + buf.EncodeBytes(v0.Prefix.Address[:], 16) + buf.EncodeUint8(uint8(v0.Prefix.Len)) + buf.EncodeUint32(uint32(v0.ValidTime)) + buf.EncodeUint32(uint32(v0.PreferredTime)) + } + return buf.Bytes(), nil +} +func (m *DHCP6PdSendClientMessage) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ServerIndex = buf.DecodeUint32() + m.Irt = buf.DecodeUint32() + m.Mrt = buf.DecodeUint32() + m.Mrc = buf.DecodeUint32() + m.Mrd = buf.DecodeUint32() + m.Stop = buf.DecodeBool() + m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) + m.T1 = buf.DecodeUint32() + m.T2 = buf.DecodeUint32() + m.NPrefixes = buf.DecodeUint32() + m.Prefixes = make([]DHCP6PdPrefixInfo, int(m.NPrefixes)) + for j0 := 0; j0 < len(m.Prefixes); j0++ { + copy(m.Prefixes[j0].Prefix.Address[:], buf.DecodeBytes(16)) + m.Prefixes[j0].Prefix.Len = buf.DecodeUint8() + m.Prefixes[j0].ValidTime = buf.DecodeUint32() + m.Prefixes[j0].PreferredTime = buf.DecodeUint32() + } + return nil +} + +// DHCP6PdSendClientMessageReply defines message 'dhcp6_pd_send_client_message_reply'. +type DHCP6PdSendClientMessageReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6PdSendClientMessageReply) Reset() { *m = DHCP6PdSendClientMessageReply{} } +func (*DHCP6PdSendClientMessageReply) GetMessageName() string { + return "dhcp6_pd_send_client_message_reply" +} +func (*DHCP6PdSendClientMessageReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6PdSendClientMessageReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6PdSendClientMessageReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6PdSendClientMessageReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6PdSendClientMessageReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCP6ReplyEvent defines message 'dhcp6_reply_event'. +type DHCP6ReplyEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` + MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` + T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` + T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` + InnerStatusCode uint16 `binapi:"u16,name=inner_status_code" json:"inner_status_code,omitempty"` + StatusCode uint16 `binapi:"u16,name=status_code" json:"status_code,omitempty"` + Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` + NAddresses uint32 `binapi:"u32,name=n_addresses" json:"-"` + Addresses []DHCP6AddressInfo `binapi:"dhcp6_address_info[n_addresses],name=addresses" json:"addresses,omitempty"` +} + +func (m *DHCP6ReplyEvent) Reset() { *m = DHCP6ReplyEvent{} } +func (*DHCP6ReplyEvent) GetMessageName() string { return "dhcp6_reply_event" } +func (*DHCP6ReplyEvent) GetCrcString() string { return "9f3af9e5" } +func (*DHCP6ReplyEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *DHCP6ReplyEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.SwIfIndex + size += 4 // m.ServerIndex + size += 4 // m.MsgType + size += 4 // m.T1 + size += 4 // m.T2 + size += 2 // m.InnerStatusCode + size += 2 // m.StatusCode + size += 1 // m.Preference + size += 4 // m.NAddresses + for j1 := 0; j1 < len(m.Addresses); j1++ { + var s1 DHCP6AddressInfo + _ = s1 + if j1 < len(m.Addresses) { + s1 = m.Addresses[j1] + } + size += 1 * 16 // s1.Address + size += 4 // s1.ValidTime + size += 4 // s1.PreferredTime + } + return size +} +func (m *DHCP6ReplyEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ServerIndex)) + buf.EncodeUint32(uint32(m.MsgType)) + buf.EncodeUint32(uint32(m.T1)) + buf.EncodeUint32(uint32(m.T2)) + buf.EncodeUint16(uint16(m.InnerStatusCode)) + buf.EncodeUint16(uint16(m.StatusCode)) + buf.EncodeUint8(uint8(m.Preference)) + buf.EncodeUint32(uint32(len(m.Addresses))) + for j0 := 0; j0 < len(m.Addresses); j0++ { + var v0 DHCP6AddressInfo + if j0 < len(m.Addresses) { + v0 = m.Addresses[j0] + } + buf.EncodeBytes(v0.Address[:], 16) + buf.EncodeUint32(uint32(v0.ValidTime)) + buf.EncodeUint32(uint32(v0.PreferredTime)) + } + return buf.Bytes(), nil +} +func (m *DHCP6ReplyEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ServerIndex = buf.DecodeUint32() + m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) + m.T1 = buf.DecodeUint32() + m.T2 = buf.DecodeUint32() + m.InnerStatusCode = buf.DecodeUint16() + m.StatusCode = buf.DecodeUint16() + m.Preference = buf.DecodeUint8() + m.NAddresses = buf.DecodeUint32() + m.Addresses = make([]DHCP6AddressInfo, int(m.NAddresses)) + for j0 := 0; j0 < len(m.Addresses); j0++ { + copy(m.Addresses[j0].Address[:], buf.DecodeBytes(16)) + m.Addresses[j0].ValidTime = buf.DecodeUint32() + m.Addresses[j0].PreferredTime = buf.DecodeUint32() + } + return nil +} + +// DHCP6SendClientMessage defines message 'dhcp6_send_client_message'. +type DHCP6SendClientMessage struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ServerIndex uint32 `binapi:"u32,name=server_index" json:"server_index,omitempty"` + Irt uint32 `binapi:"u32,name=irt" json:"irt,omitempty"` + Mrt uint32 `binapi:"u32,name=mrt" json:"mrt,omitempty"` + Mrc uint32 `binapi:"u32,name=mrc" json:"mrc,omitempty"` + Mrd uint32 `binapi:"u32,name=mrd" json:"mrd,omitempty"` + Stop bool `binapi:"bool,name=stop" json:"stop,omitempty"` + MsgType Dhcpv6MsgType `binapi:"dhcpv6_msg_type,name=msg_type" json:"msg_type,omitempty"` + T1 uint32 `binapi:"u32,name=T1" json:"T1,omitempty"` + T2 uint32 `binapi:"u32,name=T2" json:"T2,omitempty"` + NAddresses uint32 `binapi:"u32,name=n_addresses" json:"-"` + Addresses []DHCP6AddressInfo `binapi:"dhcp6_address_info[n_addresses],name=addresses" json:"addresses,omitempty"` +} + +func (m *DHCP6SendClientMessage) Reset() { *m = DHCP6SendClientMessage{} } +func (*DHCP6SendClientMessage) GetMessageName() string { return "dhcp6_send_client_message" } +func (*DHCP6SendClientMessage) GetCrcString() string { return "f6f14ef0" } +func (*DHCP6SendClientMessage) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6SendClientMessage) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 4 // m.ServerIndex + size += 4 // m.Irt + size += 4 // m.Mrt + size += 4 // m.Mrc + size += 4 // m.Mrd + size += 1 // m.Stop + size += 4 // m.MsgType + size += 4 // m.T1 + size += 4 // m.T2 + size += 4 // m.NAddresses + for j1 := 0; j1 < len(m.Addresses); j1++ { + var s1 DHCP6AddressInfo + _ = s1 + if j1 < len(m.Addresses) { + s1 = m.Addresses[j1] + } + size += 1 * 16 // s1.Address + size += 4 // s1.ValidTime + size += 4 // s1.PreferredTime + } + return size +} +func (m *DHCP6SendClientMessage) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint32(uint32(m.ServerIndex)) + buf.EncodeUint32(uint32(m.Irt)) + buf.EncodeUint32(uint32(m.Mrt)) + buf.EncodeUint32(uint32(m.Mrc)) + buf.EncodeUint32(uint32(m.Mrd)) + buf.EncodeBool(m.Stop) + buf.EncodeUint32(uint32(m.MsgType)) + buf.EncodeUint32(uint32(m.T1)) + buf.EncodeUint32(uint32(m.T2)) + buf.EncodeUint32(uint32(len(m.Addresses))) + for j0 := 0; j0 < len(m.Addresses); j0++ { + var v0 DHCP6AddressInfo + if j0 < len(m.Addresses) { + v0 = m.Addresses[j0] + } + buf.EncodeBytes(v0.Address[:], 16) + buf.EncodeUint32(uint32(v0.ValidTime)) + buf.EncodeUint32(uint32(v0.PreferredTime)) + } + return buf.Bytes(), nil +} +func (m *DHCP6SendClientMessage) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.ServerIndex = buf.DecodeUint32() + m.Irt = buf.DecodeUint32() + m.Mrt = buf.DecodeUint32() + m.Mrc = buf.DecodeUint32() + m.Mrd = buf.DecodeUint32() + m.Stop = buf.DecodeBool() + m.MsgType = Dhcpv6MsgType(buf.DecodeUint32()) + m.T1 = buf.DecodeUint32() + m.T2 = buf.DecodeUint32() + m.NAddresses = buf.DecodeUint32() + m.Addresses = make([]DHCP6AddressInfo, int(m.NAddresses)) + for j0 := 0; j0 < len(m.Addresses); j0++ { + copy(m.Addresses[j0].Address[:], buf.DecodeBytes(16)) + m.Addresses[j0].ValidTime = buf.DecodeUint32() + m.Addresses[j0].PreferredTime = buf.DecodeUint32() + } + return nil +} + +// DHCP6SendClientMessageReply defines message 'dhcp6_send_client_message_reply'. +type DHCP6SendClientMessageReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6SendClientMessageReply) Reset() { *m = DHCP6SendClientMessageReply{} } +func (*DHCP6SendClientMessageReply) GetMessageName() string { return "dhcp6_send_client_message_reply" } +func (*DHCP6SendClientMessageReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6SendClientMessageReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6SendClientMessageReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6SendClientMessageReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6SendClientMessageReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCPClientConfig defines message 'dhcp_client_config'. +type DHCPClientConfig struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + Client DHCPClient `binapi:"dhcp_client,name=client" json:"client,omitempty"` +} + +func (m *DHCPClientConfig) Reset() { *m = DHCPClientConfig{} } +func (*DHCPClientConfig) GetMessageName() string { return "dhcp_client_config" } +func (*DHCPClientConfig) GetCrcString() string { return "959b80a3" } +func (*DHCPClientConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPClientConfig) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 4 // m.Client.SwIfIndex + size += 64 // m.Client.Hostname + size += 1 * 64 // m.Client.ID + size += 1 // m.Client.WantDHCPEvent + size += 1 // m.Client.SetBroadcastFlag + size += 1 // m.Client.Dscp + size += 4 // m.Client.PID + return size +} +func (m *DHCPClientConfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(uint32(m.Client.SwIfIndex)) + buf.EncodeString(m.Client.Hostname, 64) + buf.EncodeBytes(m.Client.ID[:], 64) + buf.EncodeBool(m.Client.WantDHCPEvent) + buf.EncodeBool(m.Client.SetBroadcastFlag) + buf.EncodeUint8(uint8(m.Client.Dscp)) + buf.EncodeUint32(uint32(m.Client.PID)) + return buf.Bytes(), nil +} +func (m *DHCPClientConfig) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.Client.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Client.Hostname = buf.DecodeString(64) + copy(m.Client.ID[:], buf.DecodeBytes(64)) + m.Client.WantDHCPEvent = buf.DecodeBool() + m.Client.SetBroadcastFlag = buf.DecodeBool() + m.Client.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.Client.PID = buf.DecodeUint32() + return nil +} + +// DHCPClientConfigReply defines message 'dhcp_client_config_reply'. +type DHCPClientConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCPClientConfigReply) Reset() { *m = DHCPClientConfigReply{} } +func (*DHCPClientConfigReply) GetMessageName() string { return "dhcp_client_config_reply" } +func (*DHCPClientConfigReply) GetCrcString() string { return "e8d4e804" } +func (*DHCPClientConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPClientConfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCPClientConfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCPClientConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCPClientDetails defines message 'dhcp_client_details'. +type DHCPClientDetails struct { + Client DHCPClient `binapi:"dhcp_client,name=client" json:"client,omitempty"` + Lease DHCPLease `binapi:"dhcp_lease,name=lease" json:"lease,omitempty"` +} + +func (m *DHCPClientDetails) Reset() { *m = DHCPClientDetails{} } +func (*DHCPClientDetails) GetMessageName() string { return "dhcp_client_details" } +func (*DHCPClientDetails) GetCrcString() string { return "acd82f5a" } +func (*DHCPClientDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPClientDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Client.SwIfIndex + size += 64 // m.Client.Hostname + size += 1 * 64 // m.Client.ID + size += 1 // m.Client.WantDHCPEvent + size += 1 // m.Client.SetBroadcastFlag + size += 1 // m.Client.Dscp + size += 4 // m.Client.PID + size += 4 // m.Lease.SwIfIndex + size += 4 // m.Lease.State + size += 1 // m.Lease.IsIPv6 + size += 64 // m.Lease.Hostname + size += 1 // m.Lease.MaskWidth + size += 1 // m.Lease.HostAddress.Af + size += 1 * 16 // m.Lease.HostAddress.Un + size += 1 // m.Lease.RouterAddress.Af + size += 1 * 16 // m.Lease.RouterAddress.Un + size += 1 * 6 // m.Lease.HostMac + size += 1 // m.Lease.Count + for j2 := 0; j2 < len(m.Lease.DomainServer); j2++ { + var s2 DomainServer + _ = s2 + if j2 < len(m.Lease.DomainServer) { + s2 = m.Lease.DomainServer[j2] + } + size += 1 // s2.Address.Af + size += 1 * 16 // s2.Address.Un + } + return size +} +func (m *DHCPClientDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Client.SwIfIndex)) + buf.EncodeString(m.Client.Hostname, 64) + buf.EncodeBytes(m.Client.ID[:], 64) + buf.EncodeBool(m.Client.WantDHCPEvent) + buf.EncodeBool(m.Client.SetBroadcastFlag) + buf.EncodeUint8(uint8(m.Client.Dscp)) + buf.EncodeUint32(uint32(m.Client.PID)) + buf.EncodeUint32(uint32(m.Lease.SwIfIndex)) + buf.EncodeUint32(uint32(m.Lease.State)) + buf.EncodeBool(m.Lease.IsIPv6) + buf.EncodeString(m.Lease.Hostname, 64) + buf.EncodeUint8(uint8(m.Lease.MaskWidth)) + buf.EncodeUint8(uint8(m.Lease.HostAddress.Af)) + buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Lease.RouterAddress.Af)) + buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 0) + buf.EncodeBytes(m.Lease.HostMac[:], 6) + buf.EncodeUint8(uint8(len(m.Lease.DomainServer))) + for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { + var v1 DomainServer + if j1 < len(m.Lease.DomainServer) { + v1 = m.Lease.DomainServer[j1] + } + buf.EncodeUint8(uint8(v1.Address.Af)) + buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *DHCPClientDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Client.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Client.Hostname = buf.DecodeString(64) + copy(m.Client.ID[:], buf.DecodeBytes(64)) + m.Client.WantDHCPEvent = buf.DecodeBool() + m.Client.SetBroadcastFlag = buf.DecodeBool() + m.Client.Dscp = ip_types.IPDscp(buf.DecodeUint8()) + m.Client.PID = buf.DecodeUint32() + m.Lease.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Lease.State = DHCPClientState(buf.DecodeUint32()) + m.Lease.IsIPv6 = buf.DecodeBool() + m.Lease.Hostname = buf.DecodeString(64) + m.Lease.MaskWidth = buf.DecodeUint8() + m.Lease.HostAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.HostAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Lease.RouterAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.RouterAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Lease.HostMac[:], buf.DecodeBytes(6)) + m.Lease.Count = buf.DecodeUint8() + m.Lease.DomainServer = make([]DomainServer, int(m.Lease.Count)) + for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { + m.Lease.DomainServer[j1].Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.DomainServer[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// DHCPClientDump defines message 'dhcp_client_dump'. +type DHCPClientDump struct{} + +func (m *DHCPClientDump) Reset() { *m = DHCPClientDump{} } +func (*DHCPClientDump) GetMessageName() string { return "dhcp_client_dump" } +func (*DHCPClientDump) GetCrcString() string { return "51077d14" } +func (*DHCPClientDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPClientDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DHCPClientDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DHCPClientDump) Unmarshal(b []byte) error { + return nil +} + +// DHCPComplEvent defines message 'dhcp_compl_event'. +type DHCPComplEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + Lease DHCPLease `binapi:"dhcp_lease,name=lease" json:"lease,omitempty"` +} + +func (m *DHCPComplEvent) Reset() { *m = DHCPComplEvent{} } +func (*DHCPComplEvent) GetMessageName() string { return "dhcp_compl_event" } +func (*DHCPComplEvent) GetCrcString() string { return "e908fd1d" } +func (*DHCPComplEvent) GetMessageType() api.MessageType { + return api.EventMessage +} + +func (m *DHCPComplEvent) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.PID + size += 4 // m.Lease.SwIfIndex + size += 4 // m.Lease.State + size += 1 // m.Lease.IsIPv6 + size += 64 // m.Lease.Hostname + size += 1 // m.Lease.MaskWidth + size += 1 // m.Lease.HostAddress.Af + size += 1 * 16 // m.Lease.HostAddress.Un + size += 1 // m.Lease.RouterAddress.Af + size += 1 * 16 // m.Lease.RouterAddress.Un + size += 1 * 6 // m.Lease.HostMac + size += 1 // m.Lease.Count + for j2 := 0; j2 < len(m.Lease.DomainServer); j2++ { + var s2 DomainServer + _ = s2 + if j2 < len(m.Lease.DomainServer) { + s2 = m.Lease.DomainServer[j2] + } + size += 1 // s2.Address.Af + size += 1 * 16 // s2.Address.Un + } + return size +} +func (m *DHCPComplEvent) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.PID)) + buf.EncodeUint32(uint32(m.Lease.SwIfIndex)) + buf.EncodeUint32(uint32(m.Lease.State)) + buf.EncodeBool(m.Lease.IsIPv6) + buf.EncodeString(m.Lease.Hostname, 64) + buf.EncodeUint8(uint8(m.Lease.MaskWidth)) + buf.EncodeUint8(uint8(m.Lease.HostAddress.Af)) + buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.Lease.RouterAddress.Af)) + buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 0) + buf.EncodeBytes(m.Lease.HostMac[:], 6) + buf.EncodeUint8(uint8(len(m.Lease.DomainServer))) + for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { + var v1 DomainServer + if j1 < len(m.Lease.DomainServer) { + v1 = m.Lease.DomainServer[j1] + } + buf.EncodeUint8(uint8(v1.Address.Af)) + buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *DHCPComplEvent) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.PID = buf.DecodeUint32() + m.Lease.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Lease.State = DHCPClientState(buf.DecodeUint32()) + m.Lease.IsIPv6 = buf.DecodeBool() + m.Lease.Hostname = buf.DecodeString(64) + m.Lease.MaskWidth = buf.DecodeUint8() + m.Lease.HostAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.HostAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Lease.RouterAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.RouterAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + copy(m.Lease.HostMac[:], buf.DecodeBytes(6)) + m.Lease.Count = buf.DecodeUint8() + m.Lease.DomainServer = make([]DomainServer, int(m.Lease.Count)) + for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ { + m.Lease.DomainServer[j1].Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Lease.DomainServer[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// DHCPPluginControlPing defines message 'dhcp_plugin_control_ping'. +type DHCPPluginControlPing struct{} + +func (m *DHCPPluginControlPing) Reset() { *m = DHCPPluginControlPing{} } +func (*DHCPPluginControlPing) GetMessageName() string { return "dhcp_plugin_control_ping" } +func (*DHCPPluginControlPing) GetCrcString() string { return "51077d14" } +func (*DHCPPluginControlPing) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPPluginControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DHCPPluginControlPing) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DHCPPluginControlPing) Unmarshal(b []byte) error { + return nil +} + +// DHCPPluginControlPingReply defines message 'dhcp_plugin_control_ping_reply'. +type DHCPPluginControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *DHCPPluginControlPingReply) Reset() { *m = DHCPPluginControlPingReply{} } +func (*DHCPPluginControlPingReply) GetMessageName() string { return "dhcp_plugin_control_ping_reply" } +func (*DHCPPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*DHCPPluginControlPingReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPPluginControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.ClientIndex + size += 4 // m.VpePID + return size +} +func (m *DHCPPluginControlPingReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.ClientIndex)) + buf.EncodeUint32(uint32(m.VpePID)) + return buf.Bytes(), nil +} +func (m *DHCPPluginControlPingReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.ClientIndex = buf.DecodeUint32() + m.VpePID = buf.DecodeUint32() + return nil +} + +// DHCPPluginGetVersion defines message 'dhcp_plugin_get_version'. +type DHCPPluginGetVersion struct{} + +func (m *DHCPPluginGetVersion) Reset() { *m = DHCPPluginGetVersion{} } +func (*DHCPPluginGetVersion) GetMessageName() string { return "dhcp_plugin_get_version" } +func (*DHCPPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*DHCPPluginGetVersion) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DHCPPluginGetVersion) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DHCPPluginGetVersion) Unmarshal(b []byte) error { + return nil +} + +// DHCPPluginGetVersionReply defines message 'dhcp_plugin_get_version_reply'. +type DHCPPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *DHCPPluginGetVersionReply) Reset() { *m = DHCPPluginGetVersionReply{} } +func (*DHCPPluginGetVersionReply) GetMessageName() string { return "dhcp_plugin_get_version_reply" } +func (*DHCPPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*DHCPPluginGetVersionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Major + size += 4 // m.Minor + return size +} +func (m *DHCPPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Major)) + buf.EncodeUint32(uint32(m.Minor)) + return buf.Bytes(), nil +} +func (m *DHCPPluginGetVersionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Major = buf.DecodeUint32() + m.Minor = buf.DecodeUint32() + return nil +} + +// DHCPProxyConfig defines message 'dhcp_proxy_config'. +type DHCPProxyConfig struct { + RxVrfID uint32 `binapi:"u32,name=rx_vrf_id" json:"rx_vrf_id,omitempty"` + ServerVrfID uint32 `binapi:"u32,name=server_vrf_id" json:"server_vrf_id,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DHCPServer ip_types.Address `binapi:"address,name=dhcp_server" json:"dhcp_server,omitempty"` + DHCPSrcAddress ip_types.Address `binapi:"address,name=dhcp_src_address" json:"dhcp_src_address,omitempty"` +} + +func (m *DHCPProxyConfig) Reset() { *m = DHCPProxyConfig{} } +func (*DHCPProxyConfig) GetMessageName() string { return "dhcp_proxy_config" } +func (*DHCPProxyConfig) GetCrcString() string { return "6767230e" } +func (*DHCPProxyConfig) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPProxyConfig) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RxVrfID + size += 4 // m.ServerVrfID + size += 1 // m.IsAdd + size += 1 // m.DHCPServer.Af + size += 1 * 16 // m.DHCPServer.Un + size += 1 // m.DHCPSrcAddress.Af + size += 1 * 16 // m.DHCPSrcAddress.Un + return size +} +func (m *DHCPProxyConfig) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RxVrfID)) + buf.EncodeUint32(uint32(m.ServerVrfID)) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint8(uint8(m.DHCPServer.Af)) + buf.EncodeBytes(m.DHCPServer.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(m.DHCPSrcAddress.Af)) + buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 0) + return buf.Bytes(), nil +} +func (m *DHCPProxyConfig) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RxVrfID = buf.DecodeUint32() + m.ServerVrfID = buf.DecodeUint32() + m.IsAdd = buf.DecodeBool() + m.DHCPServer.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DHCPServer.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DHCPSrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DHCPSrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + return nil +} + +// DHCPProxyConfigReply defines message 'dhcp_proxy_config_reply'. +type DHCPProxyConfigReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCPProxyConfigReply) Reset() { *m = DHCPProxyConfigReply{} } +func (*DHCPProxyConfigReply) GetMessageName() string { return "dhcp_proxy_config_reply" } +func (*DHCPProxyConfigReply) GetCrcString() string { return "e8d4e804" } +func (*DHCPProxyConfigReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPProxyConfigReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCPProxyConfigReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCPProxyConfigReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DHCPProxyDetails defines message 'dhcp_proxy_details'. +type DHCPProxyDetails struct { + RxVrfID uint32 `binapi:"u32,name=rx_vrf_id" json:"rx_vrf_id,omitempty"` + VssOui uint32 `binapi:"u32,name=vss_oui" json:"vss_oui,omitempty"` + VssFibID uint32 `binapi:"u32,name=vss_fib_id" json:"vss_fib_id,omitempty"` + VssType VssType `binapi:"vss_type,name=vss_type" json:"vss_type,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + VssVPNAsciiID string `binapi:"string[129],name=vss_vpn_ascii_id" json:"vss_vpn_ascii_id,omitempty"` + DHCPSrcAddress ip_types.Address `binapi:"address,name=dhcp_src_address" json:"dhcp_src_address,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"-"` + Servers []DHCPServer `binapi:"dhcp_server[count],name=servers" json:"servers,omitempty"` +} + +func (m *DHCPProxyDetails) Reset() { *m = DHCPProxyDetails{} } +func (*DHCPProxyDetails) GetMessageName() string { return "dhcp_proxy_details" } +func (*DHCPProxyDetails) GetCrcString() string { return "ce16f044" } +func (*DHCPProxyDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPProxyDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.RxVrfID + size += 4 // m.VssOui + size += 4 // m.VssFibID + size += 4 // m.VssType + size += 1 // m.IsIPv6 + size += 129 // m.VssVPNAsciiID + size += 1 // m.DHCPSrcAddress.Af + size += 1 * 16 // m.DHCPSrcAddress.Un + size += 1 // m.Count + for j1 := 0; j1 < len(m.Servers); j1++ { + var s1 DHCPServer + _ = s1 + if j1 < len(m.Servers) { + s1 = m.Servers[j1] + } + size += 4 // s1.ServerVrfID + size += 1 // s1.DHCPServer.Af + size += 1 * 16 // s1.DHCPServer.Un + } + return size +} +func (m *DHCPProxyDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.RxVrfID)) + buf.EncodeUint32(uint32(m.VssOui)) + buf.EncodeUint32(uint32(m.VssFibID)) + buf.EncodeUint32(uint32(m.VssType)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeString(m.VssVPNAsciiID, 129) + buf.EncodeUint8(uint8(m.DHCPSrcAddress.Af)) + buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(len(m.Servers))) + for j0 := 0; j0 < len(m.Servers); j0++ { + var v0 DHCPServer + if j0 < len(m.Servers) { + v0 = m.Servers[j0] + } + buf.EncodeUint32(uint32(v0.ServerVrfID)) + buf.EncodeUint8(uint8(v0.DHCPServer.Af)) + buf.EncodeBytes(v0.DHCPServer.Un.XXX_UnionData[:], 0) + } + return buf.Bytes(), nil +} +func (m *DHCPProxyDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.RxVrfID = buf.DecodeUint32() + m.VssOui = buf.DecodeUint32() + m.VssFibID = buf.DecodeUint32() + m.VssType = VssType(buf.DecodeUint32()) + m.IsIPv6 = buf.DecodeBool() + m.VssVPNAsciiID = buf.DecodeString(129) + m.DHCPSrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.DHCPSrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.Count = buf.DecodeUint8() + m.Servers = make([]DHCPServer, int(m.Count)) + for j0 := 0; j0 < len(m.Servers); j0++ { + m.Servers[j0].ServerVrfID = buf.DecodeUint32() + m.Servers[j0].DHCPServer.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.Servers[j0].DHCPServer.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + } + return nil +} + +// DHCPProxyDump defines message 'dhcp_proxy_dump'. +type DHCPProxyDump struct { + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` +} + +func (m *DHCPProxyDump) Reset() { *m = DHCPProxyDump{} } +func (*DHCPProxyDump) GetMessageName() string { return "dhcp_proxy_dump" } +func (*DHCPProxyDump) GetCrcString() string { return "5c5b063f" } +func (*DHCPProxyDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPProxyDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIP6 + return size +} +func (m *DHCPProxyDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsIP6) + return buf.Bytes(), nil +} +func (m *DHCPProxyDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIP6 = buf.DecodeBool() + return nil +} + +// DHCPProxySetVss defines message 'dhcp_proxy_set_vss'. +type DHCPProxySetVss struct { + TblID uint32 `binapi:"u32,name=tbl_id" json:"tbl_id,omitempty"` + VssType VssType `binapi:"vss_type,name=vss_type" json:"vss_type,omitempty"` + VPNAsciiID string `binapi:"string[129],name=vpn_ascii_id" json:"vpn_ascii_id,omitempty"` + Oui uint32 `binapi:"u32,name=oui" json:"oui,omitempty"` + VPNIndex uint32 `binapi:"u32,name=vpn_index" json:"vpn_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *DHCPProxySetVss) Reset() { *m = DHCPProxySetVss{} } +func (*DHCPProxySetVss) GetMessageName() string { return "dhcp_proxy_set_vss" } +func (*DHCPProxySetVss) GetCrcString() string { return "50537301" } +func (*DHCPProxySetVss) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCPProxySetVss) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.TblID + size += 4 // m.VssType + size += 129 // m.VPNAsciiID + size += 4 // m.Oui + size += 4 // m.VPNIndex + size += 1 // m.IsIPv6 + size += 1 // m.IsAdd + return size +} +func (m *DHCPProxySetVss) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.TblID)) + buf.EncodeUint32(uint32(m.VssType)) + buf.EncodeString(m.VPNAsciiID, 129) + buf.EncodeUint32(uint32(m.Oui)) + buf.EncodeUint32(uint32(m.VPNIndex)) + buf.EncodeBool(m.IsIPv6) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *DHCPProxySetVss) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TblID = buf.DecodeUint32() + m.VssType = VssType(buf.DecodeUint32()) + m.VPNAsciiID = buf.DecodeString(129) + m.Oui = buf.DecodeUint32() + m.VPNIndex = buf.DecodeUint32() + m.IsIPv6 = buf.DecodeBool() + m.IsAdd = buf.DecodeBool() + return nil +} + +// DHCPProxySetVssReply defines message 'dhcp_proxy_set_vss_reply'. +type DHCPProxySetVssReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCPProxySetVssReply) Reset() { *m = DHCPProxySetVssReply{} } +func (*DHCPProxySetVssReply) GetMessageName() string { return "dhcp_proxy_set_vss_reply" } +func (*DHCPProxySetVssReply) GetCrcString() string { return "e8d4e804" } +func (*DHCPProxySetVssReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCPProxySetVssReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCPProxySetVssReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCPProxySetVssReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantDHCP6PdReplyEvents defines message 'want_dhcp6_pd_reply_events'. +type WantDHCP6PdReplyEvents struct { + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantDHCP6PdReplyEvents) Reset() { *m = WantDHCP6PdReplyEvents{} } +func (*WantDHCP6PdReplyEvents) GetMessageName() string { return "want_dhcp6_pd_reply_events" } +func (*WantDHCP6PdReplyEvents) GetCrcString() string { return "c5e2af94" } +func (*WantDHCP6PdReplyEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantDHCP6PdReplyEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantDHCP6PdReplyEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.EnableDisable) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantDHCP6PdReplyEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeBool() + m.PID = buf.DecodeUint32() + return nil +} + +// WantDHCP6PdReplyEventsReply defines message 'want_dhcp6_pd_reply_events_reply'. +type WantDHCP6PdReplyEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantDHCP6PdReplyEventsReply) Reset() { *m = WantDHCP6PdReplyEventsReply{} } +func (*WantDHCP6PdReplyEventsReply) GetMessageName() string { + return "want_dhcp6_pd_reply_events_reply" +} +func (*WantDHCP6PdReplyEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantDHCP6PdReplyEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantDHCP6PdReplyEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantDHCP6PdReplyEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantDHCP6PdReplyEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// WantDHCP6ReplyEvents defines message 'want_dhcp6_reply_events'. +type WantDHCP6ReplyEvents struct { + EnableDisable uint8 `binapi:"u8,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantDHCP6ReplyEvents) Reset() { *m = WantDHCP6ReplyEvents{} } +func (*WantDHCP6ReplyEvents) GetMessageName() string { return "want_dhcp6_reply_events" } +func (*WantDHCP6ReplyEvents) GetCrcString() string { return "05b454b5" } +func (*WantDHCP6ReplyEvents) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *WantDHCP6ReplyEvents) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.EnableDisable + size += 4 // m.PID + return size +} +func (m *WantDHCP6ReplyEvents) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.EnableDisable)) + buf.EncodeUint32(uint32(m.PID)) + return buf.Bytes(), nil +} +func (m *WantDHCP6ReplyEvents) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EnableDisable = buf.DecodeUint8() + m.PID = buf.DecodeUint32() + return nil +} + +// WantDHCP6ReplyEventsReply defines message 'want_dhcp6_reply_events_reply'. +type WantDHCP6ReplyEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantDHCP6ReplyEventsReply) Reset() { *m = WantDHCP6ReplyEventsReply{} } +func (*WantDHCP6ReplyEventsReply) GetMessageName() string { return "want_dhcp6_reply_events_reply" } +func (*WantDHCP6ReplyEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantDHCP6ReplyEventsReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *WantDHCP6ReplyEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *WantDHCP6ReplyEventsReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *WantDHCP6ReplyEventsReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_dhcp_binapi_init() } +func file_dhcp_binapi_init() { + api.RegisterMessage((*DHCP6ClientsEnableDisable)(nil), "dhcp6_clients_enable_disable_b3e225d2") + api.RegisterMessage((*DHCP6ClientsEnableDisableReply)(nil), "dhcp6_clients_enable_disable_reply_e8d4e804") + api.RegisterMessage((*DHCP6DuidLlSet)(nil), "dhcp6_duid_ll_set_0f6ca323") + api.RegisterMessage((*DHCP6DuidLlSetReply)(nil), "dhcp6_duid_ll_set_reply_e8d4e804") + api.RegisterMessage((*DHCP6PdReplyEvent)(nil), "dhcp6_pd_reply_event_cb3e462b") + api.RegisterMessage((*DHCP6PdSendClientMessage)(nil), "dhcp6_pd_send_client_message_064badb8") + api.RegisterMessage((*DHCP6PdSendClientMessageReply)(nil), "dhcp6_pd_send_client_message_reply_e8d4e804") + api.RegisterMessage((*DHCP6ReplyEvent)(nil), "dhcp6_reply_event_9f3af9e5") + api.RegisterMessage((*DHCP6SendClientMessage)(nil), "dhcp6_send_client_message_f6f14ef0") + api.RegisterMessage((*DHCP6SendClientMessageReply)(nil), "dhcp6_send_client_message_reply_e8d4e804") + api.RegisterMessage((*DHCPClientConfig)(nil), "dhcp_client_config_959b80a3") + api.RegisterMessage((*DHCPClientConfigReply)(nil), "dhcp_client_config_reply_e8d4e804") + api.RegisterMessage((*DHCPClientDetails)(nil), "dhcp_client_details_acd82f5a") + api.RegisterMessage((*DHCPClientDump)(nil), "dhcp_client_dump_51077d14") + api.RegisterMessage((*DHCPComplEvent)(nil), "dhcp_compl_event_e908fd1d") + api.RegisterMessage((*DHCPPluginControlPing)(nil), "dhcp_plugin_control_ping_51077d14") + api.RegisterMessage((*DHCPPluginControlPingReply)(nil), "dhcp_plugin_control_ping_reply_f6b0b8ca") + api.RegisterMessage((*DHCPPluginGetVersion)(nil), "dhcp_plugin_get_version_51077d14") + api.RegisterMessage((*DHCPPluginGetVersionReply)(nil), "dhcp_plugin_get_version_reply_9b32cf86") + api.RegisterMessage((*DHCPProxyConfig)(nil), "dhcp_proxy_config_6767230e") + api.RegisterMessage((*DHCPProxyConfigReply)(nil), "dhcp_proxy_config_reply_e8d4e804") + api.RegisterMessage((*DHCPProxyDetails)(nil), "dhcp_proxy_details_ce16f044") + api.RegisterMessage((*DHCPProxyDump)(nil), "dhcp_proxy_dump_5c5b063f") + api.RegisterMessage((*DHCPProxySetVss)(nil), "dhcp_proxy_set_vss_50537301") + api.RegisterMessage((*DHCPProxySetVssReply)(nil), "dhcp_proxy_set_vss_reply_e8d4e804") + api.RegisterMessage((*WantDHCP6PdReplyEvents)(nil), "want_dhcp6_pd_reply_events_c5e2af94") + api.RegisterMessage((*WantDHCP6PdReplyEventsReply)(nil), "want_dhcp6_pd_reply_events_reply_e8d4e804") + api.RegisterMessage((*WantDHCP6ReplyEvents)(nil), "want_dhcp6_reply_events_05b454b5") + api.RegisterMessage((*WantDHCP6ReplyEventsReply)(nil), "want_dhcp6_reply_events_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DHCP6ClientsEnableDisable)(nil), + (*DHCP6ClientsEnableDisableReply)(nil), + (*DHCP6DuidLlSet)(nil), + (*DHCP6DuidLlSetReply)(nil), + (*DHCP6PdReplyEvent)(nil), + (*DHCP6PdSendClientMessage)(nil), + (*DHCP6PdSendClientMessageReply)(nil), + (*DHCP6ReplyEvent)(nil), + (*DHCP6SendClientMessage)(nil), + (*DHCP6SendClientMessageReply)(nil), + (*DHCPClientConfig)(nil), + (*DHCPClientConfigReply)(nil), + (*DHCPClientDetails)(nil), + (*DHCPClientDump)(nil), + (*DHCPComplEvent)(nil), + (*DHCPPluginControlPing)(nil), + (*DHCPPluginControlPingReply)(nil), + (*DHCPPluginGetVersion)(nil), + (*DHCPPluginGetVersionReply)(nil), + (*DHCPProxyConfig)(nil), + (*DHCPProxyConfigReply)(nil), + (*DHCPProxyDetails)(nil), + (*DHCPProxyDump)(nil), + (*DHCPProxySetVss)(nil), + (*DHCPProxySetVssReply)(nil), + (*WantDHCP6PdReplyEvents)(nil), + (*WantDHCP6PdReplyEventsReply)(nil), + (*WantDHCP6ReplyEvents)(nil), + (*WantDHCP6ReplyEventsReply)(nil), + } +} diff --git a/binapi/dhcp/dhcp_rest.ba.go b/binapi/dhcp/dhcp_rest.ba.go new file mode 100644 index 0000000..4a4d9d1 --- /dev/null +++ b/binapi/dhcp/dhcp_rest.ba.go @@ -0,0 +1,249 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dhcp6_clients_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6ClientsEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6ClientsEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp6_duid_ll_set", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6DuidLlSet) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6DuidLlSet(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp6_pd_send_client_message", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6PdSendClientMessage) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6PdSendClientMessage(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp6_send_client_message", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6SendClientMessage) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6SendClientMessage(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_client_config", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPClientConfig) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCPClientConfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPPluginControlPing) + reply, err := rpc.DHCPPluginControlPing(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_plugin_get_version", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPPluginGetVersion) + reply, err := rpc.DHCPPluginGetVersion(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_proxy_config", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPProxyConfig) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCPProxyConfig(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dhcp_proxy_set_vss", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCPProxySetVss) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCPProxySetVss(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_dhcp6_pd_reply_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantDHCP6PdReplyEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantDHCP6PdReplyEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/want_dhcp6_reply_events", func(w http.ResponseWriter, req *http.Request) { + var request = new(WantDHCP6ReplyEvents) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.WantDHCP6ReplyEvents(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dhcp/dhcp_rpc.ba.go b/binapi/dhcp/dhcp_rpc.ba.go new file mode 100644 index 0000000..379bb9b --- /dev/null +++ b/binapi/dhcp/dhcp_rpc.ba.go @@ -0,0 +1,213 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service dhcp. +type RPCService interface { + DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) + DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) + DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) + DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) + DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) + DHCPClientDump(ctx context.Context, in *DHCPClientDump) (RPCService_DHCPClientDumpClient, error) + DHCPPluginControlPing(ctx context.Context, in *DHCPPluginControlPing) (*DHCPPluginControlPingReply, error) + DHCPPluginGetVersion(ctx context.Context, in *DHCPPluginGetVersion) (*DHCPPluginGetVersionReply, error) + DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) + DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (RPCService_DHCPProxyDumpClient, error) + DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) + WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) + WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DHCP6ClientsEnableDisable(ctx context.Context, in *DHCP6ClientsEnableDisable) (*DHCP6ClientsEnableDisableReply, error) { + out := new(DHCP6ClientsEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6DuidLlSet(ctx context.Context, in *DHCP6DuidLlSet) (*DHCP6DuidLlSetReply, error) { + out := new(DHCP6DuidLlSetReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6PdSendClientMessage(ctx context.Context, in *DHCP6PdSendClientMessage) (*DHCP6PdSendClientMessageReply, error) { + out := new(DHCP6PdSendClientMessageReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCP6SendClientMessage(ctx context.Context, in *DHCP6SendClientMessage) (*DHCP6SendClientMessageReply, error) { + out := new(DHCP6SendClientMessageReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPClientConfig(ctx context.Context, in *DHCPClientConfig) (*DHCPClientConfigReply, error) { + out := new(DHCPClientConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPClientDump(ctx context.Context, in *DHCPClientDump) (RPCService_DHCPClientDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_DHCPClientDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_DHCPClientDumpClient interface { + Recv() (*DHCPClientDetails, error) + api.Stream +} + +type serviceClient_DHCPClientDumpClient struct { + api.Stream +} + +func (c *serviceClient_DHCPClientDumpClient) Recv() (*DHCPClientDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *DHCPClientDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) DHCPPluginControlPing(ctx context.Context, in *DHCPPluginControlPing) (*DHCPPluginControlPingReply, error) { + out := new(DHCPPluginControlPingReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPPluginGetVersion(ctx context.Context, in *DHCPPluginGetVersion) (*DHCPPluginGetVersionReply, error) { + out := new(DHCPPluginGetVersionReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxyConfig(ctx context.Context, in *DHCPProxyConfig) (*DHCPProxyConfigReply, error) { + out := new(DHCPProxyConfigReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DHCPProxyDump(ctx context.Context, in *DHCPProxyDump) (RPCService_DHCPProxyDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_DHCPProxyDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_DHCPProxyDumpClient interface { + Recv() (*DHCPProxyDetails, error) + api.Stream +} + +type serviceClient_DHCPProxyDumpClient struct { + api.Stream +} + +func (c *serviceClient_DHCPProxyDumpClient) Recv() (*DHCPProxyDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *DHCPProxyDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) DHCPProxySetVss(ctx context.Context, in *DHCPProxySetVss) (*DHCPProxySetVssReply, error) { + out := new(DHCPProxySetVssReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6PdReplyEvents(ctx context.Context, in *WantDHCP6PdReplyEvents) (*WantDHCP6PdReplyEventsReply, error) { + out := new(WantDHCP6PdReplyEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantDHCP6ReplyEvents(ctx context.Context, in *WantDHCP6ReplyEvents) (*WantDHCP6ReplyEventsReply, error) { + out := new(WantDHCP6ReplyEventsReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go new file mode 100644 index 0000000..41ea756 --- /dev/null +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go @@ -0,0 +1,122 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dhcp6_ia_na_client_cp.api.json + +// Package dhcp6_ia_na_client_cp contains generated bindings for API file dhcp6_ia_na_client_cp.api. +// +// Contents: +// 2 messages +// +package dhcp6_ia_na_client_cp + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dhcp6_ia_na_client_cp" + APIVersion = "1.0.1" + VersionCrc = 0x7c918b8 +) + +// DHCP6ClientEnableDisable defines message 'dhcp6_client_enable_disable'. +type DHCP6ClientEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *DHCP6ClientEnableDisable) Reset() { *m = DHCP6ClientEnableDisable{} } +func (*DHCP6ClientEnableDisable) GetMessageName() string { return "dhcp6_client_enable_disable" } +func (*DHCP6ClientEnableDisable) GetCrcString() string { return "ae6cfcfb" } +func (*DHCP6ClientEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6ClientEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + return size +} +func (m *DHCP6ClientEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *DHCP6ClientEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + return nil +} + +// DHCP6ClientEnableDisableReply defines message 'dhcp6_client_enable_disable_reply'. +type DHCP6ClientEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6ClientEnableDisableReply) Reset() { *m = DHCP6ClientEnableDisableReply{} } +func (*DHCP6ClientEnableDisableReply) GetMessageName() string { + return "dhcp6_client_enable_disable_reply" +} +func (*DHCP6ClientEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6ClientEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6ClientEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6ClientEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6ClientEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_dhcp6_ia_na_client_cp_binapi_init() } +func file_dhcp6_ia_na_client_cp_binapi_init() { + api.RegisterMessage((*DHCP6ClientEnableDisable)(nil), "dhcp6_client_enable_disable_ae6cfcfb") + api.RegisterMessage((*DHCP6ClientEnableDisableReply)(nil), "dhcp6_client_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DHCP6ClientEnableDisable)(nil), + (*DHCP6ClientEnableDisableReply)(nil), + } +} diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go new file mode 100644 index 0000000..0fd5ce2 --- /dev/null +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp6_ia_na_client_cp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dhcp6_client_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6ClientEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6ClientEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go new file mode 100644 index 0000000..b975236 --- /dev/null +++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp6_ia_na_client_cp + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service dhcp6_ia_na_client_cp. +type RPCService interface { + DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6ClientEnableDisable) (*DHCP6ClientEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DHCP6ClientEnableDisable(ctx context.Context, in *DHCP6ClientEnableDisable) (*DHCP6ClientEnableDisableReply, error) { + out := new(DHCP6ClientEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go new file mode 100644 index 0000000..73e7fad --- /dev/null +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go @@ -0,0 +1,222 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dhcp6_pd_client_cp.api.json + +// Package dhcp6_pd_client_cp contains generated bindings for API file dhcp6_pd_client_cp.api. +// +// Contents: +// 4 messages +// +package dhcp6_pd_client_cp + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dhcp6_pd_client_cp" + APIVersion = "2.0.0" + VersionCrc = 0x96f41948 +) + +// DHCP6PdClientEnableDisable defines message 'dhcp6_pd_client_enable_disable'. +type DHCP6PdClientEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + PrefixGroup string `binapi:"string[64],name=prefix_group" json:"prefix_group,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *DHCP6PdClientEnableDisable) Reset() { *m = DHCP6PdClientEnableDisable{} } +func (*DHCP6PdClientEnableDisable) GetMessageName() string { return "dhcp6_pd_client_enable_disable" } +func (*DHCP6PdClientEnableDisable) GetCrcString() string { return "a75a0772" } +func (*DHCP6PdClientEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DHCP6PdClientEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.PrefixGroup + size += 1 // m.Enable + return size +} +func (m *DHCP6PdClientEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.PrefixGroup, 64) + buf.EncodeBool(m.Enable) + return buf.Bytes(), nil +} +func (m *DHCP6PdClientEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.PrefixGroup = buf.DecodeString(64) + m.Enable = buf.DecodeBool() + return nil +} + +// DHCP6PdClientEnableDisableReply defines message 'dhcp6_pd_client_enable_disable_reply'. +type DHCP6PdClientEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DHCP6PdClientEnableDisableReply) Reset() { *m = DHCP6PdClientEnableDisableReply{} } +func (*DHCP6PdClientEnableDisableReply) GetMessageName() string { + return "dhcp6_pd_client_enable_disable_reply" +} +func (*DHCP6PdClientEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*DHCP6PdClientEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DHCP6PdClientEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DHCP6PdClientEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DHCP6PdClientEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// IP6AddDelAddressUsingPrefix defines message 'ip6_add_del_address_using_prefix'. +type IP6AddDelAddressUsingPrefix struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + PrefixGroup string `binapi:"string[64],name=prefix_group" json:"prefix_group,omitempty"` + AddressWithPrefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=address_with_prefix" json:"address_with_prefix,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *IP6AddDelAddressUsingPrefix) Reset() { *m = IP6AddDelAddressUsingPrefix{} } +func (*IP6AddDelAddressUsingPrefix) GetMessageName() string { + return "ip6_add_del_address_using_prefix" +} +func (*IP6AddDelAddressUsingPrefix) GetCrcString() string { return "9b3d11e0" } +func (*IP6AddDelAddressUsingPrefix) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IP6AddDelAddressUsingPrefix) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 64 // m.PrefixGroup + size += 1 * 16 // m.AddressWithPrefix.Address + size += 1 // m.AddressWithPrefix.Len + size += 1 // m.IsAdd + return size +} +func (m *IP6AddDelAddressUsingPrefix) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeString(m.PrefixGroup, 64) + buf.EncodeBytes(m.AddressWithPrefix.Address[:], 16) + buf.EncodeUint8(uint8(m.AddressWithPrefix.Len)) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *IP6AddDelAddressUsingPrefix) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.PrefixGroup = buf.DecodeString(64) + copy(m.AddressWithPrefix.Address[:], buf.DecodeBytes(16)) + m.AddressWithPrefix.Len = buf.DecodeUint8() + m.IsAdd = buf.DecodeBool() + return nil +} + +// IP6AddDelAddressUsingPrefixReply defines message 'ip6_add_del_address_using_prefix_reply'. +type IP6AddDelAddressUsingPrefixReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IP6AddDelAddressUsingPrefixReply) Reset() { *m = IP6AddDelAddressUsingPrefixReply{} } +func (*IP6AddDelAddressUsingPrefixReply) GetMessageName() string { + return "ip6_add_del_address_using_prefix_reply" +} +func (*IP6AddDelAddressUsingPrefixReply) GetCrcString() string { return "e8d4e804" } +func (*IP6AddDelAddressUsingPrefixReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IP6AddDelAddressUsingPrefixReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *IP6AddDelAddressUsingPrefixReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *IP6AddDelAddressUsingPrefixReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_dhcp6_pd_client_cp_binapi_init() } +func file_dhcp6_pd_client_cp_binapi_init() { + api.RegisterMessage((*DHCP6PdClientEnableDisable)(nil), "dhcp6_pd_client_enable_disable_a75a0772") + api.RegisterMessage((*DHCP6PdClientEnableDisableReply)(nil), "dhcp6_pd_client_enable_disable_reply_e8d4e804") + api.RegisterMessage((*IP6AddDelAddressUsingPrefix)(nil), "ip6_add_del_address_using_prefix_9b3d11e0") + api.RegisterMessage((*IP6AddDelAddressUsingPrefixReply)(nil), "ip6_add_del_address_using_prefix_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DHCP6PdClientEnableDisable)(nil), + (*DHCP6PdClientEnableDisableReply)(nil), + (*IP6AddDelAddressUsingPrefix)(nil), + (*IP6AddDelAddressUsingPrefixReply)(nil), + } +} diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go new file mode 100644 index 0000000..fa76aa8 --- /dev/null +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rest.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp6_pd_client_cp + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dhcp6_pd_client_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(DHCP6PdClientEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DHCP6PdClientEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/ip6_add_del_address_using_prefix", func(w http.ResponseWriter, req *http.Request) { + var request = new(IP6AddDelAddressUsingPrefix) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.IP6AddDelAddressUsingPrefix(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go new file mode 100644 index 0000000..7199e5a --- /dev/null +++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp_rpc.ba.go @@ -0,0 +1,40 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dhcp6_pd_client_cp + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service dhcp6_pd_client_cp. +type RPCService interface { + DHCP6PdClientEnableDisable(ctx context.Context, in *DHCP6PdClientEnableDisable) (*DHCP6PdClientEnableDisableReply, error) + IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6AddDelAddressUsingPrefix) (*IP6AddDelAddressUsingPrefixReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DHCP6PdClientEnableDisable(ctx context.Context, in *DHCP6PdClientEnableDisable) (*DHCP6PdClientEnableDisableReply, error) { + out := new(DHCP6PdClientEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IP6AddDelAddressUsingPrefix(ctx context.Context, in *IP6AddDelAddressUsingPrefix) (*IP6AddDelAddressUsingPrefixReply, error) { + out := new(IP6AddDelAddressUsingPrefixReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dns/dns.ba.go b/binapi/dns/dns.ba.go new file mode 100644 index 0000000..25c8ddf --- /dev/null +++ b/binapi/dns/dns.ba.go @@ -0,0 +1,375 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dns.api.json + +// Package dns contains generated bindings for API file dns.api. +// +// Contents: +// 8 messages +// +package dns + +import ( + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dns" + APIVersion = "1.0.0" + VersionCrc = 0x269575cd +) + +// DNSEnableDisable defines message 'dns_enable_disable'. +type DNSEnableDisable struct { + Enable uint8 `binapi:"u8,name=enable" json:"enable,omitempty"` +} + +func (m *DNSEnableDisable) Reset() { *m = DNSEnableDisable{} } +func (*DNSEnableDisable) GetMessageName() string { return "dns_enable_disable" } +func (*DNSEnableDisable) GetCrcString() string { return "8050327d" } +func (*DNSEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DNSEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.Enable + return size +} +func (m *DNSEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.Enable)) + return buf.Bytes(), nil +} +func (m *DNSEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Enable = buf.DecodeUint8() + return nil +} + +// DNSEnableDisableReply defines message 'dns_enable_disable_reply'. +type DNSEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DNSEnableDisableReply) Reset() { *m = DNSEnableDisableReply{} } +func (*DNSEnableDisableReply) GetMessageName() string { return "dns_enable_disable_reply" } +func (*DNSEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*DNSEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DNSEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DNSEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DNSEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DNSNameServerAddDel defines message 'dns_name_server_add_del'. +type DNSNameServerAddDel struct { + IsIP6 uint8 `binapi:"u8,name=is_ip6" json:"is_ip6,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + ServerAddress []byte `binapi:"u8[16],name=server_address" json:"server_address,omitempty"` +} + +func (m *DNSNameServerAddDel) Reset() { *m = DNSNameServerAddDel{} } +func (*DNSNameServerAddDel) GetMessageName() string { return "dns_name_server_add_del" } +func (*DNSNameServerAddDel) GetCrcString() string { return "3bb05d8c" } +func (*DNSNameServerAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DNSNameServerAddDel) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIP6 + size += 1 // m.IsAdd + size += 1 * 16 // m.ServerAddress + return size +} +func (m *DNSNameServerAddDel) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IsIP6)) + buf.EncodeUint8(uint8(m.IsAdd)) + buf.EncodeBytes(m.ServerAddress[:], 16) + return buf.Bytes(), nil +} +func (m *DNSNameServerAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIP6 = buf.DecodeUint8() + m.IsAdd = buf.DecodeUint8() + copy(m.ServerAddress[:], buf.DecodeBytes(16)) + return nil +} + +// DNSNameServerAddDelReply defines message 'dns_name_server_add_del_reply'. +type DNSNameServerAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DNSNameServerAddDelReply) Reset() { *m = DNSNameServerAddDelReply{} } +func (*DNSNameServerAddDelReply) GetMessageName() string { return "dns_name_server_add_del_reply" } +func (*DNSNameServerAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*DNSNameServerAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DNSNameServerAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DNSNameServerAddDelReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DNSNameServerAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DNSResolveIP defines message 'dns_resolve_ip'. +type DNSResolveIP struct { + IsIP6 uint8 `binapi:"u8,name=is_ip6" json:"is_ip6,omitempty"` + Address []byte `binapi:"u8[16],name=address" json:"address,omitempty"` +} + +func (m *DNSResolveIP) Reset() { *m = DNSResolveIP{} } +func (*DNSResolveIP) GetMessageName() string { return "dns_resolve_ip" } +func (*DNSResolveIP) GetCrcString() string { return "ae96a1a3" } +func (*DNSResolveIP) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DNSResolveIP) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsIP6 + size += 1 * 16 // m.Address + return size +} +func (m *DNSResolveIP) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint8(uint8(m.IsIP6)) + buf.EncodeBytes(m.Address[:], 16) + return buf.Bytes(), nil +} +func (m *DNSResolveIP) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsIP6 = buf.DecodeUint8() + copy(m.Address[:], buf.DecodeBytes(16)) + return nil +} + +// DNSResolveIPReply defines message 'dns_resolve_ip_reply'. +type DNSResolveIPReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Name []byte `binapi:"u8[256],name=name" json:"name,omitempty"` +} + +func (m *DNSResolveIPReply) Reset() { *m = DNSResolveIPReply{} } +func (*DNSResolveIPReply) GetMessageName() string { return "dns_resolve_ip_reply" } +func (*DNSResolveIPReply) GetCrcString() string { return "49ed78d6" } +func (*DNSResolveIPReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DNSResolveIPReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 256 // m.Name + return size +} +func (m *DNSResolveIPReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.Name[:], 256) + return buf.Bytes(), nil +} +func (m *DNSResolveIPReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.Name[:], buf.DecodeBytes(256)) + return nil +} + +// DNSResolveName defines message 'dns_resolve_name'. +type DNSResolveName struct { + Name []byte `binapi:"u8[256],name=name" json:"name,omitempty"` +} + +func (m *DNSResolveName) Reset() { *m = DNSResolveName{} } +func (*DNSResolveName) GetMessageName() string { return "dns_resolve_name" } +func (*DNSResolveName) GetCrcString() string { return "c6566676" } +func (*DNSResolveName) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DNSResolveName) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 256 // m.Name + return size +} +func (m *DNSResolveName) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.Name[:], 256) + return buf.Bytes(), nil +} +func (m *DNSResolveName) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.Name[:], buf.DecodeBytes(256)) + return nil +} + +// DNSResolveNameReply defines message 'dns_resolve_name_reply'. +type DNSResolveNameReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IP4Set uint8 `binapi:"u8,name=ip4_set" json:"ip4_set,omitempty"` + IP6Set uint8 `binapi:"u8,name=ip6_set" json:"ip6_set,omitempty"` + IP4Address []byte `binapi:"u8[4],name=ip4_address" json:"ip4_address,omitempty"` + IP6Address []byte `binapi:"u8[16],name=ip6_address" json:"ip6_address,omitempty"` +} + +func (m *DNSResolveNameReply) Reset() { *m = DNSResolveNameReply{} } +func (*DNSResolveNameReply) GetMessageName() string { return "dns_resolve_name_reply" } +func (*DNSResolveNameReply) GetCrcString() string { return "c2d758c3" } +func (*DNSResolveNameReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DNSResolveNameReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 // m.IP4Set + size += 1 // m.IP6Set + size += 1 * 4 // m.IP4Address + size += 1 * 16 // m.IP6Address + return size +} +func (m *DNSResolveNameReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint8(uint8(m.IP4Set)) + buf.EncodeUint8(uint8(m.IP6Set)) + buf.EncodeBytes(m.IP4Address[:], 4) + buf.EncodeBytes(m.IP6Address[:], 16) + return buf.Bytes(), nil +} +func (m *DNSResolveNameReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.IP4Set = buf.DecodeUint8() + m.IP6Set = buf.DecodeUint8() + copy(m.IP4Address[:], buf.DecodeBytes(4)) + copy(m.IP6Address[:], buf.DecodeBytes(16)) + return nil +} + +func init() { file_dns_binapi_init() } +func file_dns_binapi_init() { + api.RegisterMessage((*DNSEnableDisable)(nil), "dns_enable_disable_8050327d") + api.RegisterMessage((*DNSEnableDisableReply)(nil), "dns_enable_disable_reply_e8d4e804") + api.RegisterMessage((*DNSNameServerAddDel)(nil), "dns_name_server_add_del_3bb05d8c") + api.RegisterMessage((*DNSNameServerAddDelReply)(nil), "dns_name_server_add_del_reply_e8d4e804") + api.RegisterMessage((*DNSResolveIP)(nil), "dns_resolve_ip_ae96a1a3") + api.RegisterMessage((*DNSResolveIPReply)(nil), "dns_resolve_ip_reply_49ed78d6") + api.RegisterMessage((*DNSResolveName)(nil), "dns_resolve_name_c6566676") + api.RegisterMessage((*DNSResolveNameReply)(nil), "dns_resolve_name_reply_c2d758c3") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DNSEnableDisable)(nil), + (*DNSEnableDisableReply)(nil), + (*DNSNameServerAddDel)(nil), + (*DNSNameServerAddDelReply)(nil), + (*DNSResolveIP)(nil), + (*DNSResolveIPReply)(nil), + (*DNSResolveName)(nil), + (*DNSResolveNameReply)(nil), + } +} diff --git a/binapi/dns/dns_rest.ba.go b/binapi/dns/dns_rest.ba.go new file mode 100644 index 0000000..e67d971 --- /dev/null +++ b/binapi/dns/dns_rest.ba.go @@ -0,0 +1,106 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dns + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dns_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(DNSEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DNSEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dns_name_server_add_del", func(w http.ResponseWriter, req *http.Request) { + var request = new(DNSNameServerAddDel) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DNSNameServerAddDel(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dns_resolve_ip", func(w http.ResponseWriter, req *http.Request) { + var request = new(DNSResolveIP) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DNSResolveIP(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dns_resolve_name", func(w http.ResponseWriter, req *http.Request) { + var request = new(DNSResolveName) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DNSResolveName(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dns/dns_rpc.ba.go b/binapi/dns/dns_rpc.ba.go new file mode 100644 index 0000000..57760ab --- /dev/null +++ b/binapi/dns/dns_rpc.ba.go @@ -0,0 +1,60 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dns + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service dns. +type RPCService interface { + DNSEnableDisable(ctx context.Context, in *DNSEnableDisable) (*DNSEnableDisableReply, error) + DNSNameServerAddDel(ctx context.Context, in *DNSNameServerAddDel) (*DNSNameServerAddDelReply, error) + DNSResolveIP(ctx context.Context, in *DNSResolveIP) (*DNSResolveIPReply, error) + DNSResolveName(ctx context.Context, in *DNSResolveName) (*DNSResolveNameReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DNSEnableDisable(ctx context.Context, in *DNSEnableDisable) (*DNSEnableDisableReply, error) { + out := new(DNSEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DNSNameServerAddDel(ctx context.Context, in *DNSNameServerAddDel) (*DNSNameServerAddDelReply, error) { + out := new(DNSNameServerAddDelReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DNSResolveIP(ctx context.Context, in *DNSResolveIP) (*DNSResolveIPReply, error) { + out := new(DNSResolveIPReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DNSResolveName(ctx context.Context, in *DNSResolveName) (*DNSResolveNameReply, error) { + out := new(DNSResolveNameReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/dslite/dslite.ba.go b/binapi/dslite/dslite.ba.go new file mode 100644 index 0000000..b7aff21 --- /dev/null +++ b/binapi/dslite/dslite.ba.go @@ -0,0 +1,513 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/dslite.api.json + +// Package dslite contains generated bindings for API file dslite.api. +// +// Contents: +// 12 messages +// +package dslite + +import ( + api "git.fd.io/govpp.git/api" + _ "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "dslite" + APIVersion = "1.0.0" + VersionCrc = 0xb62715c5 +) + +// DsliteAddDelPoolAddrRange defines message 'dslite_add_del_pool_addr_range'. +type DsliteAddDelPoolAddrRange struct { + StartAddr ip_types.IP4Address `binapi:"ip4_address,name=start_addr" json:"start_addr,omitempty"` + EndAddr ip_types.IP4Address `binapi:"ip4_address,name=end_addr" json:"end_addr,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *DsliteAddDelPoolAddrRange) Reset() { *m = DsliteAddDelPoolAddrRange{} } +func (*DsliteAddDelPoolAddrRange) GetMessageName() string { return "dslite_add_del_pool_addr_range" } +func (*DsliteAddDelPoolAddrRange) GetCrcString() string { return "c448457a" } +func (*DsliteAddDelPoolAddrRange) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteAddDelPoolAddrRange) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.StartAddr + size += 1 * 4 // m.EndAddr + size += 1 // m.IsAdd + return size +} +func (m *DsliteAddDelPoolAddrRange) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.StartAddr[:], 4) + buf.EncodeBytes(m.EndAddr[:], 4) + buf.EncodeBool(m.IsAdd) + return buf.Bytes(), nil +} +func (m *DsliteAddDelPoolAddrRange) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.StartAddr[:], buf.DecodeBytes(4)) + copy(m.EndAddr[:], buf.DecodeBytes(4)) + m.IsAdd = buf.DecodeBool() + return nil +} + +// DsliteAddDelPoolAddrRangeReply defines message 'dslite_add_del_pool_addr_range_reply'. +type DsliteAddDelPoolAddrRangeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DsliteAddDelPoolAddrRangeReply) Reset() { *m = DsliteAddDelPoolAddrRangeReply{} } +func (*DsliteAddDelPoolAddrRangeReply) GetMessageName() string { + return "dslite_add_del_pool_addr_range_reply" +} +func (*DsliteAddDelPoolAddrRangeReply) GetCrcString() string { return "e8d4e804" } +func (*DsliteAddDelPoolAddrRangeReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteAddDelPoolAddrRangeReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DsliteAddDelPoolAddrRangeReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DsliteAddDelPoolAddrRangeReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DsliteAddressDetails defines message 'dslite_address_details'. +type DsliteAddressDetails struct { + IPAddress ip_types.IP4Address `binapi:"ip4_address,name=ip_address" json:"ip_address,omitempty"` +} + +func (m *DsliteAddressDetails) Reset() { *m = DsliteAddressDetails{} } +func (*DsliteAddressDetails) GetMessageName() string { return "dslite_address_details" } +func (*DsliteAddressDetails) GetCrcString() string { return "ec26d648" } +func (*DsliteAddressDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteAddressDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IPAddress + return size +} +func (m *DsliteAddressDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IPAddress[:], 4) + return buf.Bytes(), nil +} +func (m *DsliteAddressDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IPAddress[:], buf.DecodeBytes(4)) + return nil +} + +// DsliteAddressDump defines message 'dslite_address_dump'. +type DsliteAddressDump struct{} + +func (m *DsliteAddressDump) Reset() { *m = DsliteAddressDump{} } +func (*DsliteAddressDump) GetMessageName() string { return "dslite_address_dump" } +func (*DsliteAddressDump) GetCrcString() string { return "51077d14" } +func (*DsliteAddressDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteAddressDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DsliteAddressDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DsliteAddressDump) Unmarshal(b []byte) error { + return nil +} + +// DsliteGetAftrAddr defines message 'dslite_get_aftr_addr'. +type DsliteGetAftrAddr struct{} + +func (m *DsliteGetAftrAddr) Reset() { *m = DsliteGetAftrAddr{} } +func (*DsliteGetAftrAddr) GetMessageName() string { return "dslite_get_aftr_addr" } +func (*DsliteGetAftrAddr) GetCrcString() string { return "51077d14" } +func (*DsliteGetAftrAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteGetAftrAddr) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DsliteGetAftrAddr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DsliteGetAftrAddr) Unmarshal(b []byte) error { + return nil +} + +// DsliteGetAftrAddrReply defines message 'dslite_get_aftr_addr_reply'. +type DsliteGetAftrAddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *DsliteGetAftrAddrReply) Reset() { *m = DsliteGetAftrAddrReply{} } +func (*DsliteGetAftrAddrReply) GetMessageName() string { return "dslite_get_aftr_addr_reply" } +func (*DsliteGetAftrAddrReply) GetCrcString() string { return "38e30db1" } +func (*DsliteGetAftrAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteGetAftrAddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 4 // m.IP4Addr + size += 1 * 16 // m.IP6Addr + return size +} +func (m *DsliteGetAftrAddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *DsliteGetAftrAddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// DsliteGetB4Addr defines message 'dslite_get_b4_addr'. +type DsliteGetB4Addr struct{} + +func (m *DsliteGetB4Addr) Reset() { *m = DsliteGetB4Addr{} } +func (*DsliteGetB4Addr) GetMessageName() string { return "dslite_get_b4_addr" } +func (*DsliteGetB4Addr) GetCrcString() string { return "51077d14" } +func (*DsliteGetB4Addr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteGetB4Addr) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *DsliteGetB4Addr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + return buf.Bytes(), nil +} +func (m *DsliteGetB4Addr) Unmarshal(b []byte) error { + return nil +} + +// DsliteGetB4AddrReply defines message 'dslite_get_b4_addr_reply'. +type DsliteGetB4AddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *DsliteGetB4AddrReply) Reset() { *m = DsliteGetB4AddrReply{} } +func (*DsliteGetB4AddrReply) GetMessageName() string { return "dslite_get_b4_addr_reply" } +func (*DsliteGetB4AddrReply) GetCrcString() string { return "38e30db1" } +func (*DsliteGetB4AddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteGetB4AddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 1 * 4 // m.IP4Addr + size += 1 * 16 // m.IP6Addr + return size +} +func (m *DsliteGetB4AddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *DsliteGetB4AddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// DsliteSetAftrAddr defines message 'dslite_set_aftr_addr'. +type DsliteSetAftrAddr struct { + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *DsliteSetAftrAddr) Reset() { *m = DsliteSetAftrAddr{} } +func (*DsliteSetAftrAddr) GetMessageName() string { return "dslite_set_aftr_addr" } +func (*DsliteSetAftrAddr) GetCrcString() string { return "1e955f8d" } +func (*DsliteSetAftrAddr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteSetAftrAddr) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IP4Addr + size += 1 * 16 // m.IP6Addr + return size +} +func (m *DsliteSetAftrAddr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *DsliteSetAftrAddr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// DsliteSetAftrAddrReply defines message 'dslite_set_aftr_addr_reply'. +type DsliteSetAftrAddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DsliteSetAftrAddrReply) Reset() { *m = DsliteSetAftrAddrReply{} } +func (*DsliteSetAftrAddrReply) GetMessageName() string { return "dslite_set_aftr_addr_reply" } +func (*DsliteSetAftrAddrReply) GetCrcString() string { return "e8d4e804" } +func (*DsliteSetAftrAddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteSetAftrAddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DsliteSetAftrAddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DsliteSetAftrAddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +// DsliteSetB4Addr defines message 'dslite_set_b4_addr'. +type DsliteSetB4Addr struct { + IP4Addr ip_types.IP4Address `binapi:"ip4_address,name=ip4_addr" json:"ip4_addr,omitempty"` + IP6Addr ip_types.IP6Address `binapi:"ip6_address,name=ip6_addr" json:"ip6_addr,omitempty"` +} + +func (m *DsliteSetB4Addr) Reset() { *m = DsliteSetB4Addr{} } +func (*DsliteSetB4Addr) GetMessageName() string { return "dslite_set_b4_addr" } +func (*DsliteSetB4Addr) GetCrcString() string { return "1e955f8d" } +func (*DsliteSetB4Addr) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *DsliteSetB4Addr) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 * 4 // m.IP4Addr + size += 1 * 16 // m.IP6Addr + return size +} +func (m *DsliteSetB4Addr) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBytes(m.IP4Addr[:], 4) + buf.EncodeBytes(m.IP6Addr[:], 16) + return buf.Bytes(), nil +} +func (m *DsliteSetB4Addr) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.IP4Addr[:], buf.DecodeBytes(4)) + copy(m.IP6Addr[:], buf.DecodeBytes(16)) + return nil +} + +// DsliteSetB4AddrReply defines message 'dslite_set_b4_addr_reply'. +type DsliteSetB4AddrReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DsliteSetB4AddrReply) Reset() { *m = DsliteSetB4AddrReply{} } +func (*DsliteSetB4AddrReply) GetMessageName() string { return "dslite_set_b4_addr_reply" } +func (*DsliteSetB4AddrReply) GetCrcString() string { return "e8d4e804" } +func (*DsliteSetB4AddrReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *DsliteSetB4AddrReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *DsliteSetB4AddrReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *DsliteSetB4AddrReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_dslite_binapi_init() } +func file_dslite_binapi_init() { + api.RegisterMessage((*DsliteAddDelPoolAddrRange)(nil), "dslite_add_del_pool_addr_range_c448457a") + api.RegisterMessage((*DsliteAddDelPoolAddrRangeReply)(nil), "dslite_add_del_pool_addr_range_reply_e8d4e804") + api.RegisterMessage((*DsliteAddressDetails)(nil), "dslite_address_details_ec26d648") + api.RegisterMessage((*DsliteAddressDump)(nil), "dslite_address_dump_51077d14") + api.RegisterMessage((*DsliteGetAftrAddr)(nil), "dslite_get_aftr_addr_51077d14") + api.RegisterMessage((*DsliteGetAftrAddrReply)(nil), "dslite_get_aftr_addr_reply_38e30db1") + api.RegisterMessage((*DsliteGetB4Addr)(nil), "dslite_get_b4_addr_51077d14") + api.RegisterMessage((*DsliteGetB4AddrReply)(nil), "dslite_get_b4_addr_reply_38e30db1") + api.RegisterMessage((*DsliteSetAftrAddr)(nil), "dslite_set_aftr_addr_1e955f8d") + api.RegisterMessage((*DsliteSetAftrAddrReply)(nil), "dslite_set_aftr_addr_reply_e8d4e804") + api.RegisterMessage((*DsliteSetB4Addr)(nil), "dslite_set_b4_addr_1e955f8d") + api.RegisterMessage((*DsliteSetB4AddrReply)(nil), "dslite_set_b4_addr_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*DsliteAddDelPoolAddrRange)(nil), + (*DsliteAddDelPoolAddrRangeReply)(nil), + (*DsliteAddressDetails)(nil), + (*DsliteAddressDump)(nil), + (*DsliteGetAftrAddr)(nil), + (*DsliteGetAftrAddrReply)(nil), + (*DsliteGetB4Addr)(nil), + (*DsliteGetB4AddrReply)(nil), + (*DsliteSetAftrAddr)(nil), + (*DsliteSetAftrAddrReply)(nil), + (*DsliteSetB4Addr)(nil), + (*DsliteSetB4AddrReply)(nil), + } +} diff --git a/binapi/dslite/dslite_rest.ba.go b/binapi/dslite/dslite_rest.ba.go new file mode 100644 index 0000000..eba86b0 --- /dev/null +++ b/binapi/dslite/dslite_rest.ba.go @@ -0,0 +1,111 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dslite + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/dslite_add_del_pool_addr_range", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteAddDelPoolAddrRange) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DsliteAddDelPoolAddrRange(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dslite_get_aftr_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteGetAftrAddr) + reply, err := rpc.DsliteGetAftrAddr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dslite_get_b4_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteGetB4Addr) + reply, err := rpc.DsliteGetB4Addr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dslite_set_aftr_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteSetAftrAddr) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DsliteSetAftrAddr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + mux.HandleFunc("/dslite_set_b4_addr", func(w http.ResponseWriter, req *http.Request) { + var request = new(DsliteSetB4Addr) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.DsliteSetB4Addr(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/dslite/dslite_rpc.ba.go b/binapi/dslite/dslite_rpc.ba.go new file mode 100644 index 0000000..7f6e90e --- /dev/null +++ b/binapi/dslite/dslite_rpc.ba.go @@ -0,0 +1,113 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package dslite + +import ( + "context" + "fmt" + api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/binapi/vpe" + "io" +) + +// RPCService defines RPC service dslite. +type RPCService interface { + DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) + DsliteAddressDump(ctx context.Context, in *DsliteAddressDump) (RPCService_DsliteAddressDumpClient, error) + DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) + DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) + DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) + DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) DsliteAddDelPoolAddrRange(ctx context.Context, in *DsliteAddDelPoolAddrRange) (*DsliteAddDelPoolAddrRangeReply, error) { + out := new(DsliteAddDelPoolAddrRangeReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteAddressDump(ctx context.Context, in *DsliteAddressDump) (RPCService_DsliteAddressDumpClient, error) { + stream, err := c.conn.NewStream(ctx) + if err != nil { + return nil, err + } + x := &serviceClient_DsliteAddressDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil +} + +type RPCService_DsliteAddressDumpClient interface { + Recv() (*DsliteAddressDetails, error) + api.Stream +} + +type serviceClient_DsliteAddressDumpClient struct { + api.Stream +} + +func (c *serviceClient_DsliteAddressDumpClient) Recv() (*DsliteAddressDetails, error) { + msg, err := c.Stream.RecvMsg() + if err != nil { + return nil, err + } + switch m := msg.(type) { + case *DsliteAddressDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } +} + +func (c *serviceClient) DsliteGetAftrAddr(ctx context.Context, in *DsliteGetAftrAddr) (*DsliteGetAftrAddrReply, error) { + out := new(DsliteGetAftrAddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteGetB4Addr(ctx context.Context, in *DsliteGetB4Addr) (*DsliteGetB4AddrReply, error) { + out := new(DsliteGetB4AddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetAftrAddr(ctx context.Context, in *DsliteSetAftrAddr) (*DsliteSetAftrAddrReply, error) { + out := new(DsliteSetAftrAddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DsliteSetB4Addr(ctx context.Context, in *DsliteSetB4Addr) (*DsliteSetB4AddrReply, error) { + out := new(DsliteSetB4AddrReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/ethernet_types/ethernet_types.ba.go b/binapi/ethernet_types/ethernet_types.ba.go new file mode 100644 index 0000000..b54b1ef --- /dev/null +++ b/binapi/ethernet_types/ethernet_types.ba.go @@ -0,0 +1,53 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/ethernet_types.api.json + +// Package ethernet_types contains generated bindings for API file ethernet_types.api. +// +// Contents: +// 1 alias +// +package ethernet_types + +import ( + api "git.fd.io/govpp.git/api" + "net" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// MacAddress defines alias 'mac_address'. +type MacAddress [6]uint8 + +func ParseMacAddress(s string) (MacAddress, error) { + var macaddr MacAddress + mac, err := net.ParseMAC(s) + if err != nil { + return macaddr, err + } + copy(macaddr[:], mac[:]) + return macaddr, nil +} +func (x MacAddress) ToMAC() net.HardwareAddr { + return net.HardwareAddr(x[:]) +} +func (x MacAddress) String() string { + return x.ToMAC().String() +} +func (x *MacAddress) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *MacAddress) UnmarshalText(text []byte) error { + mac, err := ParseMacAddress(string(text)) + if err != nil { + return err + } + *x = mac + return nil +} diff --git a/binapi/feature/feature.ba.go b/binapi/feature/feature.ba.go new file mode 100644 index 0000000..4d16ce8 --- /dev/null +++ b/binapi/feature/feature.ba.go @@ -0,0 +1,128 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/feature.api.json + +// Package feature contains generated bindings for API file feature.api. +// +// Contents: +// 2 messages +// +package feature + +import ( + api "git.fd.io/govpp.git/api" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "feature" + APIVersion = "1.0.2" + VersionCrc = 0x8dd9f8ab +) + +// FeatureEnableDisable defines message 'feature_enable_disable'. +type FeatureEnableDisable struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` + ArcName string `binapi:"string[64],name=arc_name" json:"arc_name,omitempty"` + FeatureName string `binapi:"string[64],name=feature_name" json:"feature_name,omitempty"` +} + +func (m *FeatureEnableDisable) Reset() { *m = FeatureEnableDisable{} } +func (*FeatureEnableDisable) GetMessageName() string { return "feature_enable_disable" } +func (*FeatureEnableDisable) GetCrcString() string { return "7531c862" } +func (*FeatureEnableDisable) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *FeatureEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 1 // m.Enable + size += 64 // m.ArcName + size += 64 // m.FeatureName + return size +} +func (m *FeatureEnableDisable) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBool(m.Enable) + buf.EncodeString(m.ArcName, 64) + buf.EncodeString(m.FeatureName, 64) + return buf.Bytes(), nil +} +func (m *FeatureEnableDisable) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.Enable = buf.DecodeBool() + m.ArcName = buf.DecodeString(64) + m.FeatureName = buf.DecodeString(64) + return nil +} + +// FeatureEnableDisableReply defines message 'feature_enable_disable_reply'. +type FeatureEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *FeatureEnableDisableReply) Reset() { *m = FeatureEnableDisableReply{} } +func (*FeatureEnableDisableReply) GetMessageName() string { return "feature_enable_disable_reply" } +func (*FeatureEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*FeatureEnableDisableReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *FeatureEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + return size +} +func (m *FeatureEnableDisableReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + return buf.Bytes(), nil +} +func (m *FeatureEnableDisableReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + return nil +} + +func init() { file_feature_binapi_init() } +func file_feature_binapi_init() { + api.RegisterMessage((*FeatureEnableDisable)(nil), "feature_enable_disable_7531c862") + api.RegisterMessage((*FeatureEnableDisableReply)(nil), "feature_enable_disable_reply_e8d4e804") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*FeatureEnableDisable)(nil), + (*FeatureEnableDisableReply)(nil), + } +} diff --git a/binapi/feature/feature_rest.ba.go b/binapi/feature/feature_rest.ba.go new file mode 100644 index 0000000..a1b0604 --- /dev/null +++ b/binapi/feature/feature_rest.ba.go @@ -0,0 +1,37 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package feature + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/feature_enable_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(FeatureEnableDisable) + b, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, "read body failed", http.StatusBadRequest) + return + } + if err := json.Unmarshal(b, request); err != nil { + http.Error(w, "unmarshal data failed", http.StatusBadRequest) + return + } + reply, err := rpc.FeatureEnableDisable(req.Context(), request) + if err != nil { + http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) + return + } + rep, err := json.MarshalIndent(reply, "", " ") + if err != nil { + http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) + return + } + w.Write(rep) + }) + return http.HandlerFunc(mux.ServeHTTP) +} diff --git a/binapi/feature/feature_rpc.ba.go b/binapi/feature/feature_rpc.ba.go new file mode 100644 index 0000000..cd91188 --- /dev/null +++ b/binapi/feature/feature_rpc.ba.go @@ -0,0 +1,30 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package feature + +import ( + "context" + api "git.fd.io/govpp.git/api" +) + +// RPCService defines RPC service feature. +type RPCService interface { + FeatureEnableDisable(ctx context.Context, in *FeatureEnableDisable) (*FeatureEnableDisableReply, error) +} + +type serviceClient struct { + conn api.Connection +} + +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} +} + +func (c *serviceClient) FeatureEnableDisable(ctx context.Context, in *FeatureEnableDisable) (*FeatureEnableDisableReply, error) { + out := new(FeatureEnableDisableReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil +} diff --git a/binapi/fib_types/fib_types.ba.go b/binapi/fib_types/fib_types.ba.go new file mode 100644 index 0000000..eb67597 --- /dev/null +++ b/binapi/fib_types/fib_types.ba.go @@ -0,0 +1,198 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/core/fib_types.api.json + +// Package fib_types contains generated bindings for API file fib_types.api. +// +// Contents: +// 3 enums +// 3 structs +// +package fib_types + +import ( + api "git.fd.io/govpp.git/api" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + "strconv" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +// FibPathFlags defines enum 'fib_path_flags'. +type FibPathFlags uint32 + +const ( + FIB_API_PATH_FLAG_NONE FibPathFlags = 0 + FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 + FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 + FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 +) + +var ( + FibPathFlags_name = map[uint32]string{ + 0: "FIB_API_PATH_FLAG_NONE", + 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", + 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", + 4: "FIB_API_PATH_FLAG_POP_PW_CW", + } + FibPathFlags_value = map[string]uint32{ + "FIB_API_PATH_FLAG_NONE": 0, + "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, + "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, + "FIB_API_PATH_FLAG_POP_PW_CW": 4, + } +) + +func (x FibPathFlags) String() string { + s, ok := FibPathFlags_name[uint32(x)] + if ok { + return s + } + str := func(n uint32) string { + s, ok := FibPathFlags_name[uint32(n)] + if ok { + return s + } + return "FibPathFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1< 0 } -func (file *File) addRef(typ string, name string, ref interface{}) { - apiName := toApiType(name) - if _, ok := file.refmap[apiName]; ok { - logf("%s type %v already in refmap", typ, apiName) - return - } - file.refmap[apiName] = name -} - func (file *File) importedFiles(gen *Generator) []*File { var files []*File for _, imp := range file.Imports { impFile, ok := gen.FilesByName[imp] if !ok { - logf("file %s import %s not found API files", file.Name, imp) + logf("file %s import %s not found API files", file.Desc.Name, imp) continue } files = append(files, impFile) @@ -103,115 +141,102 @@ func (file *File) importedFiles(gen *Generator) []*File { return files } -func (file *File) loadTypeImports(gen *Generator, typeFiles []*File) { - if len(typeFiles) == 0 { - return - } - for _, t := range file.Structs { - for _, imp := range typeFiles { - if _, ok := file.imports[t.Name]; ok { - break - } - for _, at := range imp.File.StructTypes { - if at.Name != t.Name { - continue - } - if len(at.Fields) != len(t.Fields) { - continue - } - file.imports[t.Name] = imp.PackageName - } - } - } - for _, t := range file.AliasTypes { - for _, imp := range typeFiles { - if _, ok := file.imports[t.Name]; ok { - break - } - for _, at := range imp.File.AliasTypes { - if at.Name != t.Name { - continue - } - if at.Length != t.Length { - continue - } - if at.Type != t.Type { - continue - } - file.imports[t.Name] = imp.PackageName - } +func (file *File) dependsOnFile(gen *Generator, dep string) bool { + for _, imp := range file.Imports { + if imp == dep { + return true } - } - for _, t := range file.EnumTypes { - for _, imp := range typeFiles { - if _, ok := file.imports[t.Name]; ok { - break - } - for _, at := range imp.File.EnumTypes { - if at.Name != t.Name { - continue - } - if at.Type != t.Type { - continue - } - file.imports[t.Name] = imp.PackageName - } + impFile, ok := gen.FilesByName[imp] + if ok && impFile.dependsOnFile(gen, dep) { + return true } } - for _, t := range file.UnionTypes { - for _, imp := range typeFiles { - if _, ok := file.imports[t.Name]; ok { - break - } - for _, at := range imp.File.UnionTypes { - if at.Name != t.Name { - continue - } - file.imports[t.Name] = imp.PackageName - /*if gen.ImportTypes { - imp.Generate = true - }*/ - } - } + return false +} + +func normalizeImport(imp string) string { + imp = path.Base(imp) + if idx := strings.Index(imp, "."); idx >= 0 { + imp = imp[:idx] } + return imp +} + +const ( + enumFlagSuffix = "_flags" +) + +func isEnumFlag(enum *Enum) bool { + return strings.HasSuffix(enum.Name, enumFlagSuffix) } type Enum struct { vppapi.EnumType - GoName string + GoIdent } func newEnum(gen *Generator, file *File, apitype vppapi.EnumType) *Enum { typ := &Enum{ EnumType: apitype, - GoName: camelCaseName(apitype.Name), + GoIdent: GoIdent{ + GoName: camelCaseName(apitype.Name), + GoImportPath: file.GoImportPath, + }, } - gen.enumsByName[fmt.Sprintf("%s.%s", file.Name, typ.Name)] = typ - file.addRef("enum", typ.Name, typ) + gen.enumsByName[typ.Name] = typ return typ } type Alias struct { vppapi.AliasType - GoName string + GoIdent + + TypeBasic *string + TypeStruct *Struct + TypeUnion *Union } func newAlias(gen *Generator, file *File, apitype vppapi.AliasType) *Alias { typ := &Alias{ AliasType: apitype, - GoName: camelCaseName(apitype.Name), + GoIdent: GoIdent{ + GoName: camelCaseName(apitype.Name), + GoImportPath: file.GoImportPath, + }, } - gen.aliasesByName[fmt.Sprintf("%s.%s", file.Name, typ.Name)] = typ - file.addRef("alias", typ.Name, typ) + gen.aliasesByName[typ.Name] = typ return typ } +func (a *Alias) resolveDependencies(gen *Generator) error { + if err := a.resolveType(gen); err != nil { + return fmt.Errorf("unable to resolve field: %w", err) + } + return nil +} + +func (a *Alias) resolveType(gen *Generator) error { + if _, ok := BaseTypesGo[a.Type]; ok { + return nil + } + typ := fromApiType(a.Type) + if t, ok := gen.structsByName[typ]; ok { + a.TypeStruct = t + return nil + } + if t, ok := gen.unionsByName[typ]; ok { + a.TypeUnion = t + return nil + } + return fmt.Errorf("unknown type: %q", a.Type) +} + type Struct struct { vppapi.StructType - GoName string + GoIdent Fields []*Field } @@ -219,22 +244,33 @@ type Struct struct { func newStruct(gen *Generator, file *File, apitype vppapi.StructType) *Struct { typ := &Struct{ StructType: apitype, - GoName: camelCaseName(apitype.Name), + GoIdent: GoIdent{ + GoName: camelCaseName(apitype.Name), + GoImportPath: file.GoImportPath, + }, } + gen.structsByName[typ.Name] = typ for _, fieldType := range apitype.Fields { field := newField(gen, file, fieldType) field.ParentStruct = typ typ.Fields = append(typ.Fields, field) } - gen.structsByName[fmt.Sprintf("%s.%s", file.Name, typ.Name)] = typ - file.addRef("struct", typ.Name, typ) return typ } +func (m *Struct) resolveDependencies(gen *Generator) (err error) { + for _, field := range m.Fields { + if err := field.resolveDependencies(gen); err != nil { + return fmt.Errorf("unable to resolve for struct %s: %w", m.Name, err) + } + } + return nil +} + type Union struct { vppapi.UnionType - GoName string + GoIdent Fields []*Field } @@ -242,32 +278,96 @@ type Union struct { func newUnion(gen *Generator, file *File, apitype vppapi.UnionType) *Union { typ := &Union{ UnionType: apitype, - GoName: camelCaseName(apitype.Name), + GoIdent: GoIdent{ + GoName: camelCaseName(apitype.Name), + GoImportPath: file.GoImportPath, + }, } - gen.unionsByName[fmt.Sprintf("%s.%s", file.Name, typ.Name)] = typ + gen.unionsByName[typ.Name] = typ for _, fieldType := range apitype.Fields { field := newField(gen, file, fieldType) field.ParentUnion = typ typ.Fields = append(typ.Fields, field) } - file.addRef("union", typ.Name, typ) return typ } +func (m *Union) resolveDependencies(gen *Generator) (err error) { + for _, field := range m.Fields { + if err := field.resolveDependencies(gen); err != nil { + return err + } + } + return nil +} + +// msgType determines message header fields +type msgType int + +const ( + msgTypeBase msgType = iota // msg_id + msgTypeRequest // msg_id, client_index, context + msgTypeReply // msg_id, context + msgTypeEvent // msg_id, client_index +) + +func apiMsgType(t msgType) GoIdent { + switch t { + case msgTypeRequest: + return govppApiPkg.Ident("RequestMessage") + case msgTypeReply: + return govppApiPkg.Ident("ReplyMessage") + case msgTypeEvent: + return govppApiPkg.Ident("EventMessage") + default: + return govppApiPkg.Ident("OtherMessage") + } +} + +// message fields +const ( + fieldMsgID = "_vl_msg_id" + fieldClientIndex = "client_index" + fieldContext = "context" + fieldRetval = "retval" +) + +// field options +const ( + optFieldDefault = "default" +) + type Message struct { vppapi.Message - GoName string + CRC string + + GoIdent Fields []*Field + + msgType msgType } func newMessage(gen *Generator, file *File, apitype vppapi.Message) *Message { msg := &Message{ Message: apitype, - GoName: camelCaseName(apitype.Name), + CRC: strings.TrimPrefix(apitype.CRC, "0x"), + GoIdent: newGoIdent(file, apitype.Name), } + gen.messagesByName[apitype.Name] = msg + n := 0 for _, fieldType := range apitype.Fields { + // skip internal fields + switch strings.ToLower(fieldType.Name) { + case fieldMsgID: + continue + case fieldClientIndex, fieldContext: + if n == 0 { + continue + } + } + n++ field := newField(gen, file, fieldType) field.ParentMessage = msg msg.Fields = append(msg.Fields, field) @@ -275,21 +375,71 @@ func newMessage(gen *Generator, file *File, apitype vppapi.Message) *Message { return msg } +func (m *Message) resolveDependencies(gen *Generator) (err error) { + if m.msgType, err = getMsgType(m.Message); err != nil { + return err + } + for _, field := range m.Fields { + if err := field.resolveDependencies(gen); err != nil { + return err + } + } + return nil +} + +func getMsgType(m vppapi.Message) (msgType, error) { + if len(m.Fields) == 0 { + return msgType(0), fmt.Errorf("message %s has no fields", m.Name) + } + typ := msgTypeBase + wasClientIndex := false + for i, field := range m.Fields { + if i == 0 { + if field.Name != fieldMsgID { + return msgType(0), fmt.Errorf("message %s is missing ID field", m.Name) + } + } else if i == 1 { + if field.Name == fieldClientIndex { + // "client_index" as the second member, + // this might be an event message or a request + typ = msgTypeEvent + wasClientIndex = true + } else if field.Name == fieldContext { + // reply needs "context" as the second member + typ = msgTypeReply + } + } else if i == 2 { + if wasClientIndex && field.Name == fieldContext { + // request needs "client_index" as the second member + // and "context" as the third member + typ = msgTypeRequest + } + } + } + return typ, nil +} + type Field struct { vppapi.Field GoName string - // Field parent + DefaultValue interface{} + + // Reference to actual type of this field + TypeEnum *Enum + TypeAlias *Alias + TypeStruct *Struct + TypeUnion *Union + + // Parent in which this field is declared ParentMessage *Message ParentStruct *Struct ParentUnion *Union - // Type reference - Enum *Enum - Alias *Alias - Struct *Struct - Union *Union + // Field reference for fields determining size + FieldSizeOf *Field + FieldSizeFrom *Field } func newField(gen *Generator, file *File, apitype vppapi.Field) *Field { @@ -297,64 +447,134 @@ func newField(gen *Generator, file *File, apitype vppapi.Field) *Field { Field: apitype, GoName: camelCaseName(apitype.Name), } + if apitype.Meta != nil { + if val, ok := apitype.Meta[optFieldDefault]; ok { + typ.DefaultValue = val + } + } return typ } -type Service = vppapi.Service -type RPC = vppapi.RPC - -func sortFileObjects(file *vppapi.File) { - // sort imports - sort.SliceStable(file.Imports, func(i, j int) bool { - return file.Imports[i] < file.Imports[j] - }) - // sort enum types - sort.SliceStable(file.EnumTypes, func(i, j int) bool { - return file.EnumTypes[i].Name < file.EnumTypes[j].Name - }) - // sort alias types - sort.Slice(file.AliasTypes, func(i, j int) bool { - return file.AliasTypes[i].Name < file.AliasTypes[j].Name - }) - // sort struct types - sort.SliceStable(file.StructTypes, func(i, j int) bool { - return file.StructTypes[i].Name < file.StructTypes[j].Name - }) - // sort union types - sort.SliceStable(file.UnionTypes, func(i, j int) bool { - return file.UnionTypes[i].Name < file.UnionTypes[j].Name - }) - // sort messages - sort.SliceStable(file.Messages, func(i, j int) bool { - return file.Messages[i].Name < file.Messages[j].Name - }) - // sort services - if file.Service != nil { - sort.Slice(file.Service.RPCs, func(i, j int) bool { - // dumps first - if file.Service.RPCs[i].Stream != file.Service.RPCs[j].Stream { - return file.Service.RPCs[i].Stream +func (f *Field) resolveDependencies(gen *Generator) error { + if err := f.resolveType(gen); err != nil { + return fmt.Errorf("unable to resolve field type: %w", err) + } + if err := f.resolveFields(gen); err != nil { + return fmt.Errorf("unable to resolve fields: %w", err) + } + return nil +} + +func (f *Field) resolveType(gen *Generator) error { + if _, ok := BaseTypesGo[f.Type]; ok { + return nil + } + typ := fromApiType(f.Type) + if t, ok := gen.structsByName[typ]; ok { + f.TypeStruct = t + return nil + } + if t, ok := gen.enumsByName[typ]; ok { + f.TypeEnum = t + return nil + } + if t, ok := gen.aliasesByName[typ]; ok { + f.TypeAlias = t + return nil + } + if t, ok := gen.unionsByName[typ]; ok { + f.TypeUnion = t + return nil + } + return fmt.Errorf("unknown type: %q", f.Type) +} + +func (f *Field) resolveFields(gen *Generator) error { + var fields []*Field + if f.ParentMessage != nil { + fields = f.ParentMessage.Fields + } else if f.ParentStruct != nil { + fields = f.ParentStruct.Fields + } + if f.SizeFrom != "" { + for _, field := range fields { + if field.Name == f.SizeFrom { + f.FieldSizeFrom = field + break + } + } + } else { + for _, field := range fields { + if field.SizeFrom == f.Name { + f.FieldSizeOf = field + break } - return file.Service.RPCs[i].RequestMsg < file.Service.RPCs[j].RequestMsg - }) + } } + return nil } -func sanitizedName(name string) string { - switch name { - case "interface": - return "interfaces" - case "map": - return "maps" - default: - return name +type Service struct { + vppapi.Service + + RPCs []*RPC +} + +func newService(gen *Generator, file *File, apitype vppapi.Service) *Service { + svc := &Service{ + Service: apitype, } + for _, rpc := range apitype.RPCs { + svc.RPCs = append(svc.RPCs, newRpc(file, svc, rpc)) + } + return svc } -func normalizeImport(imp string) string { - imp = path.Base(imp) - if idx := strings.Index(imp, "."); idx >= 0 { - imp = imp[:idx] +const ( + serviceNoReply = "null" +) + +type RPC struct { + VPP vppapi.RPC + + GoName string + + Service *Service + + MsgRequest *Message + MsgReply *Message + MsgStream *Message +} + +func newRpc(file *File, service *Service, apitype vppapi.RPC) *RPC { + rpc := &RPC{ + VPP: apitype, + GoName: camelCaseName(apitype.Request), + Service: service, } - return imp + return rpc +} + +func (rpc *RPC) resolveMessages(gen *Generator) error { + msg, ok := gen.messagesByName[rpc.VPP.Request] + if !ok { + return fmt.Errorf("rpc %v: no message for request type %v", rpc.GoName, rpc.VPP.Request) + } + rpc.MsgRequest = msg + + if rpc.VPP.Reply != "" && rpc.VPP.Reply != serviceNoReply { + msg, ok := gen.messagesByName[rpc.VPP.Reply] + if !ok { + return fmt.Errorf("rpc %v: no message for reply type %v", rpc.GoName, rpc.VPP.Reply) + } + rpc.MsgReply = msg + } + if rpc.VPP.StreamMsg != "" { + msg, ok := gen.messagesByName[rpc.VPP.StreamMsg] + if !ok { + return fmt.Errorf("rpc %v: no message for stream type %v", rpc.GoName, rpc.VPP.StreamMsg) + } + rpc.MsgStream = msg + } + return nil } diff --git a/binapigen/binapigen_test.go b/binapigen/binapigen_test.go new file mode 100644 index 0000000..2fbd163 --- /dev/null +++ b/binapigen/binapigen_test.go @@ -0,0 +1,55 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package binapigen + +import ( + "testing" + + . "github.com/onsi/gomega" + + "git.fd.io/govpp.git/binapigen/vppapi" +) + +func TestGenerator(t *testing.T) { + tests := []struct { + name string + file *vppapi.File + expectPackage string + }{ + {name: "vpe", file: &vppapi.File{ + Name: "vpe", + Path: "/usr/share/vpp/api/core/vpe.api.json", + CRC: "0x12345678", + }, + expectPackage: "vpe", + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + RegisterTestingT(t) + + apifiles := []*vppapi.File{test.file} + + gen, err := New(Options{ + ImportPrefix: "test", + }, apifiles, nil) + Expect(err).ToNot(HaveOccurred(), "unexpected generator error: %v", err) + + Expect(gen.Files).To(HaveLen(1)) + Expect(gen.Files[0].PackageName).To(BeEquivalentTo(test.expectPackage)) + Expect(gen.Files[0].GoImportPath).To(BeEquivalentTo("test/" + test.expectPackage)) + }) + } +} diff --git a/binapigen/gen_encoding.go b/binapigen/gen_encoding.go new file mode 100644 index 0000000..1cd3eb3 --- /dev/null +++ b/binapigen/gen_encoding.go @@ -0,0 +1,375 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package binapigen + +import ( + "fmt" + "strconv" + "strings" + + "github.com/sirupsen/logrus" +) + +func init() { + //RegisterPlugin("encoding", GenerateEncoding) +} + +func generateMessageSize(g *GenFile, name string, fields []*Field) { + g.P("func (m *", name, ") Size() int {") + g.P("if m == nil { return 0 }") + g.P("var size int") + + sizeBaseType := func(typ, name string, length int, sizefrom string) { + switch typ { + case STRING: + if length > 0 { + g.P("size += ", length, " // ", name) + } else { + g.P("size += 4 + len(", name, ")", " // ", name) + } + default: + var size = BaseTypeSizes[typ] + if sizefrom != "" { + g.P("size += ", size, " * len(", name, ")", " // ", name) + } else { + if length > 0 { + g.P("size += ", size, " * ", length, " // ", name) + } else { + g.P("size += ", size, " // ", name) + } + } + } + } + + lvl := 0 + var sizeFields func(fields []*Field, parentName string) + sizeFields = func(fields []*Field, parentName string) { + lvl++ + defer func() { lvl-- }() + + getFieldName := func(name string) string { + return fmt.Sprintf("%s.%s", parentName, name) + } + + for _, field := range fields { + name := getFieldName(field.GoName) + + var sizeFromName string + if field.FieldSizeFrom != nil { + sizeFromName = getFieldName(field.FieldSizeFrom.GoName) + } + + if _, ok := BaseTypesGo[field.Type]; ok { + sizeBaseType(field.Type, name, field.Length, sizeFromName) + continue + } + + if field.Array { + char := fmt.Sprintf("s%d", lvl) + index := fmt.Sprintf("j%d", lvl) + if field.Length > 0 { + g.P("for ", index, " := 0; ", index, " < ", field.Length, "; ", index, "++ {") + } else if field.FieldSizeFrom != nil { + g.P("for ", index, " := 0; ", index, " < len(", name, "); ", index, "++ {") + } + g.P("var ", char, " ", fieldGoType(g, field)) + g.P("_ = ", char) + g.P("if ", index, " < len(", name, ") { ", char, " = ", name, "[", index, "] }") + name = char + } + + switch { + case field.TypeEnum != nil: + enum := field.TypeEnum + if _, ok := BaseTypesGo[enum.Type]; ok { + sizeBaseType(enum.Type, name, 0, "") + } else { + logrus.Panicf("\t// ??? ENUM %s %s\n", name, enum.Type) + } + case field.TypeAlias != nil: + alias := field.TypeAlias + if typ := alias.TypeStruct; typ != nil { + sizeFields(typ.Fields, name) + } else { + sizeBaseType(alias.Type, name, alias.Length, "") + } + case field.TypeStruct != nil: + typ := field.TypeStruct + sizeFields(typ.Fields, name) + case field.TypeUnion != nil: + union := field.TypeUnion + maxSize := getUnionSize(union) + sizeBaseType("u8", name, maxSize, "") + default: + logrus.Panicf("\t// ??? buf[pos] = %s (%s)\n", name, field.Type) + } + + if field.Array { + g.P("}") + } + } + } + sizeFields(fields, "m") + + g.P("return size") + g.P("}") +} + +func encodeBaseType(g *GenFile, typ, name string, length int, sizefrom string) { + isArray := length > 0 || sizefrom != "" + if isArray { + switch typ { + case U8: + g.P("buf.EncodeBytes(", name, "[:], ", length, ")") + return + case I8, I16, U16, I32, U32, I64, U64, F64: + gotype := BaseTypesGo[typ] + if length != 0 { + g.P("for i := 0; i < ", length, "; i++ {") + } else if sizefrom != "" { + g.P("for i := 0; i < len(", name, "); i++ {") + } + g.P("var x ", gotype) + g.P("if i < len(", name, ") { x = ", gotype, "(", name, "[i]) }") + name = "x" + } + } + switch typ { + case I8, U8, I16, U16, I32, U32, I64, U64: + typsize := BaseTypeSizes[typ] + g.P("buf.EncodeUint", typsize*8, "(uint", typsize*8, "(", name, "))") + case F64: + g.P("buf.EncodeFloat64(float64(", name, "))") + case BOOL: + g.P("buf.EncodeBool(", name, ")") + case STRING: + g.P("buf.EncodeString(", name, ", ", length, ")") + default: + logrus.Panicf("// ??? %s %s\n", name, typ) + } + if isArray { + switch typ { + case I8, U8, I16, U16, I32, U32, I64, U64, F64: + g.P("}") + } + } +} + +func encodeFields(g *GenFile, fields []*Field, parentName string, lvl int) { + getFieldName := func(name string) string { + return fmt.Sprintf("%s.%s", parentName, name) + } + + for _, field := range fields { + name := getFieldName(field.GoName) + + encodeField(g, field, name, getFieldName, lvl) + } +} + +func encodeField(g *GenFile, field *Field, name string, getFieldName func(name string) string, lvl int) { + if f := field.FieldSizeOf; f != nil { + if _, ok := BaseTypesGo[field.Type]; ok { + encodeBaseType(g, field.Type, fmt.Sprintf("len(%s)", getFieldName(f.GoName)), field.Length, "") + return + } else { + panic(fmt.Sprintf("failed to encode base type of sizefrom field: %s (%s)", field.Name, field.Type)) + } + } + var sizeFromName string + if field.FieldSizeFrom != nil { + sizeFromName = getFieldName(field.FieldSizeFrom.GoName) + } + + if _, ok := BaseTypesGo[field.Type]; ok { + encodeBaseType(g, field.Type, name, field.Length, sizeFromName) + return + } + + if field.Array { + char := fmt.Sprintf("v%d", lvl) + index := fmt.Sprintf("j%d", lvl) + if field.Length > 0 { + g.P("for ", index, " := 0; ", index, " < ", field.Length, "; ", index, "++ {") + } else if field.SizeFrom != "" { + g.P("for ", index, " := 0; ", index, " < len(", name, "); ", index, "++ {") + } + g.P("var ", char, " ", fieldGoType(g, field)) + g.P("if ", index, " < len(", name, ") { ", char, " = ", name, "[", index, "] }") + name = char + } + + switch { + case field.TypeEnum != nil: + encodeBaseType(g, field.TypeEnum.Type, name, 0, "") + case field.TypeAlias != nil: + alias := field.TypeAlias + if typ := alias.TypeStruct; typ != nil { + encodeFields(g, typ.Fields, name, lvl+1) + } else { + encodeBaseType(g, alias.Type, name, alias.Length, "") + } + case field.TypeStruct != nil: + encodeFields(g, field.TypeStruct.Fields, name, lvl+1) + case field.TypeUnion != nil: + g.P("buf.EncodeBytes(", name, ".", fieldUnionData, "[:], 0)") + default: + logrus.Panicf("\t// ??? buf[pos] = %s (%s)\n", name, field.Type) + } + + if field.Array { + g.P("}") + } +} + +func generateMessageMarshal(g *GenFile, name string, fields []*Field) { + g.P("func (m *", name, ") Marshal(b []byte) ([]byte, error) {") + g.P("var buf *", govppCodecPkg.Ident("Buffer")) + g.P("if b == nil {") + g.P("buf = ", govppCodecPkg.Ident("NewBuffer"), "(make([]byte, m.Size()))") + g.P("} else {") + g.P("buf = ", govppCodecPkg.Ident("NewBuffer"), "(b)") + g.P("}") + + encodeFields(g, fields, "m", 0) + + g.P("return buf.Bytes(), nil") + g.P("}") +} + +func decodeBaseType(g *GenFile, typ, orig, name string, length int, sizefrom string, alloc bool) { + isArray := length > 0 || sizefrom != "" + if isArray { + switch typ { + case U8: + g.P("copy(", name, "[:], buf.DecodeBytes(", length, "))") + return + case I8, I16, U16, I32, U32, I64, U64, F64: + if alloc { + var size string + switch { + case length > 0: + size = strconv.Itoa(length) + case sizefrom != "": + size = sizefrom + } + if size != "" { + g.P(name, " = make([]", orig, ", ", size, ")") + } + } + g.P("for i := 0; i < len(", name, "); i++ {") + name = fmt.Sprintf("%s[i]", name) + } + } + switch typ { + case I8, U8, I16, U16, I32, U32, I64, U64: + typsize := BaseTypeSizes[typ] + if gotype, ok := BaseTypesGo[typ]; !ok || gotype != orig || strings.HasPrefix(orig, "i") { + g.P(name, " = ", orig, "(buf.DecodeUint", typsize*8, "())") + } else { + g.P(name, " = buf.DecodeUint", typsize*8, "()") + } + case F64: + g.P(name, " = ", orig, "(buf.DecodeFloat64())") + case BOOL: + g.P(name, " = buf.DecodeBool()") + case STRING: + g.P(name, " = buf.DecodeString(", length, ")") + default: + logrus.Panicf("\t// ??? %s %s\n", name, typ) + } + if isArray { + switch typ { + case I8, U8, I16, U16, I32, U32, I64, U64, F64: + g.P("}") + } + } +} + +func generateMessageUnmarshal(g *GenFile, name string, fields []*Field) { + g.P("func (m *", name, ") Unmarshal(b []byte) error {") + + if len(fields) > 0 { + g.P("buf := ", govppCodecPkg.Ident("NewBuffer"), "(b)") + decodeFields(g, fields, "m", 0) + } + + g.P("return nil") + g.P("}") +} + +func decodeFields(g *GenFile, fields []*Field, parentName string, lvl int) { + getFieldName := func(name string) string { + return fmt.Sprintf("%s.%s", parentName, name) + } + + for _, field := range fields { + name := getFieldName(field.GoName) + + decodeField(g, field, name, getFieldName, lvl) + } +} + +func decodeField(g *GenFile, field *Field, name string, getFieldName func(string) string, lvl int) { + var sizeFromName string + if field.FieldSizeFrom != nil { + sizeFromName = getFieldName(field.FieldSizeFrom.GoName) + } + + if _, ok := BaseTypesGo[field.Type]; ok { + decodeBaseType(g, field.Type, fieldGoType(g, field), name, field.Length, sizeFromName, true) + return + } + + if field.Array { + index := fmt.Sprintf("j%d", lvl) + if field.Length > 0 { + g.P("for ", index, " := 0; ", index, " < ", field.Length, ";", index, "++ {") + } else if field.SizeFrom != "" { + g.P(name, " = make(", getFieldType(g, field), ", int(", sizeFromName, "))") + g.P("for ", index, " := 0; ", index, " < len(", name, ");", index, "++ {") + } + name = fmt.Sprintf("%s[%s]", name, index) + } + + if enum := field.TypeEnum; enum != nil { + if _, ok := BaseTypesGo[enum.Type]; ok { + decodeBaseType(g, enum.Type, fieldGoType(g, field), name, 0, "", false) + } else { + logrus.Panicf("\t// ??? ENUM %s %s\n", name, enum.Type) + } + } else if alias := field.TypeAlias; alias != nil { + if typ := alias.TypeStruct; typ != nil { + decodeFields(g, typ.Fields, name, lvl+1) + } else { + if alias.Length > 0 { + decodeBaseType(g, alias.Type, BaseTypesGo[alias.Type], name, alias.Length, "", false) + } else { + decodeBaseType(g, alias.Type, fieldGoType(g, field), name, alias.Length, "", false) + } + } + } else if typ := field.TypeStruct; typ != nil { + decodeFields(g, typ.Fields, name, lvl+1) + } else if union := field.TypeUnion; union != nil { + maxSize := getUnionSize(union) + g.P("copy(", name, ".", fieldUnionData, "[:], buf.DecodeBytes(", maxSize, "))") + } else { + logrus.Panicf("\t// ??? %s (%v)\n", field.GoName, field.Type) + } + + if field.Array { + g.P("}") + } +} diff --git a/binapigen/gen_helpers.go b/binapigen/gen_helpers.go new file mode 100644 index 0000000..a22f1c6 --- /dev/null +++ b/binapigen/gen_helpers.go @@ -0,0 +1,348 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package binapigen + +func init() { + //RegisterPlugin("convert", GenerateConvert) +} + +// library dependencies +const ( + fmtPkg = GoImportPath("fmt") + netPkg = GoImportPath("net") + stringsPkg = GoImportPath("strings") +) + +func generateIPConversion(g *GenFile, structName string, ipv int) { + // ParseIPXAddress method + g.P("func Parse", structName, "(s string) (", structName, ", error) {") + if ipv == 4 { + g.P(" ip := ", netPkg.Ident("ParseIP"), "(s).To4()") + } else { + g.P(" ip := ", netPkg.Ident("ParseIP"), "(s).To16()") + } + g.P(" if ip == nil {") + g.P(" return ", structName, "{}, ", fmtPkg.Ident("Errorf"), "(\"invalid IP address: %s\", s)") + g.P(" }") + g.P(" var ipaddr ", structName) + if ipv == 4 { + g.P(" copy(ipaddr[:], ip.To4())") + } else { + g.P(" copy(ipaddr[:], ip.To16())") + } + g.P(" return ipaddr, nil") + g.P("}") + g.P() + + // ToIP method + g.P("func (x ", structName, ") ToIP() ", netPkg.Ident("IP"), " {") + if ipv == 4 { + g.P(" return ", netPkg.Ident("IP"), "(x[:]).To4()") + } else { + g.P(" return ", netPkg.Ident("IP"), "(x[:]).To16()") + } + g.P("}") + + // String method + g.P("func (x ", structName, ") String() string {") + g.P(" return x.ToIP().String()") + g.P("}") + + // MarshalText method + g.P("func (x *", structName, ") MarshalText() ([]byte, error) {") + g.P(" return []byte(x.String()), nil") + g.P("}") + + // UnmarshalText method + g.P("func (x *", structName, ") UnmarshalText(text []byte) error {") + g.P(" ipaddr, err := Parse", structName, "(string(text))") + g.P(" if err !=nil {") + g.P(" return err") + g.P(" }") + g.P(" *x = ipaddr") + g.P(" return nil") + g.P("}") + g.P() +} + +func generateAddressConversion(g *GenFile, structName string) { + // ParseAddress method + g.P("func Parse", structName, "(s string) (", structName, ", error) {") + g.P(" ip := ", netPkg.Ident("ParseIP"), "(s)") + g.P(" if ip == nil {") + g.P(" return ", structName, "{}, ", fmtPkg.Ident("Errorf"), "(\"invalid address: %s\", s)") + g.P(" }") + g.P(" var addr ", structName) + g.P(" if ip.To4() == nil {") + g.P(" addr.Af = ADDRESS_IP6") + g.P(" var ip6 IP6Address") + g.P(" copy(ip6[:], ip.To16())") + g.P(" addr.Un.SetIP6(ip6)") + g.P(" } else {") + g.P(" addr.Af = ADDRESS_IP4") + g.P(" var ip4 IP4Address") + g.P(" copy(ip4[:], ip.To4())") + g.P(" addr.Un.SetIP4(ip4)") + g.P(" }") + g.P(" return addr, nil") + g.P("}") + + // ToIP method + g.P("func (x ", structName, ") ToIP() ", netPkg.Ident("IP"), " {") + g.P(" if x.Af == ADDRESS_IP6 {") + g.P(" ip6 := x.Un.GetIP6()") + g.P(" return ", netPkg.Ident("IP"), "(ip6[:]).To16()") + g.P(" } else {") + g.P(" ip4 := x.Un.GetIP4()") + g.P(" return ", netPkg.Ident("IP"), "(ip4[:]).To4()") + g.P(" }") + g.P("}") + + // String method + g.P("func (x ", structName, ") String() string {") + g.P(" return x.ToIP().String()") + g.P("}") + + // MarshalText method + g.P("func (x *", structName, ") MarshalText() ([]byte, error) {") + g.P(" return []byte(x.String()), nil") + g.P("}") + + // UnmarshalText method + g.P("func (x *", structName, ") UnmarshalText(text []byte) error {") + g.P(" addr, err := Parse", structName, "(string(text))") + g.P(" if err != nil {") + g.P(" return err") + g.P(" }") + g.P(" *x = addr") + g.P(" return nil") + g.P("}") + g.P() +} + +func generateIPPrefixConversion(g *GenFile, structName string, ipv int) { + // ParsePrefix method + g.P("func Parse", structName, "(s string) (prefix ", structName, ", err error) {") + g.P(" hasPrefix := ", stringsPkg.Ident("Contains"), "(s, \"/\")") + g.P(" if hasPrefix {") + g.P(" ip, network, err := ", netPkg.Ident("ParseCIDR"), "(s)") + g.P(" if err != nil {") + g.P(" return ", structName, "{}, ", fmtPkg.Ident("Errorf"), "(\"invalid IP %s: %s\", s, err)") + g.P(" }") + g.P(" maskSize, _ := network.Mask.Size()") + g.P(" prefix.Len = byte(maskSize)") + if ipv == 4 { + g.P(" prefix.Address, err = ParseIP4Address(ip.String())") + } else { + g.P(" prefix.Address, err = ParseIP6Address(ip.String())") + } + g.P(" if err != nil {") + g.P(" return ", structName, "{}, ", fmtPkg.Ident("Errorf"), "(\"invalid IP %s: %s\", s, err)") + g.P(" }") + g.P(" } else {") + g.P(" ip := ", netPkg.Ident("ParseIP"), "(s)") + g.P(" defaultMaskSize, _ := ", netPkg.Ident("CIDRMask"), "(32, 32).Size()") + g.P(" if ip.To4() == nil {") + g.P(" defaultMaskSize, _ =", netPkg.Ident("CIDRMask"), "(128, 128).Size()") + g.P(" }") + g.P(" prefix.Len = byte(defaultMaskSize)") + if ipv == 4 { + g.P(" prefix.Address, err = ParseIP4Address(ip.String())") + } else { + g.P(" prefix.Address, err = ParseIP6Address(ip.String())") + } + g.P(" if err != nil {") + g.P(" return ", structName, "{}, ", fmtPkg.Ident("Errorf"), "(\"invalid IP %s: %s\", s, err)") + g.P(" }") + g.P(" }") + g.P(" return prefix, nil") + g.P("}") + + // ToIPNet method + g.P("func (x ", structName, ") ToIPNet() *", netPkg.Ident("IPNet"), " {") + if ipv == 4 { + g.P(" mask := ", netPkg.Ident("CIDRMask"), "(int(x.Len), 32)") + } else { + g.P(" mask := ", netPkg.Ident("CIDRMask"), "(int(x.Len), 128)") + } + g.P(" ipnet := &", netPkg.Ident("IPNet"), "{IP: x.Address.ToIP(), Mask: mask}") + g.P(" return ipnet") + g.P("}") + + // String method + g.P("func (x ", structName, ") String() string {") + g.P(" ip := x.Address.String()") + g.P(" return ip + \"/\" + ", strconvPkg.Ident("Itoa"), "(int(x.Len))") + /*if ipv == 4 { + g.P(" mask := ", netPkg.Ident("CIDRMask"), "(int(x.Len), 32)") + } else { + g.P(" mask := ", netPkg.Ident("CIDRMask"), "(int(x.Len), 128)") + } + g.P(" ipnet := &", netPkg.Ident("IPNet"), "{IP: x.Address.ToIP(), Mask: mask}") + g.P(" return ipnet.String()")*/ + g.P("}") + + // MarshalText method + g.P("func (x *", structName, ") MarshalText() ([]byte, error) {") + g.P(" return []byte(x.String()), nil") + g.P("}") + + // UnmarshalText method + g.P("func (x *", structName, ") UnmarshalText(text []byte) error {") + g.P(" prefix, err := Parse", structName, "(string(text))") + g.P(" if err != nil {") + g.P(" return err") + g.P(" }") + g.P(" *x = prefix") + g.P(" return nil") + g.P("}") + g.P() +} + +func generatePrefixConversion(g *GenFile, structName string) { + // ParsePrefix method + g.P("func Parse", structName, "(ip string) (prefix ", structName, ", err error) {") + g.P(" hasPrefix := ", stringsPkg.Ident("Contains"), "(ip, \"/\")") + g.P(" if hasPrefix {") + g.P(" netIP, network, err := ", netPkg.Ident("ParseCIDR"), "(ip)") + g.P(" if err != nil {") + g.P(" return Prefix{}, ", fmtPkg.Ident("Errorf"), "(\"invalid IP %s: %s\", ip, err)") + g.P(" }") + g.P(" maskSize, _ := network.Mask.Size()") + g.P(" prefix.Len = byte(maskSize)") + g.P(" prefix.Address, err = ParseAddress(netIP.String())") + g.P(" if err != nil {") + g.P(" return Prefix{}, ", fmtPkg.Ident("Errorf"), "(\"invalid IP %s: %s\", ip, err)") + g.P(" }") + g.P(" } else {") + g.P(" netIP := ", netPkg.Ident("ParseIP"), "(ip)") + g.P(" defaultMaskSize, _ := ", netPkg.Ident("CIDRMask"), "(32, 32).Size()") + g.P(" if netIP.To4() == nil {") + g.P(" defaultMaskSize, _ =", netPkg.Ident("CIDRMask"), "(128, 128).Size()") + g.P(" }") + g.P(" prefix.Len = byte(defaultMaskSize)") + g.P(" prefix.Address, err = ParseAddress(netIP.String())") + g.P(" if err != nil {") + g.P(" return Prefix{}, ", fmtPkg.Ident("Errorf"), "(\"invalid IP %s: %s\", ip, err)") + g.P(" }") + g.P(" }") + g.P(" return prefix, nil") + g.P("}") + + // ToIPNet method + g.P("func (x ", structName, ") ToIPNet() *", netPkg.Ident("IPNet"), " {") + g.P(" var mask ", netPkg.Ident("IPMask")) + g.P(" if x.Address.Af == ADDRESS_IP4 {") + g.P(" mask = ", netPkg.Ident("CIDRMask"), "(int(x.Len), 32)") + g.P(" } else {") + g.P(" mask = ", netPkg.Ident("CIDRMask"), "(int(x.Len), 128)") + g.P(" }") + g.P(" ipnet := &", netPkg.Ident("IPNet"), "{IP: x.Address.ToIP(), Mask: mask}") + g.P(" return ipnet") + g.P("}") + + // String method + g.P("func (x ", structName, ") String() string {") + g.P(" ip := x.Address.String()") + g.P(" return ip + \"/\" + ", strconvPkg.Ident("Itoa"), "(int(x.Len))") + g.P("}") + + // MarshalText method + g.P("func (x *", structName, ") MarshalText() ([]byte, error) {") + g.P(" return []byte(x.String()), nil") + g.P("}") + + // UnmarshalText method + g.P("func (x *", structName, ") UnmarshalText(text []byte) error {") + g.P(" prefix, err := Parse", structName, "(string(text))") + g.P(" if err !=nil {") + g.P(" return err") + g.P(" }") + g.P(" *x = prefix") + g.P(" return nil") + g.P("}") + g.P() +} + +func generateAddressWithPrefixConversion(g *GenFile, structName string) { + // ParseAddressWithPrefix method + g.P("func Parse", structName, "(s string) (", structName, ", error) {") + g.P(" prefix, err := ParsePrefix(s)") + g.P(" if err != nil {") + g.P(" return ", structName, "{}, err") + g.P(" }") + g.P(" return ", structName, "(prefix), nil") + g.P("}") + + // String method + g.P("func (x ", structName, ") String() string {") + g.P(" return Prefix(x).String()") + g.P("}") + + // MarshalText method + g.P("func (x *", structName, ") MarshalText() ([]byte, error) {") + g.P(" return []byte(x.String()), nil") + g.P("}") + + // UnmarshalText method + g.P("func (x *", structName, ") UnmarshalText(text []byte) error {") + g.P(" prefix, err := Parse", structName, "(string(text))") + g.P(" if err != nil {") + g.P(" return err") + g.P(" }") + g.P(" *x = prefix") + g.P(" return nil") + g.P("}") + g.P() +} + +func generateMacAddressConversion(g *GenFile, structName string) { + // ParseMAC method + g.P("func Parse", structName, "(s string) (", structName, ", error) {") + g.P(" var macaddr ", structName) + g.P(" mac, err := ", netPkg.Ident("ParseMAC"), "(s)") + g.P(" if err != nil {") + g.P(" return macaddr, err") + g.P(" }") + g.P(" copy(macaddr[:], mac[:])") + g.P(" return macaddr, nil") + g.P("}") + + // ToMAC method + g.P("func (x ", structName, ") ToMAC() ", netPkg.Ident("HardwareAddr"), " {") + g.P(" return ", netPkg.Ident("HardwareAddr"), "(x[:])") + g.P("}") + + // String method + g.P("func (x ", structName, ") String() string {") + g.P(" return x.ToMAC().String()") + g.P("}") + + // MarshalText method + g.P("func (x *", structName, ") MarshalText() ([]byte, error) {") + g.P(" return []byte(x.String()), nil") + g.P("}") + + // UnmarshalText method + g.P("func (x *", structName, ") UnmarshalText(text []byte) error {") + g.P(" mac, err := Parse", structName, "(string(text))") + g.P(" if err != nil {") + g.P(" return err") + g.P(" }") + g.P(" *x = mac") + g.P(" return nil") + g.P("}") + g.P() +} diff --git a/binapigen/gen_helpers_test.go b/binapigen/gen_helpers_test.go new file mode 100644 index 0000000..371fd6c --- /dev/null +++ b/binapigen/gen_helpers_test.go @@ -0,0 +1,156 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package binapigen + +import ( + "strings" + "testing" + + . "github.com/onsi/gomega" + + "git.fd.io/govpp.git/binapi/ethernet_types" + "git.fd.io/govpp.git/binapi/ip_types" +) + +func TestGeneratedParseAddress(t *testing.T) { + RegisterTestingT(t) + + var data = []struct { + input string + result ip_types.Address + }{ + {"192.168.0.1", ip_types.Address{ + Af: ip_types.ADDRESS_IP4, + Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 0, 1}), + }}, + {"aac1:0:ab45::", ip_types.Address{ + Af: ip_types.ADDRESS_IP6, + Un: ip_types.AddressUnionIP6(ip_types.IP6Address{170, 193, 0, 0, 171, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), + }}, + } + + for _, entry := range data { + t.Run(entry.input, func(t *testing.T) { + parsedAddress, err := ip_types.ParseAddress(entry.input) + Expect(err).ShouldNot(HaveOccurred()) + Expect(parsedAddress).To(Equal(entry.result)) + + originAddress := parsedAddress.String() + Expect(originAddress).To(Equal(entry.input)) + }) + } +} + +func TestGeneratedParseAddressError(t *testing.T) { + RegisterTestingT(t) + + _, err := ip_types.ParseAddress("malformed_ip") + Expect(err).Should(HaveOccurred()) +} + +func TestGeneratedParsePrefix(t *testing.T) { + RegisterTestingT(t) + + var data = []struct { + input string + result ip_types.Prefix + }{ + {"192.168.0.1/24", ip_types.Prefix{ + Address: ip_types.Address{ + Af: ip_types.ADDRESS_IP4, + Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 0, 1}), + }, + Len: 24, + }}, + {"192.168.0.1", ip_types.Prefix{ + Address: ip_types.Address{ + Af: ip_types.ADDRESS_IP4, + Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 0, 1}), + }, + Len: 32, + }}, + {"aac1:0:ab45::/96", ip_types.Prefix{ + Address: ip_types.Address{ + Af: ip_types.ADDRESS_IP6, + Un: ip_types.AddressUnionIP6(ip_types.IP6Address{170, 193, 0, 0, 171, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), + }, + Len: 96, + }}, + {"aac1:0:ab45::", ip_types.Prefix{ + Address: ip_types.Address{ + Af: ip_types.ADDRESS_IP6, + Un: ip_types.AddressUnionIP6(ip_types.IP6Address{170, 193, 0, 0, 171, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), + }, + Len: 128, + }}, + } + + for _, entry := range data { + t.Run(entry.input, func(t *testing.T) { + parsedAddress, err := ip_types.ParsePrefix(entry.input) + Expect(err).ShouldNot(HaveOccurred()) + Expect(parsedAddress).To(Equal(entry.result)) + + // Parsed IP without prefix receives a default one + // so the input data must be adjusted + if entry.result.Address.Af == ip_types.ADDRESS_IP4 && !strings.Contains(entry.input, "/") { + entry.input = entry.input + "/32" + } + if entry.result.Address.Af == ip_types.ADDRESS_IP6 && !strings.Contains(entry.input, "/") { + entry.input = entry.input + "/128" + } + originAddress := parsedAddress.String() + Expect(originAddress).To(Equal(entry.input)) + }) + } +} + +func TestGeneratedParsePrefixError(t *testing.T) { + RegisterTestingT(t) + + _, err := ip_types.ParsePrefix("malformed_ip") + Expect(err).Should(HaveOccurred()) +} + +func TestGeneratedParseMAC(t *testing.T) { + RegisterTestingT(t) + + var data = []struct { + input string + result ethernet_types.MacAddress + }{ + {"b7:b9:bb:a1:5c:af", ethernet_types.MacAddress{183, 185, 187, 161, 92, 175}}, + {"47:4b:c7:3e:06:c8", ethernet_types.MacAddress{71, 75, 199, 62, 6, 200}}, + {"a7:cc:9f:10:18:e3", ethernet_types.MacAddress{167, 204, 159, 16, 24, 227}}, + } + + for _, entry := range data { + t.Run(entry.input, func(t *testing.T) { + parsedMac, err := ethernet_types.ParseMacAddress(entry.input) + Expect(err).ShouldNot(HaveOccurred()) + Expect(parsedMac).To(Equal(entry.result)) + + originAddress := parsedMac.String() + Expect(originAddress).To(Equal(entry.input)) + }) + } +} + +func TestGeneratedParseMACError(t *testing.T) { + RegisterTestingT(t) + + _, err := ethernet_types.ParseMacAddress("malformed_mac") + Expect(err).Should(HaveOccurred()) +} diff --git a/binapigen/gen_rest.go b/binapigen/gen_rest.go new file mode 100644 index 0000000..6ddb57a --- /dev/null +++ b/binapigen/gen_rest.go @@ -0,0 +1,103 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package binapigen + +import ( + "path" + "strconv" +) + +func init() { + RegisterPlugin("rest", GenerateREST) +} + +// library dependencies +const ( + httpPkg = GoImportPath("net/http") + ioutilPkg = GoImportPath("io/ioutil") + jsonPkg = GoImportPath("encoding/json") +) + +func GenerateREST(gen *Generator, file *File) *GenFile { + if file.Service == nil { + return nil + } + + logf("----------------------------") + logf(" Generate REST - %s", file.Desc.Name) + logf("----------------------------") + + filename := path.Join(file.FilenamePrefix, file.Desc.Name+"_rest.ba.go") + g := gen.NewGenFile(filename, file.GoImportPath) + g.file = file + + // generate file header + g.P("// Code generated by GoVPP's binapi-generator. DO NOT EDIT.") + g.P() + g.P("package ", file.PackageName) + g.P() + + // generate RPC service + if len(file.Service.RPCs) > 0 { + genRESTHandler(g, file.Service) + } + + return g +} + +func genRESTHandler(g *GenFile, svc *Service) { + // generate handler constructor + g.P("func RESTHandler(rpc ", serviceApiName, ") ", httpPkg.Ident("Handler"), " {") + g.P(" mux := ", httpPkg.Ident("NewServeMux"), "()") + + // generate http handlers for rpc + for _, rpc := range svc.RPCs { + if rpc.MsgReply == nil { + continue + } + if rpc.VPP.Stream { + continue // TODO: implement handler for streaming messages + } + g.P("mux.HandleFunc(", strconv.Quote("/"+rpc.VPP.Request), ", func(w ", httpPkg.Ident("ResponseWriter"), ", req *", httpPkg.Ident("Request"), ") {") + g.P("var request = new(", rpc.MsgRequest.GoName, ")") + if len(rpc.MsgRequest.Fields) > 0 { + g.P("b, err := ", ioutilPkg.Ident("ReadAll"), "(req.Body)") + g.P("if err != nil {") + g.P(" ", httpPkg.Ident("Error"), "(w, \"read body failed\", ", httpPkg.Ident("StatusBadRequest"), ")") + g.P(" return") + g.P("}") + g.P("if err := ", jsonPkg.Ident("Unmarshal"), "(b, request); err != nil {") + g.P(" ", httpPkg.Ident("Error"), "(w, \"unmarshal data failed\", ", httpPkg.Ident("StatusBadRequest"), ")") + g.P(" return") + g.P("}") + } + g.P("reply, err := rpc.", rpc.GoName, "(req.Context(), request)") + g.P("if err != nil {") + g.P(" ", httpPkg.Ident("Error"), "(w, \"request failed: \"+err.Error(), ", httpPkg.Ident("StatusInternalServerError"), ")") + g.P(" return") + g.P("}") + g.P("rep, err := ", jsonPkg.Ident("MarshalIndent"), "(reply, \"\", \" \")") + g.P("if err != nil {") + g.P(" ", httpPkg.Ident("Error"), "(w, \"marshal failed: \"+err.Error(), ", httpPkg.Ident("StatusInternalServerError"), ")") + g.P(" return") + g.P("}") + g.P("w.Write(rep)") + g.P("})") + } + + g.P("return ", httpPkg.Ident("HandlerFunc"), "(mux.ServeHTTP)") + g.P("}") + g.P() +} diff --git a/binapigen/gen_rpc.go b/binapigen/gen_rpc.go new file mode 100644 index 0000000..ba23f4a --- /dev/null +++ b/binapigen/gen_rpc.go @@ -0,0 +1,204 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package binapigen + +import ( + "fmt" + "path" + + "github.com/sirupsen/logrus" +) + +func init() { + RegisterPlugin("rpc", GenerateRPC) +} + +// library dependencies +const ( + contextPkg = GoImportPath("context") + ioPkg = GoImportPath("io") +) + +// generated names +const ( + serviceApiName = "RPCService" // name for the RPC service interface + serviceImplName = "serviceClient" // name for the RPC service implementation + serviceClientName = "ServiceClient" // name for the RPC service client + + // TODO: register service descriptor + //serviceDescType = "ServiceDesc" // name for service descriptor type + //serviceDescName = "_ServiceRPC_serviceDesc" // name for service descriptor var +) + +func GenerateRPC(gen *Generator, file *File) *GenFile { + if file.Service == nil { + return nil + } + + logf("----------------------------") + logf(" Generate RPC - %s", file.Desc.Name) + logf("----------------------------") + + filename := path.Join(file.FilenamePrefix, file.Desc.Name+"_rpc.ba.go") + g := gen.NewGenFile(filename, file.GoImportPath) + g.file = file + + // generate file header + g.P("// Code generated by GoVPP's binapi-generator. DO NOT EDIT.") + g.P() + g.P("package ", file.PackageName) + g.P() + + // generate RPC service + if len(file.Service.RPCs) > 0 { + genService(g, file.Service) + } + + return g +} + +func genService(g *GenFile, svc *Service) { + // generate comment + g.P("// ", serviceApiName, " defines RPC service ", g.file.Desc.Name, ".") + + // generate service interface + g.P("type ", serviceApiName, " interface {") + for _, rpc := range svc.RPCs { + g.P(rpcMethodSignature(g, rpc)) + } + g.P("}") + g.P() + + // generate client implementation + g.P("type ", serviceImplName, " struct {") + g.P("conn ", govppApiPkg.Ident("Connection")) + g.P("}") + g.P() + + // generate client constructor + g.P("func New", serviceClientName, "(conn ", govppApiPkg.Ident("Connection"), ") ", serviceApiName, " {") + g.P("return &", serviceImplName, "{conn}") + g.P("}") + g.P() + + msgControlPingReply, ok := g.gen.messagesByName["control_ping_reply"] + if !ok { + logrus.Fatalf("no message for %v", "control_ping_reply") + } + msgControlPing, ok := g.gen.messagesByName["control_ping"] + if !ok { + logrus.Fatalf("no message for %v", "control_ping") + } + + for _, rpc := range svc.RPCs { + logf(" gen RPC: %v (%s)", rpc.GoName, rpc.VPP.Request) + + g.P("func (c *", serviceImplName, ") ", rpcMethodSignature(g, rpc), " {") + if rpc.VPP.Stream { + streamImpl := fmt.Sprintf("%s_%sClient", serviceImplName, rpc.GoName) + streamApi := fmt.Sprintf("%s_%sClient", serviceApiName, rpc.GoName) + + msgDetails := rpc.MsgReply + var msgReply *Message + if rpc.MsgStream != nil { + msgDetails = rpc.MsgStream + msgReply = rpc.MsgReply + } else { + msgDetails = rpc.MsgReply + msgReply = msgControlPingReply + } + + g.P("stream, err := c.conn.NewStream(ctx)") + g.P("if err != nil { return nil, err }") + g.P("x := &", streamImpl, "{stream}") + g.P("if err := x.Stream.SendMsg(in); err != nil {") + g.P(" return nil, err") + g.P("}") + if rpc.MsgStream == nil { + g.P("if err = x.Stream.SendMsg(&", msgControlPing.GoIdent, "{}); err != nil {") + g.P(" return nil, err") + g.P("}") + } + g.P("return x, nil") + g.P("}") + g.P() + g.P("type ", streamApi, " interface {") + g.P(" Recv() (*", msgDetails.GoIdent, ", error)") + g.P(" ", govppApiPkg.Ident("Stream")) + g.P("}") + g.P() + + g.P("type ", streamImpl, " struct {") + g.P(" ", govppApiPkg.Ident("Stream")) + g.P("}") + g.P() + + g.P("func (c *", streamImpl, ") Recv() (*", msgDetails.GoIdent, ", error) {") + g.P(" msg, err := c.Stream.RecvMsg()") + g.P(" if err != nil { return nil, err }") + g.P(" switch m := msg.(type) {") + g.P(" case *", msgDetails.GoIdent, ":") + g.P(" return m, nil") + g.P(" case *", msgReply.GoIdent, ":") + g.P(" return nil, ", ioPkg.Ident("EOF")) + g.P(" default:") + g.P(" return nil, ", fmtPkg.Ident("Errorf"), "(\"unexpected message: %T %v\", m, m)") + g.P("}") + } else if rpc.MsgReply != nil { + g.P("out := new(", rpc.MsgReply.GoIdent, ")") + g.P("err := c.conn.Invoke(ctx, in, out)") + g.P("if err != nil { return nil, err }") + g.P("return out, nil") + } else { + g.P("stream, err := c.conn.NewStream(ctx)") + g.P("if err != nil { return err }") + g.P("err = stream.SendMsg(in)") + g.P("if err != nil { return err }") + g.P("return nil") + } + g.P("}") + g.P() + } + + // TODO: generate service descriptor + /*fmt.Fprintf(w, "var %s = api.%s{\n", serviceDescName, serviceDescType) + fmt.Fprintf(w, "\tServiceName: \"%s\",\n", ctx.moduleName) + fmt.Fprintf(w, "\tHandlerType: (*%s)(nil),\n", serviceApiName) + fmt.Fprintf(w, "\tMethods: []api.MethodDesc{\n") + for _, method := range rpcs { + fmt.Fprintf(w, "\t {\n") + fmt.Fprintf(w, "\t MethodName: \"%s\",\n", method.Name) + fmt.Fprintf(w, "\t },\n") + } + fmt.Fprintf(w, "\t},\n") + //fmt.Fprintf(w, "\tCompatibility: %s,\n", messageCrcName) + //fmt.Fprintf(w, "\tMetadata: reflect.TypeOf((*%s)(nil)).Elem().PkgPath(),\n", serviceApiName) + fmt.Fprintf(w, "\tMetadata: \"%s\",\n", ctx.inputFile) + fmt.Fprintln(w, "}")*/ + + g.P() +} + +func rpcMethodSignature(g *GenFile, rpc *RPC) string { + s := rpc.GoName + "(ctx " + g.GoIdent(contextPkg.Ident("Context")) + s += ", in *" + g.GoIdent(rpc.MsgRequest.GoIdent) + ") (" + if rpc.VPP.Stream { + s += serviceApiName + "_" + rpc.GoName + "Client, " + } else if rpc.MsgReply != nil { + s += "*" + g.GoIdent(rpc.MsgReply.GoIdent) + ", " + } + s += "error)" + return s +} diff --git a/binapigen/generate.go b/binapigen/generate.go index d35427f..689463e 100644 --- a/binapigen/generate.go +++ b/binapigen/generate.go @@ -16,1338 +16,468 @@ package binapigen import ( "fmt" - "io" + "path" "sort" + "strconv" "strings" - "git.fd.io/govpp.git/version" - "github.com/sirupsen/logrus" + "git.fd.io/govpp.git/internal/version" ) -// generatedCodeVersion indicates a version of the generated code. -// It is incremented whenever an incompatibility between the generated code and -// GoVPP api package is introduced; the generated code references -// a constant, api.GoVppAPIPackageIsVersionN (where N is generatedCodeVersion). -const generatedCodeVersion = 2 - -// common message fields +// library dependencies const ( - msgIdField = "_vl_msg_id" - clientIndexField = "client_index" - contextField = "context" - retvalField = "retval" -) + strconvPkg = GoImportPath("strconv") -// global API info -const ( - constModuleName = "ModuleName" // module name constant - constAPIVersion = "APIVersion" // API version constant - constVersionCrc = "VersionCrc" // version CRC constant + govppApiPkg = GoImportPath("git.fd.io/govpp.git/api") + govppCodecPkg = GoImportPath("git.fd.io/govpp.git/codec") ) -// generated fiels +// generated names const ( - unionDataField = "XXX_UnionData" // name for the union data field -) - -// MessageType represents the type of a VPP message -type MessageType int + apiName = "APIFile" // API file name + apiVersion = "APIVersion" // API version number + apiCrc = "VersionCrc" // version checksum -const ( - requestMessage MessageType = iota // VPP request message - replyMessage // VPP reply message - eventMessage // VPP event message - otherMessage // other VPP message + fieldUnionData = "XXX_UnionData" // name for the union data field ) -func generateFileBinapi(ctx *GenFile, w io.Writer) { +func GenerateAPI(gen *Generator, file *File) *GenFile { logf("----------------------------") - logf("generating BINAPI file package: %q", ctx.file.PackageName) + logf(" Generate API - %s", file.Desc.Name) logf("----------------------------") - // generate file header - fmt.Fprintln(w, "// Code generated by GoVPP's binapi-generator. DO NOT EDIT.") - fmt.Fprintln(w, "// versions:") - fmt.Fprintf(w, "// binapi-generator: %s\n", version.Version()) - if ctx.IncludeVppVersion { - fmt.Fprintf(w, "// VPP: %s\n", ctx.VPPVersion) + filename := path.Join(file.FilenamePrefix, file.Desc.Name+".ba.go") + g := gen.NewGenFile(filename, file.GoImportPath) + g.file = file + + g.P("// Code generated by GoVPP's binapi-generator. DO NOT EDIT.") + if !gen.opts.NoVersionInfo { + g.P("// versions:") + g.P("// binapi-generator: ", version.Version()) + g.P("// VPP: ", g.gen.vppVersion) + g.P("// source: ", g.file.Desc.Path) } - fmt.Fprintf(w, "// source: %s\n", ctx.file.Path) - fmt.Fprintln(w) + g.P() - generatePackageHeader(ctx, w) - generateImports(ctx, w) + genPackageComment(g) + g.P("package ", file.PackageName) + g.P() - generateApiInfo(ctx, w) - generateTypes(ctx, w) - generateMessages(ctx, w) + for _, imp := range g.file.Imports { + genImport(g, imp) + } - generateImportRefs(ctx, w) -} + // generate version assertion + g.P("// This is a compile-time assertion to ensure that this generated file") + g.P("// is compatible with the GoVPP api package it is being compiled against.") + g.P("// A compilation error at this line likely means your copy of the") + g.P("// GoVPP api package needs to be updated.") + g.P("const _ = ", govppApiPkg.Ident("GoVppAPIPackageIsVersion"), generatedCodeVersion) + g.P() -func generatePackageHeader(ctx *GenFile, w io.Writer) { - fmt.Fprintln(w, "/*") - fmt.Fprintf(w, "Package %s contains generated code for VPP API file %s.api (%s).\n", - ctx.file.PackageName, ctx.file.Name, ctx.file.Version()) - fmt.Fprintln(w) - fmt.Fprintln(w, "It consists of:") - printObjNum := func(obj string, num int) { - if num > 0 { - if num > 1 { - if strings.HasSuffix(obj, "s") { - obj += "es" - } else { - obj += "s" - } - } - fmt.Fprintf(w, "\t%3d %s\n", num, obj) - } + if !file.isTypesFile() { + g.P("const (") + g.P(apiName, " = ", strconv.Quote(g.file.Desc.Name)) + g.P(apiVersion, " = ", strconv.Quote(g.file.Version)) + g.P(apiCrc, " = ", g.file.Desc.CRC) + g.P(")") + g.P() } - printObjNum("alias", len(ctx.file.Aliases)) - printObjNum("enum", len(ctx.file.Enums)) - printObjNum("message", len(ctx.file.Messages)) - printObjNum("type", len(ctx.file.Structs)) - printObjNum("union", len(ctx.file.Unions)) - fmt.Fprintln(w, "*/") - fmt.Fprintf(w, "package %s\n", ctx.file.PackageName) - fmt.Fprintln(w) -} -func generateImports(ctx *GenFile, w io.Writer) { - fmt.Fprintln(w, "import (") - fmt.Fprintln(w, ` "bytes"`) - fmt.Fprintln(w, ` "context"`) - fmt.Fprintln(w, ` "encoding/binary"`) - fmt.Fprintln(w, ` "fmt"`) - fmt.Fprintln(w, ` "io"`) - fmt.Fprintln(w, ` "math"`) - fmt.Fprintln(w, ` "net"`) - fmt.Fprintln(w, ` "strconv"`) - fmt.Fprintln(w, ` "strings"`) - fmt.Fprintln(w) - fmt.Fprintf(w, "\tapi \"%s\"\n", "git.fd.io/govpp.git/api") - fmt.Fprintf(w, "\tcodec \"%s\"\n", "git.fd.io/govpp.git/codec") - fmt.Fprintf(w, "\tstruc \"%s\"\n", "github.com/lunixbochs/struc") - imports := listImports(ctx) - if len(imports) > 0 { - fmt.Fprintln(w) - for imp, importPath := range imports { - fmt.Fprintf(w, "\t%s \"%s\"\n", imp, importPath) - } + for _, enum := range g.file.Enums { + genEnum(g, enum) } - fmt.Fprintln(w, ")") - fmt.Fprintln(w) - - fmt.Fprintln(w, "// This is a compile-time assertion to ensure that this generated file") - fmt.Fprintln(w, "// is compatible with the GoVPP api package it is being compiled against.") - fmt.Fprintln(w, "// A compilation error at this line likely means your copy of the") - fmt.Fprintln(w, "// GoVPP api package needs to be updated.") - fmt.Fprintf(w, "const _ = api.GoVppAPIPackageIsVersion%d // please upgrade the GoVPP api package\n", generatedCodeVersion) - fmt.Fprintln(w) -} - -func generateApiInfo(ctx *GenFile, w io.Writer) { - // generate module desc - fmt.Fprintln(w, "const (") - fmt.Fprintf(w, "\t// %s is the name of this module.\n", constModuleName) - fmt.Fprintf(w, "\t%s = \"%s\"\n", constModuleName, ctx.file.Name) - - if ctx.IncludeAPIVersion { - fmt.Fprintf(w, "\t// %s is the API version of this module.\n", constAPIVersion) - fmt.Fprintf(w, "\t%s = \"%s\"\n", constAPIVersion, ctx.file.Version()) - fmt.Fprintf(w, "\t// %s is the CRC of this module.\n", constVersionCrc) - fmt.Fprintf(w, "\t%s = %v\n", constVersionCrc, ctx.file.CRC) + for _, alias := range g.file.Aliases { + genAlias(g, alias) } - fmt.Fprintln(w, ")") - fmt.Fprintln(w) -} - -func generateTypes(ctx *GenFile, w io.Writer) { - // generate enums - if len(ctx.file.Enums) > 0 { - for _, enum := range ctx.file.Enums { - if imp, ok := ctx.file.imports[enum.Name]; ok { - if strings.HasSuffix(ctx.file.Name, "_types") { - generateImportedAlias(ctx, w, enum.GoName, imp) - } - continue - } - generateEnum(ctx, w, enum) - } + for _, typ := range g.file.Structs { + genStruct(g, typ) } - - // generate aliases - if len(ctx.file.Aliases) > 0 { - for _, alias := range ctx.file.Aliases { - if imp, ok := ctx.file.imports[alias.Name]; ok { - if strings.HasSuffix(ctx.file.Name, "_types") { - generateImportedAlias(ctx, w, alias.GoName, imp) - } - continue - } - generateAlias(ctx, w, alias) - } + for _, union := range g.file.Unions { + genUnion(g, union) } + genMessages(g) - // generate types - if len(ctx.file.Structs) > 0 { - for _, typ := range ctx.file.Structs { - if imp, ok := ctx.file.imports[typ.Name]; ok { - if strings.HasSuffix(ctx.file.Name, "_types") { - generateImportedAlias(ctx, w, typ.GoName, imp) - } - continue - } - generateStruct(ctx, w, typ) - } - } + return g +} - // generate unions - if len(ctx.file.Unions) > 0 { - for _, union := range ctx.file.Unions { - if imp, ok := ctx.file.imports[union.Name]; ok { - if strings.HasSuffix(ctx.file.Name, "_types") { - generateImportedAlias(ctx, w, union.GoName, imp) +func genPackageComment(g *GenFile) { + apifile := g.file.Desc.Name + ".api" + g.P("// Package ", g.file.PackageName, " contains generated bindings for API file ", apifile, ".") + g.P("//") + g.P("// Contents:") + printObjNum := func(obj string, num int) { + if num > 0 { + if num > 1 { + if strings.HasSuffix(obj, "s") { + obj += "es" + } else { + obj += "s" } - continue } - generateUnion(ctx, w, union) + g.P("// ", fmt.Sprintf("%3d", num), " ", obj) } } + printObjNum("alias", len(g.file.Aliases)) + printObjNum("enum", len(g.file.Enums)) + printObjNum("struct", len(g.file.Structs)) + printObjNum("union", len(g.file.Unions)) + printObjNum("message", len(g.file.Messages)) + g.P("//") } -func generateMessages(ctx *GenFile, w io.Writer) { - if len(ctx.file.Messages) == 0 { +func genImport(g *GenFile, imp string) { + impFile, ok := g.gen.FilesByName[imp] + if !ok { return } - - for _, msg := range ctx.file.Messages { - generateMessage(ctx, w, msg) - } - - // generate message registrations - initFnName := fmt.Sprintf("file_%s_binapi_init", ctx.file.PackageName) - - fmt.Fprintf(w, "func init() { %s() }\n", initFnName) - fmt.Fprintf(w, "func %s() {\n", initFnName) - for _, msg := range ctx.file.Messages { - fmt.Fprintf(w, "\tapi.RegisterMessage((*%s)(nil), \"%s\")\n", - msg.GoName, ctx.file.Name+"."+msg.GoName) - } - fmt.Fprintln(w, "}") - fmt.Fprintln(w) - - // generate list of messages - fmt.Fprintf(w, "// Messages returns list of all messages in this module.\n") - fmt.Fprintln(w, "func AllMessages() []api.Message {") - fmt.Fprintln(w, "\treturn []api.Message{") - for _, msg := range ctx.file.Messages { - fmt.Fprintf(w, "\t(*%s)(nil),\n", msg.GoName) + if impFile.GoImportPath == g.file.GoImportPath { + // Skip generating imports for types in the same package + return } - fmt.Fprintln(w, "}") - fmt.Fprintln(w, "}") + // Generate imports for all dependencies, even if not used + g.Import(impFile.GoImportPath) } -func generateImportRefs(ctx *GenFile, w io.Writer) { - fmt.Fprintf(w, "// Reference imports to suppress errors if they are not otherwise used.\n") - fmt.Fprintf(w, "var _ = api.RegisterMessage\n") - fmt.Fprintf(w, "var _ = codec.DecodeString\n") - fmt.Fprintf(w, "var _ = bytes.NewBuffer\n") - fmt.Fprintf(w, "var _ = context.Background\n") - fmt.Fprintf(w, "var _ = io.Copy\n") - fmt.Fprintf(w, "var _ = strconv.Itoa\n") - fmt.Fprintf(w, "var _ = strings.Contains\n") - fmt.Fprintf(w, "var _ = struc.Pack\n") - fmt.Fprintf(w, "var _ = binary.BigEndian\n") - fmt.Fprintf(w, "var _ = math.Float32bits\n") - fmt.Fprintf(w, "var _ = net.ParseIP\n") - fmt.Fprintf(w, "var _ = fmt.Errorf\n") +func genTypeComment(g *GenFile, goName string, vppName string, objKind string) { + g.P("// ", goName, " defines ", objKind, " '", vppName, "'.") } -func generateComment(ctx *GenFile, w io.Writer, goName string, vppName string, objKind string) { - if objKind == "service" { - fmt.Fprintf(w, "// %s represents RPC service API for %s module.\n", goName, ctx.file.Name) - } else { - fmt.Fprintf(w, "// %s represents VPP binary API %s '%s'.\n", goName, objKind, vppName) - } -} +func genEnum(g *GenFile, enum *Enum) { + logf("gen ENUM %s (%s) - %d entries", enum.GoName, enum.Name, len(enum.Entries)) -func generateEnum(ctx *GenFile, w io.Writer, enum *Enum) { - name := enum.GoName - typ := binapiTypes[enum.Type] + genTypeComment(g, enum.GoName, enum.Name, "enum") - logf(" writing ENUM %q (%s) with %d entries", enum.Name, name, len(enum.Entries)) + gotype := BaseTypesGo[enum.Type] - // generate enum comment - generateComment(ctx, w, name, enum.Name, "enum") - - // generate enum definition - fmt.Fprintf(w, "type %s %s\n", name, typ) - fmt.Fprintln(w) + g.P("type ", enum.GoName, " ", gotype) + g.P() // generate enum entries - fmt.Fprintln(w, "const (") + g.P("const (") for _, entry := range enum.Entries { - fmt.Fprintf(w, "\t%s %s = %v\n", entry.Name, name, entry.Value) + g.P(entry.Name, " ", enum.GoName, " = ", entry.Value) } - fmt.Fprintln(w, ")") - fmt.Fprintln(w) + g.P(")") + g.P() // generate enum conversion maps - fmt.Fprintln(w, "var (") - fmt.Fprintf(w, "%s_name = map[%s]string{\n", name, typ) + g.P("var (") + g.P(enum.GoName, "_name = map[", gotype, "]string{") for _, entry := range enum.Entries { - fmt.Fprintf(w, "\t%v: \"%s\",\n", entry.Value, entry.Name) + g.P(entry.Value, ": ", strconv.Quote(entry.Name), ",") } - fmt.Fprintln(w, "}") - fmt.Fprintf(w, "%s_value = map[string]%s{\n", name, typ) + g.P("}") + g.P(enum.GoName, "_value = map[string]", gotype, "{") for _, entry := range enum.Entries { - fmt.Fprintf(w, "\t\"%s\": %v,\n", entry.Name, entry.Value) + g.P(strconv.Quote(entry.Name), ": ", entry.Value, ",") + } + g.P("}") + g.P(")") + g.P() + + if isEnumFlag(enum) { + size := BaseTypeSizes[enum.Type] * 8 + g.P("func (x ", enum.GoName, ") String() string {") + g.P(" s, ok := ", enum.GoName, "_name[", gotype, "(x)]") + g.P(" if ok { return s }") + g.P(" str := func(n ", gotype, ") string {") + g.P(" s, ok := ", enum.GoName, "_name[", gotype, "(n)]") + g.P(" if ok {") + g.P(" return s") + g.P(" }") + g.P(" return \"", enum.GoName, "(\" + ", strconvPkg.Ident("Itoa"), "(int(n)) + \")\"") + g.P(" }") + g.P(" for i := ", gotype, "(0); i <= ", size, "; i++ {") + g.P(" val := ", gotype, "(x)") + g.P(" if val&(1< 0 { - fmt.Fprintf(w, "[%d]", alias.Length) + gotype = fmt.Sprintf("[%d]%s", alias.Length, gotype) } - dataType := convertToGoType(ctx.file, alias.Type) - fmt.Fprintf(w, "%s\n", dataType) + g.P("type ", alias.GoName, " ", gotype) + g.P() // generate alias-specific methods switch alias.Name { + case "ip4_address": + generateIPConversion(g, alias.GoName, 4) + case "ip6_address": + generateIPConversion(g, alias.GoName, 16) + case "address_with_prefix": + generateAddressWithPrefixConversion(g, alias.GoName) case "mac_address": - fmt.Fprintln(w) - generateMacAddressConversion(w, name) + generateMacAddressConversion(g, alias.GoName) } - - fmt.Fprintln(w) } -func generateStruct(ctx *GenFile, w io.Writer, typ *Struct) { - name := typ.GoName - - logf(" writing STRUCT %q (%s) with %d fields", typ.Name, name, len(typ.Fields)) +func genStruct(g *GenFile, typ *Struct) { + logf("gen STRUCT %s (%s) - %d fields", typ.GoName, typ.Name, len(typ.Fields)) - // generate struct comment - generateComment(ctx, w, name, typ.Name, "type") + genTypeComment(g, typ.GoName, typ.Name, "type") - // generate struct definition - fmt.Fprintf(w, "type %s struct {\n", name) - - // generate struct fields - for i := range typ.Fields { - // skip internal fields - switch strings.ToLower(typ.Name) { - case msgIdField: - continue + if len(typ.Fields) == 0 { + g.P("type ", typ.GoName, " struct {}") + } else { + g.P("type ", typ.GoName, " struct {") + for i := range typ.Fields { + generateField(g, typ.Fields, i) } - - generateField(ctx, w, typ.Fields, i) + g.P("}") } - - // generate end of the struct - fmt.Fprintln(w, "}") - - // generate name getter - generateTypeNameGetter(w, name, typ.Name) + g.P() // generate type-specific methods switch typ.Name { case "address": - fmt.Fprintln(w) - generateIPAddressConversion(w, name) + generateAddressConversion(g, typ.GoName) case "prefix": - fmt.Fprintln(w) - generatePrefixConversion(w, name) + generatePrefixConversion(g, typ.GoName) + case "ip4_prefix": + generateIPPrefixConversion(g, typ.GoName, 4) + case "ip6_prefix": + generateIPPrefixConversion(g, typ.GoName, 6) } - - fmt.Fprintln(w) } -// generateUnionMethods generates methods that implement struc.Custom -// interface to allow having XXX_uniondata field unexported -// TODO: do more testing when unions are actually used in some messages -/*func generateUnionMethods(w io.Writer, structName string) { - // generate struc.Custom implementation for union - fmt.Fprintf(w, ` -func (u *%[1]s) Pack(p []byte, opt *struc.Options) (int, error) { - var b = new(bytes.Buffer) - if err := struc.PackWithOptions(b, u.union_data, opt); err != nil { - return 0, err - } - copy(p, b.Bytes()) - return b.Len(), nil -} -func (u *%[1]s) Unpack(r io.Reader, length int, opt *struc.Options) error { - return struc.UnpackWithOptions(r, u.union_data[:], opt) -} -func (u *%[1]s) Size(opt *struc.Options) int { - return len(u.union_data) -} -func (u *%[1]s) String() string { - return string(u.union_data[:]) -} -`, structName) -}*/ - -/*func generateUnionGetterSetterNew(w io.Writer, structName string, getterField, getterStruct string) { - fmt.Fprintf(w, ` -func %[1]s%[2]s(a %[3]s) (u %[1]s) { - u.Set%[2]s(a) - return -} -func (u *%[1]s) Set%[2]s(a %[3]s) { - copy(u.%[4]s[:], a[:]) -} -func (u *%[1]s) Get%[2]s() (a %[3]s) { - copy(a[:], u.%[4]s[:]) - return -} -`, structName, getterField, getterStruct, unionDataField) -}*/ - -func generateUnion(ctx *GenFile, w io.Writer, union *Union) { - name := union.GoName +func genUnion(g *GenFile, union *Union) { + logf("gen UNION %s (%s) - %d fields", union.GoName, union.Name, len(union.Fields)) - logf(" writing UNION %q (%s) with %d fields", union.Name, name, len(union.Fields)) + genTypeComment(g, union.GoName, union.Name, "union") - // generate struct comment - generateComment(ctx, w, name, union.Name, "union") + g.P("type ", union.GoName, " struct {") - // generate struct definition - fmt.Fprintln(w, "type", name, "struct {") - - // maximum size for union - maxSize := getUnionSize(ctx.file, union) + for _, field := range union.Fields { + g.P("// ", field.GoName, " *", getFieldType(g, field)) + } // generate data field - fmt.Fprintf(w, "\t%s [%d]byte\n", unionDataField, maxSize) + maxSize := getUnionSize(union) + g.P(fieldUnionData, " [", maxSize, "]byte") // generate end of the struct - fmt.Fprintln(w, "}") + g.P("}") + g.P() - // generate name getter - generateTypeNameGetter(w, name, union.Name) - - // generate getters for fields + // generate methods for fields for _, field := range union.Fields { - fieldType := convertToGoType(ctx.file, field.Type) - generateUnionGetterSetter(w, name, field.GoName, fieldType) + genUnionFieldMethods(g, union.GoName, field) } - - // generate union methods - //generateUnionMethods(w, name) - - fmt.Fprintln(w) -} - -func generateUnionGetterSetter(w io.Writer, structName string, getterField, getterStruct string) { - fmt.Fprintf(w, ` -func %[1]s%[2]s(a %[3]s) (u %[1]s) { - u.Set%[2]s(a) - return + g.P() } -func (u *%[1]s) Set%[2]s(a %[3]s) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.%[4]s[:], b.Bytes()) -} -func (u *%[1]s) Get%[2]s() (a %[3]s) { - var b = bytes.NewReader(u.%[4]s[:]) - struc.Unpack(b, &a) - return -} -`, structName, getterField, getterStruct, unionDataField) -} - -func generateMessage(ctx *GenFile, w io.Writer, msg *Message) { - name := msg.GoName - logf(" writing MESSAGE %q (%s) with %d fields", msg.Name, name, len(msg.Fields)) +func genUnionFieldMethods(g *GenFile, structName string, field *Field) { + getterStruct := fieldGoType(g, field) - // generate struct comment - generateComment(ctx, w, name, msg.Name, "message") + // Constructor + g.P("func ", structName, field.GoName, "(a ", getterStruct, ") (u ", structName, ") {") + g.P(" u.Set", field.GoName, "(a)") + g.P(" return") + g.P("}") - // generate struct definition - fmt.Fprintf(w, "type %s struct {", name) + // Setter + g.P("func (u *", structName, ") Set", field.GoName, "(a ", getterStruct, ") {") + g.P(" var buf = ", govppCodecPkg.Ident("NewBuffer"), "(u.", fieldUnionData, "[:])") + encodeField(g, field, "a", func(name string) string { + return "a." + name + }, 0) + g.P("}") - msgType := otherMessage - wasClientIndex := false - - // generate struct fields - n := 0 - for i, field := range msg.Fields { - if i == 1 { - if field.Name == clientIndexField { - // "client_index" as the second member, - // this might be an event message or a request - msgType = eventMessage - wasClientIndex = true - } else if field.Name == contextField { - // reply needs "context" as the second member - msgType = replyMessage - } - } else if i == 2 { - if wasClientIndex && field.Name == contextField { - // request needs "client_index" as the second member - // and "context" as the third member - msgType = requestMessage - } - } - - // skip internal fields - switch strings.ToLower(field.Name) { - case msgIdField: - continue - case clientIndexField, contextField: - if n == 0 { - continue - } - } - n++ - if n == 1 { - fmt.Fprintln(w) - } - - generateField(ctx, w, msg.Fields, i) - } - - // generate end of the struct - fmt.Fprintln(w, "}") - - // generate message methods - generateMessageResetMethod(w, name) - generateMessageNameGetter(w, name, msg.Name) - generateCrcGetter(w, name, msg.CRC) - generateMessageTypeGetter(w, name, msgType) - generateMessageSize(ctx, w, name, msg.Fields) - generateMessageMarshal(ctx, w, name, msg.Fields) - generateMessageUnmarshal(ctx, w, name, msg.Fields) - - fmt.Fprintln(w) + // Getter + g.P("func (u *", structName, ") Get", field.GoName, "() (a ", getterStruct, ") {") + g.P(" var buf = ", govppCodecPkg.Ident("NewBuffer"), "(u.", fieldUnionData, "[:])") + decodeField(g, field, "a", func(name string) string { + return "a." + name + }, 0) + g.P(" return") + g.P("}") + g.P() } -func generateMessageSize(ctx *GenFile, w io.Writer, name string, fields []*Field) { - fmt.Fprintf(w, "func (m *%[1]s) Size() int {\n", name) - - fmt.Fprintf(w, "\tif m == nil { return 0 }\n") - fmt.Fprintf(w, "\tvar size int\n") - - encodeBaseType := func(typ, name string, length int, sizefrom string) bool { - t, ok := BaseTypeNames[typ] - if !ok { - return false - } +func generateField(g *GenFile, fields []*Field, i int) { + field := fields[i] - var s = BaseTypeSizes[t] - switch t { - case STRING: - if length > 0 { - s = length - fmt.Fprintf(w, "\tsize += %d\n", s) - } else { - s = 4 - fmt.Fprintf(w, "\tsize += %d + len(%s)\n", s, name) - } - default: - if sizefrom != "" { - //fmt.Fprintf(w, "\tsize += %d * int(%s)\n", s, sizefrom) - fmt.Fprintf(w, "\tsize += %d * len(%s)\n", s, name) - } else { - if length > 0 { - s = BaseTypeSizes[t] * length - } - fmt.Fprintf(w, "\tsize += %d\n", s) - } - } + logf(" gen FIELD[%d] %s (%s) - type: %q (array: %v/%v)", i, field.GoName, field.Name, field.Type, field.Array, field.Length) - return true + gotype := getFieldType(g, field) + tags := structTags{ + "binapi": fieldTagJSON(field), + "json": fieldTagBinapi(field), } - lvl := 0 - var sizeFields func(fields []*Field, parentName string) - sizeFields = func(fields []*Field, parentName string) { - lvl++ - defer func() { lvl-- }() - - n := 0 - for _, field := range fields { - if field.ParentMessage != nil { - // skip internal fields - switch strings.ToLower(field.Name) { - case msgIdField: - continue - case clientIndexField, contextField: - if n == 0 { - continue - } - } - } - n++ - - fieldName := field.GoName //camelCaseName(strings.TrimPrefix(field.Name, "_")) - name := fmt.Sprintf("%s.%s", parentName, fieldName) - sizeFrom := camelCaseName(strings.TrimPrefix(field.SizeFrom, "_")) - var sizeFromName string - if sizeFrom != "" { - sizeFromName = fmt.Sprintf("%s.%s", parentName, sizeFrom) - } - - fmt.Fprintf(w, "\t// field[%d] %s\n", lvl, name) - - if encodeBaseType(field.Type, name, field.Length, sizeFromName) { - continue - } - - char := fmt.Sprintf("s%d", lvl) - index := fmt.Sprintf("j%d", lvl) - - if field.Array { - if field.Length > 0 { - fmt.Fprintf(w, "\tfor %[2]s := 0; %[2]s < %[1]d; %[2]s ++ {\n", field.Length, index) - } else if field.SizeFrom != "" { - //fmt.Fprintf(w, "\tfor %[1]s := 0; %[1]s < int(%[2]s.%[3]s); %[1]s++ {\n", index, parentName, sizeFrom) - fmt.Fprintf(w, "\tfor %[1]s := 0; %[1]s < len(%[2]s); %[1]s++ {\n", index, name) - } - - fmt.Fprintf(w, "\tvar %[1]s %[2]s\n_ = %[1]s\n", char, convertToGoType(ctx.file, field.Type)) - fmt.Fprintf(w, "\tif %[1]s < len(%[2]s) { %[3]s = %[2]s[%[1]s] }\n", index, name, char) - name = char - } - - if enum := getEnumByRef(ctx.file, field.Type); enum != nil { - if encodeBaseType(enum.Type, name, 0, "") { - } else { - fmt.Fprintf(w, "\t// ??? ENUM %s %s\n", name, enum.Type) - } - } else if alias := getAliasByRef(ctx.file, field.Type); alias != nil { - if encodeBaseType(alias.Type, name, alias.Length, "") { - } else if typ := getTypeByRef(ctx.file, alias.Type); typ != nil { - sizeFields(typ.Fields, name) - } else { - fmt.Fprintf(w, "\t// ??? ALIAS %s %s\n", name, alias.Type) - } - } else if typ := getTypeByRef(ctx.file, field.Type); typ != nil { - sizeFields(typ.Fields, name) - } else if union := getUnionByRef(ctx.file, field.Type); union != nil { - maxSize := getUnionSize(ctx.file, union) - fmt.Fprintf(w, "\tsize += %d\n", maxSize) - } else { - fmt.Fprintf(w, "\t// ??? buf[pos] = (%s)\n", name) - } + g.P(field.GoName, " ", gotype, tags) +} - if field.Array { - fmt.Fprintf(w, "\t}\n") - } - } +func fieldTagBinapi(field *Field) string { + if field.FieldSizeOf != nil { + return "-" } - - sizeFields(fields, "m") - - fmt.Fprintf(w, "return size\n") - - fmt.Fprintf(w, "}\n") + return fmt.Sprintf("%s,omitempty", field.Name) } -func generateMessageMarshal(ctx *GenFile, w io.Writer, name string, fields []*Field) { - fmt.Fprintf(w, "func (m *%[1]s) Marshal(b []byte) ([]byte, error) {\n", name) - - fmt.Fprintf(w, "\to := binary.BigEndian\n") - fmt.Fprintf(w, "\t_ = o\n") - fmt.Fprintf(w, "\tpos := 0\n") - fmt.Fprintf(w, "\t_ = pos\n") - - var buf = new(strings.Builder) - - encodeBaseType := func(typ, name string, length int, sizefrom string) bool { - t, ok := BaseTypeNames[typ] - if !ok { - return false - } - - isArray := length > 0 || sizefrom != "" - - switch t { - case I8, U8, I16, U16, I32, U32, I64, U64, F64: - if isArray { - if length != 0 { - fmt.Fprintf(buf, "\tfor i := 0; i < %d; i++ {\n", length) - } else if sizefrom != "" { - //fmt.Fprintf(buf, "\tfor i := 0; i < int(%s); i++ {\n", sizefrom) - fmt.Fprintf(buf, "\tfor i := 0; i < len(%s); i++ {\n", name) - } - } - } - - switch t { - case I8, U8: - if isArray { - fmt.Fprintf(buf, "\tvar x uint8\n") - fmt.Fprintf(buf, "\tif i < len(%s) { x = uint8(%s[i]) }\n", name, name) - name = "x" - } - fmt.Fprintf(buf, "\tbuf[pos] = uint8(%s)\n", name) - fmt.Fprintf(buf, "\tpos += 1\n") - if isArray { - fmt.Fprintf(buf, "\t}\n") - } - case I16, U16: - if isArray { - fmt.Fprintf(buf, "\tvar x uint16\n") - fmt.Fprintf(buf, "\tif i < len(%s) { x = uint16(%s[i]) }\n", name, name) - name = "x" - } - fmt.Fprintf(buf, "\to.PutUint16(buf[pos:pos+2], uint16(%s))\n", name) - fmt.Fprintf(buf, "\tpos += 2\n") - if isArray { - fmt.Fprintf(buf, "\t}\n") - } - case I32, U32: - if isArray { - fmt.Fprintf(buf, "\tvar x uint32\n") - fmt.Fprintf(buf, "\tif i < len(%s) { x = uint32(%s[i]) }\n", name, name) - name = "x" - } - fmt.Fprintf(buf, "\to.PutUint32(buf[pos:pos+4], uint32(%s))\n", name) - fmt.Fprintf(buf, "\tpos += 4\n") - if isArray { - fmt.Fprintf(buf, "\t}\n") - } - case I64, U64: - if isArray { - fmt.Fprintf(buf, "\tvar x uint64\n") - fmt.Fprintf(buf, "\tif i < len(%s) { x = uint64(%s[i]) }\n", name, name) - name = "x" - } - fmt.Fprintf(buf, "\to.PutUint64(buf[pos:pos+8], uint64(%s))\n", name) - fmt.Fprintf(buf, "\tpos += 8\n") - if isArray { - fmt.Fprintf(buf, "\t}\n") - } - case F64: - if isArray { - fmt.Fprintf(buf, "\tvar x float64\n") - fmt.Fprintf(buf, "\tif i < len(%s) { x = float64(%s[i]) }\n", name, name) - name = "x" - } - fmt.Fprintf(buf, "\to.PutUint64(buf[pos:pos+8], math.Float64bits(float64(%s)))\n", name) - fmt.Fprintf(buf, "\tpos += 8\n") - if isArray { - fmt.Fprintf(buf, "\t}\n") - } - case BOOL: - fmt.Fprintf(buf, "\tif %s { buf[pos] = 1 }\n", name) - fmt.Fprintf(buf, "\tpos += 1\n") - case STRING: - if length != 0 { - fmt.Fprintf(buf, "\tcopy(buf[pos:pos+%d], %s)\n", length, name) - fmt.Fprintf(buf, "\tpos += %d\n", length) - } else { - fmt.Fprintf(buf, "\to.PutUint32(buf[pos:pos+4], uint32(len(%s)))\n", name) - fmt.Fprintf(buf, "\tpos += 4\n") - fmt.Fprintf(buf, "\tcopy(buf[pos:pos+len(%s)], %s[:])\n", name, name) - fmt.Fprintf(buf, "\tpos += len(%s)\n", name) - } - default: - fmt.Fprintf(buf, "\t// ??? %s %s\n", name, typ) - return false +func fieldTagJSON(field *Field) string { + typ := fromApiType(field.Type) + if field.Array { + if field.Length > 0 { + typ = fmt.Sprintf("%s[%d]", typ, field.Length) + } else if field.SizeFrom != "" { + typ = fmt.Sprintf("%s[%s]", typ, field.SizeFrom) + } else { + typ = fmt.Sprintf("%s[]", typ) } - return true } - - lvl := 0 - var encodeFields func(fields []*Field, parentName string) - encodeFields = func(fields []*Field, parentName string) { - lvl++ - defer func() { lvl-- }() - - n := 0 - for _, field := range fields { - if field.ParentMessage != nil { - // skip internal fields - switch strings.ToLower(field.Name) { - case msgIdField: - continue - case clientIndexField, contextField: - if n == 0 { - continue - } - } - } - n++ - - getFieldName := func(name string) string { - fieldName := camelCaseName(strings.TrimPrefix(name, "_")) - return fmt.Sprintf("%s.%s", parentName, fieldName) - } - - fieldName := camelCaseName(strings.TrimPrefix(field.Name, "_")) - name := fmt.Sprintf("%s.%s", parentName, fieldName) - sizeFrom := camelCaseName(strings.TrimPrefix(field.SizeFrom, "_")) - var sizeFromName string - if sizeFrom != "" { - sizeFromName = fmt.Sprintf("%s.%s", parentName, sizeFrom) - } - - fmt.Fprintf(buf, "\t// field[%d] %s\n", lvl, name) - - getSizeOfField := func() *Field { - for _, f := range fields { - if f.SizeFrom == field.Name { - return f - } - } - return nil - } - if f := getSizeOfField(); f != nil { - if encodeBaseType(field.Type, fmt.Sprintf("len(%s)", getFieldName(f.Name)), field.Length, "") { - continue - } - panic(fmt.Sprintf("failed to encode base type of sizefrom field: %s", field.Name)) - } - - if encodeBaseType(field.Type, name, field.Length, sizeFromName) { - continue - } - - char := fmt.Sprintf("v%d", lvl) - index := fmt.Sprintf("j%d", lvl) - - if field.Array { - if field.Length > 0 { - fmt.Fprintf(buf, "\tfor %[2]s := 0; %[2]s < %[1]d; %[2]s ++ {\n", field.Length, index) - } else if field.SizeFrom != "" { - //fmt.Fprintf(buf, "\tfor %[1]s := 0; %[1]s < int(%[2]s.%[3]s); %[1]s++ {\n", index, parentName, sizeFrom) - fmt.Fprintf(buf, "\tfor %[1]s := 0; %[1]s < len(%[2]s); %[1]s++ {\n", index, name) - } - - fmt.Fprintf(buf, "\tvar %s %s\n", char, convertToGoType(ctx.file, field.Type)) - fmt.Fprintf(buf, "\tif %[1]s < len(%[2]s) { %[3]s = %[2]s[%[1]s] }\n", index, name, char) - name = char - } - - if enum := getEnumByRef(ctx.file, field.Type); enum != nil { - if encodeBaseType(enum.Type, name, 0, "") { - } else { - fmt.Fprintf(buf, "\t// ??? ENUM %s %s\n", name, enum.Type) - } - } else if alias := getAliasByRef(ctx.file, field.Type); alias != nil { - if encodeBaseType(alias.Type, name, alias.Length, "") { - } else if typ := getTypeByRef(ctx.file, alias.Type); typ != nil { - encodeFields(typ.Fields, name) - } else { - fmt.Fprintf(buf, "\t// ??? ALIAS %s %s\n", name, alias.Type) - } - } else if typ := getTypeByRef(ctx.file, field.Type); typ != nil { - encodeFields(typ.Fields, name) - } else if union := getUnionByRef(ctx.file, field.Type); union != nil { - maxSize := getUnionSize(ctx.file, union) - fmt.Fprintf(buf, "\tcopy(buf[pos:pos+%d], %s.%s[:])\n", maxSize, name, unionDataField) - fmt.Fprintf(buf, "\tpos += %d\n", maxSize) - } else { - fmt.Fprintf(buf, "\t// ??? buf[pos] = (%s)\n", name) - } - - if field.Array { - fmt.Fprintf(buf, "\t}\n") - } - } + tag := []string{ + typ, + fmt.Sprintf("name=%s", field.Name), } - - encodeFields(fields, "m") - - fmt.Fprintf(w, "\tvar buf []byte\n") - fmt.Fprintf(w, "\tif b == nil {\n") - fmt.Fprintf(w, "\tbuf = make([]byte, m.Size())\n") - fmt.Fprintf(w, "\t} else {\n") - fmt.Fprintf(w, "\tbuf = b\n") - fmt.Fprintf(w, "\t}\n") - fmt.Fprint(w, buf.String()) - - fmt.Fprintf(w, "return buf, nil\n") - - fmt.Fprintf(w, "}\n") -} - -func generateMessageUnmarshal(ctx *GenFile, w io.Writer, name string, fields []*Field) { - fmt.Fprintf(w, "func (m *%[1]s) Unmarshal(tmp []byte) error {\n", name) - - fmt.Fprintf(w, "\to := binary.BigEndian\n") - fmt.Fprintf(w, "\t_ = o\n") - fmt.Fprintf(w, "\tpos := 0\n") - fmt.Fprintf(w, "\t_ = pos\n") - - decodeBaseType := func(typ, orig, name string, length int, sizefrom string, alloc bool) bool { - t, ok := BaseTypeNames[typ] - if !ok { - return false - } - - isArray := length > 0 || sizefrom != "" - - switch t { - case I8, U8, I16, U16, I32, U32, I64, U64, F64: - if isArray { - if alloc { - if length != 0 { - fmt.Fprintf(w, "\t%s = make([]%s, %d)\n", name, orig, length) - } else if sizefrom != "" { - fmt.Fprintf(w, "\t%s = make([]%s, %s)\n", name, orig, sizefrom) - } - } - fmt.Fprintf(w, "\tfor i := 0; i < len(%s); i++ {\n", name) - } - } - - switch t { - case I8, U8: - if isArray { - fmt.Fprintf(w, "\t%s[i] = %s(tmp[pos])\n", name, convertToGoType(ctx.file, typ)) - } else { - fmt.Fprintf(w, "\t%s = %s(tmp[pos])\n", name, orig) - } - fmt.Fprintf(w, "\tpos += 1\n") - if isArray { - fmt.Fprintf(w, "\t}\n") - } - case I16, U16: - if isArray { - fmt.Fprintf(w, "\t%s[i] = %s(o.Uint16(tmp[pos:pos+2]))\n", name, orig) - } else { - fmt.Fprintf(w, "\t%s = %s(o.Uint16(tmp[pos:pos+2]))\n", name, orig) - } - fmt.Fprintf(w, "\tpos += 2\n") - if isArray { - fmt.Fprintf(w, "\t}\n") - } - case I32, U32: - if isArray { - fmt.Fprintf(w, "\t%s[i] = %s(o.Uint32(tmp[pos:pos+4]))\n", name, orig) - } else { - fmt.Fprintf(w, "\t%s = %s(o.Uint32(tmp[pos:pos+4]))\n", name, orig) - } - fmt.Fprintf(w, "\tpos += 4\n") - if isArray { - fmt.Fprintf(w, "\t}\n") - } - case I64, U64: - if isArray { - fmt.Fprintf(w, "\t%s[i] = %s(o.Uint64(tmp[pos:pos+8]))\n", name, orig) - } else { - fmt.Fprintf(w, "\t%s = %s(o.Uint64(tmp[pos:pos+8]))\n", name, orig) - } - fmt.Fprintf(w, "\tpos += 8\n") - if isArray { - fmt.Fprintf(w, "\t}\n") - } - case F64: - if isArray { - fmt.Fprintf(w, "\t%s[i] = %s(math.Float64frombits(o.Uint64(tmp[pos:pos+8])))\n", name, orig) - } else { - fmt.Fprintf(w, "\t%s = %s(math.Float64frombits(o.Uint64(tmp[pos:pos+8])))\n", name, orig) - } - fmt.Fprintf(w, "\tpos += 8\n") - if isArray { - fmt.Fprintf(w, "\t}\n") - } - case BOOL: - fmt.Fprintf(w, "\t%s = tmp[pos] != 0\n", name) - fmt.Fprintf(w, "\tpos += 1\n") - case STRING: - if length != 0 { - fmt.Fprintf(w, "\t{\n") - fmt.Fprintf(w, "\tnul := bytes.Index(tmp[pos:pos+%d], []byte{0x00})\n", length) - fmt.Fprintf(w, "\t%[1]s = codec.DecodeString(tmp[pos:pos+nul])\n", name) - fmt.Fprintf(w, "\tpos += %d\n", length) - fmt.Fprintf(w, "\t}\n") - } else { - fmt.Fprintf(w, "\t{\n") - fmt.Fprintf(w, "\tsiz := o.Uint32(tmp[pos:pos+4])\n") - fmt.Fprintf(w, "\tpos += 4\n") - fmt.Fprintf(w, "\t%[1]s = codec.DecodeString(tmp[pos:pos+int(siz)])\n", name) - fmt.Fprintf(w, "\tpos += len(%s)\n", name) - fmt.Fprintf(w, "\t}\n") - } - default: - fmt.Fprintf(w, "\t// ??? %s %s\n", name, typ) - return false - } - return true + if limit, ok := field.Meta["limit"]; ok && limit.(int) > 0 { + tag = append(tag, fmt.Sprintf("limit=%s", limit)) } - - lvl := 0 - var decodeFields func(fields []*Field, parentName string) - decodeFields = func(fields []*Field, parentName string) { - lvl++ - defer func() { lvl-- }() - - n := 0 - for _, field := range fields { - if field.ParentMessage != nil { - // skip internal fields - switch strings.ToLower(field.Name) { - case msgIdField: - continue - case clientIndexField, contextField: - if n == 0 { - continue - } - } - } - n++ - - fieldName := camelCaseName(strings.TrimPrefix(field.Name, "_")) - name := fmt.Sprintf("%s.%s", parentName, fieldName) - sizeFrom := camelCaseName(strings.TrimPrefix(field.SizeFrom, "_")) - var sizeFromName string - if sizeFrom != "" { - sizeFromName = fmt.Sprintf("%s.%s", parentName, sizeFrom) - } - - fmt.Fprintf(w, "\t// field[%d] %s\n", lvl, name) - - if decodeBaseType(field.Type, convertToGoType(ctx.file, field.Type), name, field.Length, sizeFromName, true) { - continue - } - - //char := fmt.Sprintf("v%d", lvl) - index := fmt.Sprintf("j%d", lvl) - - if field.Array { - if field.Length > 0 { - fmt.Fprintf(w, "\tfor %[2]s := 0; %[2]s < %[1]d; %[2]s ++ {\n", field.Length, index) - } else if field.SizeFrom != "" { - fieldType := getFieldType(ctx, field) - if strings.HasPrefix(fieldType, "[]") { - fmt.Fprintf(w, "\t%s = make(%s, int(%s.%s))\n", name, fieldType, parentName, sizeFrom) - } - fmt.Fprintf(w, "\tfor %[1]s := 0; %[1]s < int(%[2]s.%[3]s); %[1]s++ {\n", index, parentName, sizeFrom) - } - - /*fmt.Fprintf(w, "\tvar %s %s\n", char, convertToGoType(ctx, field.Type)) - fmt.Fprintf(w, "\tif %[1]s < len(%[2]s) { %[3]s = %[2]s[%[1]s] }\n", index, name, char) - name = char*/ - name = fmt.Sprintf("%s[%s]", name, index) - } - - if enum := getEnumByRef(ctx.file, field.Type); enum != nil { - if decodeBaseType(enum.Type, convertToGoType(ctx.file, field.Type), name, 0, "", false) { - } else { - fmt.Fprintf(w, "\t// ??? ENUM %s %s\n", name, enum.Type) - } - } else if alias := getAliasByRef(ctx.file, field.Type); alias != nil { - if decodeBaseType(alias.Type, convertToGoType(ctx.file, field.Type), name, alias.Length, "", false) { - } else if typ := getTypeByRef(ctx.file, alias.Type); typ != nil { - decodeFields(typ.Fields, name) - } else { - fmt.Fprintf(w, "\t// ??? ALIAS %s %s\n", name, alias.Type) - } - } else if typ := getTypeByRef(ctx.file, field.Type); typ != nil { - decodeFields(typ.Fields, name) - } else if union := getUnionByRef(ctx.file, field.Type); union != nil { - maxSize := getUnionSize(ctx.file, union) - fmt.Fprintf(w, "\tcopy(%s.%s[:], tmp[pos:pos+%d])\n", name, unionDataField, maxSize) - fmt.Fprintf(w, "\tpos += %d\n", maxSize) - } else { - fmt.Fprintf(w, "\t// ??? buf[pos] = (%s)\n", name) - } - - if field.Array { - fmt.Fprintf(w, "\t}\n") + if def, ok := field.Meta["default"]; ok && def != nil { + actual := fieldActualType(field) + if t, ok := BaseTypesGo[actual]; ok { + switch t { + case I8, I16, I32, I64: + def = int(def.(float64)) + case U8, U16, U32, U64: + def = uint(def.(float64)) + case F64: + def = def.(float64) } } + tag = append(tag, fmt.Sprintf("default=%s", def)) } - - decodeFields(fields, "m") - - fmt.Fprintf(w, "return nil\n") - - fmt.Fprintf(w, "}\n") + return strings.Join(tag, ",") } -func getFieldType(ctx *GenFile, field *Field) string { - //fieldName := strings.TrimPrefix(field.Name, "_") - //fieldName = camelCaseName(fieldName) - //fieldName := field.GoName +type structTags map[string]string - dataType := convertToGoType(ctx.file, field.Type) - fieldType := dataType - - // check if it is array - if field.Length > 0 || field.SizeFrom != "" { - if dataType == "uint8" { - dataType = "byte" - } - if dataType == "string" && field.Array { - fieldType = "string" - dataType = "byte" - } else if _, ok := BaseTypeNames[field.Type]; !ok && field.SizeFrom == "" { - fieldType = fmt.Sprintf("[%d]%s", field.Length, dataType) - } else { - fieldType = "[]" + dataType - } +func (tags structTags) String() string { + if len(tags) == 0 { + return "" } - - return fieldType -} - -func generateField(ctx *GenFile, w io.Writer, fields []*Field, i int) { - field := fields[i] - - //fieldName := strings.TrimPrefix(field.Name, "_") - //fieldName = camelCaseName(fieldName) - fieldName := field.GoName - - dataType := convertToGoType(ctx.file, field.Type) - fieldType := dataType - - // generate length field for strings - if field.Type == "string" && field.Length == 0 { - fmt.Fprintf(w, "\tXXX_%sLen uint32 `struc:\"sizeof=%s\"`\n", fieldName, fieldName) + var keys []string + for k := range tags { + keys = append(keys, k) } - - // check if it is array - if field.Length > 0 || field.SizeFrom != "" { - if dataType == "uint8" { - dataType = "byte" - } - if dataType == "string" && field.Array { - fieldType = "string" - dataType = "byte" - } else if _, ok := BaseTypeNames[field.Type]; !ok && field.SizeFrom == "" { - fieldType = fmt.Sprintf("[%d]%s", field.Length, dataType) - } else { - fieldType = "[]" + dataType - } + sort.Strings(keys) + var ss []string + for _, key := range keys { + tag := tags[key] + ss = append(ss, fmt.Sprintf(`%s:%s`, key, strconv.Quote(tag))) } - fmt.Fprintf(w, "\t%s %s", fieldName, fieldType) - - fieldTags := map[string]string{} + return "`" + strings.Join(ss, " ") + "`" +} - if field.Length > 0 && field.Array { - // fixed size array - fieldTags["struc"] = fmt.Sprintf("[%d]%s", field.Length, dataType) - } else { - for _, f := range fields { - if f.SizeFrom == field.Name { - // variable sized array - //sizeOfName := camelCaseName(f.Name) - fieldTags["struc"] = fmt.Sprintf("sizeof=%s", f.GoName) - } - } +func genMessages(g *GenFile) { + if len(g.file.Messages) == 0 { + return } - if ctx.IncludeBinapiNames { - typ := fromApiType(field.Type) - if field.Array { - if field.Length > 0 { - fieldTags["binapi"] = fmt.Sprintf("%s[%d],name=%s", typ, field.Length, field.Name) - } else if field.SizeFrom != "" { - fieldTags["binapi"] = fmt.Sprintf("%s[%s],name=%s", typ, field.SizeFrom, field.Name) - } - } else { - fieldTags["binapi"] = fmt.Sprintf("%s,name=%s", typ, field.Name) - } - } - if limit, ok := field.Meta["limit"]; ok && limit.(int) > 0 { - fieldTags["binapi"] = fmt.Sprintf("%s,limit=%d", fieldTags["binapi"], limit) - } - if def, ok := field.Meta["default"]; ok && def != nil { - actual := getActualType(ctx.file, fieldType) - if t, ok := binapiTypes[actual]; ok && t != "float64" { - defnum := int(def.(float64)) - fieldTags["binapi"] = fmt.Sprintf("%s,default=%d", fieldTags["binapi"], defnum) - } else { - fieldTags["binapi"] = fmt.Sprintf("%s,default=%v", fieldTags["binapi"], def) - } + for _, msg := range g.file.Messages { + genMessage(g, msg) } - fieldTags["json"] = fmt.Sprintf("%s,omitempty", field.Name) + // generate registrations + initFnName := fmt.Sprintf("file_%s_binapi_init", g.file.PackageName) - if len(fieldTags) > 0 { - fmt.Fprintf(w, "\t`") - var keys []string - for k := range fieldTags { - keys = append(keys, k) - } - sort.Strings(keys) - var n int - for _, tt := range keys { - t, ok := fieldTags[tt] - if !ok { - continue - } - if n > 0 { - fmt.Fprintf(w, " ") - } - n++ - fmt.Fprintf(w, `%s:"%s"`, tt, t) - } - fmt.Fprintf(w, "`") + g.P("func init() { ", initFnName, "() }") + g.P("func ", initFnName, "() {") + for _, msg := range g.file.Messages { + id := fmt.Sprintf("%s_%s", msg.Name, msg.CRC) + g.P(govppApiPkg.Ident("RegisterMessage"), "((*", msg.GoIdent, ")(nil), ", strconv.Quote(id), ")") } + g.P("}") + g.P() - fmt.Fprintln(w) + // generate list of messages + g.P("// Messages returns list of all messages in this module.") + g.P("func AllMessages() []", govppApiPkg.Ident("Message"), " {") + g.P("return []", govppApiPkg.Ident("Message"), "{") + for _, msg := range g.file.Messages { + g.P("(*", msg.GoIdent, ")(nil),") + } + g.P("}") + g.P("}") } -func generateMessageResetMethod(w io.Writer, structName string) { - fmt.Fprintf(w, "func (m *%[1]s) Reset() { *m = %[1]s{} }\n", structName) -} +func genMessage(g *GenFile, msg *Message) { + logf("gen MESSAGE %s (%s) - %d fields", msg.GoName, msg.Name, len(msg.Fields)) -func generateMessageNameGetter(w io.Writer, structName, msgName string) { - fmt.Fprintf(w, "func (*%s) GetMessageName() string { return %q }\n", structName, msgName) -} + genTypeComment(g, msg.GoIdent.GoName, msg.Name, "message") -func generateTypeNameGetter(w io.Writer, structName, msgName string) { - fmt.Fprintf(w, "func (*%s) GetTypeName() string { return %q }\n", structName, msgName) -} - -func generateIPAddressConversion(w io.Writer, structName string) { - f1 := func(ipVer, ipVerExt int) string { - return fmt.Sprintf(`address.Af = ADDRESS_IP%[1]d - var ip%[1]daddr IP%[1]dAddress - copy(ip%[1]daddr[:], netIP.To%[2]d()) - address.Un.SetIP%[1]d(ip%[1]daddr)`, ipVer, ipVerExt) - } - f2 := func(ipVer, ipVerExt int) string { - return fmt.Sprintf("ip%[1]dAddress := a.Un.GetIP%[1]d()\nip = net.IP(ip%[1]dAddress[:]).To%[2]d().String()", - ipVer, ipVerExt) - } - // IP to Address - fmt.Fprintf(w, `func ParseAddress(ip string) (%[1]s, error) { - var address %[1]s - netIP := net.ParseIP(ip) - if netIP == nil { - return address, fmt.Errorf("invalid address: %[2]s", ip) - } - if ip4 := netIP.To4(); ip4 == nil { - %[3]s + // generate message definition + if len(msg.Fields) == 0 { + g.P("type ", msg.GoIdent, " struct {}") } else { - %[4]s - } - return address, nil -} -`, structName, "%s", f1(6, 16), f1(4, 4)) - fmt.Fprintln(w) - - // Address to IP - fmt.Fprintln(w) - fmt.Fprintf(w, `func (a *%[1]s) ToString() string { - var ip string - if a.Af == ADDRESS_IP6 { - %[2]s - } else { - %[3]s + g.P("type ", msg.GoIdent, " struct {") + for i := range msg.Fields { + generateField(g, msg.Fields, i) + } + g.P("}") } - return ip -}`, structName, f2(6, 16), f2(4, 4)) -} + g.P() -func generatePrefixConversion(w io.Writer, structName string) { - fErr := func() string { - return fmt.Sprintf(`if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %s", ip, err) - }`, "%s", "%v") - } + generateMessageMethods(g, msg) - // IP to Prefix - fmt.Fprintf(w, `func ParsePrefix(ip string) (prefix %[1]s, err error) { - hasPrefix := strings.Contains(ip, "/") - if hasPrefix { - netIP, network, err := net.ParseCIDR(ip) - %[2]s - maskSize, _ := network.Mask.Size() - prefix.Len = byte(maskSize) - prefix.Address, err = ParseAddress(netIP.String()) - %[2]s - } else { - netIP := net.ParseIP(ip) - defaultMaskSize, _ := net.CIDRMask(32, 32).Size() - if netIP.To4() == nil { - defaultMaskSize, _ = net.CIDRMask(128, 128).Size() - } - prefix.Len = byte(defaultMaskSize) - prefix.Address, err = ParseAddress(netIP.String()) - %[2]s - } - return prefix, nil -}`, structName, fErr(), nil) - fmt.Fprintln(w) - - // Prefix to IP - fmt.Fprintln(w) - fmt.Fprintf(w, `func (p *%[1]s) ToString() string { - ip := p.Address.ToString() - return ip + "/" + strconv.Itoa(int(p.Len)) - }`, structName) -} + // encoding methods + generateMessageSize(g, msg.GoIdent.GoName, msg.Fields) + generateMessageMarshal(g, msg.GoIdent.GoName, msg.Fields) + generateMessageUnmarshal(g, msg.GoIdent.GoName, msg.Fields) -func generateMacAddressConversion(w io.Writer, structName string) { - // string to MAC - fmt.Fprintf(w, `func ParseMAC(mac string) (parsed %[1]s, err error) { - var hw net.HardwareAddr - if hw, err = net.ParseMAC(mac); err != nil { - return - } - copy(parsed[:], hw[:]) - return -}`, structName) - fmt.Fprintln(w) - - // MAC to string - fmt.Fprintln(w) - fmt.Fprintf(w, `func (m *%[1]s) ToString() string { - return net.HardwareAddr(m[:]).String() - }`, structName) + g.P() } -func generateCrcGetter(w io.Writer, structName, crc string) { - crc = strings.TrimPrefix(crc, "0x") - fmt.Fprintf(w, "func (*%s) GetCrcString() string { return %q }\n", structName, crc) -} +func generateMessageMethods(g *GenFile, msg *Message) { + // Reset method + g.P("func (m *", msg.GoIdent.GoName, ") Reset() { *m = ", msg.GoIdent.GoName, "{} }") -func generateMessageTypeGetter(w io.Writer, structName string, msgType MessageType) { - fmt.Fprintf(w, "func (*"+structName+") GetMessageType() api.MessageType {") - if msgType == requestMessage { - fmt.Fprintf(w, "\treturn api.RequestMessage") - } else if msgType == replyMessage { - fmt.Fprintf(w, "\treturn api.ReplyMessage") - } else if msgType == eventMessage { - fmt.Fprintf(w, "\treturn api.EventMessage") - } else { - fmt.Fprintf(w, "\treturn api.OtherMessage") - } - fmt.Fprintln(w, "}") - fmt.Fprintln(w) -} + // GetMessageName method + g.P("func (*", msg.GoIdent.GoName, ") GetMessageName() string { return ", strconv.Quote(msg.Name), " }") + + // GetCrcString method + g.P("func (*", msg.GoIdent.GoName, ") GetCrcString() string { return ", strconv.Quote(msg.CRC), " }") + + // GetMessageType method + g.P("func (*", msg.GoIdent.GoName, ") GetMessageType() api.MessageType {") + g.P(" return ", apiMsgType(msg.msgType)) + g.P("}") -func logf(f string, v ...interface{}) { - logrus.Debugf(f, v...) + g.P() } diff --git a/binapigen/generate_rpc.go b/binapigen/generate_rpc.go deleted file mode 100644 index 4beec04..0000000 --- a/binapigen/generate_rpc.go +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) 2020 Cisco and/or its affiliates. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package binapigen - -import ( - "fmt" - "io" - "strings" -) - -// generated service names -const ( - serviceApiName = "RPCService" // name for the RPC service interface - serviceImplName = "serviceClient" // name for the RPC service implementation - serviceClientName = "ServiceClient" // name for the RPC service client - - // TODO: register service descriptor - //serviceDescType = "ServiceDesc" // name for service descriptor type - //serviceDescName = "_ServiceRPC_serviceDesc" // name for service descriptor var -) - -func generateFileRPC(ctx *GenFile, w io.Writer) { - logf("----------------------------") - logf("generating RPC file package: %q", ctx.file.PackageName) - logf("----------------------------") - - // generate file header - fmt.Fprintln(w, "// Code generated by GoVPP's binapi-generator. DO NOT EDIT.") - fmt.Fprintln(w) - - // generate package header - fmt.Fprintf(w, "package %s\n", ctx.file.PackageName) - fmt.Fprintln(w) - - // generate imports - fmt.Fprintln(w, "import (") - fmt.Fprintln(w, ` "context"`) - fmt.Fprintln(w, ` "io"`) - fmt.Fprintln(w) - fmt.Fprintf(w, "\tapi \"%s\"\n", "git.fd.io/govpp.git/api") - fmt.Fprintln(w, ")") - fmt.Fprintln(w) - - // generate RPC service - if ctx.file.Service != nil && len(ctx.file.Service.RPCs) > 0 { - generateService(ctx, w, ctx.file.Service) - } - - // generate message registrations - /*fmt.Fprintln(w, "var _RPCService_desc = api.RPCDesc{") - - fmt.Fprintln(w, "}") - fmt.Fprintln(w)*/ - - // generate import refs - fmt.Fprintf(w, "// Reference imports to suppress errors if they are not otherwise used.\n") - fmt.Fprintf(w, "var _ = api.RegisterMessage\n") - fmt.Fprintf(w, "var _ = context.Background\n") - fmt.Fprintf(w, "var _ = io.Copy\n") - -} - -func generateService(ctx *GenFile, w io.Writer, svc *Service) { - // generate services comment - generateComment(ctx, w, serviceApiName, "services", "service") - - // generate service api - fmt.Fprintf(w, "type %s interface {\n", serviceApiName) - for _, rpc := range svc.RPCs { - generateRPCMethod(ctx, w, &rpc) - fmt.Fprintln(w) - } - fmt.Fprintln(w, "}") - fmt.Fprintln(w) - - // generate client implementation - fmt.Fprintf(w, "type %s struct {\n", serviceImplName) - fmt.Fprintf(w, "\tch api.Channel\n") - fmt.Fprintln(w, "}") - fmt.Fprintln(w) - - // generate client constructor - fmt.Fprintf(w, "func New%s(ch api.Channel) %s {\n", serviceClientName, serviceApiName) - fmt.Fprintf(w, "\treturn &%s{ch}\n", serviceImplName) - fmt.Fprintln(w, "}") - fmt.Fprintln(w) - - for _, rpc := range svc.RPCs { - method := camelCaseName(rpc.RequestMsg) - if m := strings.TrimSuffix(method, "Dump"); method != m { - method = "Dump" + m - } - - fmt.Fprintf(w, "func (c *%s) ", serviceImplName) - generateRPCMethod(ctx, w, &rpc) - fmt.Fprintln(w, " {") - if rpc.Stream { - streamImpl := fmt.Sprintf("%s_%sClient", serviceImplName, method) - fmt.Fprintf(w, "\tstream := c.ch.SendMultiRequest(in)\n") - fmt.Fprintf(w, "\tx := &%s{stream}\n", streamImpl) - fmt.Fprintf(w, "\treturn x, nil\n") - } else if replyTyp := camelCaseName(rpc.ReplyMsg); replyTyp != "" { - fmt.Fprintf(w, "\tout := new(%s)\n", replyTyp) - fmt.Fprintf(w, "\terr:= c.ch.SendRequest(in).ReceiveReply(out)\n") - fmt.Fprintf(w, "\tif err != nil { return nil, err }\n") - fmt.Fprintf(w, "\treturn out, nil\n") - } else { - fmt.Fprintf(w, "\tc.ch.SendRequest(in)\n") - fmt.Fprintf(w, "\treturn nil\n") - } - fmt.Fprintln(w, "}") - fmt.Fprintln(w) - - if rpc.Stream { - replyTyp := camelCaseName(rpc.ReplyMsg) - method := camelCaseName(rpc.RequestMsg) - if m := strings.TrimSuffix(method, "Dump"); method != m { - method = "Dump" + m - } - streamApi := fmt.Sprintf("%s_%sClient", serviceApiName, method) - - fmt.Fprintf(w, "type %s interface {\n", streamApi) - fmt.Fprintf(w, "\tRecv() (*%s, error)\n", replyTyp) - fmt.Fprintln(w, "}") - fmt.Fprintln(w) - - streamImpl := fmt.Sprintf("%s_%sClient", serviceImplName, method) - fmt.Fprintf(w, "type %s struct {\n", streamImpl) - fmt.Fprintf(w, "\tapi.MultiRequestCtx\n") - fmt.Fprintln(w, "}") - fmt.Fprintln(w) - - fmt.Fprintf(w, "func (c *%s) Recv() (*%s, error) {\n", streamImpl, replyTyp) - fmt.Fprintf(w, "\tm := new(%s)\n", replyTyp) - fmt.Fprintf(w, "\tstop, err := c.MultiRequestCtx.ReceiveReply(m)\n") - fmt.Fprintf(w, "\tif err != nil { return nil, err }\n") - fmt.Fprintf(w, "\tif stop { return nil, io.EOF }\n") - fmt.Fprintf(w, "\treturn m, nil\n") - fmt.Fprintln(w, "}") - fmt.Fprintln(w) - } - } - - // TODO: generate service descriptor - /*fmt.Fprintf(w, "var %s = api.%s{\n", serviceDescName, serviceDescType) - fmt.Fprintf(w, "\tServiceName: \"%s\",\n", ctx.moduleName) - fmt.Fprintf(w, "\tHandlerType: (*%s)(nil),\n", serviceApiName) - fmt.Fprintf(w, "\tMethods: []api.MethodDesc{\n") - for _, method := range rpcs { - fmt.Fprintf(w, "\t {\n") - fmt.Fprintf(w, "\t MethodName: \"%s\",\n", method.Name) - fmt.Fprintf(w, "\t },\n") - } - fmt.Fprintf(w, "\t},\n") - //fmt.Fprintf(w, "\tCompatibility: %s,\n", messageCrcName) - //fmt.Fprintf(w, "\tMetadata: reflect.TypeOf((*%s)(nil)).Elem().PkgPath(),\n", serviceApiName) - fmt.Fprintf(w, "\tMetadata: \"%s\",\n", ctx.inputFile) - fmt.Fprintln(w, "}")*/ - - fmt.Fprintln(w) -} - -func generateRPCMethod(ctx *GenFile, w io.Writer, rpc *RPC) { - reqTyp := camelCaseName(rpc.RequestMsg) - - logf(" writing RPC: %+v", reqTyp) - - // method name is same as parameter type name by default - method := reqTyp - if rpc.Stream { - // use Dump as prefix instead of suffix for stream services - if m := strings.TrimSuffix(method, "Dump"); method != m { - method = "Dump" + m - } - } - - params := fmt.Sprintf("in *%s", reqTyp) - returns := "error" - - if replyType := camelCaseName(rpc.ReplyMsg); replyType != "" { - var replyTyp string - if rpc.Stream { - replyTyp = fmt.Sprintf("%s_%sClient", serviceApiName, method) - } else { - replyTyp = fmt.Sprintf("*%s", replyType) - } - returns = fmt.Sprintf("(%s, error)", replyTyp) - } - - fmt.Fprintf(w, "\t%s(ctx context.Context, %s) %s", method, params, returns) -} diff --git a/binapigen/generate_test.go b/binapigen/generate_test.go index 46cc5eb..2fa5dc6 100644 --- a/binapigen/generate_test.go +++ b/binapigen/generate_test.go @@ -15,43 +15,35 @@ package binapigen import ( - "git.fd.io/govpp.git/examples/binapi/interfaces" - "git.fd.io/govpp.git/examples/binapi/ip_types" "os" - "strings" "testing" . "github.com/onsi/gomega" + "git.fd.io/govpp.git/binapi/ip_types" "git.fd.io/govpp.git/binapigen/vppapi" ) -const testOutputDir = "test_output_directory" +const testOutputDir = "test_output_dir" -func GenerateFromFile(file, outputDir string, opts Options) error { +func GenerateFromFile(file string, opts Options) error { apifile, err := vppapi.ParseFile(file) if err != nil { return err } - - g, err := New(opts, []*vppapi.File{apifile}) + gen, err := New(opts, []*vppapi.File{apifile}, nil) if err != nil { return err } - for _, file := range g.Files { + for _, file := range gen.Files { if !file.Generate { continue } - GenerateBinapi(g, file, outputDir) - if file.Service != nil { - GenerateRPC(g, file, outputDir) - } + GenerateAPI(gen, file) } - - if err = g.Generate(); err != nil { + if err = gen.Generate(); err != nil { return err } - return nil } @@ -61,7 +53,8 @@ func TestGenerateFromFile(t *testing.T) { // remove directory created during test defer os.RemoveAll(testOutputDir) - err := GenerateFromFile("vppapi/testdata/acl.api.json", testOutputDir, Options{FilesToGenerate: []string{"acl"}}) + opts := Options{OutputDir: testOutputDir} + err := GenerateFromFile("vppapi/testdata/acl.api.json", opts) Expect(err).ShouldNot(HaveOccurred()) fileInfo, err := os.Stat(testOutputDir + "/acl/acl.ba.go") Expect(err).ShouldNot(HaveOccurred()) @@ -72,7 +65,8 @@ func TestGenerateFromFile(t *testing.T) { func TestGenerateFromFileInputError(t *testing.T) { RegisterTestingT(t) - err := GenerateFromFile("vppapi/testdata/nonexisting.json", testOutputDir, Options{}) + opts := Options{OutputDir: testOutputDir} + err := GenerateFromFile("vppapi/testdata/nonexisting.json", opts) Expect(err).Should(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("unsupported")) } @@ -80,7 +74,8 @@ func TestGenerateFromFileInputError(t *testing.T) { func TestGenerateFromFileReadJsonError(t *testing.T) { RegisterTestingT(t) - err := GenerateFromFile("vppapi/testdata/input-read-json-error.json", testOutputDir, Options{}) + opts := Options{OutputDir: testOutputDir} + err := GenerateFromFile("vppapi/testdata/input-read-json-error.json", opts) Expect(err).Should(HaveOccurred()) Expect(err.Error()).To(ContainSubstring("unsupported")) } @@ -96,139 +91,23 @@ func TestGenerateFromFileGeneratePackageError(t *testing.T) { os.RemoveAll(testOutputDir) }() - err := GenerateFromFile("vppapi/testdata/input-generate-error.json", testOutputDir, Options{}) - Expect(err).Should(HaveOccurred()) -} - -func TestGeneratedParseAddress(t *testing.T) { - RegisterTestingT(t) - - var data = []struct { - input string - result ip_types.Address - }{ - {"192.168.0.1", ip_types.Address{ - Af: ip_types.ADDRESS_IP4, - Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 0, 1}), - }}, - {"aac1:0:ab45::", ip_types.Address{ - Af: ip_types.ADDRESS_IP6, - Un: ip_types.AddressUnionIP6(ip_types.IP6Address{170, 193, 0, 0, 171, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), - }}, - } - - for _, entry := range data { - t.Run(entry.input, func(t *testing.T) { - parsedAddress, err := ip_types.ParseAddress(entry.input) - Expect(err).ShouldNot(HaveOccurred()) - Expect(parsedAddress).To(Equal(entry.result)) - - originAddress := parsedAddress.ToString() - Expect(originAddress).To(Equal(entry.input)) - }) - } -} - -func TestGeneratedParseAddressError(t *testing.T) { - RegisterTestingT(t) - - _, err := ip_types.ParseAddress("malformed_ip") + opts := Options{OutputDir: testOutputDir} + err := GenerateFromFile("vppapi/testdata/input-generate-error.json", opts) Expect(err).Should(HaveOccurred()) } -func TestGeneratedParsePrefix(t *testing.T) { +func TestAddress(t *testing.T) { RegisterTestingT(t) - var data = []struct { - input string - result ip_types.Prefix - }{ - {"192.168.0.1/24", ip_types.Prefix{ - Address: ip_types.Address{ - Af: ip_types.ADDRESS_IP4, - Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 0, 1}), - }, - Len: 24, - }}, - {"192.168.0.1", ip_types.Prefix{ - Address: ip_types.Address{ - Af: ip_types.ADDRESS_IP4, - Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 0, 1}), - }, - Len: 32, - }}, - {"aac1:0:ab45::/96", ip_types.Prefix{ - Address: ip_types.Address{ - Af: ip_types.ADDRESS_IP6, - Un: ip_types.AddressUnionIP6(ip_types.IP6Address{170, 193, 0, 0, 171, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), - }, - Len: 96, - }}, - {"aac1:0:ab45::", ip_types.Prefix{ - Address: ip_types.Address{ - Af: ip_types.ADDRESS_IP6, - Un: ip_types.AddressUnionIP6(ip_types.IP6Address{170, 193, 0, 0, 171, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), - }, - Len: 128, - }}, - } + addr := ip_types.AddressUnionIP4(ip_types.IP4Address{10, 20, 0, 1}) + t.Logf("addr: %v (%#v)", addr, addr) - for _, entry := range data { - t.Run(entry.input, func(t *testing.T) { - parsedAddress, err := ip_types.ParsePrefix(entry.input) - Expect(err).ShouldNot(HaveOccurred()) - Expect(parsedAddress).To(Equal(entry.result)) + ip4 := addr.GetIP4() + t.Logf("ip4: %v", ip4) + addr.SetIP4(ip_types.IP4Address{192, 168, 1, 1}) + t.Logf("ip4: %v", addr.GetIP4()) - // Parsed IP without prefix receives a default one - // so the input data must be adjusted - if entry.result.Address.Af == ip_types.ADDRESS_IP4 && !strings.Contains(entry.input, "/") { - entry.input = entry.input + "/32" - } - if entry.result.Address.Af == ip_types.ADDRESS_IP6 && !strings.Contains(entry.input, "/") { - entry.input = entry.input + "/128" - } - originAddress := parsedAddress.ToString() - Expect(originAddress).To(Equal(entry.input)) - }) - } -} - -func TestGeneratedParsePrefixError(t *testing.T) { - RegisterTestingT(t) - - _, err := ip_types.ParsePrefix("malformed_ip") - Expect(err).Should(HaveOccurred()) -} - -func TestGeneratedParseMAC(t *testing.T) { - RegisterTestingT(t) - - var data = []struct { - input string - result interfaces.MacAddress - }{ - {"b7:b9:bb:a1:5c:af", interfaces.MacAddress{183, 185, 187, 161, 92, 175}}, - {"47:4b:c7:3e:06:c8", interfaces.MacAddress{71, 75, 199, 62, 6, 200}}, - {"a7:cc:9f:10:18:e3", interfaces.MacAddress{167, 204, 159, 16, 24, 227}}, - } - - for _, entry := range data { - t.Run(entry.input, func(t *testing.T) { - parsedMac, err := interfaces.ParseMAC(entry.input) - Expect(err).ShouldNot(HaveOccurred()) - Expect(parsedMac).To(Equal(entry.result)) - - originAddress := parsedMac.ToString() - Expect(originAddress).To(Equal(entry.input)) - }) - } -} - -func TestGeneratedParseMACError(t *testing.T) { - RegisterTestingT(t) - - _, err := interfaces.ParseMAC("malformed_mac") - Expect(err).Should(HaveOccurred()) + Expect(addr.GetIP4()).To(Equal(ip_types.IP4Address{192, 168, 1, 1})) } /*func TestGetContext(t *testing.T) { @@ -280,7 +159,7 @@ func TestGetContextInterfaceJson(t *testing.T) { // prepare writer writer := bufio.NewWriter(outFile) Expect(writer.Buffered()).To(BeZero()) - err = generateFileBinapi(testCtx, writer) + err = GenerateFileBinapi(testCtx, writer) Expect(err).ShouldNot(HaveOccurred()) } @@ -306,7 +185,7 @@ func TestGenerateMessageType(t *testing.T) { writer := bufio.NewWriter(outFile) for _, msg := range testCtx.file.Messages { - generateMessage(testCtx, writer, &msg) + genMessage(testCtx, writer, &msg) Expect(writer.Buffered()).ToNot(BeZero()) } }*/ @@ -335,7 +214,7 @@ func TestGenerateMessageType(t *testing.T) { for i := 0; i < types.Len(); i++ { typ := types.At(i) Expect(writer.Buffered()).To(BeZero()) - err := generateMessage(testCtx, writer, typ, false) + err := genMessage(testCtx, writer, typ, false) Expect(err).ShouldNot(HaveOccurred()) Expect(writer.Buffered()).ToNot(BeZero()) @@ -446,7 +325,7 @@ func TestGeneratePackageHeader(t *testing.T) { // prepare writer writer := bufio.NewWriter(outFile) Expect(writer.Buffered()).To(BeZero()) - generatePackageHeader(testCtx, writer, inFile) + genPackageComment(testCtx, writer, inFile) Expect(writer.Buffered()).ToNot(BeZero()) } diff --git a/binapigen/generator.go b/binapigen/generator.go index 07c1b13..e42e7fb 100644 --- a/binapigen/generator.go +++ b/binapigen/generator.go @@ -15,130 +15,122 @@ package binapigen import ( + "bufio" "bytes" "fmt" + "go/ast" "go/format" + "go/parser" + "go/printer" + "go/token" "io/ioutil" "os" "path" "path/filepath" - "regexp" + "sort" + "strconv" + "strings" "github.com/sirupsen/logrus" "git.fd.io/govpp.git/binapigen/vppapi" ) -type Options struct { - VPPVersion string // version of VPP that produced API files - - FilesToGenerate []string // list of API files to generate - - ImportPrefix string // defines import path prefix for importing types - ImportTypes bool // generate packages for import types - IncludeAPIVersion bool // include constant with API version string - IncludeComments bool // include parts of original source in comments - IncludeBinapiNames bool // include binary API names as struct tag - IncludeServices bool // include service interface with client implementation - IncludeVppVersion bool // include info about used VPP version -} - type Generator struct { - Options - Files []*File - FilesByPath map[string]*File FilesByName map[string]*File - enumsByName map[string]*Enum - aliasesByName map[string]*Alias - structsByName map[string]*Struct - unionsByName map[string]*Union + opts Options + apifiles []*vppapi.File + vppVersion string + + filesToGen []string + genfiles []*GenFile - genfiles []*GenFile + enumsByName map[string]*Enum + aliasesByName map[string]*Alias + structsByName map[string]*Struct + unionsByName map[string]*Union + messagesByName map[string]*Message } -func New(opts Options, apifiles []*vppapi.File) (*Generator, error) { - g := &Generator{ - Options: opts, - FilesByPath: make(map[string]*File), - FilesByName: make(map[string]*File), - enumsByName: map[string]*Enum{}, - aliasesByName: map[string]*Alias{}, - structsByName: map[string]*Struct{}, - unionsByName: map[string]*Union{}, +func New(opts Options, apifiles []*vppapi.File, filesToGen []string) (*Generator, error) { + gen := &Generator{ + FilesByName: make(map[string]*File), + opts: opts, + apifiles: apifiles, + filesToGen: filesToGen, + enumsByName: map[string]*Enum{}, + aliasesByName: map[string]*Alias{}, + structsByName: map[string]*Struct{}, + unionsByName: map[string]*Union{}, + messagesByName: map[string]*Message{}, } - logrus.Debugf("adding %d VPP API files to generator", len(apifiles)) + // Normalize API files + SortFilesByImports(gen.apifiles) for _, apifile := range apifiles { - filename := apifile.Path - if filename == "" { - filename = apifile.Name - } - if _, ok := g.FilesByPath[filename]; ok { - return nil, fmt.Errorf("duplicate file name: %q", filename) - } - if _, ok := g.FilesByName[apifile.Name]; ok { + RemoveImportedTypes(gen.apifiles, apifile) + SortFileObjectsByName(apifile) + } + + // prepare package names and import paths + packageNames := make(map[string]GoPackageName) + importPaths := make(map[string]GoImportPath) + for _, apifile := range gen.apifiles { + filename := getFilename(apifile) + packageNames[filename] = cleanPackageName(apifile.Name) + importPaths[filename] = GoImportPath(path.Join(gen.opts.ImportPrefix, baseName(apifile.Name))) + } + + logrus.Debugf("adding %d VPP API files to generator", len(gen.apifiles)) + + for _, apifile := range gen.apifiles { + filename := getFilename(apifile) + + if _, ok := gen.FilesByName[apifile.Name]; ok { return nil, fmt.Errorf("duplicate file: %q", apifile.Name) } - file, err := newFile(g, apifile) + file, err := newFile(gen, apifile, packageNames[filename], importPaths[filename]) if err != nil { - return nil, err + return nil, fmt.Errorf("loading file %s failed: %w", apifile.Name, err) } - g.Files = append(g.Files, file) - g.FilesByPath[filename] = file - g.FilesByName[apifile.Name] = file + gen.Files = append(gen.Files, file) + gen.FilesByName[apifile.Name] = file logrus.Debugf("added file %q (path: %v)", apifile.Name, apifile.Path) - if len(file.Imports) > 0 { - logrus.Debugf(" - %d imports: %v", len(file.Imports), file.Imports) - } } - if len(opts.FilesToGenerate) > 0 { - logrus.Debugf("Checking %d files to generate: %v", len(opts.FilesToGenerate), opts.FilesToGenerate) - for _, genfile := range opts.FilesToGenerate { - file, ok := g.FilesByPath[genfile] + // mark files for generation + if len(gen.filesToGen) > 0 { + logrus.Debugf("Checking %d files to generate: %v", len(gen.filesToGen), gen.filesToGen) + for _, genfile := range gen.filesToGen { + file, ok := gen.FilesByName[genfile] if !ok { - file, ok = g.FilesByName[genfile] - if !ok { - return nil, fmt.Errorf("no API file found for: %v", genfile) - } + return nil, fmt.Errorf("no API file found for: %v", genfile) } file.Generate = true - if opts.ImportTypes { - // generate all imported files - for _, impFile := range file.importedFiles(g) { - impFile.Generate = true - } + // generate all imported files + for _, impFile := range file.importedFiles(gen) { + impFile.Generate = true } } } else { - logrus.Debugf("Files to generate not specified, marking all %d files to generate", len(g.Files)) - for _, file := range g.Files { + logrus.Debugf("Files to generate not specified, marking all %d files for generate", len(gen.Files)) + for _, file := range gen.Files { file.Generate = true } } - logrus.Debugf("Resolving imported types") - for _, file := range g.Files { - if !file.Generate { - // skip resolving for non-generated files - continue - } - var importedFiles []*File - for _, impFile := range file.importedFiles(g) { - if !impFile.Generate { - // exclude imports of non-generated files - continue - } - importedFiles = append(importedFiles, impFile) - } - file.loadTypeImports(g, importedFiles) - } + return gen, nil +} - return g, nil +func getFilename(file *vppapi.File) string { + if file.Path == "" { + return file.Name + } + return file.Path } func (g *Generator) Generate() error { @@ -147,127 +139,238 @@ func (g *Generator) Generate() error { } logrus.Infof("Generating %d files", len(g.genfiles)) + for _, genfile := range g.genfiles { - if err := writeSourceTo(genfile.filename, genfile.Content()); err != nil { - return fmt.Errorf("writing source for RPC package %s failed: %v", genfile.filename, err) + content, err := genfile.Content() + if err != nil { + return err + } + if err := writeSourceTo(genfile.filename, content); err != nil { + return fmt.Errorf("writing source package %s failed: %v", genfile.filename, err) } } return nil } type GenFile struct { - *Generator - filename string - file *File - outputDir string - buf bytes.Buffer + gen *Generator + file *File + filename string + goImportPath GoImportPath + buf bytes.Buffer + manualImports map[GoImportPath]bool + packageNames map[GoImportPath]GoPackageName } -func (g *Generator) NewGenFile(filename string) *GenFile { +func (g *Generator) NewGenFile(filename string, importPath GoImportPath) *GenFile { f := &GenFile{ - Generator: g, - filename: filename, + gen: g, + filename: filename, + goImportPath: importPath, + manualImports: make(map[GoImportPath]bool), + packageNames: make(map[GoImportPath]GoPackageName), } g.genfiles = append(g.genfiles, f) return f } -func (f *GenFile) Content() []byte { - return f.buf.Bytes() +func (g *GenFile) Write(p []byte) (n int, err error) { + return g.buf.Write(p) } -func writeSourceTo(outputFile string, b []byte) error { - // create output directory - packageDir := filepath.Dir(outputFile) - if err := os.MkdirAll(packageDir, 0775); err != nil { - return fmt.Errorf("creating output dir %s failed: %v", packageDir, err) - } +func (g *GenFile) Import(importPath GoImportPath) { + g.manualImports[importPath] = true +} - // format generated source code - gosrc, err := format.Source(b) - if err != nil { - _ = ioutil.WriteFile(outputFile, b, 0666) - return fmt.Errorf("formatting source code failed: %v", err) +func (g *GenFile) GoIdent(ident GoIdent) string { + if ident.GoImportPath == g.goImportPath { + return ident.GoName } - - // write generated code to output file - if err := ioutil.WriteFile(outputFile, gosrc, 0666); err != nil { - return fmt.Errorf("writing to output file %s failed: %v", outputFile, err) + if packageName, ok := g.packageNames[ident.GoImportPath]; ok { + return string(packageName) + "." + ident.GoName } + packageName := cleanPackageName(baseName(string(ident.GoImportPath))) + g.packageNames[ident.GoImportPath] = packageName + return string(packageName) + "." + ident.GoName +} - lines := bytes.Count(gosrc, []byte("\n")) - logf("wrote %d lines (%d bytes) of code to: %q", lines, len(gosrc), outputFile) +func (g *GenFile) P(v ...interface{}) { + for _, x := range v { + switch x := x.(type) { + case GoIdent: + fmt.Fprint(&g.buf, g.GoIdent(x)) + default: + fmt.Fprint(&g.buf, x) + } + } + fmt.Fprintln(&g.buf) +} - return nil +func (g *GenFile) Content() ([]byte, error) { + if !strings.HasSuffix(g.filename, ".go") { + return g.buf.Bytes(), nil + } + return g.injectImports(g.buf.Bytes()) } -func listImports(genfile *GenFile) map[string]string { - var importPath = genfile.ImportPrefix - if importPath == "" { - importPath = resolveImportPath(genfile.outputDir) - logrus.Debugf("resolved import path: %s", importPath) +func (g *GenFile) injectImports(original []byte) ([]byte, error) { + // Parse source code + fset := token.NewFileSet() + file, err := parser.ParseFile(fset, "", original, parser.ParseComments) + if err != nil { + var src bytes.Buffer + s := bufio.NewScanner(bytes.NewReader(original)) + for line := 1; s.Scan(); line++ { + fmt.Fprintf(&src, "%5d\t%s\n", line, s.Bytes()) + } + return nil, fmt.Errorf("%v: unparsable Go source: %v\n%v", g.filename, err, src.String()) + } + type Import struct { + Name string + Path string + } + // Prepare list of all imports + var importPaths []Import + for importPath := range g.packageNames { + importPaths = append(importPaths, Import{ + Name: string(g.packageNames[GoImportPath(importPath)]), + Path: string(importPath), + }) } - imports := map[string]string{} - for _, imp := range genfile.file.imports { - if _, ok := imports[imp]; !ok { - imports[imp] = path.Join(importPath, imp) + for importPath := range g.manualImports { + if _, ok := g.packageNames[importPath]; ok { + continue } + importPaths = append(importPaths, Import{ + Name: "_", + Path: string(importPath), + }) } - return imports -} + // Sort imports by import path + sort.Slice(importPaths, func(i, j int) bool { + return importPaths[i].Path < importPaths[j].Path + }) + // Inject new import block into parsed AST + if len(importPaths) > 0 { + // Find import block position + pos := file.Package + tokFile := fset.File(file.Package) + pkgLine := tokFile.Line(file.Package) + for _, c := range file.Comments { + if tokFile.Line(c.Pos()) > pkgLine { + break + } + pos = c.End() + } + // Prepare the import block + impDecl := &ast.GenDecl{Tok: token.IMPORT, TokPos: pos, Lparen: pos, Rparen: pos} + for _, importPath := range importPaths { + var name *ast.Ident + if importPath.Name == "_" || strings.Contains(importPath.Path, ".") { + name = &ast.Ident{Name: importPath.Name, NamePos: pos} + } + impDecl.Specs = append(impDecl.Specs, &ast.ImportSpec{ + Name: name, + Path: &ast.BasicLit{Kind: token.STRING, Value: strconv.Quote(importPath.Path), ValuePos: pos}, + EndPos: pos, + }) + } -func resolveImportPath(outputDir string) string { - absPath, err := filepath.Abs(outputDir) - if err != nil { - panic(err) + file.Decls = append([]ast.Decl{impDecl}, file.Decls...) } - modRoot := findModuleRoot(absPath) - if modRoot == "" { - logrus.Fatalf("module root not found at: %s", absPath) + // Reformat source code + var out bytes.Buffer + cfg := &printer.Config{ + Mode: printer.TabIndent | printer.UseSpaces, + Tabwidth: 8, } - modPath := findModulePath(path.Join(modRoot, "go.mod")) - if modPath == "" { - logrus.Fatalf("module path not found") + if err = cfg.Fprint(&out, fset, file); err != nil { + return nil, fmt.Errorf("%v: can not reformat Go source: %v", g.filename, err) } - relDir, err := filepath.Rel(modRoot, absPath) - if err != nil { - panic(err) + return out.Bytes(), nil +} + +// GoIdent is a Go identifier, consisting of a name and import path. +// The name is a single identifier and may not be a dot-qualified selector. +type GoIdent struct { + GoName string + GoImportPath GoImportPath +} + +func (id GoIdent) String() string { + return fmt.Sprintf("%q.%v", id.GoImportPath, id.GoName) +} + +func newGoIdent(f *File, fullName string) GoIdent { + name := strings.TrimPrefix(fullName, string(f.PackageName)+".") + return GoIdent{ + GoName: camelCaseName(name), + GoImportPath: f.GoImportPath, } - return filepath.Join(modPath, relDir) } -func findModuleRoot(dir string) (root string) { - if dir == "" { - panic("dir not set") +// GoImportPath is a Go import path for a package. +type GoImportPath string + +func (p GoImportPath) String() string { + return strconv.Quote(string(p)) +} + +func (p GoImportPath) Ident(s string) GoIdent { + return GoIdent{GoName: s, GoImportPath: p} +} + +type GoPackageName string + +func cleanPackageName(name string) GoPackageName { + return GoPackageName(sanitizedName(name)) +} + +func sanitizedName(name string) string { + switch name { + case "interface": + return "interfaces" + case "map": + return "maps" + default: + return name } - dir = filepath.Clean(dir) +} - // Look for enclosing go.mod. - for { - if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() { - return dir - } - d := filepath.Dir(dir) - if d == dir { - break - } - dir = d +// baseName returns the last path element of the name, with the last dotted suffix removed. +func baseName(name string) string { + // First, find the last element + if i := strings.LastIndex(name, "/"); i >= 0 { + name = name[i+1:] + } + // Now drop the suffix + if i := strings.LastIndex(name, "."); i >= 0 { + name = name[:i] } - return "" + return name } -var ( - modulePathRE = regexp.MustCompile(`module[ \t]+([^ \t\r\n]+)`) -) +func writeSourceTo(outputFile string, b []byte) error { + // create output directory + packageDir := filepath.Dir(outputFile) + if err := os.MkdirAll(packageDir, 0775); err != nil { + return fmt.Errorf("creating output dir %s failed: %v", packageDir, err) + } -func findModulePath(file string) string { - data, err := ioutil.ReadFile(file) + // format generated source code + gosrc, err := format.Source(b) if err != nil { - return "" + _ = ioutil.WriteFile(outputFile, b, 0666) + return fmt.Errorf("formatting source code failed: %v", err) } - m := modulePathRE.FindSubmatch(data) - if m == nil { - return "" + + // write generated code to output file + if err := ioutil.WriteFile(outputFile, gosrc, 0666); err != nil { + return fmt.Errorf("writing to output file %s failed: %v", outputFile, err) } - return string(m[1]) + + lines := bytes.Count(gosrc, []byte("\n")) + logf("wrote %d lines (%d bytes) to: %q", lines, len(gosrc), outputFile) + + return nil } diff --git a/binapigen/generator_test.go b/binapigen/generator_test.go index 9e5b342..aa4ee04 100644 --- a/binapigen/generator_test.go +++ b/binapigen/generator_test.go @@ -18,10 +18,10 @@ import ( "testing" ) -func TestModule(t *testing.T) { - const expected = "git.fd.io/govpp.git/examples/binapi" +func TestGoModule(t *testing.T) { + const expected = "git.fd.io/govpp.git/binapi" - impPath := resolveImportPath("../examples/binapi") + impPath := resolveImportPath("../binapi") if impPath != expected { t.Fatalf("expected: %q, got: %q", expected, impPath) } @@ -42,78 +42,10 @@ func TestBinapiTypeSizes(t *testing.T) { } for _, test := range tests { t.Run(test.name, func(t *testing.T) { - size := getBinapiTypeSize(test.input) + size := getSizeOfBinapiTypeLength(test.input, 1) if size != test.expsize { t.Errorf("expected %d, got %d", test.expsize, size) } }) } } - -/*func TestSizeOfType(t *testing.T) { - tests := []struct { - name string - input StructType - expsize int - }{ - { - name: "basic1", - input: StructType{ - Fields: []Field{ - {Type: "u8"}, - }, - }, - expsize: 1, - }, - { - name: "basic2", - input: Type{ - Fields: []Field{ - {Type: "u8", Length: 4}, - }, - }, - expsize: 4, - }, - { - name: "basic3", - input: Type{ - Fields: []Field{ - {Type: "u8", Length: 16}, - }, - }, - expsize: 16, - }, - { - name: "withEnum", - input: Type{ - Fields: []Field{ - {Type: "u16"}, - {Type: "vl_api_myenum_t"}, - }, - }, - expsize: 6, - }, - { - name: "invalid1", - input: Type{ - Fields: []Field{ - {Type: "x", Length: 16}, - }, - }, - expsize: 0, - }, - } - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - module := &File{ - Enums: []Enum{ - {Name: "myenum", Type: "u32"}, - }, - } - size := getSizeOfType(module, &test.input) - if size != test.expsize { - t.Errorf("expected %d, got %d", test.expsize, size) - } - }) - } -}*/ diff --git a/binapigen/plugin.go b/binapigen/plugin.go new file mode 100644 index 0000000..b57cc68 --- /dev/null +++ b/binapigen/plugin.go @@ -0,0 +1,51 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package binapigen + +import "fmt" + +type Plugin struct { + Name string + GenerateFile func(*Generator, *File) *GenFile +} + +var Plugins = map[string]*Plugin{} +var plugins []*Plugin + +func RegisterPlugin(name string, genfn func(*Generator, *File) *GenFile) { + if name == "" { + panic("plugin name empty") + } + for _, p := range plugins { + if p.Name == name { + panic("duplicate plugin name: " + name) + } + } + plugin := &Plugin{ + Name: name, + GenerateFile: genfn, + } + plugins = append(plugins, plugin) + Plugins[name] = plugin +} + +func RunPlugin(name string, gen *Generator, file *File) error { + p, ok := Plugins[name] + if !ok { + return fmt.Errorf("plugin not found: %q", name) + } + p.GenerateFile(gen, file) + return nil +} diff --git a/binapigen/run.go b/binapigen/run.go index e6086ee..88e32b7 100644 --- a/binapigen/run.go +++ b/binapigen/run.go @@ -16,69 +16,145 @@ package binapigen import ( "fmt" + "io/ioutil" "os" + "path" "path/filepath" + "regexp" + "strings" + + "github.com/sirupsen/logrus" "git.fd.io/govpp.git/binapigen/vppapi" ) -const ( - outputFileExt = ".ba.go" // file extension of the Go generated files - rpcFileSuffix = "_rpc" // file name suffix for the RPC services -) +type Options struct { + OutputDir string // output directory for generated files + ImportPrefix string // prefix for import paths + NoVersionInfo bool // disables generating version info +} -func Run(apiDir string, opts Options, f func(*Generator) error) { - if err := run(apiDir, opts, f); err != nil { +func Run(apiDir string, filesToGenerate []string, opts Options, f func(*Generator) error) { + if err := run(apiDir, filesToGenerate, opts, f); err != nil { fmt.Fprintf(os.Stderr, "%s: %v\n", filepath.Base(os.Args[0]), err) os.Exit(1) } } -func run(apiDir string, opts Options, f func(*Generator) error) error { - // parse API files +func run(apiDir string, filesToGenerate []string, opts Options, fn func(*Generator) error) error { apifiles, err := vppapi.ParseDir(apiDir) if err != nil { return err } - g, err := New(opts, apifiles) + if opts.ImportPrefix == "" { + opts.ImportPrefix = resolveImportPath(opts.OutputDir) + logrus.Debugf("resolved import prefix: %s", opts.ImportPrefix) + } + + gen, err := New(opts, apifiles, filesToGenerate) if err != nil { return err } - if err := f(g); err != nil { - return err + gen.vppVersion = vppapi.ResolveVPPVersion(apiDir) + if gen.vppVersion == "" { + gen.vppVersion = "unknown" } - if err = g.Generate(); err != nil { + if fn == nil { + GenerateDefault(gen) + } else { + if err := fn(gen); err != nil { + return err + } + } + + if err = gen.Generate(); err != nil { return err } return nil } -func GenerateBinapi(gen *Generator, file *File, outputDir string) *GenFile { - packageDir := filepath.Join(outputDir, file.PackageName) - filename := filepath.Join(packageDir, file.PackageName+outputFileExt) +func GenerateDefault(gen *Generator) { + for _, file := range gen.Files { + if !file.Generate { + continue + } + GenerateAPI(gen, file) + GenerateRPC(gen, file) + } +} - g := gen.NewGenFile(filename) - g.file = file - g.outputDir = outputDir +var Logger = logrus.New() - generateFileBinapi(g, &g.buf) +func init() { + if debug := os.Getenv("DEBUG_GOVPP"); strings.Contains(debug, "binapigen") { + Logger.SetLevel(logrus.DebugLevel) + logrus.SetLevel(logrus.DebugLevel) + } else if debug != "" { + Logger.SetLevel(logrus.InfoLevel) + } else { + Logger.SetLevel(logrus.WarnLevel) + } +} - return g +func logf(f string, v ...interface{}) { + Logger.Debugf(f, v...) } -func GenerateRPC(gen *Generator, file *File, outputDir string) *GenFile { - packageDir := filepath.Join(outputDir, file.PackageName) - filename := filepath.Join(packageDir, file.PackageName+rpcFileSuffix+outputFileExt) +func resolveImportPath(dir string) string { + absPath, err := filepath.Abs(dir) + if err != nil { + panic(err) + } + modRoot := findGoModuleRoot(absPath) + if modRoot == "" { + logrus.Fatalf("module root not found at: %s", absPath) + } + modPath := findModulePath(path.Join(modRoot, "go.mod")) + if modPath == "" { + logrus.Fatalf("module path not found") + } + relDir, err := filepath.Rel(modRoot, absPath) + if err != nil { + panic(err) + } + return filepath.Join(modPath, relDir) +} - g := gen.NewGenFile(filename) - g.file = file - g.outputDir = outputDir +func findGoModuleRoot(dir string) (root string) { + if dir == "" { + panic("dir not set") + } + dir = filepath.Clean(dir) + // Look for enclosing go.mod. + for { + if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() { + return dir + } + d := filepath.Dir(dir) + if d == dir { + break + } + dir = d + } + return "" +} - generateFileRPC(g, &g.buf) +var ( + modulePathRE = regexp.MustCompile(`module[ \t]+([^ \t\r\n]+)`) +) - return g +func findModulePath(file string) string { + data, err := ioutil.ReadFile(file) + if err != nil { + return "" + } + m := modulePathRE.FindSubmatch(data) + if m == nil { + return "" + } + return string(m[1]) } diff --git a/binapigen/types.go b/binapigen/types.go index 96ae870..0a21622 100644 --- a/binapigen/types.go +++ b/binapigen/types.go @@ -27,53 +27,33 @@ const ( defineApiSuffix = "_t" ) -// BaseType represents base types in VPP binary API. -type BaseType int +// toApiType returns name that is used as type reference in VPP binary API +func toApiType(name string) string { + return defineApiPrefix + name + defineApiSuffix +} -const ( - U8 BaseType = iota + 1 - I8 - U16 - I16 - U32 - I32 - U64 - I64 - F64 - BOOL - STRING -) +func fromApiType(typ string) string { + name := typ + name = strings.TrimPrefix(name, defineApiPrefix) + name = strings.TrimSuffix(name, defineApiSuffix) + return name +} -var ( - BaseTypes = map[BaseType]string{ - U8: "u8", - I8: "i8", - U16: "u16", - I16: "i16", - U32: "u32", - I32: "i32", - U64: "u64", - I64: "i64", - F64: "f64", - BOOL: "bool", - STRING: "string", - } - BaseTypeNames = map[string]BaseType{ - "u8": U8, - "i8": I8, - "u16": U16, - "i16": I16, - "u32": U32, - "i32": I32, - "u64": U64, - "i64": I64, - "f64": F64, - "bool": BOOL, - "string": STRING, - } +const ( + U8 = "u8" + I8 = "i8" + U16 = "u16" + I16 = "i16" + U32 = "u32" + I32 = "i32" + U64 = "u64" + I64 = "i64" + F64 = "f64" + BOOL = "bool" + STRING = "string" ) -var BaseTypeSizes = map[BaseType]int{ +var BaseTypeSizes = map[string]int{ U8: 1, I8: 1, U16: 2, @@ -87,106 +67,7 @@ var BaseTypeSizes = map[BaseType]int{ STRING: 1, } -type Kind int - -const ( - _ = iota - Uint8Kind - Int8Kind - Uint16Kind - Int16Kind - Uint32Kind - Int32Kind - Uint64Kind - Int64Kind - Float64Kind - BoolKind - StringKind - EnumKind - AliasKind - StructKind - UnionKind - MessageKind -) - -// toApiType returns name that is used as type reference in VPP binary API -func toApiType(name string) string { - return defineApiPrefix + name + defineApiSuffix -} - -func fromApiType(typ string) string { - name := typ - name = strings.TrimPrefix(name, defineApiPrefix) - name = strings.TrimSuffix(name, defineApiSuffix) - return name -} - -func getSizeOfType(module *File, typ *Struct) (size int) { - for _, field := range typ.Fields { - enum := getEnumByRef(module, field.Type) - if enum != nil { - size += getSizeOfBinapiTypeLength(enum.Type, field.Length) - continue - } - size += getSizeOfBinapiTypeLength(field.Type, field.Length) - } - return size -} - -func getEnumByRef(file *File, ref string) *Enum { - for _, typ := range file.Enums { - if ref == toApiType(typ.Name) { - return typ - } - } - return nil -} - -func getTypeByRef(file *File, ref string) *Struct { - for _, typ := range file.Structs { - if ref == toApiType(typ.Name) { - return typ - } - } - return nil -} - -func getAliasByRef(file *File, ref string) *Alias { - for _, alias := range file.Aliases { - if ref == toApiType(alias.Name) { - return alias - } - } - return nil -} - -func getUnionByRef(file *File, ref string) *Union { - for _, union := range file.Unions { - if ref == toApiType(union.Name) { - return union - } - } - return nil -} - -func getBinapiTypeSize(binapiType string) (size int) { - typName := BaseTypeNames[binapiType] - return BaseTypeSizes[typName] -} - -// binapiTypes is a set of types used VPP binary API for translation to Go types -var binapiTypes = map[string]string{ - "u8": "uint8", - "i8": "int8", - "u16": "uint16", - "i16": "int16", - "u32": "uint32", - "i32": "int32", - "u64": "uint64", - "i64": "int64", - "f64": "float64", -} -var BaseTypesGo = map[BaseType]string{ +var BaseTypesGo = map[string]string{ U8: "uint8", I8: "int8", U16: "uint16", @@ -200,82 +81,90 @@ var BaseTypesGo = map[BaseType]string{ STRING: "string", } -func getActualType(file *File, typ string) (actual string) { - for _, enum := range file.Enums { - if enum.GoName == typ { - return enum.Type - } +func fieldActualType(field *Field) (actual string) { + switch { + case field.TypeAlias != nil: + actual = field.TypeAlias.Type + case field.TypeEnum != nil: + actual = field.TypeEnum.Type } - for _, alias := range file.Aliases { - if alias.GoName == typ { - return alias.Type - } + return field.Type +} + +func fieldGoType(g *GenFile, field *Field) string { + switch { + case field.TypeAlias != nil: + return g.GoIdent(field.TypeAlias.GoIdent) + case field.TypeEnum != nil: + return g.GoIdent(field.TypeEnum.GoIdent) + case field.TypeStruct != nil: + return g.GoIdent(field.TypeStruct.GoIdent) + case field.TypeUnion != nil: + return g.GoIdent(field.TypeUnion.GoIdent) + } + t, ok := BaseTypesGo[field.Type] + if !ok { + logrus.Panicf("type %s is not base type", field.Type) } - return typ + return t } -// convertToGoType translates the VPP binary API type into Go type. -// Imported types are with import prefix. -func convertToGoType(file *File, binapiType string) (typ string) { - if t, ok := binapiTypes[binapiType]; ok { - // basic types - typ = t - } else if r, ok := file.refmap[binapiType]; ok { - // specific types (enums/types/unions) - var prefix string - typ = camelCaseName(r) - // look in imports using name and type name eventually - if imp, ok := file.imports[typ]; ok { - prefix = fmt.Sprintf("%s.", imp) - } else if imp, ok := file.imports[fromApiType(binapiType)]; ok { - prefix = fmt.Sprintf("%s.", imp) +func getFieldType(g *GenFile, field *Field) string { + gotype := fieldGoType(g, field) + if field.Array { + switch gotype { + case "uint8": + return "[]byte" + case "string": + return "string" } - typ = fmt.Sprintf("%s%s", prefix, typ) - } else { - switch binapiType { - case "bool", "string": - typ = binapiType - default: - // fallback type - logrus.Warnf("found unknown VPP binary API type %q, using byte", binapiType) - typ = "byte" + if _, ok := BaseTypesGo[field.Type]; !ok && field.Length > 0 { + return fmt.Sprintf("[%d]%s", field.Length, gotype) } + return "[]" + gotype } - return typ + return gotype } func getSizeOfBinapiTypeLength(typ string, length int) (size int) { - if n := getBinapiTypeSize(typ); n > 0 { + if n := BaseTypeSizes[typ]; n > 0 { if length > 0 { return n * length } else { return n } } - return } -func getUnionSize(file *File, union *Union) (maxSize int) { +func getSizeOfType(typ *Struct) (size int) { + for _, field := range typ.Fields { + if enum := field.TypeEnum; enum != nil { + size += getSizeOfBinapiTypeLength(enum.Type, field.Length) + continue + } + size += getSizeOfBinapiTypeLength(field.Type, field.Length) + } + return size +} + +func getUnionSize(union *Union) (maxSize int) { for _, field := range union.Fields { - typ := getTypeByRef(file, field.Type) - if typ != nil { - if size := getSizeOfType(file, typ); size > maxSize { + if typ := field.TypeStruct; typ != nil { + if size := getSizeOfType(typ); size > maxSize { maxSize = size } continue } - alias := getAliasByRef(file, field.Type) - if alias != nil { + if alias := field.TypeAlias; alias != nil { if size := getSizeOfBinapiTypeLength(alias.Type, alias.Length); size > maxSize { maxSize = size } continue } else { - logf("no type or alias found for union %s field type %q", union.Name, field.Type) - continue + logrus.Panicf("no type or alias found for union %s field type %q", union.Name, field.Type) } } - logf("getUnionSize: %s %+v max=%v", union.Name, union.Fields, maxSize) + //logf("getUnionSize: %s %+v max=%v", union.Name, union.Fields, maxSize) return } diff --git a/binapigen/validate.go b/binapigen/validate.go deleted file mode 100644 index a79e148..0000000 --- a/binapigen/validate.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2020 Cisco and/or its affiliates. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package binapigen - -import ( - "strings" - - "github.com/sirupsen/logrus" - - "git.fd.io/govpp.git/binapigen/vppapi" -) - -const ( - serviceEventPrefix = "want_" - serviceDumpSuffix = "_dump" - serviceDetailsSuffix = "_details" - serviceReplySuffix = "_reply" -) - -func validateService(svc vppapi.Service) { - for _, rpc := range svc.RPCs { - validateRPC(rpc) - } -} - -func validateRPC(rpc vppapi.RPC) { - if len(rpc.Events) > 0 { - // EVENT service - if !strings.HasPrefix(rpc.RequestMsg, serviceEventPrefix) { - logrus.Warnf("unusual EVENTS service: %+v\n"+ - "- events service %q does not have %q prefix in request.", - rpc, rpc.Name, serviceEventPrefix) - } - } else if rpc.Stream { - // STREAM service - if !strings.HasSuffix(rpc.RequestMsg, serviceDumpSuffix) { - logrus.Warnf("unusual STREAM service: %+v\n"+ - "- stream service %q does not have %q suffix in request.", - rpc, rpc.Name, serviceDumpSuffix) - } - if !strings.HasSuffix(rpc.ReplyMsg, serviceDetailsSuffix) && !strings.HasSuffix(rpc.StreamMsg, serviceDetailsSuffix) { - logrus.Warnf("unusual STREAM service: %+v\n"+ - "- stream service %q does not have %q suffix in reply or stream msg.", - rpc, rpc.Name, serviceDetailsSuffix) - } - } else if rpc.ReplyMsg != "" { - // REQUEST service - // some messages might have `null` reply (for example: memclnt) - if !strings.HasSuffix(rpc.ReplyMsg, serviceReplySuffix) { - logrus.Warnf("unusual REQUEST service: %+v\n"+ - "- service %q does not have %q suffix in reply.", - rpc, rpc.Name, serviceReplySuffix) - } - } -} diff --git a/binapigen/vppapi.go b/binapigen/vppapi.go new file mode 100644 index 0000000..7388ad5 --- /dev/null +++ b/binapigen/vppapi.go @@ -0,0 +1,211 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package binapigen + +import ( + "log" + "sort" + + "git.fd.io/govpp.git/binapigen/vppapi" +) + +func SortFileObjectsByName(file *vppapi.File) { + sort.SliceStable(file.Imports, func(i, j int) bool { + return file.Imports[i] < file.Imports[j] + }) + sort.SliceStable(file.EnumTypes, func(i, j int) bool { + return file.EnumTypes[i].Name < file.EnumTypes[j].Name + }) + sort.Slice(file.AliasTypes, func(i, j int) bool { + return file.AliasTypes[i].Name < file.AliasTypes[j].Name + }) + sort.SliceStable(file.StructTypes, func(i, j int) bool { + return file.StructTypes[i].Name < file.StructTypes[j].Name + }) + sort.SliceStable(file.UnionTypes, func(i, j int) bool { + return file.UnionTypes[i].Name < file.UnionTypes[j].Name + }) + sort.SliceStable(file.Messages, func(i, j int) bool { + return file.Messages[i].Name < file.Messages[j].Name + }) + if file.Service != nil { + sort.Slice(file.Service.RPCs, func(i, j int) bool { + return file.Service.RPCs[i].Request < file.Service.RPCs[j].Request + }) + } +} + +func importedFiles(files []*vppapi.File, file *vppapi.File) []*vppapi.File { + var list []*vppapi.File + byName := func(s string) *vppapi.File { + for _, f := range files { + if f.Name == s { + return f + } + } + return nil + } + imported := map[string]struct{}{} + for _, imp := range file.Imports { + imp = normalizeImport(imp) + impFile := byName(imp) + if impFile == nil { + log.Fatalf("file %q not found", imp) + } + for _, nest := range importedFiles(files, impFile) { + if _, ok := imported[nest.Name]; !ok { + list = append(list, nest) + imported[nest.Name] = struct{}{} + } + } + if _, ok := imported[impFile.Name]; !ok { + list = append(list, impFile) + imported[impFile.Name] = struct{}{} + } + } + return list +} + +func SortFilesByImports(apifiles []*vppapi.File) { + dependsOn := func(file *vppapi.File, dep string) bool { + for _, imp := range importedFiles(apifiles, file) { + if imp.Name == dep { + return true + } + } + return false + } + sort.Slice(apifiles, func(i, j int) bool { + a := apifiles[i] + b := apifiles[j] + if dependsOn(a, b.Name) { + return false + } + if dependsOn(b, a.Name) { + return true + } + return len(b.Imports) > len(a.Imports) + }) +} + +func ListImportedTypes(apifiles []*vppapi.File, file *vppapi.File) []string { + var importedTypes []string + typeFiles := importedFiles(apifiles, file) + for _, t := range file.StructTypes { + var imported bool + for _, imp := range typeFiles { + for _, at := range imp.StructTypes { + if at.Name != t.Name { + continue + } + importedTypes = append(importedTypes, t.Name) + imported = true + break + } + if imported { + break + } + } + } + for _, t := range file.AliasTypes { + var imported bool + for _, imp := range typeFiles { + for _, at := range imp.AliasTypes { + if at.Name != t.Name { + continue + } + importedTypes = append(importedTypes, t.Name) + imported = true + break + } + if imported { + break + } + } + } + for _, t := range file.EnumTypes { + var imported bool + for _, imp := range typeFiles { + for _, at := range imp.EnumTypes { + if at.Name != t.Name { + continue + } + importedTypes = append(importedTypes, t.Name) + imported = true + break + } + if imported { + break + } + } + } + for _, t := range file.UnionTypes { + var imported bool + for _, imp := range typeFiles { + for _, at := range imp.UnionTypes { + if at.Name != t.Name { + continue + } + importedTypes = append(importedTypes, t.Name) + imported = true + break + } + if imported { + break + } + } + } + return importedTypes +} + +func RemoveImportedTypes(apifiles []*vppapi.File, apifile *vppapi.File) { + importedTypes := ListImportedTypes(apifiles, apifile) + isImportedType := func(s string) bool { + for _, t := range importedTypes { + if t == s { + return true + } + } + return false + } + var enums []vppapi.EnumType + for _, enumType := range apifile.EnumTypes { + if !isImportedType(enumType.Name) { + enums = append(enums, enumType) + } + } + var aliases []vppapi.AliasType + for _, aliasType := range apifile.AliasTypes { + if !isImportedType(aliasType.Name) { + aliases = append(aliases, aliasType) + } + } + var structs []vppapi.StructType + for _, structType := range apifile.StructTypes { + if !isImportedType(structType.Name) { + structs = append(structs, structType) + } + } + var unions []vppapi.UnionType + for _, unionType := range apifile.UnionTypes { + if !isImportedType(unionType.Name) { + unions = append(unions, unionType) + } + } + apifile.EnumTypes = enums + apifile.AliasTypes = aliases + apifile.StructTypes = structs + apifile.UnionTypes = unions +} diff --git a/binapigen/vppapi/api.go b/binapigen/vppapi/api.go deleted file mode 100644 index 06d9046..0000000 --- a/binapigen/vppapi/api.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2020 Cisco and/or its affiliates. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vppapi - -type File struct { - Name string - Path string - - CRC string - Options map[string]string `json:",omitempty"` - - Imports []string `json:",omitempty"` - - AliasTypes []AliasType `json:",omitempty"` - EnumTypes []EnumType `json:",omitempty"` - StructTypes []StructType `json:",omitempty"` - UnionTypes []UnionType `json:",omitempty"` - Messages []Message `json:",omitempty"` - Service *Service `json:",omitempty"` -} - -func (x File) Version() string { - if x.Options != nil { - return x.Options[fileOptionVersion] - } - return "" -} - -type AliasType struct { - Name string - Type string - Length int `json:",omitempty"` -} - -type EnumType struct { - Name string - Type string - Entries []EnumEntry -} - -type EnumEntry struct { - Name string - Value uint32 -} - -type StructType struct { - Name string - Fields []Field -} - -type UnionType struct { - Name string - Fields []Field -} - -type Message struct { - Name string - Fields []Field - CRC string -} - -type Field struct { - Name string - Type string - Length int `json:",omitempty"` - Array bool `json:",omitempty"` - SizeFrom string `json:",omitempty"` - Meta map[string]interface{} `json:",omitempty"` -} - -type Service struct { - RPCs []RPC `json:",omitempty"` -} - -type RPC struct { - Name string - RequestMsg string - ReplyMsg string - Stream bool `json:",omitempty"` - StreamMsg string `json:",omitempty"` - Events []string `json:",omitempty"` -} diff --git a/binapigen/vppapi/api_schema.go b/binapigen/vppapi/api_schema.go new file mode 100644 index 0000000..7eceab3 --- /dev/null +++ b/binapigen/vppapi/api_schema.go @@ -0,0 +1,89 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package vppapi parses VPP API files without any additional processing. +package vppapi + +type ( + File struct { + Name string + Path string + CRC string + + Options map[string]string `json:",omitempty"` + Imports []string `json:",omitempty"` + + AliasTypes []AliasType `json:",omitempty"` + EnumTypes []EnumType `json:",omitempty"` + StructTypes []StructType `json:",omitempty"` + UnionTypes []UnionType `json:",omitempty"` + + Messages []Message `json:",omitempty"` + Service *Service `json:",omitempty"` + } + + AliasType struct { + Name string + Type string + Length int `json:",omitempty"` + } + + EnumType struct { + Name string + Type string + Entries []EnumEntry + } + + EnumEntry struct { + Name string + Value uint32 + } + + StructType struct { + Name string + Fields []Field + } + + UnionType struct { + Name string + Fields []Field + } + + Message struct { + Name string + Fields []Field + CRC string + } + + Field struct { + Name string + Type string + Length int `json:",omitempty"` + Array bool `json:",omitempty"` + SizeFrom string `json:",omitempty"` + Meta map[string]interface{} `json:",omitempty"` + } + + Service struct { + RPCs []RPC `json:",omitempty"` + } + + RPC struct { + Request string + Reply string + Stream bool `json:",omitempty"` + StreamMsg string `json:",omitempty"` + Events []string `json:",omitempty"` + } +) diff --git a/binapigen/vppapi/parse_json.go b/binapigen/vppapi/parse_json.go index 45b5796..d14865c 100644 --- a/binapigen/vppapi/parse_json.go +++ b/binapigen/vppapi/parse_json.go @@ -18,79 +18,52 @@ import ( "encoding/json" "errors" "fmt" + "log" "os" "strings" "github.com/bennyscetbun/jsongo" - "github.com/sirupsen/logrus" ) -var Logger *logrus.Logger - -func init() { - if strings.Contains(os.Getenv("DEBUG_GOVPP"), "parser") { - Logger = logrus.StandardLogger() - } -} +var debug = strings.Contains(os.Getenv("DEBUG_GOVPP"), "parser") func logf(f string, v ...interface{}) { - if Logger != nil { - Logger.Debugf(f, v...) + if debug { + log.Printf(f, v...) } } const ( - // file - objAPIVersion = "vl_api_version" - objTypes = "types" - objMessages = "messages" - objUnions = "unions" - objEnums = "enums" - objServices = "services" - objAliases = "aliases" - objOptions = "options" - objImports = "imports" - - // message - messageFieldCrc = "crc" - - // alias - aliasFieldLength = "length" - aliasFieldType = "type" - - // service - serviceFieldReply = "reply" - serviceFieldStream = "stream" - serviceFieldStreamMsg = "stream_msg" - serviceFieldEvents = "events" -) - -const ( - // file - fileOptionVersion = "version" - - // field - fieldOptionLimit = "limit" - fieldOptionDefault = "default" - + // root keys + fileAPIVersion = "vl_api_version" + fileOptions = "options" + fileTypes = "types" + fileMessages = "messages" + fileUnions = "unions" + fileEnums = "enums" + fileAliases = "aliases" + fileServices = "services" + fileImports = "imports" + // type keys + messageCrc = "crc" + enumType = "enumtype" + aliasLength = "length" + aliasType = "type" // service - serviceReplyNull = "null" + serviceReply = "reply" + serviceStream = "stream" + serviceStreamMsg = "stream_msg" + serviceEvents = "events" ) func parseJSON(data []byte) (module *File, err error) { - defer func() { - if e := recover(); e != nil { - err = fmt.Errorf("recovered panic: %v", e) - } - }() - - // parse JSON data into objects + // parse root jsonRoot := new(jsongo.Node) if err := json.Unmarshal(data, jsonRoot); err != nil { return nil, fmt.Errorf("unmarshalling JSON failed: %v", err) } - logf("file contents:") + logf("file contains:") for _, key := range jsonRoot.GetKeys() { if jsonRoot.At(key).Len() > 0 { logf(" - %2d %s", jsonRoot.At(key).Len(), key) @@ -100,38 +73,35 @@ func parseJSON(data []byte) (module *File, err error) { module = new(File) // parse CRC - if crc := jsonRoot.At(objAPIVersion); crc.GetType() == jsongo.TypeValue { - module.CRC = crc.Get().(string) + crc := jsonRoot.At(fileAPIVersion) + if crc.GetType() == jsongo.TypeValue { + module.CRC = crc.MustGetString() } // parse options - opt := jsonRoot.Map(objOptions) + opt := jsonRoot.Map(fileOptions) if opt.GetType() == jsongo.TypeMap { - module.Options = make(map[string]string, 0) + module.Options = make(map[string]string) for _, key := range opt.GetKeys() { - optionsNode := opt.At(key) optionKey := key.(string) - optionValue := optionsNode.Get().(string) - module.Options[optionKey] = optionValue + optionVal := opt.At(key).MustGetString() + module.Options[optionKey] = optionVal } } // parse imports - imports := jsonRoot.Map(objImports) - module.Imports = make([]string, 0) - imported := make(map[string]struct{}) - for i := 0; i < imports.Len(); i++ { - importNode := imports.At(i) - imp, err := parseImport(importNode) - if err != nil { - return nil, err - } - if _, ok := imported[*imp]; ok { - logf("duplicate import found: %v", *imp) + importsNode := jsonRoot.Map(fileImports) + module.Imports = make([]string, 0, importsNode.Len()) + uniq := make(map[string]struct{}) + for i := 0; i < importsNode.Len(); i++ { + importNode := importsNode.At(i) + imp := importNode.MustGetString() + if _, ok := uniq[imp]; ok { + logf("duplicate import found: %v", imp) continue } - imported[*imp] = struct{}{} - module.Imports = append(module.Imports, *imp) + uniq[imp] = struct{}{} + module.Imports = append(module.Imports, imp) } // avoid duplicate objects @@ -146,11 +116,10 @@ func parseJSON(data []byte) (module *File, err error) { } // parse enum types - enumsNode := jsonRoot.Map(objEnums) + enumsNode := jsonRoot.Map(fileEnums) module.EnumTypes = make([]EnumType, 0) for i := 0; i < enumsNode.Len(); i++ { - enumNode := enumsNode.At(i) - enum, err := parseEnum(enumNode) + enum, err := parseEnum(enumsNode.At(i)) if err != nil { return nil, err } @@ -161,13 +130,12 @@ func parseJSON(data []byte) (module *File, err error) { } // parse alias types - aliasesNode := jsonRoot.Map(objAliases) + aliasesNode := jsonRoot.Map(fileAliases) if aliasesNode.GetType() == jsongo.TypeMap { module.AliasTypes = make([]AliasType, 0) for _, key := range aliasesNode.GetKeys() { - aliasNode := aliasesNode.At(key) aliasName := key.(string) - alias, err := parseAlias(aliasName, aliasNode) + alias, err := parseAlias(aliasName, aliasesNode.At(key)) if err != nil { return nil, err } @@ -179,11 +147,10 @@ func parseJSON(data []byte) (module *File, err error) { } // parse struct types - typesNode := jsonRoot.Map(objTypes) + typesNode := jsonRoot.Map(fileTypes) module.StructTypes = make([]StructType, 0) for i := 0; i < typesNode.Len(); i++ { - typNode := typesNode.At(i) - structyp, err := parseStruct(typNode) + structyp, err := parseStruct(typesNode.At(i)) if err != nil { return nil, err } @@ -194,11 +161,10 @@ func parseJSON(data []byte) (module *File, err error) { } // parse union types - unionsNode := jsonRoot.Map(objUnions) + unionsNode := jsonRoot.Map(fileUnions) module.UnionTypes = make([]UnionType, 0) for i := 0; i < unionsNode.Len(); i++ { - unionNode := unionsNode.At(i) - union, err := parseUnion(unionNode) + union, err := parseUnion(unionsNode.At(i)) if err != nil { return nil, err } @@ -209,12 +175,11 @@ func parseJSON(data []byte) (module *File, err error) { } // parse messages - messagesNode := jsonRoot.Map(objMessages) + messagesNode := jsonRoot.Map(fileMessages) if messagesNode.GetType() == jsongo.TypeArray { module.Messages = make([]Message, messagesNode.Len()) for i := 0; i < messagesNode.Len(); i++ { - msgNode := messagesNode.At(i) - msg, err := parseMessage(msgNode) + msg, err := parseMessage(messagesNode.At(i)) if err != nil { return nil, err } @@ -223,15 +188,14 @@ func parseJSON(data []byte) (module *File, err error) { } // parse services - servicesNode := jsonRoot.Map(objServices) + servicesNode := jsonRoot.Map(fileServices) if servicesNode.GetType() == jsongo.TypeMap { module.Service = &Service{ RPCs: make([]RPC, servicesNode.Len()), } for i, key := range servicesNode.GetKeys() { - rpcNode := servicesNode.At(key) rpcName := key.(string) - svc, err := parseServiceRPC(rpcName, rpcNode) + svc, err := parseServiceRPC(rpcName, servicesNode.At(key)) if err != nil { return nil, err } @@ -242,20 +206,6 @@ func parseJSON(data []byte) (module *File, err error) { return module, nil } -// parseImport parses VPP binary API import from JSON node -func parseImport(importNode *jsongo.Node) (*string, error) { - if importNode.GetType() != jsongo.TypeValue { - return nil, errors.New("invalid JSON for import specified") - } - - importName, ok := importNode.Get().(string) - if !ok { - return nil, fmt.Errorf("import name is %T, not a string", importNode.Get()) - } - - return &importName, nil -} - // parseEnum parses VPP binary API enum object from JSON node func parseEnum(enumNode *jsongo.Node) (*EnumType, error) { if enumNode.Len() == 0 || enumNode.At(0).GetType() != jsongo.TypeValue { @@ -266,7 +216,7 @@ func parseEnum(enumNode *jsongo.Node) (*EnumType, error) { if !ok { return nil, fmt.Errorf("enum name is %T, not a string", enumNode.At(0).Get()) } - enumType, ok := enumNode.At(enumNode.Len() - 1).At("enumtype").Get().(string) + enumType, ok := enumNode.At(enumNode.Len() - 1).At(enumType).Get().(string) if !ok { return nil, fmt.Errorf("enum type invalid or missing") } @@ -367,7 +317,7 @@ func parseStruct(typeNode *jsongo.Node) (*StructType, error) { // parseAlias parses VPP binary API alias object from JSON node func parseAlias(aliasName string, aliasNode *jsongo.Node) (*AliasType, error) { - if aliasNode.Len() == 0 || aliasNode.At(aliasFieldType).GetType() != jsongo.TypeValue { + if aliasNode.Len() == 0 || aliasNode.At(aliasType).GetType() != jsongo.TypeValue { return nil, errors.New("invalid JSON for alias specified") } @@ -375,7 +325,7 @@ func parseAlias(aliasName string, aliasNode *jsongo.Node) (*AliasType, error) { Name: aliasName, } - if typeNode := aliasNode.At(aliasFieldType); typeNode.GetType() == jsongo.TypeValue { + if typeNode := aliasNode.At(aliasType); typeNode.GetType() == jsongo.TypeValue { typ, ok := typeNode.Get().(string) if !ok { return nil, fmt.Errorf("alias type is %T, not a string", typeNode.Get()) @@ -385,7 +335,7 @@ func parseAlias(aliasName string, aliasNode *jsongo.Node) (*AliasType, error) { } } - if lengthNode := aliasNode.At(aliasFieldLength); lengthNode.GetType() == jsongo.TypeValue { + if lengthNode := aliasNode.At(aliasLength); lengthNode.GetType() == jsongo.TypeValue { length, ok := lengthNode.Get().(float64) if !ok { return nil, fmt.Errorf("alias length is %T, not a float64", lengthNode.Get()) @@ -398,7 +348,7 @@ func parseAlias(aliasName string, aliasNode *jsongo.Node) (*AliasType, error) { // parseMessage parses VPP binary API message object from JSON node func parseMessage(msgNode *jsongo.Node) (*Message, error) { - if msgNode.Len() == 0 || msgNode.At(0).GetType() != jsongo.TypeValue { + if msgNode.Len() < 2 || msgNode.At(0).GetType() != jsongo.TypeValue { return nil, errors.New("invalid JSON for message specified") } @@ -406,9 +356,8 @@ func parseMessage(msgNode *jsongo.Node) (*Message, error) { if !ok { return nil, fmt.Errorf("message name is %T, not a string", msgNode.At(0).Get()) } - msgCRC, ok := msgNode.At(msgNode.Len() - 1).At(messageFieldCrc).Get().(string) + msgCRC, ok := msgNode.At(msgNode.Len() - 1).At(messageCrc).Get().(string) if !ok { - return nil, fmt.Errorf("message crc invalid or missing") } @@ -466,26 +415,16 @@ func parseField(field *jsongo.Node) (*Field, error) { case jsongo.TypeMap: fieldMeta := field.At(2) - + if fieldMeta.Len() == 0 { + break + } + f.Meta = map[string]interface{}{} for _, key := range fieldMeta.GetKeys() { - metaNode := fieldMeta.At(key) metaName := key.(string) - metaValue := metaNode.Get() - - switch metaName { - case fieldOptionLimit: - metaValue = int(metaNode.Get().(float64)) - case fieldOptionDefault: - metaValue = metaNode.Get() - default: - logrus.Warnf("unknown meta info (%s=%v) for field (%s)", metaName, metaValue, fieldName) - } - - if f.Meta == nil { - f.Meta = map[string]interface{}{} - } + metaValue := fieldMeta.At(key).Get() f.Meta[metaName] = metaValue } + default: return nil, errors.New("invalid JSON for field specified") } @@ -503,27 +442,24 @@ func parseField(field *jsongo.Node) (*Field, error) { // parseServiceRPC parses VPP binary API service object from JSON node func parseServiceRPC(rpcName string, rpcNode *jsongo.Node) (*RPC, error) { - if rpcNode.Len() == 0 || rpcNode.At(serviceFieldReply).GetType() != jsongo.TypeValue { + if rpcNode.Len() == 0 || rpcNode.At(serviceReply).GetType() != jsongo.TypeValue { return nil, errors.New("invalid JSON for service RPC specified") } rpc := RPC{ - Name: rpcName, - RequestMsg: rpcName, + Request: rpcName, } - if replyNode := rpcNode.At(serviceFieldReply); replyNode.GetType() == jsongo.TypeValue { + if replyNode := rpcNode.At(serviceReply); replyNode.GetType() == jsongo.TypeValue { reply, ok := replyNode.Get().(string) if !ok { return nil, fmt.Errorf("service RPC reply is %T, not a string", replyNode.Get()) } - if reply != serviceReplyNull { - rpc.ReplyMsg = reply - } + rpc.Reply = reply } // is stream (dump) - if streamNode := rpcNode.At(serviceFieldStream); streamNode.GetType() == jsongo.TypeValue { + if streamNode := rpcNode.At(serviceStream); streamNode.GetType() == jsongo.TypeValue { var ok bool rpc.Stream, ok = streamNode.Get().(bool) if !ok { @@ -532,7 +468,7 @@ func parseServiceRPC(rpcName string, rpcNode *jsongo.Node) (*RPC, error) { } // stream message - if streamMsgNode := rpcNode.At(serviceFieldStreamMsg); streamMsgNode.GetType() == jsongo.TypeValue { + if streamMsgNode := rpcNode.At(serviceStreamMsg); streamMsgNode.GetType() == jsongo.TypeValue { var ok bool rpc.StreamMsg, ok = streamMsgNode.Get().(string) if !ok { @@ -541,7 +477,7 @@ func parseServiceRPC(rpcName string, rpcNode *jsongo.Node) (*RPC, error) { } // events service (event subscription) - if eventsNode := rpcNode.At(serviceFieldEvents); eventsNode.GetType() == jsongo.TypeArray { + if eventsNode := rpcNode.At(serviceEvents); eventsNode.GetType() == jsongo.TypeArray { for j := 0; j < eventsNode.Len(); j++ { event := eventsNode.At(j).Get().(string) rpc.Events = append(rpc.Events, event) diff --git a/binapigen/vppapi/parser.go b/binapigen/vppapi/parser.go deleted file mode 100644 index 312dd0e..0000000 --- a/binapigen/vppapi/parser.go +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2020 Cisco and/or its affiliates. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vppapi - -import ( - "fmt" - "io/ioutil" - "path/filepath" - "strings" - - "github.com/sirupsen/logrus" -) - -const ( - DefaultAPIDir = "/usr/share/vpp/api" -) - -const apifileSuffixJson = ".api.json" - -// FindFiles returns all input files located in specified directory -func FindFiles(dir string, deep int) (paths []string, err error) { - entries, err := ioutil.ReadDir(dir) - if err != nil { - return nil, fmt.Errorf("reading directory %s failed: %v", dir, err) - } - for _, e := range entries { - if e.IsDir() && deep > 0 { - nestedDir := filepath.Join(dir, e.Name()) - if nested, err := FindFiles(nestedDir, deep-1); err != nil { - return nil, err - } else { - paths = append(paths, nested...) - } - } else if strings.HasSuffix(e.Name(), apifileSuffixJson) { - paths = append(paths, filepath.Join(dir, e.Name())) - } - } - return paths, nil -} - -func Parse() ([]*File, error) { - return ParseDir(DefaultAPIDir) -} - -func ParseDir(apidir string) ([]*File, error) { - files, err := FindFiles(apidir, 1) - if err != nil { - return nil, err - } - - logrus.Infof("found %d files in API dir %q", len(files), apidir) - - var modules []*File - - for _, file := range files { - module, err := ParseFile(file) - if err != nil { - return nil, err - } - modules = append(modules, module) - } - - return modules, nil -} - -// ParseFile parses API file contents and returns File. -func ParseFile(apifile string) (*File, error) { - if !strings.HasSuffix(apifile, apifileSuffixJson) { - return nil, fmt.Errorf("unsupported file format: %q", apifile) - } - - data, err := ioutil.ReadFile(apifile) - if err != nil { - return nil, fmt.Errorf("reading file %s failed: %v", apifile, err) - } - - base := filepath.Base(apifile) - name := base[:strings.Index(base, ".")] - - logf("parsing file %q", base) - - module, err := ParseRaw(data) - if err != nil { - return nil, fmt.Errorf("parsing file %s failed: %v", base, err) - } - module.Name = name - module.Path = apifile - - return module, nil -} - -func ParseRaw(data []byte) (file *File, err error) { - file, err = parseJSON(data) - if err != nil { - return nil, err - } - - return file, nil -} diff --git a/binapigen/vppapi/parser_test.go b/binapigen/vppapi/parser_test.go deleted file mode 100644 index 2dc82e4..0000000 --- a/binapigen/vppapi/parser_test.go +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2020 Cisco and/or its affiliates. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package vppapi - -import ( - "encoding/json" - "io/ioutil" - "testing" - - . "github.com/onsi/gomega" -) - -func TestGetInputFiles(t *testing.T) { - RegisterTestingT(t) - - result, err := FindFiles("testdata", 1) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result).To(HaveLen(5)) - for _, file := range result { - Expect(file).To(BeAnExistingFile()) - } -} - -func TestGetInputFilesError(t *testing.T) { - RegisterTestingT(t) - - result, err := FindFiles("nonexisting_directory", 1) - Expect(err).Should(HaveOccurred()) - Expect(result).To(BeNil()) -} - -func TestReadJson(t *testing.T) { - RegisterTestingT(t) - - inputData, err := ioutil.ReadFile("testdata/af_packet.api.json") - Expect(err).ShouldNot(HaveOccurred()) - result, err := parseJSON(inputData) - Expect(err).ShouldNot(HaveOccurred()) - Expect(result).ToNot(BeNil()) - Expect(result.EnumTypes).To(HaveLen(0)) - Expect(result.StructTypes).To(HaveLen(0)) - Expect(result.Messages).To(HaveLen(6)) - Expect(result.Service.RPCs).To(HaveLen(3)) -} - -func TestReadJsonError(t *testing.T) { - RegisterTestingT(t) - - inputData, err := ioutil.ReadFile("testdata/input-read-json-error.json") - Expect(err).ShouldNot(HaveOccurred()) - result, err := parseJSON(inputData) - Expect(err).Should(HaveOccurred()) - Expect(result).To(BeNil()) -} - -func TestParseFile(t *testing.T) { - module, err := ParseFile("testdata/vpe.api.json") - if err != nil { - t.Fatal("unexpected error:", err) - } - - b, err := json.MarshalIndent(module, "", " ") - if err != nil { - t.Fatal(err) - } - t.Logf("parsed module: %s", b) - - if module.Name != "vpe" { - t.Errorf("expected Name=%s, got %v", "vpe", module.Name) - } - if module.CRC != "0xbd2c94f4" { - t.Errorf("expected CRC=%s, got %v", "0xbd2c94f4", module.CRC) - } - if module.Version() != "1.6.1" { - t.Errorf("expected Version=%s, got %v", "1.6.1", module.Version()) - } - if len(module.Imports) == 0 { - t.Errorf("expected imports, got none") - } - if len(module.Options) == 0 { - t.Errorf("expected options, got none") - } - if len(module.AliasTypes) == 0 { - t.Errorf("expected aliases, got none") - } - if len(module.StructTypes) == 0 { - t.Errorf("expected types, got none") - } - if len(module.Service.RPCs) == 0 { - t.Errorf("expected service method, got none") - } - if len(module.Messages) == 0 { - t.Errorf("expected messages, got none") - } -} - -func TestParseFileUnsupported(t *testing.T) { - _, err := ParseFile("testdata/input.txt") - if err == nil { - t.Fatal("expected error") - } -} diff --git a/binapigen/vppapi/util.go b/binapigen/vppapi/util.go new file mode 100644 index 0000000..87f2e55 --- /dev/null +++ b/binapigen/vppapi/util.go @@ -0,0 +1,112 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vppapi + +import ( + "fmt" + "io/ioutil" + "os" + "os/exec" + "path" + "strings" + + "github.com/sirupsen/logrus" +) + +const ( + VPPVersionEnvVar = "VPP_VERSION" +) + +// ResolveVPPVersion resolves version of the VPP for target directory. +// +// Version resolved here can be overriden by setting VPP_VERSION env var. +func ResolveVPPVersion(apidir string) string { + // check env variable override + if ver := os.Getenv(VPPVersionEnvVar); ver != "" { + logrus.Debugf("VPP version was manually set to %q via %s env var", ver, VPPVersionEnvVar) + return ver + } + + // assuming VPP package is installed + if path.Clean(apidir) == DefaultDir { + version, err := GetVPPVersionInstalled() + if err != nil { + logrus.Warnf("resolving VPP version from installed package failed: %v", err) + } else { + logrus.Debugf("resolved VPP version from installed package: %v", version) + return version + } + } + + // check if inside VPP repo + repoDir, err := findGitRepoRootDir(apidir) + if err != nil { + logrus.Warnf("checking VPP git repo failed: %v", err) + } else { + logrus.Debugf("resolved git repo root directory: %v", repoDir) + version, err := GetVPPVersionRepo(repoDir) + if err != nil { + logrus.Warnf("resolving VPP version from version script failed: %v", err) + } else { + logrus.Debugf("resolved VPP version from version script: %v", version) + return version + } + } + + // try to read VPP_VERSION file + data, err := ioutil.ReadFile(path.Join(repoDir, "VPP_VERSION")) + if err == nil { + return strings.TrimSpace(string(data)) + } + + logrus.Warnf("VPP version could not be resolved, you can set it manually using %s env var", VPPVersionEnvVar) + return "" +} + +// GetVPPVersionInstalled retrieves VPP version of installed package using dpkg-query. +func GetVPPVersionInstalled() (string, error) { + cmd := exec.Command("dpkg-query", "-f", "${Version}", "-W", "vpp") + out, err := cmd.CombinedOutput() + if err != nil { + return "", fmt.Errorf("dpkg-query command failed: %v\noutput: %s", err, out) + } + return strings.TrimSpace(string(out)), nil +} + +const versionScriptPath = "./src/scripts/version" + +// GetVPPVersionRepo retrieves VPP version using script in repo directory. +func GetVPPVersionRepo(repoDir string) (string, error) { + if _, err := os.Stat(versionScriptPath); err != nil { + return "", err + } + cmd := exec.Command(versionScriptPath) + cmd.Dir = repoDir + out, err := cmd.CombinedOutput() + if err != nil { + return "", fmt.Errorf("version script failed: %v\noutput: %s", err, out) + } + return strings.TrimSpace(string(out)), nil +} + +func findGitRepoRootDir(dir string) (string, error) { + cmd := exec.Command("git", "rev-parse", "--show-toplevel") + cmd.Dir = dir + out, err := cmd.CombinedOutput() + if err != nil { + return "", fmt.Errorf("git command failed: %v\noutput: %s", err, out) + } + return strings.TrimSpace(string(out)), nil +} diff --git a/binapigen/vppapi/vppapi.go b/binapigen/vppapi/vppapi.go new file mode 100644 index 0000000..665fa81 --- /dev/null +++ b/binapigen/vppapi/vppapi.go @@ -0,0 +1,116 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vppapi + +import ( + "fmt" + "io/ioutil" + "path/filepath" + "strings" +) + +const ( + // DefaultDir is default location of API files. + DefaultDir = "/usr/share/vpp/api" +) + +// FindFiles finds API files located in dir or in a nested directory that is not nested deeper than deep. +func FindFiles(dir string, deep int) (files []string, err error) { + entries, err := ioutil.ReadDir(dir) + if err != nil { + return nil, fmt.Errorf("reading directory %s failed: %v", dir, err) + } + for _, e := range entries { + if e.IsDir() && deep > 0 { + nestedDir := filepath.Join(dir, e.Name()) + if nested, err := FindFiles(nestedDir, deep-1); err != nil { + return nil, err + } else { + files = append(files, nested...) + } + } else if !e.IsDir() && strings.HasSuffix(e.Name(), ".api.json") { + files = append(files, filepath.Join(dir, e.Name())) + } + } + return files, nil +} + +// Parse parses API files in directory DefaultDir. +func Parse() ([]*File, error) { + return ParseDir(DefaultDir) +} + +// ParseDir finds and parses API files in given directory and returns parsed files. +// Supports API files in JSON format (.api.json) only. +func ParseDir(apidir string) ([]*File, error) { + list, err := FindFiles(apidir, 1) + if err != nil { + return nil, err + } + + logf("found %d files in API dir %q", len(list), apidir) + + var files []*File + for _, file := range list { + module, err := ParseFile(file) + if err != nil { + return nil, err + } + files = append(files, module) + } + return files, nil +} + +// ParseFile parses API file and returns File. +func ParseFile(apifile string) (*File, error) { + if !strings.HasSuffix(apifile, ".api.json") { + return nil, fmt.Errorf("unsupported file format: %q", apifile) + } + + data, err := ioutil.ReadFile(apifile) + if err != nil { + return nil, fmt.Errorf("reading file %s failed: %v", apifile, err) + } + + base := filepath.Base(apifile) + name := base[:strings.Index(base, ".")] + + logf("parsing file %q", base) + + module, err := ParseRaw(data) + if err != nil { + return nil, fmt.Errorf("parsing file %s failed: %v", base, err) + } + module.Name = name + module.Path = apifile + + return module, nil +} + +// ParseRaw parses raw API file data and returns File. +func ParseRaw(data []byte) (file *File, err error) { + defer func() { + if e := recover(); e != nil { + err = fmt.Errorf("panic occurred: %v", e) + } + }() + + file, err = parseJSON(data) + if err != nil { + return nil, err + } + + return file, nil +} diff --git a/binapigen/vppapi/vppapi_test.go b/binapigen/vppapi/vppapi_test.go new file mode 100644 index 0000000..027cc1f --- /dev/null +++ b/binapigen/vppapi/vppapi_test.go @@ -0,0 +1,118 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package vppapi + +import ( + "encoding/json" + "io/ioutil" + "testing" + + . "github.com/onsi/gomega" +) + +func TestGetInputFiles(t *testing.T) { + RegisterTestingT(t) + + result, err := FindFiles("testdata", 1) + Expect(err).ShouldNot(HaveOccurred()) + Expect(result).To(HaveLen(5)) + for _, file := range result { + Expect(file).To(BeAnExistingFile()) + } +} + +func TestGetInputFilesError(t *testing.T) { + RegisterTestingT(t) + + result, err := FindFiles("nonexisting_directory", 1) + Expect(err).Should(HaveOccurred()) + Expect(result).To(BeNil()) +} + +func TestReadJson(t *testing.T) { + RegisterTestingT(t) + + inputData, err := ioutil.ReadFile("testdata/af_packet.api.json") + Expect(err).ShouldNot(HaveOccurred()) + result, err := ParseRaw(inputData) + Expect(err).ShouldNot(HaveOccurred()) + Expect(result).ToNot(BeNil()) + Expect(result.EnumTypes).To(HaveLen(0)) + Expect(result.StructTypes).To(HaveLen(0)) + Expect(result.Messages).To(HaveLen(6)) + Expect(result.Service.RPCs).To(HaveLen(3)) +} + +func TestReadJsonError(t *testing.T) { + RegisterTestingT(t) + + inputData, err := ioutil.ReadFile("testdata/input-read-json-error.json") + Expect(err).ShouldNot(HaveOccurred()) + result, err := ParseRaw(inputData) + Expect(err).Should(HaveOccurred()) + Expect(result).To(BeNil()) +} + +func TestParseFile(t *testing.T) { + module, err := ParseFile("testdata/vpe.api.json") + if err != nil { + t.Fatal("unexpected error:", err) + } + + b, err := json.MarshalIndent(module, "", " ") + if err != nil { + t.Fatal(err) + } + t.Logf("parsed module: %s", b) + + if module.Name != "vpe" { + t.Errorf("expected Name=%s, got %v", "vpe", module.Name) + } + if module.Path != "testdata/vpe.api.json" { + t.Errorf("expected Path=%s, got %v", "testdata/vpe.api.json", module.Path) + } + if module.CRC != "0xbd2c94f4" { + t.Errorf("expected CRC=%s, got %v", "0xbd2c94f4", module.CRC) + } + + if version := module.Options["version"]; version != "1.6.1" { + t.Errorf("expected option[version]=%s, got %v", "1.6.1", version) + } + if len(module.Imports) == 0 { + t.Errorf("expected imports, got none") + } + if len(module.EnumTypes) == 0 { + t.Errorf("expected enums, got none") + } + if len(module.AliasTypes) == 0 { + t.Errorf("expected aliases, got none") + } + if len(module.StructTypes) == 0 { + t.Errorf("expected types, got none") + } + if len(module.Messages) == 0 { + t.Errorf("expected messages, got none") + } + if len(module.Service.RPCs) == 0 { + t.Errorf("expected service RPCs, got none") + } +} + +func TestParseFileUnsupported(t *testing.T) { + _, err := ParseFile("testdata/input.txt") + if err == nil { + t.Fatal("expected error") + } +} diff --git a/cmd/binapi-generator/main.go b/cmd/binapi-generator/main.go index e30aaf2..732b4f3 100644 --- a/cmd/binapi-generator/main.go +++ b/cmd/binapi-generator/main.go @@ -18,93 +18,82 @@ import ( "flag" "fmt" "os" + "path/filepath" + "strings" + "unicode" "github.com/sirupsen/logrus" "git.fd.io/govpp.git/binapigen" "git.fd.io/govpp.git/binapigen/vppapi" - "git.fd.io/govpp.git/version" + "git.fd.io/govpp.git/internal/version" ) func init() { flag.Usage = func() { - fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [OPTION]... [API]...\n", os.Args[0]) - fmt.Fprintln(flag.CommandLine.Output(), "Generate code for each API.") - fmt.Fprintf(flag.CommandLine.Output(), "Example: %s -output-dir=binapi acl interface l2\n", os.Args[0]) - fmt.Fprintln(flag.CommandLine.Output()) - fmt.Fprintln(flag.CommandLine.Output(), "Options:") - flag.CommandLine.PrintDefaults() + fmt.Fprintf(os.Stderr, "Usage: %s [OPTION] API_FILES\n", os.Args[0]) + fmt.Fprintln(os.Stderr, "Parse API_FILES and generate Go bindings based on the options given:") + flag.PrintDefaults() } } func main() { var ( - theInputFile = flag.String("input-file", "", "Input VPP API file. (DEPRECATED: Use program arguments to define VPP API files)") - theApiDir = flag.String("input-dir", vppapi.DefaultAPIDir, "Directory with VPP API files.") - theOutputDir = flag.String("output-dir", ".", "Output directory where code will be generated.") + theApiDir = flag.String("input-dir", vppapi.DefaultDir, "Input directory containing API files.") + theInputFile = flag.String("input-file", "", "DEPRECATED: Use program arguments to define files to generate.") + theOutputDir = flag.String("output-dir", "binapi", "Output directory where code will be generated.") + importPrefix = flag.String("import-prefix", "", "Define import path prefix to be used to import types.") + generatorPlugins = flag.String("gen", "rpc", "List of generator plugins to run for files.") - importPrefix = flag.String("import-prefix", "", "Define import path prefix to be used to import types.") - importTypes = flag.Bool("import-types", true, "Generate packages for imported types.") - includeAPIVer = flag.Bool("include-apiver", true, "Include APIVersion constant for each module.") - includeServices = flag.Bool("include-services", true, "Include RPC service api and client implementation.") - includeComments = flag.Bool("include-comments", false, "Include JSON API source in comments for each object.") - includeBinapiNames = flag.Bool("include-binapi-names", true, "Include binary API names in struct tag.") - includeVppVersion = flag.Bool("include-vpp-version", true, "Include version of the VPP that provided input files.") - - debugMode = flag.Bool("debug", os.Getenv("DEBUG_GOVPP") != "", "Enable debug mode.") printVersion = flag.Bool("version", false, "Prints version and exits.") + debugLog = flag.Bool("debug", false, "Enable verbose logging.") ) flag.Parse() + if *printVersion { fmt.Fprintln(os.Stdout, version.Info()) os.Exit(0) } - if flag.NArg() == 1 && flag.Arg(0) == "version" { - fmt.Fprintln(os.Stdout, version.Verbose()) - os.Exit(0) + + if *debugLog { + logrus.SetLevel(logrus.DebugLevel) } - // prepare options - var opts binapigen.Options + var filesToGenerate []string if *theInputFile != "" { if flag.NArg() > 0 { fmt.Fprintln(os.Stderr, "input-file cannot be combined with files to generate in arguments") os.Exit(1) } - opts.FilesToGenerate = append(opts.FilesToGenerate, *theInputFile) - } else { - opts.FilesToGenerate = append(opts.FilesToGenerate, flag.Args()...) - } - if ver := os.Getenv("VPP_API_VERSION"); ver != "" { - // use version from env var if set - opts.VPPVersion = ver + filesToGenerate = append(filesToGenerate, *theInputFile) } else { - opts.VPPVersion = ResolveVppVersion(*theApiDir) + filesToGenerate = append(filesToGenerate, flag.Args()...) } - opts.IncludeAPIVersion = *includeAPIVer - opts.IncludeComments = *includeComments - opts.IncludeBinapiNames = *includeBinapiNames - opts.IncludeServices = *includeServices - opts.IncludeVppVersion = *includeVppVersion - opts.ImportPrefix = *importPrefix - opts.ImportTypes = *importTypes - if *debugMode { - logrus.SetLevel(logrus.DebugLevel) - logrus.Debug("debug mode enabled") + opts := binapigen.Options{ + ImportPrefix: *importPrefix, + OutputDir: *theOutputDir, + } + if opts.OutputDir == "binapi" { + if wd, _ := os.Getwd(); filepath.Base(wd) == "binapi" { + opts.OutputDir = "." + } } - apiDir := *theApiDir - outputDir := *theOutputDir + genPlugins := strings.FieldsFunc(*generatorPlugins, func(c rune) bool { + return !unicode.IsLetter(c) && !unicode.IsNumber(c) + }) - binapigen.Run(apiDir, opts, func(g *binapigen.Generator) error { - for _, file := range g.Files { + binapigen.Run(apiDir, filesToGenerate, opts, func(gen *binapigen.Generator) error { + for _, file := range gen.Files { if !file.Generate { continue } - binapigen.GenerateBinapi(g, file, outputDir) - if g.IncludeServices && file.Service != nil { - binapigen.GenerateRPC(g, file, outputDir) + binapigen.GenerateAPI(gen, file) + for _, p := range genPlugins { + if err := binapigen.RunPlugin(p, gen, file); err != nil { + return err + } } } return nil diff --git a/cmd/binapi-generator/util.go b/cmd/binapi-generator/util.go deleted file mode 100644 index 8738963..0000000 --- a/cmd/binapi-generator/util.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2020 Cisco and/or its affiliates. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "io/ioutil" - "os/exec" - "path" - "strings" - - "github.com/sirupsen/logrus" -) - -const ( - versionScriptPath = "./src/scripts/version" - defaultVppApiDir = "/usr/share/vpp/api" -) - -func ResolveVppVersion(inputDir string) string { - // assuming VPP package is installed - if inputDir == defaultVppApiDir { - // resolve VPP version using dpkg - cmd := exec.Command("dpkg-query", "-f", "${Version}", "-W", "vpp") - out, err := cmd.CombinedOutput() - if err != nil { - logrus.Warnf("resolving VPP version from installed package failed: %v", err) - logrus.Warnf("command output: %s", out) - } else { - version := strings.TrimSpace(string(out)) - logrus.Debugf("resolved VPP version from installed package: %v", version) - return version - } - } - // check if inside VPP git repo - if inputDir != "" { - repo := findVppGitRepo(inputDir) - if repo != "" { - cmd := exec.Command(versionScriptPath) - cmd.Dir = repo - out, err := cmd.CombinedOutput() - if err != nil { - logrus.Warnf("resolving VPP version from version script failed: %v", err) - logrus.Warnf("command output: %s", out) - } else { - version := strings.TrimSpace(string(out)) - logrus.Debugf("resolved VPP version from version script: %v", version) - return version - } - } - file, err := ioutil.ReadFile(path.Join(inputDir, "VPP_VERSION")) - if err == nil { - return strings.TrimSpace(string(file)) - } - } - logrus.Warnf("VPP version could not be resolved, you can set it manually using VPP_API_VERSION env var") - return "unknown" -} - -func findVppGitRepo(dir string) string { - cmd := exec.Command("git", "rev-parse", "--show-toplevel") - cmd.Dir = dir - out, err := cmd.CombinedOutput() - if err != nil { - logrus.Warnf("checking VPP git repo failed: %v", err) - logrus.Warnf("command output: %s", out) - return "" - } - return strings.TrimSpace(string(out)) -} diff --git a/cmd/govpp/main.go b/cmd/govpp/main.go new file mode 100644 index 0000000..f1ad5d8 --- /dev/null +++ b/cmd/govpp/main.go @@ -0,0 +1,265 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "bytes" + "context" + "encoding/json" + "flag" + "fmt" + "io" + "io/ioutil" + "log" + "net/http" + "os" + "strings" + "text/tabwriter" + + "git.fd.io/govpp.git" + "git.fd.io/govpp.git/adapter/socketclient" + "git.fd.io/govpp.git/binapi/vpe" + "git.fd.io/govpp.git/binapigen" + "git.fd.io/govpp.git/binapigen/vppapi" +) + +func main() { + flag.Parse() + + apifiles, err := vppapi.Parse() + if err != nil { + log.Fatal(err) + } + + switch cmd := flag.Arg(0); cmd { + case "server": + runServer(apifiles, ":7777") + case "vppapi": + showVPPAPI(os.Stdout, apifiles) + case "vppapijson": + if flag.NArg() == 1 { + writeAsJSON(os.Stdout, apifiles) + } else { + f := flag.Arg(1) + var found bool + for _, apifile := range apifiles { + if apifile.Name == f { + writeAsJSON(os.Stdout, apifile) + found = true + break + } + } + if !found { + log.Fatalf("VPP API file %q not found", f) + } + } + case "rpc": + showRPC(apifiles) + case "cli": + args := flag.Args() + if len(args) == 0 { + args = []string{"?"} + } + sendCLI(args[1:]) + default: + log.Fatalf("invalid command: %q", cmd) + } + +} + +func writeAsJSON(w io.Writer, data interface{}) { + b, err := json.MarshalIndent(data, "", " ") + if err != nil { + log.Fatal(err) + return + } + if _, err := w.Write(b); err != nil { + panic(err) + } +} + +func showRPC(apifiles []*vppapi.File) { + for _, apifile := range apifiles { + fmt.Printf("%s.api\n", apifile.Name) + if apifile.Service == nil { + continue + } + for _, rpc := range apifile.Service.RPCs { + req := rpc.Request + reply := rpc.Reply + if rpc.Stream { + reply = "stream " + reply + } + fmt.Printf(" rpc (%s) --> (%s)\n", req, reply) + } + } +} + +func showVPPAPI(out io.Writer, apifiles []*vppapi.File) { + binapigen.SortFilesByImports(apifiles) + + var buf bytes.Buffer + w := tabwriter.NewWriter(&buf, 0, 0, 3, ' ', 0) + fmt.Fprintf(w, "API\tOPTIONS\tCRC\tPATH\tIMPORTED\tTYPES\t\n") + + for _, apifile := range apifiles { + importedTypes := binapigen.ListImportedTypes(apifiles, apifile) + var options []string + for k, v := range apifile.Options { + options = append(options, fmt.Sprintf("%s=%v", k, v)) + } + imports := fmt.Sprintf("%d apis, %2d types", len(apifile.Imports), len(importedTypes)) + path := strings.TrimPrefix(apifile.Path, vppapi.DefaultDir+"/") + types := fmt.Sprintf("%2d enum, %2d alias, %2d struct, %2d union, %2d msg", + len(apifile.EnumTypes), len(apifile.AliasTypes), len(apifile.StructTypes), len(apifile.UnionTypes), len(apifile.Messages)) + fmt.Fprintf(w, " %s\t%s\t%s\t%s\t%v\t%s\t\n", + apifile.Name, strings.Join(options, " "), apifile.CRC, path, imports, types) + } + + if err := w.Flush(); err != nil { + log.Fatal(err) + } + fmt.Fprint(out, buf.String()) +} + +func sendCLI(args []string) { + cmd := strings.Join(args, " ") + fmt.Printf("# %s\n", cmd) + + conn, err := govpp.Connect("/run/vpp/api.sock") + if err != nil { + log.Fatal(err) + } + defer conn.Disconnect() + + ch, err := conn.NewAPIChannel() + if err != nil { + log.Fatal(err) + } + defer ch.Close() + + if err := ch.CheckCompatiblity(vpe.AllMessages()...); err != nil { + log.Fatal(err) + } + + client := vpe.NewServiceClient(conn) + reply, err := client.CliInband(context.Background(), &vpe.CliInband{ + Cmd: cmd, + }) + if err != nil { + log.Fatal(err) + } + + fmt.Print(reply.Reply) +} + +func runServer(apifiles []*vppapi.File, addr string) { + apiRoutes(apifiles, http.DefaultServeMux) + + conn, err := govpp.Connect(socketclient.DefaultSocketName) + if err != nil { + log.Fatal(err) + } + + vpeRPC := vpe.NewServiceClient(conn) + c := vpe.RESTHandler(vpeRPC) + + http.Handle("/", c) + + log.Printf("listening on %v", addr) + + if err := http.ListenAndServe(addr, nil); err != nil { + log.Fatal(err) + } +} + +func apiRoutes(apifiles []*vppapi.File, mux *http.ServeMux) { + for _, apifile := range apifiles { + name := apifile.Name + mux.HandleFunc("/vppapi/"+name, apiFileHandler(apifile)) + mux.HandleFunc("/raw/"+name, rawHandler(apifile)) + mux.HandleFunc("/rpc/"+name, rpcHandler(apifile)) + } + mux.HandleFunc("/vppapi", apiHandler(apifiles)) +} + +func rpcHandler(apifile *vppapi.File) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, req *http.Request) { + msgName := strings.TrimPrefix(req.URL.Path, "/rpc/"+apifile.Name+"/") + if msgName == "" { + http.Error(w, "no message name", 500) + return + } + + input, err := ioutil.ReadAll(req.Body) + if err != nil { + http.Error(w, err.Error(), 500) + return + } + + msgReq := make(map[string]interface{}) + err = json.Unmarshal(input, &msgReq) + if err != nil { + http.Error(w, err.Error(), 500) + return + } + + var msg *vppapi.Message + for _, m := range apifile.Messages { + if m.Name == msgName { + msg = &m + break + } + } + if msg == nil { + http.Error(w, "unknown message name: "+msgName, 500) + return + } + + } +} + +func apiHandler(apifiles []*vppapi.File) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, req *http.Request) { + b, err := json.MarshalIndent(apifiles, "", " ") + if err != nil { + http.Error(w, err.Error(), 500) + return + } + w.Write(b) + } +} + +func apiFileHandler(apifile *vppapi.File) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, req *http.Request) { + b, err := json.MarshalIndent(apifile, "", " ") + if err != nil { + http.Error(w, err.Error(), 500) + return + } + w.Write(b) + } +} + +func rawHandler(apifile *vppapi.File) func(http.ResponseWriter, *http.Request) { + return func(w http.ResponseWriter, req *http.Request) { + b, err := ioutil.ReadFile(apifile.Path) + if err != nil { + http.Error(w, err.Error(), 500) + return + } + w.Write(b) + } +} diff --git a/cmd/vpp-proxy/main.go b/cmd/vpp-proxy/main.go index 5221218..d1af5df 100644 --- a/cmd/vpp-proxy/main.go +++ b/cmd/vpp-proxy/main.go @@ -15,18 +15,16 @@ package main import ( - "context" "encoding/gob" "flag" - "io" "log" "git.fd.io/govpp.git/adapter/socketclient" "git.fd.io/govpp.git/adapter/statsclient" "git.fd.io/govpp.git/api" + interfaces "git.fd.io/govpp.git/binapi/interface" + "git.fd.io/govpp.git/binapi/vpe" _ "git.fd.io/govpp.git/core" - "git.fd.io/govpp.git/examples/binapi/interfaces" - "git.fd.io/govpp.git/examples/binapi/vpe" "git.fd.io/govpp.git/proxy" ) @@ -93,30 +91,12 @@ func runClient() { panic(err) } - // - using binapi message directly req := &vpe.CliInband{Cmd: "show version"} reply := new(vpe.CliInbandReply) if err := binapiChannel.SendRequest(req).ReceiveReply(reply); err != nil { log.Fatalln("binapi request failed:", err) } log.Printf("VPP version: %+v", reply.Reply) - - // - or using generated rpc service - svc := interfaces.NewServiceClient(binapiChannel) - stream, err := svc.DumpSwInterface(context.Background(), &interfaces.SwInterfaceDump{}) - if err != nil { - log.Fatalln("binapi request failed:", err) - } - for { - iface, err := stream.Recv() - if err == io.EOF { - break - } - if err != nil { - log.Fatalln(err) - } - log.Printf("- interface: %+v", iface) - } } func runServer() { diff --git a/codec/bench_test.go b/codec/bench_test.go index 54d0219..4b4a702 100644 --- a/codec/bench_test.go +++ b/codec/bench_test.go @@ -14,6 +14,7 @@ package codec_test +/* import ( "testing" @@ -71,3 +72,4 @@ func BenchmarkEncodeHard(b *testing.B) { } Data = data } +*/ diff --git a/codec/codec.go b/codec/codec.go index e968a6b..4178e12 100644 --- a/codec/codec.go +++ b/codec/codec.go @@ -15,23 +15,43 @@ package codec import ( + "bytes" "encoding/binary" "math" "reflect" "unsafe" ) -var order = binary.BigEndian - +// Buffer provides buffer for encoding and decoding data on wire. type Buffer struct { - pos int buf []byte + pos int +} + +func NewBuffer(b []byte) *Buffer { + return &Buffer{ + buf: b, + } } func (b *Buffer) Bytes() []byte { return b.buf[:b.pos] } +func (b *Buffer) EncodeBytes(v []byte, length int) { + if length == 0 { + length = len(v) + } + copy(b.buf[b.pos:b.pos+length], v) + b.pos += length +} + +func (b *Buffer) DecodeBytes(length int) []byte { + v := b.buf[b.pos : b.pos+length] + b.pos += length + return v +} + func (b *Buffer) EncodeBool(v bool) { if v { b.buf[b.pos] = 1 @@ -41,38 +61,105 @@ func (b *Buffer) EncodeBool(v bool) { b.pos += 1 } +func (b *Buffer) DecodeBool() bool { + v := b.buf[b.pos] != 0 + b.pos += 1 + return v +} + func (b *Buffer) EncodeUint8(v uint8) { b.buf[b.pos] = v b.pos += 1 } +func (b *Buffer) DecodeUint8() uint8 { + v := b.buf[b.pos] + b.pos += 1 + return v +} + func (b *Buffer) EncodeUint16(v uint16) { - order.PutUint16(b.buf[b.pos:b.pos+2], v) + binary.BigEndian.PutUint16(b.buf[b.pos:b.pos+2], v) + b.pos += 2 +} + +func (b *Buffer) DecodeUint16() uint16 { + v := binary.BigEndian.Uint16(b.buf[b.pos : b.pos+2]) b.pos += 2 + return v } func (b *Buffer) EncodeUint32(v uint32) { - order.PutUint32(b.buf[b.pos:b.pos+4], v) + binary.BigEndian.PutUint32(b.buf[b.pos:b.pos+4], v) b.pos += 4 } +func (b *Buffer) DecodeUint32() uint32 { + v := binary.BigEndian.Uint32(b.buf[b.pos : b.pos+4]) + b.pos += 4 + return v +} + func (b *Buffer) EncodeUint64(v uint64) { - order.PutUint64(b.buf[b.pos:b.pos+8], v) + binary.BigEndian.PutUint64(b.buf[b.pos:b.pos+8], v) + b.pos += 8 +} + +func (b *Buffer) DecodeUint64() uint64 { + v := binary.BigEndian.Uint64(b.buf[b.pos : b.pos+8]) b.pos += 8 + return v } func (b *Buffer) EncodeFloat64(v float64) { - order.PutUint64(b.buf[b.pos:b.pos+8], math.Float64bits(v)) + binary.BigEndian.PutUint64(b.buf[b.pos:b.pos+8], math.Float64bits(v)) b.pos += 8 } +func (b *Buffer) DecodeFloat64() float64 { + v := math.Float64frombits(binary.BigEndian.Uint64(b.buf[b.pos : b.pos+8])) + b.pos += 8 + return v +} + func (b *Buffer) EncodeString(v string, length int) { + if length == 0 { + b.EncodeUint32(uint32(len(v))) + length = len(v) + } copy(b.buf[b.pos:b.pos+length], v) b.pos += length } -func DecodeString(b []byte) string { +func (b *Buffer) DecodeString(length int) string { + var v []byte + if length == 0 { + length = int(b.DecodeUint32()) + v = b.buf[b.pos : b.pos+length] + } else { + v = b.buf[b.pos : b.pos+length] + if nul := bytes.Index(v, []byte{0x00}); nul >= 0 { + v = v[:nul] + } + } + b.pos += length + return string(v) +} + +func BytesToString(b []byte) string { sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&b)) stringHeader := reflect.StringHeader{Data: sliceHeader.Data, Len: sliceHeader.Len} return *(*string)(unsafe.Pointer(&stringHeader)) } + +func DecodeString(b []byte) string { + return string(b) +} + +func DecodeStringZero(b []byte) string { + nul := bytes.Index(b, []byte{0x00}) + if nul >= 0 { + b = b[:nul] + } + return string(b) +} diff --git a/codec/marshaler_test.go b/codec/marshaler_test.go index 95b1e89..b3b20b0 100644 --- a/codec/marshaler_test.go +++ b/codec/marshaler_test.go @@ -16,16 +16,15 @@ package codec_test import ( "bytes" - "encoding/binary" "reflect" "testing" - "github.com/lunixbochs/struc" - "git.fd.io/govpp.git/api" + "git.fd.io/govpp.git/binapi/ip_types" + "git.fd.io/govpp.git/binapi/sr" "git.fd.io/govpp.git/codec" - "git.fd.io/govpp.git/codec/testdata/binapi2001/interfaces" - "git.fd.io/govpp.git/codec/testdata/binapi2001/ip" + "git.fd.io/govpp.git/internal/testbinapi/binapi2001/interfaces" + "git.fd.io/govpp.git/internal/testbinapi/binapi2001/ip" ) // CliInband represents VPP binary API message 'cli_inband'. @@ -101,127 +100,6 @@ func TestWrapperDecode(t *testing.T) { } } -/*func TestNewCodecEncodeDecode(t *testing.T) { - tests := []struct { - name string - msg Codec - }{ - { - "", &TestAllMsg{ - Bool: true, - AliasUint32: 5, - AliasArray: MacAddress{0x11, 0x22, 0x33, 0x44, 0x55, 0x66}, - BaseArray: []uint32{0x00, 0x00, 0x00, 0x00}, - Enum: IF_STATUS_API_FLAG_LINK_UP, - Uint8: 8, - Uint16: 16, - Uint32: 32, - Int8: 88, - Int16: 1616, - Int32: 3232, - Slice: []byte{10, 20, 30, 40, 0, 0, 0}, - String: "abcdefghikl", - SizeOf: 2, - VariableSlice: []SliceType{ - {Proto: IP_API_PROTO_AH}, - {Proto: IP_API_PROTO_ESP}, - }, - TypeUnion: Address{ - Af: ADDRESS_IP4, - Un: AddressUnionIP4(IP4Address{1, 2, 3, 4}), - }, - }, - }, - } - for _, test := range tests { - t.Run(test.name, func(t *testing.T) { - data, err := test.msg.Marshal() - if err != nil { - t.Fatalf("expected nil error, got: %v", err) - } - - var m2 TestAllMsg - if err := m2.Unmarshal(data); err != nil { - t.Fatalf("expected nil error, got: %v", err) - } - - t.Logf("Data:\nOLD: %+v\nNEW: %+v", m, &m2) - - if !reflect.DeepEqual(m, &m2) { - t.Fatalf("newData differs from oldData") - } - }) - } -}*/ - -func NewTestAllMsg() *TestAllMsg { - return &TestAllMsg{ - Bool: true, - AliasUint32: 5, - AliasArray: MacAddress{0x11, 0x22, 0x33, 0x44, 0x55, 0x66}, - BaseArray: []uint32{0x00, 0x00, 0x00, 0x00}, - Enum: IF_STATUS_API_FLAG_LINK_UP, - Uint8: 8, - Uint16: 16, - Uint32: 32, - Int8: 88, - Int16: 1616, - Int32: 3232, - Slice: []byte{10, 20, 30, 40, 0, 0, 0}, - String: "abcdefghikl", - SizeOf: 2, - VariableSlice: []SliceType{ - {Proto: IP_API_PROTO_AH}, - {Proto: IP_API_PROTO_ESP}, - }, - TypeUnion: Address{ - Af: ADDRESS_IP4, - Un: AddressUnionIP4(IP4Address{1, 2, 3, 4}), - }, - } -} - -func TestNewCodecEncodeDecode_(t *testing.T) { - m := NewTestAllMsg() - - data, err := m.Marshal(nil) - if err != nil { - t.Fatalf("expected nil error, got: %v", err) - } - - var m2 TestAllMsg - if err := m2.Unmarshal(data); err != nil { - t.Fatalf("expected nil error, got: %v", err) - } - - t.Logf("Data:\nOLD: %+v\nNEW: %+v", m, &m2) - - if !reflect.DeepEqual(m, &m2) { - t.Fatalf("newData differs from oldData") - } -} - -// ------------- - -func TestNewCodecEncodeDecode3(t *testing.T) { - m := NewTestAllMsg() - - data, err := m.Marshal(nil) - if err != nil { - t.Fatalf("expected nil error, got: %v", err) - } - - var m2 TestAllMsg - if err := m2.Unmarshal(data); err != nil { - t.Fatalf("expected nil error, got: %v", err) - } - - t.Logf("Data:\nOLD: %+v\nNEW: %+v", m, &m2) - - if !reflect.DeepEqual(m, &m2) { - t.Fatalf("newData differs from oldData") - } -} func TestNewCodecEncodeDecode4(t *testing.T) { m := &interfaces.SwInterfaceSetRxMode{ Mode: interfaces.RX_MODE_API_POLLING, @@ -251,9 +129,9 @@ func TestNewCodecEncodeDecode4(t *testing.T) { } } -/*func TestNewCodecEncodeDecode2(t *testing.T) { +func TestNewCodecEncodeDecode2(t *testing.T) { m := &sr.SrPoliciesDetails{ - Bsid: sr.IP6Address{00, 11, 22, 33, 44, 55, 66, 77, 88, 99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, + Bsid: ip_types.IP6Address{00, 11, 22, 33, 44, 55, 66, 77, 88, 99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, IsSpray: true, IsEncap: false, FibTable: 33, @@ -262,7 +140,7 @@ func TestNewCodecEncodeDecode4(t *testing.T) { { Weight: 555, NumSids: 2, - Sids: [16]sr.IP6Address{ + Sids: [16]ip_types.IP6Address{ {99}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, }, @@ -288,7 +166,7 @@ func TestNewCodecEncodeDecode4(t *testing.T) { if !reflect.DeepEqual(m, &m2) { t.Fatalf("newData differs from oldData") } -}*/ +} func TestNewCodecEncode(t *testing.T) { m := NewIPRouteLookupReply() @@ -461,309 +339,3 @@ func NewIPRouteLookupReply() *ip.IPRouteAddDel { }, } } - -func TestSize(t *testing.T) { - m := NewTestAllMsg() - size := binary.Size(*m) - t.Logf("size: %v", size) -} - -func (m *TestAllMsg) Marshal(b []byte) ([]byte, error) { - order := binary.BigEndian - tmp := make([]byte, 143) - pos := 0 - - tmp[pos] = boolToUint(m.Bool) - pos += 1 - - tmp[pos] = m.Uint8 - pos += 1 - - order.PutUint16(tmp[pos:pos+2], m.Uint16) - pos += 2 - - order.PutUint32(tmp[pos:pos+4], m.Uint32) - pos += 4 - - tmp[pos] = byte(m.Int8) - pos += 1 - - order.PutUint16(tmp[pos:pos+2], uint16(m.Int16)) - pos += 2 - - order.PutUint32(tmp[pos:pos+4], uint32(m.Int32)) - pos += 4 - - order.PutUint32(tmp[pos:pos+4], uint32(m.AliasUint32)) - pos += 4 - - copy(tmp[pos:pos+6], m.AliasArray[:]) - pos += 6 - - order.PutUint32(tmp[pos:pos+4], uint32(m.Enum)) - pos += 4 - - for i := 0; i < 4; i++ { - var x uint32 - if i < len(m.BaseArray) { - x = m.BaseArray[i] - } - order.PutUint32(tmp[pos:pos+4], uint32(x)) - pos += 4 - } - - copy(tmp[pos:pos+7], m.Slice) - pos += 7 - - copy(tmp[pos:pos+64], m.String) - pos += 64 - - order.PutUint32(tmp[pos:pos+4], uint32(len(m.VlaStr)) /*m.SizeOf*/) - pos += 4 - - copy(tmp[pos:pos+len(m.VlaStr)], m.VlaStr[:]) - pos += len(m.VlaStr) - - order.PutUint32(tmp[pos:pos+4], uint32(len(m.VariableSlice)) /*m.SizeOf*/) - pos += 4 - - for i := range m.VariableSlice { - tmp[pos+i*1] = uint8(m.VariableSlice[i].Proto) - //copy(tmp[102+i:103+i], []byte{byte(m.VariableSlice[i].Proto)}) - } - pos += len(m.VariableSlice) * 1 - - tmp[pos] = uint8(m.TypeUnion.Af) - pos += 1 - - copy(tmp[pos:pos+16], m.TypeUnion.Un.XXX_UnionData[:]) - pos += 16 - - return tmp, nil -} - -func (m *TestAllMsg) Unmarshal(tmp []byte) error { - order := binary.BigEndian - - //tmp := make([]byte, 143) - pos := 0 - - m.Bool = tmp[pos] != 0 - pos += 1 - - //tmp[pos] = m.Uint8 - m.Uint8 = tmp[pos] - pos += 1 - - //order.PutUint16(tmp[pos:pos+2], m.Uint16) - m.Uint16 = order.Uint16(tmp[pos : pos+2]) - pos += 2 - - //order.PutUint32(tmp[pos:pos+4], m.Uint32) - m.Uint32 = order.Uint32(tmp[pos : pos+4]) - pos += 4 - - //tmp[pos] = byte(m.Int8) - m.Int8 = int8(tmp[pos]) - pos += 1 - - //order.PutUint16(tmp[pos:pos+2], uint16(m.Int16)) - m.Int16 = int16(order.Uint16(tmp[pos : pos+2])) - pos += 2 - - //order.PutUint32(tmp[pos:pos+4], uint32(m.Int32)) - m.Int32 = int32(order.Uint32(tmp[pos : pos+4])) - pos += 4 - - //order.PutUint32(tmp[pos:pos+4], uint32(m.AliasUint32)) - m.AliasUint32 = InterfaceIndex(order.Uint32(tmp[pos : pos+4])) - pos += 4 - - //copy(tmp[pos:pos+6], m.AliasArray[:]) - copy(m.AliasArray[:], tmp[pos:pos+6]) - pos += 6 - - //order.PutUint32(tmp[pos:pos+4], uint32(m.Enum)) - m.Enum = IfStatusFlags(order.Uint32(tmp[pos : pos+4])) - pos += 4 - - m.BaseArray = make([]uint32, 4) - for i := 0; i < 4; i++ { - /*var x uint32 - if i < len(m.BaseArray) { - x = m.BaseArray[i] - } - order.PutUint32(tmp[pos:pos+4], uint32(x))*/ - m.BaseArray[i] = order.Uint32(tmp[pos : pos+4]) - pos += 4 - } - - m.Slice = make([]byte, 7) - copy(m.Slice[:7], tmp[pos:pos+7]) - //copy(tmp[pos:pos+7], m.Slice) - pos += 7 - - i := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.String = string(tmp[pos : pos+i]) - //copy(tmp[pos:pos+64], m.String) - pos += 64 - - //order.PutUint32(tmp[pos:pos+4], uint32(len(m.VlaStr)) /*m.SizeOf*/) - VlaStrLen := int(order.Uint32(tmp[pos : pos+4])) - pos += 4 - - m.VlaStr = string(tmp[pos : pos+VlaStrLen]) - //copy(m.VlaStr[pos:pos+VlaStrLen], tmp[pos:pos+64]) - pos += len(m.VlaStr) - - m.SizeOf = uint32(order.Uint32(tmp[pos : pos+4])) - pos += 4 - - /*order.PutUint32(tmp[pos:pos+4], uint32(len(m.VariableSlice))) - m.VariableSlice = IfStatusFlags(order.Uint32(tmp[pos : pos+4])) - pos += 4*/ - - m.VariableSlice = make([]SliceType, m.SizeOf) - for i := range m.VariableSlice { - //tmp[pos+i*1] = uint8(m.VariableSlice[i].Proto) - m.VariableSlice[i].Proto = IPProto(tmp[pos+i*1]) - //copy(tmp[102+i:103+i], []byte{byte(m.VariableSlice[i].Proto)}) - } - pos += len(m.VariableSlice) * 1 - - //tmp[pos] = uint8(m.TypeUnion.Af) - m.TypeUnion.Af = AddressFamily(tmp[pos]) - pos += 1 - - //copy(tmp[pos:pos+16], m.TypeUnion.Un.XXX_UnionData[:]) - copy(m.TypeUnion.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - - return nil -} - -func boolToUint(b bool) uint8 { - if b { - return 1 - } - return 0 -} - -// SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. -type TestAllMsg struct { - Bool bool - Uint8 uint8 - Uint16 uint16 - Uint32 uint32 - Int8 int8 - Int16 int16 - Int32 int32 - AliasUint32 InterfaceIndex - AliasArray MacAddress - Enum IfStatusFlags - BaseArray []uint32 `struc:"[4]uint32"` - Slice []byte `struc:"[7]byte"` - String string `struc:"[64]byte"` - XXX_VlaStrLen uint32 `struc:"sizeof=VlaStr"` - VlaStr string - SizeOf uint32 `struc:"sizeof=VariableSlice"` - VariableSlice []SliceType - TypeUnion Address -} - -type InterfaceIndex uint32 -type MacAddress [6]uint8 -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -// Address represents VPP binary API type 'address'. -type Address struct { - Af AddressFamily - Un AddressUnion -} - -// AddressFamily represents VPP binary API enum 'address_family'. -type AddressFamily uint8 - -const ( - ADDRESS_IP4 AddressFamily = 0 - ADDRESS_IP6 AddressFamily = 1 -) - -// AddressUnion represents VPP binary API union 'address_union'. -type AddressUnion struct { - XXX_UnionData [16]byte -} - -func (*AddressUnion) GetTypeName() string { return "address_union" } - -func AddressUnionIP4(a IP4Address) (u AddressUnion) { - u.SetIP4(a) - return -} -func (u *AddressUnion) SetIP4(a IP4Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -func AddressUnionIP6(a IP6Address) (u AddressUnion) { - u.SetIP6(a) - return -} -func (u *AddressUnion) SetIP6(a IP6Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -// IP4Address represents VPP binary API alias 'ip4_address'. -type IP4Address [4]uint8 - -// IP6Address represents VPP binary API alias 'ip6_address'. -type IP6Address [16]uint8 - -type SliceType struct { - Proto IPProto -} - -type IPProto uint8 - -const ( - IP_API_PROTO_HOPOPT IPProto = 0 - IP_API_PROTO_ICMP IPProto = 1 - IP_API_PROTO_IGMP IPProto = 2 - IP_API_PROTO_TCP IPProto = 6 - IP_API_PROTO_UDP IPProto = 17 - IP_API_PROTO_GRE IPProto = 47 - IP_API_PROTO_ESP IPProto = 50 - IP_API_PROTO_AH IPProto = 51 - IP_API_PROTO_ICMP6 IPProto = 58 - IP_API_PROTO_EIGRP IPProto = 88 - IP_API_PROTO_OSPF IPProto = 89 - IP_API_PROTO_SCTP IPProto = 132 - IP_API_PROTO_RESERVED IPProto = 255 -) - -func (m *TestAllMsg) Reset() { *m = TestAllMsg{} } -func (*TestAllMsg) GetMessageName() string { return "sw_interface_details" } -func (*TestAllMsg) GetCrcString() string { return "17b69fa2" } -func (*TestAllMsg) GetMessageType() api.MessageType { return api.ReplyMessage } diff --git a/codec/msg_codec.go b/codec/msg_codec.go index 920366e..68cf3b1 100644 --- a/codec/msg_codec.go +++ b/codec/msg_codec.go @@ -15,6 +15,7 @@ package codec import ( + "encoding/binary" "errors" "fmt" @@ -23,30 +24,6 @@ import ( var DefaultCodec = new(MsgCodec) -// VppRequestHeader struct contains header fields implemented by all VPP requests. -type VppRequestHeader struct { - VlMsgID uint16 - ClientIndex uint32 - Context uint32 -} - -// VppReplyHeader struct contains header fields implemented by all VPP replies. -type VppReplyHeader struct { - VlMsgID uint16 - Context uint32 -} - -// VppEventHeader struct contains header fields implemented by all VPP events. -type VppEventHeader struct { - VlMsgID uint16 - ClientIndex uint32 -} - -// VppOtherHeader struct contains header fields implemented by other VPP messages (not requests nor replies). -type VppOtherHeader struct { - VlMsgID uint16 -} - // MsgCodec provides encoding and decoding functionality of `api.Message` structs into/from // binary format as accepted by VPP. type MsgCodec struct{} @@ -126,9 +103,9 @@ func (*MsgCodec) DecodeMsgContext(data []byte, msg api.Message) (context uint32, switch msg.GetMessageType() { case api.RequestMessage: - return order.Uint32(data[6:10]), nil + return binary.BigEndian.Uint32(data[6:10]), nil case api.ReplyMessage: - return order.Uint32(data[2:6]), nil + return binary.BigEndian.Uint32(data[2:6]), nil } return 0, nil diff --git a/codec/msg_codec_test.go b/codec/msg_codec_test.go index c950fd8..c0f94da 100644 --- a/codec/msg_codec_test.go +++ b/codec/msg_codec_test.go @@ -2,13 +2,14 @@ package codec_test import ( "bytes" - "git.fd.io/govpp.git/examples/binapi/ip_types" "testing" "git.fd.io/govpp.git/api" + "git.fd.io/govpp.git/binapi/ip" + "git.fd.io/govpp.git/binapi/ip_types" + "git.fd.io/govpp.git/binapi/sr" + "git.fd.io/govpp.git/binapi/vpe" "git.fd.io/govpp.git/codec" - "git.fd.io/govpp.git/examples/binapi/ip" - "git.fd.io/govpp.git/examples/binapi/vpe" ) type MyMsg struct { @@ -58,18 +59,20 @@ func TestEncode(t *testing.T) { msgID: 743, expData: []byte{0x02, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, }, - /*{name: "sr", + {name: "sr", msg: &sr.SrPolicyAdd{ - BsidAddr: sr.IP6Address{}, - Weight: 0, + BsidAddr: ip_types.IP6Address{}, + Weight: 3, IsEncap: false, - IsSpray: false, - FibTable: 0, - Sids: sr.Srv6SidList{}, + IsSpray: true, + FibTable: 5, + Sids: sr.Srv6SidList{Weight: 2}, }, - msgID: 99, - expData: []byte{0x00, 0x64, 0x00, 0x01, 0x41, 0x62, 0x63, 0x64, 0x65, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xE8}, - },*/ + msgID: 99, + expData: []byte{ + 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { @@ -80,7 +83,7 @@ func TestEncode(t *testing.T) { t.Fatalf("expected nil error, got: %v", err) } if !bytes.Equal(data, test.expData) { - t.Fatalf("expected data: % 0X, got: % 0X", test.expData, data) + t.Fatalf("expected data:\n% 0X, got:\n% 0X", test.expData, data) } }) } @@ -95,4 +98,5 @@ func TestEncodePanic(t *testing.T) { if err == nil { t.Fatalf("expected non-nil error, got: %v", err) } + t.Logf("err: %v", err) } diff --git a/codec/testdata/binapi2001/acl/acl.ba.go b/codec/testdata/binapi2001/acl/acl.ba.go deleted file mode 100644 index 7253552..0000000 --- a/codec/testdata/binapi2001/acl/acl.ba.go +++ /dev/null @@ -1,2885 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.01-45~g7a071e370~b63 -// source: /usr/share/vpp/api/plugins/acl.api.json - -/* -Package acl contains generated code for VPP binary API defined by acl.api (version 1.0.1). - -It consists of: - 38 messages - 2 types -*/ -package acl - -import ( - "bytes" - "context" - "encoding/binary" - "io" - "math" - "strconv" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "acl" - // APIVersion is the API version of this module. - APIVersion = "1.0.1" - // VersionCrc is the CRC of this module. - VersionCrc = 0x11c5c1e5 -) - -// ACLRule represents VPP binary API type 'acl_rule'. -type ACLRule struct { - IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` - IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` - SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` - SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` - DstIPAddr []byte `binapi:"u8[16],name=dst_ip_addr" json:"dst_ip_addr,omitempty" struc:"[16]byte"` - DstIPPrefixLen uint8 `binapi:"u8,name=dst_ip_prefix_len" json:"dst_ip_prefix_len,omitempty"` - Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` - SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` - SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` - DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` - DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` - TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` - TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` -} - -func (*ACLRule) GetTypeName() string { return "acl_rule" } - -// MacipACLRule represents VPP binary API type 'macip_acl_rule'. -type MacipACLRule struct { - IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` - IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` - SrcMac []byte `binapi:"u8[6],name=src_mac" json:"src_mac,omitempty" struc:"[6]byte"` - SrcMacMask []byte `binapi:"u8[6],name=src_mac_mask" json:"src_mac_mask,omitempty" struc:"[6]byte"` - SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` - SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` -} - -func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } - -// ACLAddReplace represents VPP binary API message 'acl_add_replace'. -type ACLAddReplace struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } -func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } -func (*ACLAddReplace) GetCrcString() string { return "13bc8539" } -func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLAddReplace) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 ACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.IsIPv6 - size += 1 - // field[2] s1.SrcIPAddr - size += 16 - // field[2] s1.SrcIPPrefixLen - size += 1 - // field[2] s1.DstIPAddr - size += 16 - // field[2] s1.DstIPPrefixLen - size += 1 - // field[2] s1.Proto - size += 1 - // field[2] s1.SrcportOrIcmptypeFirst - size += 2 - // field[2] s1.SrcportOrIcmptypeLast - size += 2 - // field[2] s1.DstportOrIcmpcodeFirst - size += 2 - // field[2] s1.DstportOrIcmpcodeLast - size += 2 - // field[2] s1.TCPFlagsMask - size += 1 - // field[2] s1.TCPFlagsValue - size += 1 - } - return size -} -func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 ACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) - pos += 1 - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) - pos += 1 - // field[2] v1.DstIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.DstIPAddr) { - x = uint8(v1.DstIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.DstIPPrefixLen - buf[pos] = uint8(v1.DstIPPrefixLen) - pos += 1 - // field[2] v1.Proto - buf[pos] = uint8(v1.Proto) - pos += 1 - // field[2] v1.SrcportOrIcmptypeFirst - o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) - pos += 2 - // field[2] v1.SrcportOrIcmptypeLast - o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) - pos += 2 - // field[2] v1.DstportOrIcmpcodeFirst - o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) - pos += 2 - // field[2] v1.DstportOrIcmpcodeLast - o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) - pos += 2 - // field[2] v1.TCPFlagsMask - buf[pos] = uint8(v1.TCPFlagsMask) - pos += 1 - // field[2] v1.TCPFlagsValue - buf[pos] = uint8(v1.TCPFlagsValue) - pos += 1 - } - return buf, nil -} -func (m *ACLAddReplace) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]ACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].DstIPAddr - m.R[j1].DstIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].DstIPAddr); i++ { - m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].DstIPPrefixLen - m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].Proto - m.R[j1].Proto = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcportOrIcmptypeFirst - m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].SrcportOrIcmptypeLast - m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].DstportOrIcmpcodeFirst - m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].DstportOrIcmpcodeLast - m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].TCPFlagsMask - m.R[j1].TCPFlagsMask = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].TCPFlagsValue - m.R[j1].TCPFlagsValue = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply'. -type ACLAddReplaceReply struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLAddReplaceReply) Reset() { *m = ACLAddReplaceReply{} } -func (*ACLAddReplaceReply) GetMessageName() string { return "acl_add_replace_reply" } -func (*ACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } -func (*ACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLAddReplaceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLAddReplaceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLDel represents VPP binary API message 'acl_del'. -type ACLDel struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *ACLDel) Reset() { *m = ACLDel{} } -func (*ACLDel) GetMessageName() string { return "acl_del" } -func (*ACLDel) GetCrcString() string { return "ef34fea4" } -func (*ACLDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *ACLDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *ACLDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLDelReply represents VPP binary API message 'acl_del_reply'. -type ACLDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLDelReply) Reset() { *m = ACLDelReply{} } -func (*ACLDelReply) GetMessageName() string { return "acl_del_reply" } -func (*ACLDelReply) GetCrcString() string { return "e8d4e804" } -func (*ACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLDetails represents VPP binary API message 'acl_details'. -type ACLDetails struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *ACLDetails) Reset() { *m = ACLDetails{} } -func (*ACLDetails) GetMessageName() string { return "acl_details" } -func (*ACLDetails) GetCrcString() string { return "f89d7a88" } -func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 ACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.IsIPv6 - size += 1 - // field[2] s1.SrcIPAddr - size += 16 - // field[2] s1.SrcIPPrefixLen - size += 1 - // field[2] s1.DstIPAddr - size += 16 - // field[2] s1.DstIPPrefixLen - size += 1 - // field[2] s1.Proto - size += 1 - // field[2] s1.SrcportOrIcmptypeFirst - size += 2 - // field[2] s1.SrcportOrIcmptypeLast - size += 2 - // field[2] s1.DstportOrIcmpcodeFirst - size += 2 - // field[2] s1.DstportOrIcmpcodeLast - size += 2 - // field[2] s1.TCPFlagsMask - size += 1 - // field[2] s1.TCPFlagsValue - size += 1 - } - return size -} -func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 ACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) - pos += 1 - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) - pos += 1 - // field[2] v1.DstIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.DstIPAddr) { - x = uint8(v1.DstIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.DstIPPrefixLen - buf[pos] = uint8(v1.DstIPPrefixLen) - pos += 1 - // field[2] v1.Proto - buf[pos] = uint8(v1.Proto) - pos += 1 - // field[2] v1.SrcportOrIcmptypeFirst - o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) - pos += 2 - // field[2] v1.SrcportOrIcmptypeLast - o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) - pos += 2 - // field[2] v1.DstportOrIcmpcodeFirst - o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) - pos += 2 - // field[2] v1.DstportOrIcmpcodeLast - o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) - pos += 2 - // field[2] v1.TCPFlagsMask - buf[pos] = uint8(v1.TCPFlagsMask) - pos += 1 - // field[2] v1.TCPFlagsValue - buf[pos] = uint8(v1.TCPFlagsValue) - pos += 1 - } - return buf, nil -} -func (m *ACLDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]ACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].DstIPAddr - m.R[j1].DstIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].DstIPAddr); i++ { - m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].DstIPPrefixLen - m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].Proto - m.R[j1].Proto = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcportOrIcmptypeFirst - m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].SrcportOrIcmptypeLast - m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].DstportOrIcmpcodeFirst - m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].DstportOrIcmpcodeLast - m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].TCPFlagsMask - m.R[j1].TCPFlagsMask = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].TCPFlagsValue - m.R[j1].TCPFlagsValue = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// ACLDump represents VPP binary API message 'acl_dump'. -type ACLDump struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *ACLDump) Reset() { *m = ACLDump{} } -func (*ACLDump) GetMessageName() string { return "acl_dump" } -func (*ACLDump) GetCrcString() string { return "ef34fea4" } -func (*ACLDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *ACLDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *ACLDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. -type ACLInterfaceAddDel struct { - IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` - IsInput uint8 `binapi:"u8,name=is_input" json:"is_input,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } -func (*ACLInterfaceAddDel) GetMessageName() string { return "acl_interface_add_del" } -func (*ACLInterfaceAddDel) GetCrcString() string { return "0b2aedd1" } -func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.IsInput - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - buf[pos] = uint8(m.IsAdd) - pos += 1 - // field[1] m.IsInput - buf[pos] = uint8(m.IsInput) - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = uint8(tmp[pos]) - pos += 1 - // field[1] m.IsInput - m.IsInput = uint8(tmp[pos]) - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply'. -type ACLInterfaceAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLInterfaceAddDelReply) Reset() { *m = ACLInterfaceAddDelReply{} } -func (*ACLInterfaceAddDelReply) GetMessageName() string { return "acl_interface_add_del_reply" } -func (*ACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. -type ACLInterfaceEtypeWhitelistDetails struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` -} - -func (m *ACLInterfaceEtypeWhitelistDetails) Reset() { *m = ACLInterfaceEtypeWhitelistDetails{} } -func (*ACLInterfaceEtypeWhitelistDetails) GetMessageName() string { - return "acl_interface_etype_whitelist_details" -} -func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { return "6a5d4e81" } -func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceEtypeWhitelistDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.NInput - size += 1 - // field[1] m.Whitelist - size += 2 * len(m.Whitelist) - return size -} -func (m *ACLInterfaceEtypeWhitelistDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Whitelist)) - pos += 1 - // field[1] m.NInput - buf[pos] = uint8(m.NInput) - pos += 1 - // field[1] m.Whitelist - for i := 0; i < len(m.Whitelist); i++ { - var x uint16 - if i < len(m.Whitelist) { - x = uint16(m.Whitelist[i]) - } - o.PutUint16(buf[pos:pos+2], uint16(x)) - pos += 2 - } - return buf, nil -} -func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.NInput - m.NInput = uint8(tmp[pos]) - pos += 1 - // field[1] m.Whitelist - m.Whitelist = make([]uint16, m.Count) - for i := 0; i < len(m.Whitelist); i++ { - m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - } - return nil -} - -// ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. -type ACLInterfaceEtypeWhitelistDump struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *ACLInterfaceEtypeWhitelistDump) Reset() { *m = ACLInterfaceEtypeWhitelistDump{} } -func (*ACLInterfaceEtypeWhitelistDump) GetMessageName() string { - return "acl_interface_etype_whitelist_dump" -} -func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { return "529cb13f" } -func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceEtypeWhitelistDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *ACLInterfaceEtypeWhitelistDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. -type ACLInterfaceListDetails struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` -} - -func (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } -func (*ACLInterfaceListDetails) GetMessageName() string { return "acl_interface_list_details" } -func (*ACLInterfaceListDetails) GetCrcString() string { return "d5e80809" } -func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceListDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.NInput - size += 1 - // field[1] m.Acls - size += 4 * len(m.Acls) - return size -} -func (m *ACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Acls)) - pos += 1 - // field[1] m.NInput - buf[pos] = uint8(m.NInput) - pos += 1 - // field[1] m.Acls - for i := 0; i < len(m.Acls); i++ { - var x uint32 - if i < len(m.Acls) { - x = uint32(m.Acls[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.NInput - m.NInput = uint8(tmp[pos]) - pos += 1 - // field[1] m.Acls - m.Acls = make([]uint32, m.Count) - for i := 0; i < len(m.Acls); i++ { - m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. -type ACLInterfaceListDump struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } -func (*ACLInterfaceListDump) GetMessageName() string { return "acl_interface_list_dump" } -func (*ACLInterfaceListDump) GetCrcString() string { return "529cb13f" } -func (*ACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceListDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *ACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceListDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. -type ACLInterfaceSetACLList struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` -} - -func (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } -func (*ACLInterfaceSetACLList) GetMessageName() string { return "acl_interface_set_acl_list" } -func (*ACLInterfaceSetACLList) GetCrcString() string { return "8baece38" } -func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceSetACLList) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.NInput - size += 1 - // field[1] m.Acls - size += 4 * len(m.Acls) - return size -} -func (m *ACLInterfaceSetACLList) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Acls)) - pos += 1 - // field[1] m.NInput - buf[pos] = uint8(m.NInput) - pos += 1 - // field[1] m.Acls - for i := 0; i < len(m.Acls); i++ { - var x uint32 - if i < len(m.Acls) { - x = uint32(m.Acls[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *ACLInterfaceSetACLList) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.NInput - m.NInput = uint8(tmp[pos]) - pos += 1 - // field[1] m.Acls - m.Acls = make([]uint32, m.Count) - for i := 0; i < len(m.Acls); i++ { - m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply'. -type ACLInterfaceSetACLListReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLInterfaceSetACLListReply) Reset() { *m = ACLInterfaceSetACLListReply{} } -func (*ACLInterfaceSetACLListReply) GetMessageName() string { - return "acl_interface_set_acl_list_reply" -} -func (*ACLInterfaceSetACLListReply) GetCrcString() string { return "e8d4e804" } -func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceSetACLListReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLInterfaceSetACLListReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceSetACLListReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. -type ACLInterfaceSetEtypeWhitelist struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` -} - -func (m *ACLInterfaceSetEtypeWhitelist) Reset() { *m = ACLInterfaceSetEtypeWhitelist{} } -func (*ACLInterfaceSetEtypeWhitelist) GetMessageName() string { - return "acl_interface_set_etype_whitelist" -} -func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { return "f515efc5" } -func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceSetEtypeWhitelist) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.NInput - size += 1 - // field[1] m.Whitelist - size += 2 * len(m.Whitelist) - return size -} -func (m *ACLInterfaceSetEtypeWhitelist) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Whitelist)) - pos += 1 - // field[1] m.NInput - buf[pos] = uint8(m.NInput) - pos += 1 - // field[1] m.Whitelist - for i := 0; i < len(m.Whitelist); i++ { - var x uint16 - if i < len(m.Whitelist) { - x = uint16(m.Whitelist[i]) - } - o.PutUint16(buf[pos:pos+2], uint16(x)) - pos += 2 - } - return buf, nil -} -func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.NInput - m.NInput = uint8(tmp[pos]) - pos += 1 - // field[1] m.Whitelist - m.Whitelist = make([]uint16, m.Count) - for i := 0; i < len(m.Whitelist); i++ { - m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - } - return nil -} - -// ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply'. -type ACLInterfaceSetEtypeWhitelistReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLInterfaceSetEtypeWhitelistReply) Reset() { *m = ACLInterfaceSetEtypeWhitelistReply{} } -func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageName() string { - return "acl_interface_set_etype_whitelist_reply" -} -func (*ACLInterfaceSetEtypeWhitelistReply) GetCrcString() string { return "e8d4e804" } -func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceSetEtypeWhitelistReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLInterfaceSetEtypeWhitelistReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceSetEtypeWhitelistReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping'. -type ACLPluginControlPing struct{} - -func (m *ACLPluginControlPing) Reset() { *m = ACLPluginControlPing{} } -func (*ACLPluginControlPing) GetMessageName() string { return "acl_plugin_control_ping" } -func (*ACLPluginControlPing) GetCrcString() string { return "51077d14" } -func (*ACLPluginControlPing) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLPluginControlPing) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ACLPluginControlPing) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ACLPluginControlPing) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply'. -type ACLPluginControlPingReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` - VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` -} - -func (m *ACLPluginControlPingReply) Reset() { *m = ACLPluginControlPingReply{} } -func (*ACLPluginControlPingReply) GetMessageName() string { return "acl_plugin_control_ping_reply" } -func (*ACLPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } -func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLPluginControlPingReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.ClientIndex - size += 4 - // field[1] m.VpePID - size += 4 - return size -} -func (m *ACLPluginControlPingReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.ClientIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) - pos += 4 - // field[1] m.VpePID - o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) - pos += 4 - return buf, nil -} -func (m *ACLPluginControlPingReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ClientIndex - m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VpePID - m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries'. -type ACLPluginGetConnTableMaxEntries struct{} - -func (m *ACLPluginGetConnTableMaxEntries) Reset() { *m = ACLPluginGetConnTableMaxEntries{} } -func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { - return "acl_plugin_get_conn_table_max_entries" -} -func (*ACLPluginGetConnTableMaxEntries) GetCrcString() string { return "51077d14" } -func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLPluginGetConnTableMaxEntries) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ACLPluginGetConnTableMaxEntries) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ACLPluginGetConnTableMaxEntries) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply'. -type ACLPluginGetConnTableMaxEntriesReply struct { - ConnTableMaxEntries uint64 `binapi:"u64,name=conn_table_max_entries" json:"conn_table_max_entries,omitempty"` -} - -func (m *ACLPluginGetConnTableMaxEntriesReply) Reset() { *m = ACLPluginGetConnTableMaxEntriesReply{} } -func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageName() string { - return "acl_plugin_get_conn_table_max_entries_reply" -} -func (*ACLPluginGetConnTableMaxEntriesReply) GetCrcString() string { return "7a096d3d" } -func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *ACLPluginGetConnTableMaxEntriesReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ConnTableMaxEntries - size += 8 - return size -} -func (m *ACLPluginGetConnTableMaxEntriesReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ConnTableMaxEntries - o.PutUint64(buf[pos:pos+8], uint64(m.ConnTableMaxEntries)) - pos += 8 - return buf, nil -} -func (m *ACLPluginGetConnTableMaxEntriesReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ConnTableMaxEntries - m.ConnTableMaxEntries = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version'. -type ACLPluginGetVersion struct{} - -func (m *ACLPluginGetVersion) Reset() { *m = ACLPluginGetVersion{} } -func (*ACLPluginGetVersion) GetMessageName() string { return "acl_plugin_get_version" } -func (*ACLPluginGetVersion) GetCrcString() string { return "51077d14" } -func (*ACLPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLPluginGetVersion) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ACLPluginGetVersion) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ACLPluginGetVersion) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply'. -type ACLPluginGetVersionReply struct { - Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` - Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` -} - -func (m *ACLPluginGetVersionReply) Reset() { *m = ACLPluginGetVersionReply{} } -func (*ACLPluginGetVersionReply) GetMessageName() string { return "acl_plugin_get_version_reply" } -func (*ACLPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } -func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLPluginGetVersionReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Major - size += 4 - // field[1] m.Minor - size += 4 - return size -} -func (m *ACLPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Major - o.PutUint32(buf[pos:pos+4], uint32(m.Major)) - pos += 4 - // field[1] m.Minor - o.PutUint32(buf[pos:pos+4], uint32(m.Minor)) - pos += 4 - return buf, nil -} -func (m *ACLPluginGetVersionReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Major - m.Major = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Minor - m.Minor = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLStatsIntfCountersEnable represents VPP binary API message 'acl_stats_intf_counters_enable'. -type ACLStatsIntfCountersEnable struct { - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` -} - -func (m *ACLStatsIntfCountersEnable) Reset() { *m = ACLStatsIntfCountersEnable{} } -func (*ACLStatsIntfCountersEnable) GetMessageName() string { return "acl_stats_intf_counters_enable" } -func (*ACLStatsIntfCountersEnable) GetCrcString() string { return "b3e225d2" } -func (*ACLStatsIntfCountersEnable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLStatsIntfCountersEnable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Enable - size += 1 - return size -} -func (m *ACLStatsIntfCountersEnable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Enable - if m.Enable { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *ACLStatsIntfCountersEnable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Enable - m.Enable = tmp[pos] != 0 - pos += 1 - return nil -} - -// ACLStatsIntfCountersEnableReply represents VPP binary API message 'acl_stats_intf_counters_enable_reply'. -type ACLStatsIntfCountersEnableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLStatsIntfCountersEnableReply) Reset() { *m = ACLStatsIntfCountersEnableReply{} } -func (*ACLStatsIntfCountersEnableReply) GetMessageName() string { - return "acl_stats_intf_counters_enable_reply" -} -func (*ACLStatsIntfCountersEnableReply) GetCrcString() string { return "e8d4e804" } -func (*ACLStatsIntfCountersEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLStatsIntfCountersEnableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLStatsIntfCountersEnableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLStatsIntfCountersEnableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLAdd represents VPP binary API message 'macip_acl_add'. -type MacipACLAdd struct { - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } -func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } -func (*MacipACLAdd) GetCrcString() string { return "0c680ca5" } -func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLAdd) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 MacipACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.IsIPv6 - size += 1 - // field[2] s1.SrcMac - size += 6 - // field[2] s1.SrcMacMask - size += 6 - // field[2] s1.SrcIPAddr - size += 16 - // field[2] s1.SrcIPPrefixLen - size += 1 - } - return size -} -func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 MacipACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) - pos += 1 - // field[2] v1.SrcMac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMac) { - x = uint8(v1.SrcMac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcMacMask - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMacMask) { - x = uint8(v1.SrcMacMask[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) - pos += 1 - } - return buf, nil -} -func (m *MacipACLAdd) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]MacipACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcMac - m.R[j1].SrcMac = make([]uint8, 6) - for i := 0; i < len(m.R[j1].SrcMac); i++ { - m.R[j1].SrcMac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcMacMask - m.R[j1].SrcMacMask = make([]uint8, 6) - for i := 0; i < len(m.R[j1].SrcMacMask); i++ { - m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. -type MacipACLAddReplace struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } -func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } -func (*MacipACLAddReplace) GetCrcString() string { return "d3d313e7" } -func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLAddReplace) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 MacipACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.IsIPv6 - size += 1 - // field[2] s1.SrcMac - size += 6 - // field[2] s1.SrcMacMask - size += 6 - // field[2] s1.SrcIPAddr - size += 16 - // field[2] s1.SrcIPPrefixLen - size += 1 - } - return size -} -func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 MacipACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) - pos += 1 - // field[2] v1.SrcMac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMac) { - x = uint8(v1.SrcMac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcMacMask - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMacMask) { - x = uint8(v1.SrcMacMask[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) - pos += 1 - } - return buf, nil -} -func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]MacipACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcMac - m.R[j1].SrcMac = make([]uint8, 6) - for i := 0; i < len(m.R[j1].SrcMac); i++ { - m.R[j1].SrcMac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcMacMask - m.R[j1].SrcMacMask = make([]uint8, 6) - for i := 0; i < len(m.R[j1].SrcMacMask); i++ { - m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply'. -type MacipACLAddReplaceReply struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MacipACLAddReplaceReply) Reset() { *m = MacipACLAddReplaceReply{} } -func (*MacipACLAddReplaceReply) GetMessageName() string { return "macip_acl_add_replace_reply" } -func (*MacipACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } -func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLAddReplaceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Retval - size += 4 - return size -} -func (m *MacipACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MacipACLAddReplaceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply'. -type MacipACLAddReply struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MacipACLAddReply) Reset() { *m = MacipACLAddReply{} } -func (*MacipACLAddReply) GetMessageName() string { return "macip_acl_add_reply" } -func (*MacipACLAddReply) GetCrcString() string { return "ac407b0c" } -func (*MacipACLAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLAddReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Retval - size += 4 - return size -} -func (m *MacipACLAddReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MacipACLAddReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLDel represents VPP binary API message 'macip_acl_del'. -type MacipACLDel struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *MacipACLDel) Reset() { *m = MacipACLDel{} } -func (*MacipACLDel) GetMessageName() string { return "macip_acl_del" } -func (*MacipACLDel) GetCrcString() string { return "ef34fea4" } -func (*MacipACLDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *MacipACLDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *MacipACLDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply'. -type MacipACLDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MacipACLDelReply) Reset() { *m = MacipACLDelReply{} } -func (*MacipACLDelReply) GetMessageName() string { return "macip_acl_del_reply" } -func (*MacipACLDelReply) GetCrcString() string { return "e8d4e804" } -func (*MacipACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MacipACLDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MacipACLDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLDetails represents VPP binary API message 'macip_acl_details'. -type MacipACLDetails struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } -func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } -func (*MacipACLDetails) GetCrcString() string { return "e164e69a" } -func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 MacipACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.IsIPv6 - size += 1 - // field[2] s1.SrcMac - size += 6 - // field[2] s1.SrcMacMask - size += 6 - // field[2] s1.SrcIPAddr - size += 16 - // field[2] s1.SrcIPPrefixLen - size += 1 - } - return size -} -func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Tag - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.Tag) { - x = uint8(m.Tag[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 MacipACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) - pos += 1 - // field[2] v1.SrcMac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMac) { - x = uint8(v1.SrcMac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcMacMask - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMacMask) { - x = uint8(v1.SrcMacMask[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v1.SrcIPAddr) { - x = uint8(v1.SrcIPAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcIPPrefixLen - buf[pos] = uint8(v1.SrcIPPrefixLen) - pos += 1 - } - return buf, nil -} -func (m *MacipACLDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - m.Tag = make([]uint8, 64) - for i := 0; i < len(m.Tag); i++ { - m.Tag[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]MacipACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcMac - m.R[j1].SrcMac = make([]uint8, 6) - for i := 0; i < len(m.R[j1].SrcMac); i++ { - m.R[j1].SrcMac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcMacMask - m.R[j1].SrcMacMask = make([]uint8, 6) - for i := 0; i < len(m.R[j1].SrcMacMask); i++ { - m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPAddr - m.R[j1].SrcIPAddr = make([]uint8, 16) - for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { - m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcIPPrefixLen - m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// MacipACLDump represents VPP binary API message 'macip_acl_dump'. -type MacipACLDump struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *MacipACLDump) Reset() { *m = MacipACLDump{} } -func (*MacipACLDump) GetMessageName() string { return "macip_acl_dump" } -func (*MacipACLDump) GetCrcString() string { return "ef34fea4" } -func (*MacipACLDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *MacipACLDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *MacipACLDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. -type MacipACLInterfaceAddDel struct { - IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } -func (*MacipACLInterfaceAddDel) GetMessageName() string { return "macip_acl_interface_add_del" } -func (*MacipACLInterfaceAddDel) GetCrcString() string { return "6a6be97c" } -func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLInterfaceAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - buf[pos] = uint8(m.IsAdd) - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *MacipACLInterfaceAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = uint8(tmp[pos]) - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply'. -type MacipACLInterfaceAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MacipACLInterfaceAddDelReply) Reset() { *m = MacipACLInterfaceAddDelReply{} } -func (*MacipACLInterfaceAddDelReply) GetMessageName() string { - return "macip_acl_interface_add_del_reply" -} -func (*MacipACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLInterfaceAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MacipACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MacipACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get'. -type MacipACLInterfaceGet struct{} - -func (m *MacipACLInterfaceGet) Reset() { *m = MacipACLInterfaceGet{} } -func (*MacipACLInterfaceGet) GetMessageName() string { return "macip_acl_interface_get" } -func (*MacipACLInterfaceGet) GetCrcString() string { return "51077d14" } -func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLInterfaceGet) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MacipACLInterfaceGet) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MacipACLInterfaceGet) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply'. -type MacipACLInterfaceGetReply struct { - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` -} - -func (m *MacipACLInterfaceGetReply) Reset() { *m = MacipACLInterfaceGetReply{} } -func (*MacipACLInterfaceGetReply) GetMessageName() string { return "macip_acl_interface_get_reply" } -func (*MacipACLInterfaceGetReply) GetCrcString() string { return "accf9b05" } -func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLInterfaceGetReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Count - size += 4 - // field[1] m.Acls - size += 4 * len(m.Acls) - return size -} -func (m *MacipACLInterfaceGetReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.Acls))) - pos += 4 - // field[1] m.Acls - for i := 0; i < len(m.Acls); i++ { - var x uint32 - if i < len(m.Acls) { - x = uint32(m.Acls[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *MacipACLInterfaceGetReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Acls - m.Acls = make([]uint32, m.Count) - for i := 0; i < len(m.Acls); i++ { - m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. -type MacipACLInterfaceListDetails struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` -} - -func (m *MacipACLInterfaceListDetails) Reset() { *m = MacipACLInterfaceListDetails{} } -func (*MacipACLInterfaceListDetails) GetMessageName() string { - return "macip_acl_interface_list_details" -} -func (*MacipACLInterfaceListDetails) GetCrcString() string { return "29783fa0" } -func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLInterfaceListDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.Acls - size += 4 * len(m.Acls) - return size -} -func (m *MacipACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Acls)) - pos += 1 - // field[1] m.Acls - for i := 0; i < len(m.Acls); i++ { - var x uint32 - if i < len(m.Acls) { - x = uint32(m.Acls[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.Acls - m.Acls = make([]uint32, m.Count) - for i := 0; i < len(m.Acls); i++ { - m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. -type MacipACLInterfaceListDump struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } -func (*MacipACLInterfaceListDump) GetMessageName() string { return "macip_acl_interface_list_dump" } -func (*MacipACLInterfaceListDump) GetCrcString() string { return "529cb13f" } -func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLInterfaceListDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *MacipACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *MacipACLInterfaceListDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -func init() { file_acl_binapi_init() } -func file_acl_binapi_init() { - api.RegisterMessage((*ACLAddReplace)(nil), "acl.ACLAddReplace") - api.RegisterMessage((*ACLAddReplaceReply)(nil), "acl.ACLAddReplaceReply") - api.RegisterMessage((*ACLDel)(nil), "acl.ACLDel") - api.RegisterMessage((*ACLDelReply)(nil), "acl.ACLDelReply") - api.RegisterMessage((*ACLDetails)(nil), "acl.ACLDetails") - api.RegisterMessage((*ACLDump)(nil), "acl.ACLDump") - api.RegisterMessage((*ACLInterfaceAddDel)(nil), "acl.ACLInterfaceAddDel") - api.RegisterMessage((*ACLInterfaceAddDelReply)(nil), "acl.ACLInterfaceAddDelReply") - api.RegisterMessage((*ACLInterfaceEtypeWhitelistDetails)(nil), "acl.ACLInterfaceEtypeWhitelistDetails") - api.RegisterMessage((*ACLInterfaceEtypeWhitelistDump)(nil), "acl.ACLInterfaceEtypeWhitelistDump") - api.RegisterMessage((*ACLInterfaceListDetails)(nil), "acl.ACLInterfaceListDetails") - api.RegisterMessage((*ACLInterfaceListDump)(nil), "acl.ACLInterfaceListDump") - api.RegisterMessage((*ACLInterfaceSetACLList)(nil), "acl.ACLInterfaceSetACLList") - api.RegisterMessage((*ACLInterfaceSetACLListReply)(nil), "acl.ACLInterfaceSetACLListReply") - api.RegisterMessage((*ACLInterfaceSetEtypeWhitelist)(nil), "acl.ACLInterfaceSetEtypeWhitelist") - api.RegisterMessage((*ACLInterfaceSetEtypeWhitelistReply)(nil), "acl.ACLInterfaceSetEtypeWhitelistReply") - api.RegisterMessage((*ACLPluginControlPing)(nil), "acl.ACLPluginControlPing") - api.RegisterMessage((*ACLPluginControlPingReply)(nil), "acl.ACLPluginControlPingReply") - api.RegisterMessage((*ACLPluginGetConnTableMaxEntries)(nil), "acl.ACLPluginGetConnTableMaxEntries") - api.RegisterMessage((*ACLPluginGetConnTableMaxEntriesReply)(nil), "acl.ACLPluginGetConnTableMaxEntriesReply") - api.RegisterMessage((*ACLPluginGetVersion)(nil), "acl.ACLPluginGetVersion") - api.RegisterMessage((*ACLPluginGetVersionReply)(nil), "acl.ACLPluginGetVersionReply") - api.RegisterMessage((*ACLStatsIntfCountersEnable)(nil), "acl.ACLStatsIntfCountersEnable") - api.RegisterMessage((*ACLStatsIntfCountersEnableReply)(nil), "acl.ACLStatsIntfCountersEnableReply") - api.RegisterMessage((*MacipACLAdd)(nil), "acl.MacipACLAdd") - api.RegisterMessage((*MacipACLAddReplace)(nil), "acl.MacipACLAddReplace") - api.RegisterMessage((*MacipACLAddReplaceReply)(nil), "acl.MacipACLAddReplaceReply") - api.RegisterMessage((*MacipACLAddReply)(nil), "acl.MacipACLAddReply") - api.RegisterMessage((*MacipACLDel)(nil), "acl.MacipACLDel") - api.RegisterMessage((*MacipACLDelReply)(nil), "acl.MacipACLDelReply") - api.RegisterMessage((*MacipACLDetails)(nil), "acl.MacipACLDetails") - api.RegisterMessage((*MacipACLDump)(nil), "acl.MacipACLDump") - api.RegisterMessage((*MacipACLInterfaceAddDel)(nil), "acl.MacipACLInterfaceAddDel") - api.RegisterMessage((*MacipACLInterfaceAddDelReply)(nil), "acl.MacipACLInterfaceAddDelReply") - api.RegisterMessage((*MacipACLInterfaceGet)(nil), "acl.MacipACLInterfaceGet") - api.RegisterMessage((*MacipACLInterfaceGetReply)(nil), "acl.MacipACLInterfaceGetReply") - api.RegisterMessage((*MacipACLInterfaceListDetails)(nil), "acl.MacipACLInterfaceListDetails") - api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*ACLAddReplace)(nil), - (*ACLAddReplaceReply)(nil), - (*ACLDel)(nil), - (*ACLDelReply)(nil), - (*ACLDetails)(nil), - (*ACLDump)(nil), - (*ACLInterfaceAddDel)(nil), - (*ACLInterfaceAddDelReply)(nil), - (*ACLInterfaceEtypeWhitelistDetails)(nil), - (*ACLInterfaceEtypeWhitelistDump)(nil), - (*ACLInterfaceListDetails)(nil), - (*ACLInterfaceListDump)(nil), - (*ACLInterfaceSetACLList)(nil), - (*ACLInterfaceSetACLListReply)(nil), - (*ACLInterfaceSetEtypeWhitelist)(nil), - (*ACLInterfaceSetEtypeWhitelistReply)(nil), - (*ACLPluginControlPing)(nil), - (*ACLPluginControlPingReply)(nil), - (*ACLPluginGetConnTableMaxEntries)(nil), - (*ACLPluginGetConnTableMaxEntriesReply)(nil), - (*ACLPluginGetVersion)(nil), - (*ACLPluginGetVersionReply)(nil), - (*ACLStatsIntfCountersEnable)(nil), - (*ACLStatsIntfCountersEnableReply)(nil), - (*MacipACLAdd)(nil), - (*MacipACLAddReplace)(nil), - (*MacipACLAddReplaceReply)(nil), - (*MacipACLAddReply)(nil), - (*MacipACLDel)(nil), - (*MacipACLDelReply)(nil), - (*MacipACLDetails)(nil), - (*MacipACLDump)(nil), - (*MacipACLInterfaceAddDel)(nil), - (*MacipACLInterfaceAddDelReply)(nil), - (*MacipACLInterfaceGet)(nil), - (*MacipACLInterfaceGetReply)(nil), - (*MacipACLInterfaceListDetails)(nil), - (*MacipACLInterfaceListDump)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/acl/acl_rpc.ba.go b/codec/testdata/binapi2001/acl/acl_rpc.ba.go deleted file mode 100644 index 62b10c3..0000000 --- a/codec/testdata/binapi2001/acl/acl_rpc.ba.go +++ /dev/null @@ -1,302 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package acl - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for acl module. -type RPCService interface { - DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) - DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) - DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) - DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) - DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) - ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) - ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) - ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) - ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) - ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) - ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) - ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) - ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) - ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) - MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) - MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) - MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) - MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) - MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpACLClient{stream} - return x, nil -} - -type RPCService_DumpACLClient interface { - Recv() (*ACLDetails, error) -} - -type serviceClient_DumpACLClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpACLClient) Recv() (*ACLDetails, error) { - m := new(ACLDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpACLInterfaceEtypeWhitelistClient{stream} - return x, nil -} - -type RPCService_DumpACLInterfaceEtypeWhitelistClient interface { - Recv() (*ACLInterfaceEtypeWhitelistDetails, error) -} - -type serviceClient_DumpACLInterfaceEtypeWhitelistClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpACLInterfaceEtypeWhitelistClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { - m := new(ACLInterfaceEtypeWhitelistDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpACLInterfaceListClient{stream} - return x, nil -} - -type RPCService_DumpACLInterfaceListClient interface { - Recv() (*ACLInterfaceListDetails, error) -} - -type serviceClient_DumpACLInterfaceListClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpACLInterfaceListClient) Recv() (*ACLInterfaceListDetails, error) { - m := new(ACLInterfaceListDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMacipACLClient{stream} - return x, nil -} - -type RPCService_DumpMacipACLClient interface { - Recv() (*MacipACLDetails, error) -} - -type serviceClient_DumpMacipACLClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMacipACLClient) Recv() (*MacipACLDetails, error) { - m := new(MacipACLDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMacipACLInterfaceListClient{stream} - return x, nil -} - -type RPCService_DumpMacipACLInterfaceListClient interface { - Recv() (*MacipACLInterfaceListDetails, error) -} - -type serviceClient_DumpMacipACLInterfaceListClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMacipACLInterfaceListClient) Recv() (*MacipACLInterfaceListDetails, error) { - m := new(MacipACLInterfaceListDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { - out := new(ACLAddReplaceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { - out := new(ACLDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { - out := new(ACLInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { - out := new(ACLInterfaceSetACLListReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { - out := new(ACLInterfaceSetEtypeWhitelistReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { - out := new(ACLPluginControlPingReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { - out := new(ACLPluginGetConnTableMaxEntriesReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { - out := new(ACLPluginGetVersionReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) { - out := new(ACLStatsIntfCountersEnableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { - out := new(MacipACLAddReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { - out := new(MacipACLAddReplaceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { - out := new(MacipACLDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { - out := new(MacipACLInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { - out := new(MacipACLInterfaceGetReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/codec/testdata/binapi2001/af_packet/af_packet.ba.go b/codec/testdata/binapi2001/af_packet/af_packet.ba.go deleted file mode 100644 index 82b89b3..0000000 --- a/codec/testdata/binapi2001/af_packet/af_packet.ba.go +++ /dev/null @@ -1,725 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.01-45~g7a071e370~b63 -// source: /usr/share/vpp/api/core/af_packet.api.json - -/* -Package af_packet contains generated code for VPP binary API defined by af_packet.api (version 2.0.0). - -It consists of: - 2 aliases - 6 enums - 8 messages -*/ -package af_packet - -import ( - "bytes" - "context" - "encoding/binary" - "io" - "math" - "strconv" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "af_packet" - // APIVersion is the API version of this module. - APIVersion = "2.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0xba745e20 -) - -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) - -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" -} - -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 - -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) - -var ( - IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, - } -) - -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} - -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} - -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var ( - MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" -} - -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -// AfPacketCreate represents VPP binary API message 'af_packet_create'. -type AfPacketCreate struct { - HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` - UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"` - HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` -} - -func (m *AfPacketCreate) Reset() { *m = AfPacketCreate{} } -func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" } -func (*AfPacketCreate) GetCrcString() string { return "a190415f" } -func (*AfPacketCreate) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AfPacketCreate) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.HwAddr - size += 6 - // field[1] m.UseRandomHwAddr - size += 1 - // field[1] m.HostIfName - size += 64 - return size -} -func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.HwAddr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.HwAddr) { - x = uint8(m.HwAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.UseRandomHwAddr - if m.UseRandomHwAddr { - buf[pos] = 1 - } - pos += 1 - // field[1] m.HostIfName - copy(buf[pos:pos+64], m.HostIfName) - pos += 64 - return buf, nil -} -func (m *AfPacketCreate) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.HwAddr - for i := 0; i < len(m.HwAddr); i++ { - m.HwAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.UseRandomHwAddr - m.UseRandomHwAddr = tmp[pos] != 0 - pos += 1 - // field[1] m.HostIfName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'. -type AfPacketCreateReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *AfPacketCreateReply) Reset() { *m = AfPacketCreateReply{} } -func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" } -func (*AfPacketCreateReply) GetCrcString() string { return "5383d31f" } -func (*AfPacketCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AfPacketCreateReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *AfPacketCreateReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// AfPacketDelete represents VPP binary API message 'af_packet_delete'. -type AfPacketDelete struct { - HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` -} - -func (m *AfPacketDelete) Reset() { *m = AfPacketDelete{} } -func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" } -func (*AfPacketDelete) GetCrcString() string { return "863fa648" } -func (*AfPacketDelete) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AfPacketDelete) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.HostIfName - size += 64 - return size -} -func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.HostIfName - copy(buf[pos:pos+64], m.HostIfName) - pos += 64 - return buf, nil -} -func (m *AfPacketDelete) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.HostIfName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply'. -type AfPacketDeleteReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *AfPacketDeleteReply) Reset() { *m = AfPacketDeleteReply{} } -func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" } -func (*AfPacketDeleteReply) GetCrcString() string { return "e8d4e804" } -func (*AfPacketDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AfPacketDeleteReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *AfPacketDeleteReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// AfPacketDetails represents VPP binary API message 'af_packet_details'. -type AfPacketDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` -} - -func (m *AfPacketDetails) Reset() { *m = AfPacketDetails{} } -func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" } -func (*AfPacketDetails) GetCrcString() string { return "58c7c042" } -func (*AfPacketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AfPacketDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.HostIfName - size += 64 - return size -} -func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.HostIfName - copy(buf[pos:pos+64], m.HostIfName) - pos += 64 - return buf, nil -} -func (m *AfPacketDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.HostIfName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// AfPacketDump represents VPP binary API message 'af_packet_dump'. -type AfPacketDump struct{} - -func (m *AfPacketDump) Reset() { *m = AfPacketDump{} } -func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" } -func (*AfPacketDump) GetCrcString() string { return "51077d14" } -func (*AfPacketDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AfPacketDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *AfPacketDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'. -type AfPacketSetL4CksumOffload struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Set bool `binapi:"bool,name=set" json:"set,omitempty"` -} - -func (m *AfPacketSetL4CksumOffload) Reset() { *m = AfPacketSetL4CksumOffload{} } -func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" } -func (*AfPacketSetL4CksumOffload) GetCrcString() string { return "319cd5c8" } -func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AfPacketSetL4CksumOffload) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Set - size += 1 - return size -} -func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Set - if m.Set { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *AfPacketSetL4CksumOffload) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Set - m.Set = tmp[pos] != 0 - pos += 1 - return nil -} - -// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply'. -type AfPacketSetL4CksumOffloadReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} } -func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string { - return "af_packet_set_l4_cksum_offload_reply" -} -func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" } -func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AfPacketSetL4CksumOffloadReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -func init() { file_af_packet_binapi_init() } -func file_af_packet_binapi_init() { - api.RegisterMessage((*AfPacketCreate)(nil), "af_packet.AfPacketCreate") - api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet.AfPacketCreateReply") - api.RegisterMessage((*AfPacketDelete)(nil), "af_packet.AfPacketDelete") - api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet.AfPacketDeleteReply") - api.RegisterMessage((*AfPacketDetails)(nil), "af_packet.AfPacketDetails") - api.RegisterMessage((*AfPacketDump)(nil), "af_packet.AfPacketDump") - api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet.AfPacketSetL4CksumOffload") - api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*AfPacketCreate)(nil), - (*AfPacketCreateReply)(nil), - (*AfPacketDelete)(nil), - (*AfPacketDeleteReply)(nil), - (*AfPacketDetails)(nil), - (*AfPacketDump)(nil), - (*AfPacketSetL4CksumOffload)(nil), - (*AfPacketSetL4CksumOffloadReply)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/af_packet/af_packet_rpc.ba.go b/codec/testdata/binapi2001/af_packet/af_packet_rpc.ba.go deleted file mode 100644 index d2df47a..0000000 --- a/codec/testdata/binapi2001/af_packet/af_packet_rpc.ba.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package af_packet - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for af_packet module. -type RPCService interface { - DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) - AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) - AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) - AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpAfPacketClient{stream} - return x, nil -} - -type RPCService_DumpAfPacketClient interface { - Recv() (*AfPacketDetails, error) -} - -type serviceClient_DumpAfPacketClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpAfPacketClient) Recv() (*AfPacketDetails, error) { - m := new(AfPacketDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { - out := new(AfPacketCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { - out := new(AfPacketDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { - out := new(AfPacketSetL4CksumOffloadReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/codec/testdata/binapi2001/interfaces/interfaces.ba.go b/codec/testdata/binapi2001/interfaces/interfaces.ba.go deleted file mode 100644 index 0c6ff3e..0000000 --- a/codec/testdata/binapi2001/interfaces/interfaces.ba.go +++ /dev/null @@ -1,3961 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.01-45~g7a071e370~b63 -// source: /usr/share/vpp/api/core/interface.api.json - -/* -Package interfaces contains generated code for VPP binary API defined by interface.api (version 3.2.2). - -It consists of: - 7 aliases - 10 enums - 53 messages - 6 types - 1 union -*/ -package interfaces - -import ( - "bytes" - "context" - "encoding/binary" - "io" - "math" - "strconv" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "interface" - // APIVersion is the API version of this module. - APIVersion = "3.2.2" - // VersionCrc is the CRC of this module. - VersionCrc = 0xfebc3ffa -) - -// AddressFamily represents VPP binary API enum 'address_family'. -type AddressFamily uint32 - -const ( - ADDRESS_IP4 AddressFamily = 0 - ADDRESS_IP6 AddressFamily = 1 -) - -var ( - AddressFamily_name = map[uint32]string{ - 0: "ADDRESS_IP4", - 1: "ADDRESS_IP6", - } - AddressFamily_value = map[string]uint32{ - "ADDRESS_IP4": 0, - "ADDRESS_IP6": 1, - } -) - -func (x AddressFamily) String() string { - s, ok := AddressFamily_name[uint32(x)] - if ok { - return s - } - return "AddressFamily(" + strconv.Itoa(int(x)) + ")" -} - -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) - -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" -} - -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 - -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) - -var ( - IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, - } -) - -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} - -// IPDscp represents VPP binary API enum 'ip_dscp'. -type IPDscp uint8 - -const ( - IP_API_DSCP_CS0 IPDscp = 0 - IP_API_DSCP_CS1 IPDscp = 8 - IP_API_DSCP_AF11 IPDscp = 10 - IP_API_DSCP_AF12 IPDscp = 12 - IP_API_DSCP_AF13 IPDscp = 14 - IP_API_DSCP_CS2 IPDscp = 16 - IP_API_DSCP_AF21 IPDscp = 18 - IP_API_DSCP_AF22 IPDscp = 20 - IP_API_DSCP_AF23 IPDscp = 22 - IP_API_DSCP_CS3 IPDscp = 24 - IP_API_DSCP_AF31 IPDscp = 26 - IP_API_DSCP_AF32 IPDscp = 28 - IP_API_DSCP_AF33 IPDscp = 30 - IP_API_DSCP_CS4 IPDscp = 32 - IP_API_DSCP_AF41 IPDscp = 34 - IP_API_DSCP_AF42 IPDscp = 36 - IP_API_DSCP_AF43 IPDscp = 38 - IP_API_DSCP_CS5 IPDscp = 40 - IP_API_DSCP_EF IPDscp = 46 - IP_API_DSCP_CS6 IPDscp = 48 - IP_API_DSCP_CS7 IPDscp = 50 -) - -var ( - IPDscp_name = map[uint8]string{ - 0: "IP_API_DSCP_CS0", - 8: "IP_API_DSCP_CS1", - 10: "IP_API_DSCP_AF11", - 12: "IP_API_DSCP_AF12", - 14: "IP_API_DSCP_AF13", - 16: "IP_API_DSCP_CS2", - 18: "IP_API_DSCP_AF21", - 20: "IP_API_DSCP_AF22", - 22: "IP_API_DSCP_AF23", - 24: "IP_API_DSCP_CS3", - 26: "IP_API_DSCP_AF31", - 28: "IP_API_DSCP_AF32", - 30: "IP_API_DSCP_AF33", - 32: "IP_API_DSCP_CS4", - 34: "IP_API_DSCP_AF41", - 36: "IP_API_DSCP_AF42", - 38: "IP_API_DSCP_AF43", - 40: "IP_API_DSCP_CS5", - 46: "IP_API_DSCP_EF", - 48: "IP_API_DSCP_CS6", - 50: "IP_API_DSCP_CS7", - } - IPDscp_value = map[string]uint8{ - "IP_API_DSCP_CS0": 0, - "IP_API_DSCP_CS1": 8, - "IP_API_DSCP_AF11": 10, - "IP_API_DSCP_AF12": 12, - "IP_API_DSCP_AF13": 14, - "IP_API_DSCP_CS2": 16, - "IP_API_DSCP_AF21": 18, - "IP_API_DSCP_AF22": 20, - "IP_API_DSCP_AF23": 22, - "IP_API_DSCP_CS3": 24, - "IP_API_DSCP_AF31": 26, - "IP_API_DSCP_AF32": 28, - "IP_API_DSCP_AF33": 30, - "IP_API_DSCP_CS4": 32, - "IP_API_DSCP_AF41": 34, - "IP_API_DSCP_AF42": 36, - "IP_API_DSCP_AF43": 38, - "IP_API_DSCP_CS5": 40, - "IP_API_DSCP_EF": 46, - "IP_API_DSCP_CS6": 48, - "IP_API_DSCP_CS7": 50, - } -) - -func (x IPDscp) String() string { - s, ok := IPDscp_name[uint8(x)] - if ok { - return s - } - return "IPDscp(" + strconv.Itoa(int(x)) + ")" -} - -// IPEcn represents VPP binary API enum 'ip_ecn'. -type IPEcn uint8 - -const ( - IP_API_ECN_NONE IPEcn = 0 - IP_API_ECN_ECT0 IPEcn = 1 - IP_API_ECN_ECT1 IPEcn = 2 - IP_API_ECN_CE IPEcn = 3 -) - -var ( - IPEcn_name = map[uint8]string{ - 0: "IP_API_ECN_NONE", - 1: "IP_API_ECN_ECT0", - 2: "IP_API_ECN_ECT1", - 3: "IP_API_ECN_CE", - } - IPEcn_value = map[string]uint8{ - "IP_API_ECN_NONE": 0, - "IP_API_ECN_ECT0": 1, - "IP_API_ECN_ECT1": 2, - "IP_API_ECN_CE": 3, - } -) - -func (x IPEcn) String() string { - s, ok := IPEcn_name[uint8(x)] - if ok { - return s - } - return "IPEcn(" + strconv.Itoa(int(x)) + ")" -} - -// IPProto represents VPP binary API enum 'ip_proto'. -type IPProto uint32 - -const ( - IP_API_PROTO_HOPOPT IPProto = 0 - IP_API_PROTO_ICMP IPProto = 1 - IP_API_PROTO_IGMP IPProto = 2 - IP_API_PROTO_TCP IPProto = 6 - IP_API_PROTO_UDP IPProto = 17 - IP_API_PROTO_GRE IPProto = 47 - IP_API_PROTO_AH IPProto = 50 - IP_API_PROTO_ESP IPProto = 51 - IP_API_PROTO_EIGRP IPProto = 88 - IP_API_PROTO_OSPF IPProto = 89 - IP_API_PROTO_SCTP IPProto = 132 - IP_API_PROTO_RESERVED IPProto = 255 -) - -var ( - IPProto_name = map[uint32]string{ - 0: "IP_API_PROTO_HOPOPT", - 1: "IP_API_PROTO_ICMP", - 2: "IP_API_PROTO_IGMP", - 6: "IP_API_PROTO_TCP", - 17: "IP_API_PROTO_UDP", - 47: "IP_API_PROTO_GRE", - 50: "IP_API_PROTO_AH", - 51: "IP_API_PROTO_ESP", - 88: "IP_API_PROTO_EIGRP", - 89: "IP_API_PROTO_OSPF", - 132: "IP_API_PROTO_SCTP", - 255: "IP_API_PROTO_RESERVED", - } - IPProto_value = map[string]uint32{ - "IP_API_PROTO_HOPOPT": 0, - "IP_API_PROTO_ICMP": 1, - "IP_API_PROTO_IGMP": 2, - "IP_API_PROTO_TCP": 6, - "IP_API_PROTO_UDP": 17, - "IP_API_PROTO_GRE": 47, - "IP_API_PROTO_AH": 50, - "IP_API_PROTO_ESP": 51, - "IP_API_PROTO_EIGRP": 88, - "IP_API_PROTO_OSPF": 89, - "IP_API_PROTO_SCTP": 132, - "IP_API_PROTO_RESERVED": 255, - } -) - -func (x IPProto) String() string { - s, ok := IPProto_name[uint32(x)] - if ok { - return s - } - return "IPProto(" + strconv.Itoa(int(x)) + ")" -} - -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} - -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var ( - MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" -} - -// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. -type AddressWithPrefix Prefix - -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 - -// IP4Address represents VPP binary API alias 'ip4_address'. -type IP4Address [4]uint8 - -// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. -type IP4AddressWithPrefix IP4Prefix - -// IP6Address represents VPP binary API alias 'ip6_address'. -type IP6Address [16]uint8 - -// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. -type IP6AddressWithPrefix IP6Prefix - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -// Address represents VPP binary API type 'address'. -type Address struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` -} - -func (*Address) GetTypeName() string { return "address" } - -// IP4Prefix represents VPP binary API type 'ip4_prefix'. -type IP4Prefix struct { - Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } - -// IP6Prefix represents VPP binary API type 'ip6_prefix'. -type IP6Prefix struct { - Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } - -// Mprefix represents VPP binary API type 'mprefix'. -type Mprefix struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` - GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` - SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` -} - -func (*Mprefix) GetTypeName() string { return "mprefix" } - -// Prefix represents VPP binary API type 'prefix'. -type Prefix struct { - Address Address `binapi:"address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*Prefix) GetTypeName() string { return "prefix" } - -// PrefixMatcher represents VPP binary API type 'prefix_matcher'. -type PrefixMatcher struct { - Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` - Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` -} - -func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } - -// AddressUnion represents VPP binary API union 'address_union'. -type AddressUnion struct { - XXX_UnionData [16]byte -} - -func (*AddressUnion) GetTypeName() string { return "address_union" } - -func AddressUnionIP4(a IP4Address) (u AddressUnion) { - u.SetIP4(a) - return -} -func (u *AddressUnion) SetIP4(a IP4Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -func AddressUnionIP6(a IP6Address) (u AddressUnion) { - u.SetIP6(a) - return -} -func (u *AddressUnion) SetIP6(a IP6Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -// CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. -type CollectDetailedInterfaceStats struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` -} - -func (m *CollectDetailedInterfaceStats) Reset() { *m = CollectDetailedInterfaceStats{} } -func (*CollectDetailedInterfaceStats) GetMessageName() string { - return "collect_detailed_interface_stats" -} -func (*CollectDetailedInterfaceStats) GetCrcString() string { return "5501adee" } -func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CollectDetailedInterfaceStats) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.EnableDisable - size += 1 - return size -} -func (m *CollectDetailedInterfaceStats) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.EnableDisable - if m.EnableDisable { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *CollectDetailedInterfaceStats) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.EnableDisable - m.EnableDisable = tmp[pos] != 0 - pos += 1 - return nil -} - -// CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply'. -type CollectDetailedInterfaceStatsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *CollectDetailedInterfaceStatsReply) Reset() { *m = CollectDetailedInterfaceStatsReply{} } -func (*CollectDetailedInterfaceStatsReply) GetMessageName() string { - return "collect_detailed_interface_stats_reply" -} -func (*CollectDetailedInterfaceStatsReply) GetCrcString() string { return "e8d4e804" } -func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CollectDetailedInterfaceStatsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *CollectDetailedInterfaceStatsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *CollectDetailedInterfaceStatsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateLoopback represents VPP binary API message 'create_loopback'. -type CreateLoopback struct { - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` -} - -func (m *CreateLoopback) Reset() { *m = CreateLoopback{} } -func (*CreateLoopback) GetMessageName() string { return "create_loopback" } -func (*CreateLoopback) GetCrcString() string { return "42bb5d22" } -func (*CreateLoopback) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CreateLoopback) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.MacAddress - size += 6 - return size -} -func (m *CreateLoopback) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *CreateLoopback) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance'. -type CreateLoopbackInstance struct { - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` - IsSpecified bool `binapi:"bool,name=is_specified" json:"is_specified,omitempty"` - UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"` -} - -func (m *CreateLoopbackInstance) Reset() { *m = CreateLoopbackInstance{} } -func (*CreateLoopbackInstance) GetMessageName() string { return "create_loopback_instance" } -func (*CreateLoopbackInstance) GetCrcString() string { return "d36a3ee2" } -func (*CreateLoopbackInstance) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CreateLoopbackInstance) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.MacAddress - size += 6 - // field[1] m.IsSpecified - size += 1 - // field[1] m.UserInstance - size += 4 - return size -} -func (m *CreateLoopbackInstance) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.IsSpecified - if m.IsSpecified { - buf[pos] = 1 - } - pos += 1 - // field[1] m.UserInstance - o.PutUint32(buf[pos:pos+4], uint32(m.UserInstance)) - pos += 4 - return buf, nil -} -func (m *CreateLoopbackInstance) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.IsSpecified - m.IsSpecified = tmp[pos] != 0 - pos += 1 - // field[1] m.UserInstance - m.UserInstance = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply'. -type CreateLoopbackInstanceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *CreateLoopbackInstanceReply) Reset() { *m = CreateLoopbackInstanceReply{} } -func (*CreateLoopbackInstanceReply) GetMessageName() string { return "create_loopback_instance_reply" } -func (*CreateLoopbackInstanceReply) GetCrcString() string { return "5383d31f" } -func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CreateLoopbackInstanceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *CreateLoopbackInstanceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *CreateLoopbackInstanceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateLoopbackReply represents VPP binary API message 'create_loopback_reply'. -type CreateLoopbackReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *CreateLoopbackReply) Reset() { *m = CreateLoopbackReply{} } -func (*CreateLoopbackReply) GetMessageName() string { return "create_loopback_reply" } -func (*CreateLoopbackReply) GetCrcString() string { return "5383d31f" } -func (*CreateLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CreateLoopbackReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *CreateLoopbackReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *CreateLoopbackReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateSubif represents VPP binary API message 'create_subif'. -type CreateSubif struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` - SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` - OuterVlanID uint16 `binapi:"u16,name=outer_vlan_id" json:"outer_vlan_id,omitempty"` - InnerVlanID uint16 `binapi:"u16,name=inner_vlan_id" json:"inner_vlan_id,omitempty"` -} - -func (m *CreateSubif) Reset() { *m = CreateSubif{} } -func (*CreateSubif) GetMessageName() string { return "create_subif" } -func (*CreateSubif) GetCrcString() string { return "cb371063" } -func (*CreateSubif) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CreateSubif) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.SubID - size += 4 - // field[1] m.SubIfFlags - size += 4 - // field[1] m.OuterVlanID - size += 2 - // field[1] m.InnerVlanID - size += 2 - return size -} -func (m *CreateSubif) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.SubID - o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) - pos += 4 - // field[1] m.SubIfFlags - o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) - pos += 4 - // field[1] m.OuterVlanID - o.PutUint16(buf[pos:pos+2], uint16(m.OuterVlanID)) - pos += 2 - // field[1] m.InnerVlanID - o.PutUint16(buf[pos:pos+2], uint16(m.InnerVlanID)) - pos += 2 - return buf, nil -} -func (m *CreateSubif) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SubID - m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SubIfFlags - m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.OuterVlanID - m.OuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.InnerVlanID - m.InnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -// CreateSubifReply represents VPP binary API message 'create_subif_reply'. -type CreateSubifReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *CreateSubifReply) Reset() { *m = CreateSubifReply{} } -func (*CreateSubifReply) GetMessageName() string { return "create_subif_reply" } -func (*CreateSubifReply) GetCrcString() string { return "5383d31f" } -func (*CreateSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CreateSubifReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *CreateSubifReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *CreateSubifReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateVlanSubif represents VPP binary API message 'create_vlan_subif'. -type CreateVlanSubif struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - VlanID uint32 `binapi:"u32,name=vlan_id" json:"vlan_id,omitempty"` -} - -func (m *CreateVlanSubif) Reset() { *m = CreateVlanSubif{} } -func (*CreateVlanSubif) GetMessageName() string { return "create_vlan_subif" } -func (*CreateVlanSubif) GetCrcString() string { return "af34ac8b" } -func (*CreateVlanSubif) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CreateVlanSubif) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.VlanID - size += 4 - return size -} -func (m *CreateVlanSubif) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.VlanID - o.PutUint32(buf[pos:pos+4], uint32(m.VlanID)) - pos += 4 - return buf, nil -} -func (m *CreateVlanSubif) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VlanID - m.VlanID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply'. -type CreateVlanSubifReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *CreateVlanSubifReply) Reset() { *m = CreateVlanSubifReply{} } -func (*CreateVlanSubifReply) GetMessageName() string { return "create_vlan_subif_reply" } -func (*CreateVlanSubifReply) GetCrcString() string { return "5383d31f" } -func (*CreateVlanSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CreateVlanSubifReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *CreateVlanSubifReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *CreateVlanSubifReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// DeleteLoopback represents VPP binary API message 'delete_loopback'. -type DeleteLoopback struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *DeleteLoopback) Reset() { *m = DeleteLoopback{} } -func (*DeleteLoopback) GetMessageName() string { return "delete_loopback" } -func (*DeleteLoopback) GetCrcString() string { return "f9e6675e" } -func (*DeleteLoopback) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *DeleteLoopback) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *DeleteLoopback) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *DeleteLoopback) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply'. -type DeleteLoopbackReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DeleteLoopbackReply) Reset() { *m = DeleteLoopbackReply{} } -func (*DeleteLoopbackReply) GetMessageName() string { return "delete_loopback_reply" } -func (*DeleteLoopbackReply) GetCrcString() string { return "e8d4e804" } -func (*DeleteLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *DeleteLoopbackReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *DeleteLoopbackReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *DeleteLoopbackReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// DeleteSubif represents VPP binary API message 'delete_subif'. -type DeleteSubif struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *DeleteSubif) Reset() { *m = DeleteSubif{} } -func (*DeleteSubif) GetMessageName() string { return "delete_subif" } -func (*DeleteSubif) GetCrcString() string { return "f9e6675e" } -func (*DeleteSubif) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *DeleteSubif) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *DeleteSubif) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *DeleteSubif) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// DeleteSubifReply represents VPP binary API message 'delete_subif_reply'. -type DeleteSubifReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DeleteSubifReply) Reset() { *m = DeleteSubifReply{} } -func (*DeleteSubifReply) GetMessageName() string { return "delete_subif_reply" } -func (*DeleteSubifReply) GetCrcString() string { return "e8d4e804" } -func (*DeleteSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *DeleteSubifReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *DeleteSubifReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *DeleteSubifReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu'. -type HwInterfaceSetMtu struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` -} - -func (m *HwInterfaceSetMtu) Reset() { *m = HwInterfaceSetMtu{} } -func (*HwInterfaceSetMtu) GetMessageName() string { return "hw_interface_set_mtu" } -func (*HwInterfaceSetMtu) GetCrcString() string { return "e6746899" } -func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *HwInterfaceSetMtu) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Mtu - size += 2 - return size -} -func (m *HwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Mtu - o.PutUint16(buf[pos:pos+2], uint16(m.Mtu)) - pos += 2 - return buf, nil -} -func (m *HwInterfaceSetMtu) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mtu - m.Mtu = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -// HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply'. -type HwInterfaceSetMtuReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *HwInterfaceSetMtuReply) Reset() { *m = HwInterfaceSetMtuReply{} } -func (*HwInterfaceSetMtuReply) GetMessageName() string { return "hw_interface_set_mtu_reply" } -func (*HwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } -func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *HwInterfaceSetMtuReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *HwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *HwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber'. -type InterfaceNameRenumber struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - NewShowDevInstance uint32 `binapi:"u32,name=new_show_dev_instance" json:"new_show_dev_instance,omitempty"` -} - -func (m *InterfaceNameRenumber) Reset() { *m = InterfaceNameRenumber{} } -func (*InterfaceNameRenumber) GetMessageName() string { return "interface_name_renumber" } -func (*InterfaceNameRenumber) GetCrcString() string { return "2b8858b8" } -func (*InterfaceNameRenumber) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *InterfaceNameRenumber) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.NewShowDevInstance - size += 4 - return size -} -func (m *InterfaceNameRenumber) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.NewShowDevInstance - o.PutUint32(buf[pos:pos+4], uint32(m.NewShowDevInstance)) - pos += 4 - return buf, nil -} -func (m *InterfaceNameRenumber) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NewShowDevInstance - m.NewShowDevInstance = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply'. -type InterfaceNameRenumberReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *InterfaceNameRenumberReply) Reset() { *m = InterfaceNameRenumberReply{} } -func (*InterfaceNameRenumberReply) GetMessageName() string { return "interface_name_renumber_reply" } -func (*InterfaceNameRenumberReply) GetCrcString() string { return "e8d4e804" } -func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *InterfaceNameRenumberReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *InterfaceNameRenumberReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *InterfaceNameRenumberReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address'. -type SwInterfaceAddDelAddress struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` - Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` -} - -func (m *SwInterfaceAddDelAddress) Reset() { *m = SwInterfaceAddDelAddress{} } -func (*SwInterfaceAddDelAddress) GetMessageName() string { return "sw_interface_add_del_address" } -func (*SwInterfaceAddDelAddress) GetCrcString() string { return "5803d5c4" } -func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceAddDelAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsAdd - size += 1 - // field[1] m.DelAll - size += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 4 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - return size -} -func (m *SwInterfaceAddDelAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.DelAll - if m.DelAll { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) - pos += 4 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - return buf, nil -} -func (m *SwInterfaceAddDelAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.DelAll - m.DelAll = tmp[pos] != 0 - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - return nil -} - -// SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply'. -type SwInterfaceAddDelAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceAddDelAddressReply) Reset() { *m = SwInterfaceAddDelAddressReply{} } -func (*SwInterfaceAddDelAddressReply) GetMessageName() string { - return "sw_interface_add_del_address_reply" -} -func (*SwInterfaceAddDelAddressReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceAddDelAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceAddDelAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceAddDelAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceAddDelMacAddress represents VPP binary API message 'sw_interface_add_del_mac_address'. -type SwInterfaceAddDelMacAddress struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Addr MacAddress `binapi:"mac_address,name=addr" json:"addr,omitempty"` - IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` -} - -func (m *SwInterfaceAddDelMacAddress) Reset() { *m = SwInterfaceAddDelMacAddress{} } -func (*SwInterfaceAddDelMacAddress) GetMessageName() string { - return "sw_interface_add_del_mac_address" -} -func (*SwInterfaceAddDelMacAddress) GetCrcString() string { return "638bb9f4" } -func (*SwInterfaceAddDelMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceAddDelMacAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Addr - size += 6 - // field[1] m.IsAdd - size += 1 - return size -} -func (m *SwInterfaceAddDelMacAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Addr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.Addr) { - x = uint8(m.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.IsAdd - buf[pos] = uint8(m.IsAdd) - pos += 1 - return buf, nil -} -func (m *SwInterfaceAddDelMacAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Addr - for i := 0; i < len(m.Addr); i++ { - m.Addr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.IsAdd - m.IsAdd = uint8(tmp[pos]) - pos += 1 - return nil -} - -// SwInterfaceAddDelMacAddressReply represents VPP binary API message 'sw_interface_add_del_mac_address_reply'. -type SwInterfaceAddDelMacAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceAddDelMacAddressReply) Reset() { *m = SwInterfaceAddDelMacAddressReply{} } -func (*SwInterfaceAddDelMacAddressReply) GetMessageName() string { - return "sw_interface_add_del_mac_address_reply" -} -func (*SwInterfaceAddDelMacAddressReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceAddDelMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceAddDelMacAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceAddDelMacAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceAddDelMacAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. -type SwInterfaceClearStats struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *SwInterfaceClearStats) Reset() { *m = SwInterfaceClearStats{} } -func (*SwInterfaceClearStats) GetMessageName() string { return "sw_interface_clear_stats" } -func (*SwInterfaceClearStats) GetCrcString() string { return "f9e6675e" } -func (*SwInterfaceClearStats) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceClearStats) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *SwInterfaceClearStats) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceClearStats) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply'. -type SwInterfaceClearStatsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceClearStatsReply) Reset() { *m = SwInterfaceClearStatsReply{} } -func (*SwInterfaceClearStatsReply) GetMessageName() string { return "sw_interface_clear_stats_reply" } -func (*SwInterfaceClearStatsReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceClearStatsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceClearStatsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceClearStatsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. -type SwInterfaceDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - SupSwIfIndex uint32 `binapi:"u32,name=sup_sw_if_index" json:"sup_sw_if_index,omitempty"` - L2Address MacAddress `binapi:"mac_address,name=l2_address" json:"l2_address,omitempty"` - Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - Type IfType `binapi:"if_type,name=type" json:"type,omitempty"` - LinkDuplex LinkDuplex `binapi:"link_duplex,name=link_duplex" json:"link_duplex,omitempty"` - LinkSpeed uint32 `binapi:"u32,name=link_speed" json:"link_speed,omitempty"` - LinkMtu uint16 `binapi:"u16,name=link_mtu" json:"link_mtu,omitempty"` - Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` - SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` - SubNumberOfTags uint8 `binapi:"u8,name=sub_number_of_tags" json:"sub_number_of_tags,omitempty"` - SubOuterVlanID uint16 `binapi:"u16,name=sub_outer_vlan_id" json:"sub_outer_vlan_id,omitempty"` - SubInnerVlanID uint16 `binapi:"u16,name=sub_inner_vlan_id" json:"sub_inner_vlan_id,omitempty"` - SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` - VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` - VtrPushDot1q uint32 `binapi:"u32,name=vtr_push_dot1q" json:"vtr_push_dot1q,omitempty"` - VtrTag1 uint32 `binapi:"u32,name=vtr_tag1" json:"vtr_tag1,omitempty"` - VtrTag2 uint32 `binapi:"u32,name=vtr_tag2" json:"vtr_tag2,omitempty"` - OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` - BDmac MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` - BSmac MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` - BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` - ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` - InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty" struc:"[64]byte"` - InterfaceDevType string `binapi:"string[64],name=interface_dev_type" json:"interface_dev_type,omitempty" struc:"[64]byte"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` -} - -func (m *SwInterfaceDetails) Reset() { *m = SwInterfaceDetails{} } -func (*SwInterfaceDetails) GetMessageName() string { return "sw_interface_details" } -func (*SwInterfaceDetails) GetCrcString() string { return "17b69fa2" } -func (*SwInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.SupSwIfIndex - size += 4 - // field[1] m.L2Address - size += 6 - // field[1] m.Flags - size += 4 - // field[1] m.Type - size += 4 - // field[1] m.LinkDuplex - size += 4 - // field[1] m.LinkSpeed - size += 4 - // field[1] m.LinkMtu - size += 2 - // field[1] m.Mtu - size += 16 - // field[1] m.SubID - size += 4 - // field[1] m.SubNumberOfTags - size += 1 - // field[1] m.SubOuterVlanID - size += 2 - // field[1] m.SubInnerVlanID - size += 2 - // field[1] m.SubIfFlags - size += 4 - // field[1] m.VtrOp - size += 4 - // field[1] m.VtrPushDot1q - size += 4 - // field[1] m.VtrTag1 - size += 4 - // field[1] m.VtrTag2 - size += 4 - // field[1] m.OuterTag - size += 2 - // field[1] m.BDmac - size += 6 - // field[1] m.BSmac - size += 6 - // field[1] m.BVlanid - size += 2 - // field[1] m.ISid - size += 4 - // field[1] m.InterfaceName - size += 64 - // field[1] m.InterfaceDevType - size += 64 - // field[1] m.Tag - size += 64 - return size -} -func (m *SwInterfaceDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.SupSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SupSwIfIndex)) - pos += 4 - // field[1] m.L2Address - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.L2Address) { - x = uint8(m.L2Address[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - // field[1] m.Type - o.PutUint32(buf[pos:pos+4], uint32(m.Type)) - pos += 4 - // field[1] m.LinkDuplex - o.PutUint32(buf[pos:pos+4], uint32(m.LinkDuplex)) - pos += 4 - // field[1] m.LinkSpeed - o.PutUint32(buf[pos:pos+4], uint32(m.LinkSpeed)) - pos += 4 - // field[1] m.LinkMtu - o.PutUint16(buf[pos:pos+2], uint16(m.LinkMtu)) - pos += 2 - // field[1] m.Mtu - for i := 0; i < 4; i++ { - var x uint32 - if i < len(m.Mtu) { - x = uint32(m.Mtu[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - // field[1] m.SubID - o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) - pos += 4 - // field[1] m.SubNumberOfTags - buf[pos] = uint8(m.SubNumberOfTags) - pos += 1 - // field[1] m.SubOuterVlanID - o.PutUint16(buf[pos:pos+2], uint16(m.SubOuterVlanID)) - pos += 2 - // field[1] m.SubInnerVlanID - o.PutUint16(buf[pos:pos+2], uint16(m.SubInnerVlanID)) - pos += 2 - // field[1] m.SubIfFlags - o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) - pos += 4 - // field[1] m.VtrOp - o.PutUint32(buf[pos:pos+4], uint32(m.VtrOp)) - pos += 4 - // field[1] m.VtrPushDot1q - o.PutUint32(buf[pos:pos+4], uint32(m.VtrPushDot1q)) - pos += 4 - // field[1] m.VtrTag1 - o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag1)) - pos += 4 - // field[1] m.VtrTag2 - o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag2)) - pos += 4 - // field[1] m.OuterTag - o.PutUint16(buf[pos:pos+2], uint16(m.OuterTag)) - pos += 2 - // field[1] m.BDmac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.BDmac) { - x = uint8(m.BDmac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.BSmac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.BSmac) { - x = uint8(m.BSmac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.BVlanid - o.PutUint16(buf[pos:pos+2], uint16(m.BVlanid)) - pos += 2 - // field[1] m.ISid - o.PutUint32(buf[pos:pos+4], uint32(m.ISid)) - pos += 4 - // field[1] m.InterfaceName - copy(buf[pos:pos+64], m.InterfaceName) - pos += 64 - // field[1] m.InterfaceDevType - copy(buf[pos:pos+64], m.InterfaceDevType) - pos += 64 - // field[1] m.Tag - copy(buf[pos:pos+64], m.Tag) - pos += 64 - return buf, nil -} -func (m *SwInterfaceDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SupSwIfIndex - m.SupSwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.L2Address - for i := 0; i < len(m.L2Address); i++ { - m.L2Address[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Flags - m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Type - m.Type = IfType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.LinkDuplex - m.LinkDuplex = LinkDuplex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.LinkSpeed - m.LinkSpeed = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.LinkMtu - m.LinkMtu = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.Mtu - m.Mtu = make([]uint32, 4) - for i := 0; i < len(m.Mtu); i++ { - m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - // field[1] m.SubID - m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SubNumberOfTags - m.SubNumberOfTags = uint8(tmp[pos]) - pos += 1 - // field[1] m.SubOuterVlanID - m.SubOuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.SubInnerVlanID - m.SubInnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.SubIfFlags - m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VtrOp - m.VtrOp = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VtrPushDot1q - m.VtrPushDot1q = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VtrTag1 - m.VtrTag1 = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VtrTag2 - m.VtrTag2 = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.OuterTag - m.OuterTag = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.BDmac - for i := 0; i < len(m.BDmac); i++ { - m.BDmac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.BSmac - for i := 0; i < len(m.BSmac); i++ { - m.BSmac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.BVlanid - m.BVlanid = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.ISid - m.ISid = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.InterfaceName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.InterfaceName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.InterfaceDevType - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.InterfaceDevType = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.Tag - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Tag = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. -type SwInterfaceDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` - NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"` - XXX_NameFilterLen uint32 `struc:"sizeof=NameFilter"` - NameFilter string `json:"name_filter,omitempty"` -} - -func (m *SwInterfaceDump) Reset() { *m = SwInterfaceDump{} } -func (*SwInterfaceDump) GetMessageName() string { return "sw_interface_dump" } -func (*SwInterfaceDump) GetCrcString() string { return "aa610c27" } -func (*SwInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.NameFilterValid - size += 1 - // field[1] m.NameFilter - size += 4 + len(m.NameFilter) - return size -} -func (m *SwInterfaceDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.NameFilterValid - if m.NameFilterValid { - buf[pos] = 1 - } - pos += 1 - // field[1] m.NameFilter - o.PutUint32(buf[pos:pos+4], uint32(len(m.NameFilter))) - pos += 4 - copy(buf[pos:pos+len(m.NameFilter)], m.NameFilter[:]) - pos += len(m.NameFilter) - return buf, nil -} -func (m *SwInterfaceDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NameFilterValid - m.NameFilterValid = tmp[pos] != 0 - pos += 1 - // field[1] m.NameFilter - { - siz := o.Uint32(tmp[pos : pos+4]) - pos += 4 - m.NameFilter = codec.DecodeString(tmp[pos : pos+int(siz)]) - pos += len(m.NameFilter) - } - return nil -} - -// SwInterfaceEvent represents VPP binary API message 'sw_interface_event'. -type SwInterfaceEvent struct { - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - Deleted bool `binapi:"bool,name=deleted" json:"deleted,omitempty"` -} - -func (m *SwInterfaceEvent) Reset() { *m = SwInterfaceEvent{} } -func (*SwInterfaceEvent) GetMessageName() string { return "sw_interface_event" } -func (*SwInterfaceEvent) GetCrcString() string { return "f709f78d" } -func (*SwInterfaceEvent) GetMessageType() api.MessageType { return api.EventMessage } - -func (m *SwInterfaceEvent) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.PID - size += 4 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Flags - size += 4 - // field[1] m.Deleted - size += 1 - return size -} -func (m *SwInterfaceEvent) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.PID - o.PutUint32(buf[pos:pos+4], uint32(m.PID)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - // field[1] m.Deleted - if m.Deleted { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceEvent) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.PID - m.PID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Flags - m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Deleted - m.Deleted = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address'. -type SwInterfaceGetMacAddress struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *SwInterfaceGetMacAddress) Reset() { *m = SwInterfaceGetMacAddress{} } -func (*SwInterfaceGetMacAddress) GetMessageName() string { return "sw_interface_get_mac_address" } -func (*SwInterfaceGetMacAddress) GetCrcString() string { return "f9e6675e" } -func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceGetMacAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *SwInterfaceGetMacAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceGetMacAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply'. -type SwInterfaceGetMacAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` -} - -func (m *SwInterfaceGetMacAddressReply) Reset() { *m = SwInterfaceGetMacAddressReply{} } -func (*SwInterfaceGetMacAddressReply) GetMessageName() string { - return "sw_interface_get_mac_address_reply" -} -func (*SwInterfaceGetMacAddressReply) GetCrcString() string { return "40ef2c08" } -func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceGetMacAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.MacAddress - size += 6 - return size -} -func (m *SwInterfaceGetMacAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SwInterfaceGetMacAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table'. -type SwInterfaceGetTable struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *SwInterfaceGetTable) Reset() { *m = SwInterfaceGetTable{} } -func (*SwInterfaceGetTable) GetMessageName() string { return "sw_interface_get_table" } -func (*SwInterfaceGetTable) GetCrcString() string { return "2d033de4" } -func (*SwInterfaceGetTable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceGetTable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *SwInterfaceGetTable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceGetTable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply'. -type SwInterfaceGetTableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` -} - -func (m *SwInterfaceGetTableReply) Reset() { *m = SwInterfaceGetTableReply{} } -func (*SwInterfaceGetTableReply) GetMessageName() string { return "sw_interface_get_table_reply" } -func (*SwInterfaceGetTableReply) GetCrcString() string { return "a6eb0109" } -func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceGetTableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.VrfID - size += 4 - return size -} -func (m *SwInterfaceGetTableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.VrfID - o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceGetTableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VrfID - m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details'. -type SwInterfaceRxPlacementDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` - WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` - Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` -} - -func (m *SwInterfaceRxPlacementDetails) Reset() { *m = SwInterfaceRxPlacementDetails{} } -func (*SwInterfaceRxPlacementDetails) GetMessageName() string { - return "sw_interface_rx_placement_details" -} -func (*SwInterfaceRxPlacementDetails) GetCrcString() string { return "f6d7d024" } -func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceRxPlacementDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.QueueID - size += 4 - // field[1] m.WorkerID - size += 4 - // field[1] m.Mode - size += 4 - return size -} -func (m *SwInterfaceRxPlacementDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.QueueID - o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) - pos += 4 - // field[1] m.WorkerID - o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceRxPlacementDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.QueueID - m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.WorkerID - m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump'. -type SwInterfaceRxPlacementDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *SwInterfaceRxPlacementDump) Reset() { *m = SwInterfaceRxPlacementDump{} } -func (*SwInterfaceRxPlacementDump) GetMessageName() string { return "sw_interface_rx_placement_dump" } -func (*SwInterfaceRxPlacementDump) GetCrcString() string { return "f9e6675e" } -func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceRxPlacementDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *SwInterfaceRxPlacementDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceRxPlacementDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags'. -type SwInterfaceSetFlags struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` -} - -func (m *SwInterfaceSetFlags) Reset() { *m = SwInterfaceSetFlags{} } -func (*SwInterfaceSetFlags) GetMessageName() string { return "sw_interface_set_flags" } -func (*SwInterfaceSetFlags) GetCrcString() string { return "6a2b491a" } -func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetFlags) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Flags - size += 4 - return size -} -func (m *SwInterfaceSetFlags) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetFlags) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Flags - m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply'. -type SwInterfaceSetFlagsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetFlagsReply) Reset() { *m = SwInterfaceSetFlagsReply{} } -func (*SwInterfaceSetFlagsReply) GetMessageName() string { return "sw_interface_set_flags_reply" } -func (*SwInterfaceSetFlagsReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetFlagsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetFlagsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetFlagsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast'. -type SwInterfaceSetIPDirectedBroadcast struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` -} - -func (m *SwInterfaceSetIPDirectedBroadcast) Reset() { *m = SwInterfaceSetIPDirectedBroadcast{} } -func (*SwInterfaceSetIPDirectedBroadcast) GetMessageName() string { - return "sw_interface_set_ip_directed_broadcast" -} -func (*SwInterfaceSetIPDirectedBroadcast) GetCrcString() string { return "ae6cfcfb" } -func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetIPDirectedBroadcast) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Enable - size += 1 - return size -} -func (m *SwInterfaceSetIPDirectedBroadcast) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Enable - if m.Enable { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceSetIPDirectedBroadcast) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Enable - m.Enable = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply'. -type SwInterfaceSetIPDirectedBroadcastReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetIPDirectedBroadcastReply) Reset() { - *m = SwInterfaceSetIPDirectedBroadcastReply{} -} -func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageName() string { - return "sw_interface_set_ip_directed_broadcast_reply" -} -func (*SwInterfaceSetIPDirectedBroadcastReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *SwInterfaceSetIPDirectedBroadcastReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetIPDirectedBroadcastReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetIPDirectedBroadcastReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address'. -type SwInterfaceSetMacAddress struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` -} - -func (m *SwInterfaceSetMacAddress) Reset() { *m = SwInterfaceSetMacAddress{} } -func (*SwInterfaceSetMacAddress) GetMessageName() string { return "sw_interface_set_mac_address" } -func (*SwInterfaceSetMacAddress) GetCrcString() string { return "6aca746a" } -func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetMacAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.MacAddress - size += 6 - return size -} -func (m *SwInterfaceSetMacAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SwInterfaceSetMacAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply'. -type SwInterfaceSetMacAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetMacAddressReply) Reset() { *m = SwInterfaceSetMacAddressReply{} } -func (*SwInterfaceSetMacAddressReply) GetMessageName() string { - return "sw_interface_set_mac_address_reply" -} -func (*SwInterfaceSetMacAddressReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetMacAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetMacAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetMacAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu'. -type SwInterfaceSetMtu struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` -} - -func (m *SwInterfaceSetMtu) Reset() { *m = SwInterfaceSetMtu{} } -func (*SwInterfaceSetMtu) GetMessageName() string { return "sw_interface_set_mtu" } -func (*SwInterfaceSetMtu) GetCrcString() string { return "5cbe85e5" } -func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetMtu) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Mtu - size += 16 - return size -} -func (m *SwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Mtu - for i := 0; i < 4; i++ { - var x uint32 - if i < len(m.Mtu) { - x = uint32(m.Mtu[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *SwInterfaceSetMtu) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mtu - m.Mtu = make([]uint32, 4) - for i := 0; i < len(m.Mtu); i++ { - m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply'. -type SwInterfaceSetMtuReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetMtuReply) Reset() { *m = SwInterfaceSetMtuReply{} } -func (*SwInterfaceSetMtuReply) GetMessageName() string { return "sw_interface_set_mtu_reply" } -func (*SwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetMtuReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode'. -type SwInterfaceSetRxMode struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - QueueIDValid bool `binapi:"bool,name=queue_id_valid" json:"queue_id_valid,omitempty"` - QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` - Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` -} - -func (m *SwInterfaceSetRxMode) Reset() { *m = SwInterfaceSetRxMode{} } -func (*SwInterfaceSetRxMode) GetMessageName() string { return "sw_interface_set_rx_mode" } -func (*SwInterfaceSetRxMode) GetCrcString() string { return "780f5cee" } -func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetRxMode) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.QueueIDValid - size += 1 - // field[1] m.QueueID - size += 4 - // field[1] m.Mode - size += 4 - return size -} -func (m *SwInterfaceSetRxMode) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.QueueIDValid - if m.QueueIDValid { - buf[pos] = 1 - } - pos += 1 - // field[1] m.QueueID - o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetRxMode) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.QueueIDValid - m.QueueIDValid = tmp[pos] != 0 - pos += 1 - // field[1] m.QueueID - m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply'. -type SwInterfaceSetRxModeReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetRxModeReply) Reset() { *m = SwInterfaceSetRxModeReply{} } -func (*SwInterfaceSetRxModeReply) GetMessageName() string { return "sw_interface_set_rx_mode_reply" } -func (*SwInterfaceSetRxModeReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetRxModeReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetRxModeReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetRxModeReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement'. -type SwInterfaceSetRxPlacement struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` - WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` - IsMain bool `binapi:"bool,name=is_main" json:"is_main,omitempty"` -} - -func (m *SwInterfaceSetRxPlacement) Reset() { *m = SwInterfaceSetRxPlacement{} } -func (*SwInterfaceSetRxPlacement) GetMessageName() string { return "sw_interface_set_rx_placement" } -func (*SwInterfaceSetRxPlacement) GetCrcString() string { return "db65f3c9" } -func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetRxPlacement) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.QueueID - size += 4 - // field[1] m.WorkerID - size += 4 - // field[1] m.IsMain - size += 1 - return size -} -func (m *SwInterfaceSetRxPlacement) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.QueueID - o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) - pos += 4 - // field[1] m.WorkerID - o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) - pos += 4 - // field[1] m.IsMain - if m.IsMain { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceSetRxPlacement) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.QueueID - m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.WorkerID - m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsMain - m.IsMain = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply'. -type SwInterfaceSetRxPlacementReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetRxPlacementReply) Reset() { *m = SwInterfaceSetRxPlacementReply{} } -func (*SwInterfaceSetRxPlacementReply) GetMessageName() string { - return "sw_interface_set_rx_placement_reply" -} -func (*SwInterfaceSetRxPlacementReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetRxPlacementReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetRxPlacementReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetRxPlacementReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table'. -type SwInterfaceSetTable struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` -} - -func (m *SwInterfaceSetTable) Reset() { *m = SwInterfaceSetTable{} } -func (*SwInterfaceSetTable) GetMessageName() string { return "sw_interface_set_table" } -func (*SwInterfaceSetTable) GetCrcString() string { return "df42a577" } -func (*SwInterfaceSetTable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetTable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - // field[1] m.VrfID - size += 4 - return size -} -func (m *SwInterfaceSetTable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.VrfID - o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetTable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - // field[1] m.VrfID - m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply'. -type SwInterfaceSetTableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetTableReply) Reset() { *m = SwInterfaceSetTableReply{} } -func (*SwInterfaceSetTableReply) GetMessageName() string { return "sw_interface_set_table_reply" } -func (*SwInterfaceSetTableReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetTableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetTableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetTableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered'. -type SwInterfaceSetUnnumbered struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - UnnumberedSwIfIndex InterfaceIndex `binapi:"interface_index,name=unnumbered_sw_if_index" json:"unnumbered_sw_if_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` -} - -func (m *SwInterfaceSetUnnumbered) Reset() { *m = SwInterfaceSetUnnumbered{} } -func (*SwInterfaceSetUnnumbered) GetMessageName() string { return "sw_interface_set_unnumbered" } -func (*SwInterfaceSetUnnumbered) GetCrcString() string { return "938ef33b" } -func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetUnnumbered) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.UnnumberedSwIfIndex - size += 4 - // field[1] m.IsAdd - size += 1 - return size -} -func (m *SwInterfaceSetUnnumbered) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.UnnumberedSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.UnnumberedSwIfIndex)) - pos += 4 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceSetUnnumbered) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.UnnumberedSwIfIndex - m.UnnumberedSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply'. -type SwInterfaceSetUnnumberedReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetUnnumberedReply) Reset() { *m = SwInterfaceSetUnnumberedReply{} } -func (*SwInterfaceSetUnnumberedReply) GetMessageName() string { - return "sw_interface_set_unnumbered_reply" -} -func (*SwInterfaceSetUnnumberedReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetUnnumberedReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetUnnumberedReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetUnnumberedReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. -type SwInterfaceTagAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` -} - -func (m *SwInterfaceTagAddDel) Reset() { *m = SwInterfaceTagAddDel{} } -func (*SwInterfaceTagAddDel) GetMessageName() string { return "sw_interface_tag_add_del" } -func (*SwInterfaceTagAddDel) GetCrcString() string { return "426f8bc1" } -func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceTagAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Tag - size += 64 - return size -} -func (m *SwInterfaceTagAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Tag - copy(buf[pos:pos+64], m.Tag) - pos += 64 - return buf, nil -} -func (m *SwInterfaceTagAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Tag = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply'. -type SwInterfaceTagAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceTagAddDelReply) Reset() { *m = SwInterfaceTagAddDelReply{} } -func (*SwInterfaceTagAddDelReply) GetMessageName() string { return "sw_interface_tag_add_del_reply" } -func (*SwInterfaceTagAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceTagAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceTagAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceTagAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// WantInterfaceEvents represents VPP binary API message 'want_interface_events'. -type WantInterfaceEvents struct { - EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` -} - -func (m *WantInterfaceEvents) Reset() { *m = WantInterfaceEvents{} } -func (*WantInterfaceEvents) GetMessageName() string { return "want_interface_events" } -func (*WantInterfaceEvents) GetCrcString() string { return "476f5a08" } -func (*WantInterfaceEvents) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *WantInterfaceEvents) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.EnableDisable - size += 4 - // field[1] m.PID - size += 4 - return size -} -func (m *WantInterfaceEvents) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.EnableDisable - o.PutUint32(buf[pos:pos+4], uint32(m.EnableDisable)) - pos += 4 - // field[1] m.PID - o.PutUint32(buf[pos:pos+4], uint32(m.PID)) - pos += 4 - return buf, nil -} -func (m *WantInterfaceEvents) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.EnableDisable - m.EnableDisable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.PID - m.PID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply'. -type WantInterfaceEventsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *WantInterfaceEventsReply) Reset() { *m = WantInterfaceEventsReply{} } -func (*WantInterfaceEventsReply) GetMessageName() string { return "want_interface_events_reply" } -func (*WantInterfaceEventsReply) GetCrcString() string { return "e8d4e804" } -func (*WantInterfaceEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *WantInterfaceEventsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *WantInterfaceEventsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *WantInterfaceEventsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -func init() { file_interfaces_binapi_init() } -func file_interfaces_binapi_init() { - api.RegisterMessage((*CollectDetailedInterfaceStats)(nil), "interface.CollectDetailedInterfaceStats") - api.RegisterMessage((*CollectDetailedInterfaceStatsReply)(nil), "interface.CollectDetailedInterfaceStatsReply") - api.RegisterMessage((*CreateLoopback)(nil), "interface.CreateLoopback") - api.RegisterMessage((*CreateLoopbackInstance)(nil), "interface.CreateLoopbackInstance") - api.RegisterMessage((*CreateLoopbackInstanceReply)(nil), "interface.CreateLoopbackInstanceReply") - api.RegisterMessage((*CreateLoopbackReply)(nil), "interface.CreateLoopbackReply") - api.RegisterMessage((*CreateSubif)(nil), "interface.CreateSubif") - api.RegisterMessage((*CreateSubifReply)(nil), "interface.CreateSubifReply") - api.RegisterMessage((*CreateVlanSubif)(nil), "interface.CreateVlanSubif") - api.RegisterMessage((*CreateVlanSubifReply)(nil), "interface.CreateVlanSubifReply") - api.RegisterMessage((*DeleteLoopback)(nil), "interface.DeleteLoopback") - api.RegisterMessage((*DeleteLoopbackReply)(nil), "interface.DeleteLoopbackReply") - api.RegisterMessage((*DeleteSubif)(nil), "interface.DeleteSubif") - api.RegisterMessage((*DeleteSubifReply)(nil), "interface.DeleteSubifReply") - api.RegisterMessage((*HwInterfaceSetMtu)(nil), "interface.HwInterfaceSetMtu") - api.RegisterMessage((*HwInterfaceSetMtuReply)(nil), "interface.HwInterfaceSetMtuReply") - api.RegisterMessage((*InterfaceNameRenumber)(nil), "interface.InterfaceNameRenumber") - api.RegisterMessage((*InterfaceNameRenumberReply)(nil), "interface.InterfaceNameRenumberReply") - api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "interface.SwInterfaceAddDelAddress") - api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "interface.SwInterfaceAddDelAddressReply") - api.RegisterMessage((*SwInterfaceAddDelMacAddress)(nil), "interface.SwInterfaceAddDelMacAddress") - api.RegisterMessage((*SwInterfaceAddDelMacAddressReply)(nil), "interface.SwInterfaceAddDelMacAddressReply") - api.RegisterMessage((*SwInterfaceClearStats)(nil), "interface.SwInterfaceClearStats") - api.RegisterMessage((*SwInterfaceClearStatsReply)(nil), "interface.SwInterfaceClearStatsReply") - api.RegisterMessage((*SwInterfaceDetails)(nil), "interface.SwInterfaceDetails") - api.RegisterMessage((*SwInterfaceDump)(nil), "interface.SwInterfaceDump") - api.RegisterMessage((*SwInterfaceEvent)(nil), "interface.SwInterfaceEvent") - api.RegisterMessage((*SwInterfaceGetMacAddress)(nil), "interface.SwInterfaceGetMacAddress") - api.RegisterMessage((*SwInterfaceGetMacAddressReply)(nil), "interface.SwInterfaceGetMacAddressReply") - api.RegisterMessage((*SwInterfaceGetTable)(nil), "interface.SwInterfaceGetTable") - api.RegisterMessage((*SwInterfaceGetTableReply)(nil), "interface.SwInterfaceGetTableReply") - api.RegisterMessage((*SwInterfaceRxPlacementDetails)(nil), "interface.SwInterfaceRxPlacementDetails") - api.RegisterMessage((*SwInterfaceRxPlacementDump)(nil), "interface.SwInterfaceRxPlacementDump") - api.RegisterMessage((*SwInterfaceSetFlags)(nil), "interface.SwInterfaceSetFlags") - api.RegisterMessage((*SwInterfaceSetFlagsReply)(nil), "interface.SwInterfaceSetFlagsReply") - api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcast)(nil), "interface.SwInterfaceSetIPDirectedBroadcast") - api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcastReply)(nil), "interface.SwInterfaceSetIPDirectedBroadcastReply") - api.RegisterMessage((*SwInterfaceSetMacAddress)(nil), "interface.SwInterfaceSetMacAddress") - api.RegisterMessage((*SwInterfaceSetMacAddressReply)(nil), "interface.SwInterfaceSetMacAddressReply") - api.RegisterMessage((*SwInterfaceSetMtu)(nil), "interface.SwInterfaceSetMtu") - api.RegisterMessage((*SwInterfaceSetMtuReply)(nil), "interface.SwInterfaceSetMtuReply") - api.RegisterMessage((*SwInterfaceSetRxMode)(nil), "interface.SwInterfaceSetRxMode") - api.RegisterMessage((*SwInterfaceSetRxModeReply)(nil), "interface.SwInterfaceSetRxModeReply") - api.RegisterMessage((*SwInterfaceSetRxPlacement)(nil), "interface.SwInterfaceSetRxPlacement") - api.RegisterMessage((*SwInterfaceSetRxPlacementReply)(nil), "interface.SwInterfaceSetRxPlacementReply") - api.RegisterMessage((*SwInterfaceSetTable)(nil), "interface.SwInterfaceSetTable") - api.RegisterMessage((*SwInterfaceSetTableReply)(nil), "interface.SwInterfaceSetTableReply") - api.RegisterMessage((*SwInterfaceSetUnnumbered)(nil), "interface.SwInterfaceSetUnnumbered") - api.RegisterMessage((*SwInterfaceSetUnnumberedReply)(nil), "interface.SwInterfaceSetUnnumberedReply") - api.RegisterMessage((*SwInterfaceTagAddDel)(nil), "interface.SwInterfaceTagAddDel") - api.RegisterMessage((*SwInterfaceTagAddDelReply)(nil), "interface.SwInterfaceTagAddDelReply") - api.RegisterMessage((*WantInterfaceEvents)(nil), "interface.WantInterfaceEvents") - api.RegisterMessage((*WantInterfaceEventsReply)(nil), "interface.WantInterfaceEventsReply") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*CollectDetailedInterfaceStats)(nil), - (*CollectDetailedInterfaceStatsReply)(nil), - (*CreateLoopback)(nil), - (*CreateLoopbackInstance)(nil), - (*CreateLoopbackInstanceReply)(nil), - (*CreateLoopbackReply)(nil), - (*CreateSubif)(nil), - (*CreateSubifReply)(nil), - (*CreateVlanSubif)(nil), - (*CreateVlanSubifReply)(nil), - (*DeleteLoopback)(nil), - (*DeleteLoopbackReply)(nil), - (*DeleteSubif)(nil), - (*DeleteSubifReply)(nil), - (*HwInterfaceSetMtu)(nil), - (*HwInterfaceSetMtuReply)(nil), - (*InterfaceNameRenumber)(nil), - (*InterfaceNameRenumberReply)(nil), - (*SwInterfaceAddDelAddress)(nil), - (*SwInterfaceAddDelAddressReply)(nil), - (*SwInterfaceAddDelMacAddress)(nil), - (*SwInterfaceAddDelMacAddressReply)(nil), - (*SwInterfaceClearStats)(nil), - (*SwInterfaceClearStatsReply)(nil), - (*SwInterfaceDetails)(nil), - (*SwInterfaceDump)(nil), - (*SwInterfaceEvent)(nil), - (*SwInterfaceGetMacAddress)(nil), - (*SwInterfaceGetMacAddressReply)(nil), - (*SwInterfaceGetTable)(nil), - (*SwInterfaceGetTableReply)(nil), - (*SwInterfaceRxPlacementDetails)(nil), - (*SwInterfaceRxPlacementDump)(nil), - (*SwInterfaceSetFlags)(nil), - (*SwInterfaceSetFlagsReply)(nil), - (*SwInterfaceSetIPDirectedBroadcast)(nil), - (*SwInterfaceSetIPDirectedBroadcastReply)(nil), - (*SwInterfaceSetMacAddress)(nil), - (*SwInterfaceSetMacAddressReply)(nil), - (*SwInterfaceSetMtu)(nil), - (*SwInterfaceSetMtuReply)(nil), - (*SwInterfaceSetRxMode)(nil), - (*SwInterfaceSetRxModeReply)(nil), - (*SwInterfaceSetRxPlacement)(nil), - (*SwInterfaceSetRxPlacementReply)(nil), - (*SwInterfaceSetTable)(nil), - (*SwInterfaceSetTableReply)(nil), - (*SwInterfaceSetUnnumbered)(nil), - (*SwInterfaceSetUnnumberedReply)(nil), - (*SwInterfaceTagAddDel)(nil), - (*SwInterfaceTagAddDelReply)(nil), - (*WantInterfaceEvents)(nil), - (*WantInterfaceEventsReply)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/interfaces/interfaces_rpc.ba.go b/codec/testdata/binapi2001/interfaces/interfaces_rpc.ba.go deleted file mode 100644 index e30aed9..0000000 --- a/codec/testdata/binapi2001/interfaces/interfaces_rpc.ba.go +++ /dev/null @@ -1,321 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package interfaces - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for interface module. -type RPCService interface { - DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) - DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) - CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) - CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) - CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) - CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) - CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) - DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) - DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) - HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) - InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) - SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) - SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) - SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) - SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) - SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) - SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) - SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) - SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) - SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) - SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) - SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) - SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) - SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) - SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) - WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSwInterfaceClient{stream} - return x, nil -} - -type RPCService_DumpSwInterfaceClient interface { - Recv() (*SwInterfaceDetails, error) -} - -type serviceClient_DumpSwInterfaceClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSwInterfaceClient) Recv() (*SwInterfaceDetails, error) { - m := new(SwInterfaceDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSwInterfaceRxPlacementClient{stream} - return x, nil -} - -type RPCService_DumpSwInterfaceRxPlacementClient interface { - Recv() (*SwInterfaceRxPlacementDetails, error) -} - -type serviceClient_DumpSwInterfaceRxPlacementClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSwInterfaceRxPlacementClient) Recv() (*SwInterfaceRxPlacementDetails, error) { - m := new(SwInterfaceRxPlacementDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { - out := new(CollectDetailedInterfaceStatsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { - out := new(CreateLoopbackReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { - out := new(CreateLoopbackInstanceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { - out := new(CreateSubifReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { - out := new(CreateVlanSubifReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { - out := new(DeleteLoopbackReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { - out := new(DeleteSubifReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { - out := new(HwInterfaceSetMtuReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { - out := new(InterfaceNameRenumberReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { - out := new(SwInterfaceAddDelAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { - out := new(SwInterfaceAddDelMacAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { - out := new(SwInterfaceClearStatsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { - out := new(SwInterfaceGetMacAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { - out := new(SwInterfaceGetTableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { - out := new(SwInterfaceSetFlagsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { - out := new(SwInterfaceSetIPDirectedBroadcastReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { - out := new(SwInterfaceSetMacAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { - out := new(SwInterfaceSetMtuReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { - out := new(SwInterfaceSetRxModeReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { - out := new(SwInterfaceSetRxPlacementReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { - out := new(SwInterfaceSetTableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { - out := new(SwInterfaceSetUnnumberedReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { - out := new(SwInterfaceTagAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { - out := new(WantInterfaceEventsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/codec/testdata/binapi2001/ip/ip.ba.go b/codec/testdata/binapi2001/ip/ip.ba.go deleted file mode 100644 index ca717ca..0000000 --- a/codec/testdata/binapi2001/ip/ip.ba.go +++ /dev/null @@ -1,5730 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.01-45~g7a071e370~b63 -// source: /usr/share/vpp/api/core/ip.api.json - -/* -Package ip contains generated code for VPP binary API defined by ip.api (version 3.0.1). - -It consists of: - 7 aliases - 15 enums - 60 messages - 14 types - 1 union -*/ -package ip - -import ( - "bytes" - "context" - "encoding/binary" - "io" - "math" - "strconv" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "ip" - // APIVersion is the API version of this module. - APIVersion = "3.0.1" - // VersionCrc is the CRC of this module. - VersionCrc = 0xfc3fea46 -) - -// AddressFamily represents VPP binary API enum 'address_family'. -type AddressFamily uint32 - -const ( - ADDRESS_IP4 AddressFamily = 0 - ADDRESS_IP6 AddressFamily = 1 -) - -var ( - AddressFamily_name = map[uint32]string{ - 0: "ADDRESS_IP4", - 1: "ADDRESS_IP6", - } - AddressFamily_value = map[string]uint32{ - "ADDRESS_IP4": 0, - "ADDRESS_IP6": 1, - } -) - -func (x AddressFamily) String() string { - s, ok := AddressFamily_name[uint32(x)] - if ok { - return s - } - return "AddressFamily(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathFlags represents VPP binary API enum 'fib_path_flags'. -type FibPathFlags uint32 - -const ( - FIB_API_PATH_FLAG_NONE FibPathFlags = 0 - FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 - FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 - FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 -) - -var ( - FibPathFlags_name = map[uint32]string{ - 0: "FIB_API_PATH_FLAG_NONE", - 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", - 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", - 4: "FIB_API_PATH_FLAG_POP_PW_CW", - } - FibPathFlags_value = map[string]uint32{ - "FIB_API_PATH_FLAG_NONE": 0, - "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, - "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, - "FIB_API_PATH_FLAG_POP_PW_CW": 4, - } -) - -func (x FibPathFlags) String() string { - s, ok := FibPathFlags_name[uint32(x)] - if ok { - return s - } - return "FibPathFlags(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. -type FibPathNhProto uint32 - -const ( - FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 - FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 - FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 - FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 - FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 -) - -var ( - FibPathNhProto_name = map[uint32]string{ - 0: "FIB_API_PATH_NH_PROTO_IP4", - 1: "FIB_API_PATH_NH_PROTO_IP6", - 2: "FIB_API_PATH_NH_PROTO_MPLS", - 3: "FIB_API_PATH_NH_PROTO_ETHERNET", - 4: "FIB_API_PATH_NH_PROTO_BIER", - } - FibPathNhProto_value = map[string]uint32{ - "FIB_API_PATH_NH_PROTO_IP4": 0, - "FIB_API_PATH_NH_PROTO_IP6": 1, - "FIB_API_PATH_NH_PROTO_MPLS": 2, - "FIB_API_PATH_NH_PROTO_ETHERNET": 3, - "FIB_API_PATH_NH_PROTO_BIER": 4, - } -) - -func (x FibPathNhProto) String() string { - s, ok := FibPathNhProto_name[uint32(x)] - if ok { - return s - } - return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathType represents VPP binary API enum 'fib_path_type'. -type FibPathType uint32 - -const ( - FIB_API_PATH_TYPE_NORMAL FibPathType = 0 - FIB_API_PATH_TYPE_LOCAL FibPathType = 1 - FIB_API_PATH_TYPE_DROP FibPathType = 2 - FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 - FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 - FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 - FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 - FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 - FIB_API_PATH_TYPE_DVR FibPathType = 8 - FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 - FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 -) - -var ( - FibPathType_name = map[uint32]string{ - 0: "FIB_API_PATH_TYPE_NORMAL", - 1: "FIB_API_PATH_TYPE_LOCAL", - 2: "FIB_API_PATH_TYPE_DROP", - 3: "FIB_API_PATH_TYPE_UDP_ENCAP", - 4: "FIB_API_PATH_TYPE_BIER_IMP", - 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", - 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", - 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", - 8: "FIB_API_PATH_TYPE_DVR", - 9: "FIB_API_PATH_TYPE_INTERFACE_RX", - 10: "FIB_API_PATH_TYPE_CLASSIFY", - } - FibPathType_value = map[string]uint32{ - "FIB_API_PATH_TYPE_NORMAL": 0, - "FIB_API_PATH_TYPE_LOCAL": 1, - "FIB_API_PATH_TYPE_DROP": 2, - "FIB_API_PATH_TYPE_UDP_ENCAP": 3, - "FIB_API_PATH_TYPE_BIER_IMP": 4, - "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, - "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, - "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, - "FIB_API_PATH_TYPE_DVR": 8, - "FIB_API_PATH_TYPE_INTERFACE_RX": 9, - "FIB_API_PATH_TYPE_CLASSIFY": 10, - } -) - -func (x FibPathType) String() string { - s, ok := FibPathType_name[uint32(x)] - if ok { - return s - } - return "FibPathType(" + strconv.Itoa(int(x)) + ")" -} - -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) - -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" -} - -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 - -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) - -var ( - IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, - } -) - -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} - -// IPDscp represents VPP binary API enum 'ip_dscp'. -type IPDscp uint8 - -const ( - IP_API_DSCP_CS0 IPDscp = 0 - IP_API_DSCP_CS1 IPDscp = 8 - IP_API_DSCP_AF11 IPDscp = 10 - IP_API_DSCP_AF12 IPDscp = 12 - IP_API_DSCP_AF13 IPDscp = 14 - IP_API_DSCP_CS2 IPDscp = 16 - IP_API_DSCP_AF21 IPDscp = 18 - IP_API_DSCP_AF22 IPDscp = 20 - IP_API_DSCP_AF23 IPDscp = 22 - IP_API_DSCP_CS3 IPDscp = 24 - IP_API_DSCP_AF31 IPDscp = 26 - IP_API_DSCP_AF32 IPDscp = 28 - IP_API_DSCP_AF33 IPDscp = 30 - IP_API_DSCP_CS4 IPDscp = 32 - IP_API_DSCP_AF41 IPDscp = 34 - IP_API_DSCP_AF42 IPDscp = 36 - IP_API_DSCP_AF43 IPDscp = 38 - IP_API_DSCP_CS5 IPDscp = 40 - IP_API_DSCP_EF IPDscp = 46 - IP_API_DSCP_CS6 IPDscp = 48 - IP_API_DSCP_CS7 IPDscp = 50 -) - -var ( - IPDscp_name = map[uint8]string{ - 0: "IP_API_DSCP_CS0", - 8: "IP_API_DSCP_CS1", - 10: "IP_API_DSCP_AF11", - 12: "IP_API_DSCP_AF12", - 14: "IP_API_DSCP_AF13", - 16: "IP_API_DSCP_CS2", - 18: "IP_API_DSCP_AF21", - 20: "IP_API_DSCP_AF22", - 22: "IP_API_DSCP_AF23", - 24: "IP_API_DSCP_CS3", - 26: "IP_API_DSCP_AF31", - 28: "IP_API_DSCP_AF32", - 30: "IP_API_DSCP_AF33", - 32: "IP_API_DSCP_CS4", - 34: "IP_API_DSCP_AF41", - 36: "IP_API_DSCP_AF42", - 38: "IP_API_DSCP_AF43", - 40: "IP_API_DSCP_CS5", - 46: "IP_API_DSCP_EF", - 48: "IP_API_DSCP_CS6", - 50: "IP_API_DSCP_CS7", - } - IPDscp_value = map[string]uint8{ - "IP_API_DSCP_CS0": 0, - "IP_API_DSCP_CS1": 8, - "IP_API_DSCP_AF11": 10, - "IP_API_DSCP_AF12": 12, - "IP_API_DSCP_AF13": 14, - "IP_API_DSCP_CS2": 16, - "IP_API_DSCP_AF21": 18, - "IP_API_DSCP_AF22": 20, - "IP_API_DSCP_AF23": 22, - "IP_API_DSCP_CS3": 24, - "IP_API_DSCP_AF31": 26, - "IP_API_DSCP_AF32": 28, - "IP_API_DSCP_AF33": 30, - "IP_API_DSCP_CS4": 32, - "IP_API_DSCP_AF41": 34, - "IP_API_DSCP_AF42": 36, - "IP_API_DSCP_AF43": 38, - "IP_API_DSCP_CS5": 40, - "IP_API_DSCP_EF": 46, - "IP_API_DSCP_CS6": 48, - "IP_API_DSCP_CS7": 50, - } -) - -func (x IPDscp) String() string { - s, ok := IPDscp_name[uint8(x)] - if ok { - return s - } - return "IPDscp(" + strconv.Itoa(int(x)) + ")" -} - -// IPEcn represents VPP binary API enum 'ip_ecn'. -type IPEcn uint8 - -const ( - IP_API_ECN_NONE IPEcn = 0 - IP_API_ECN_ECT0 IPEcn = 1 - IP_API_ECN_ECT1 IPEcn = 2 - IP_API_ECN_CE IPEcn = 3 -) - -var ( - IPEcn_name = map[uint8]string{ - 0: "IP_API_ECN_NONE", - 1: "IP_API_ECN_ECT0", - 2: "IP_API_ECN_ECT1", - 3: "IP_API_ECN_CE", - } - IPEcn_value = map[string]uint8{ - "IP_API_ECN_NONE": 0, - "IP_API_ECN_ECT0": 1, - "IP_API_ECN_ECT1": 2, - "IP_API_ECN_CE": 3, - } -) - -func (x IPEcn) String() string { - s, ok := IPEcn_name[uint8(x)] - if ok { - return s - } - return "IPEcn(" + strconv.Itoa(int(x)) + ")" -} - -// IPProto represents VPP binary API enum 'ip_proto'. -type IPProto uint32 - -const ( - IP_API_PROTO_HOPOPT IPProto = 0 - IP_API_PROTO_ICMP IPProto = 1 - IP_API_PROTO_IGMP IPProto = 2 - IP_API_PROTO_TCP IPProto = 6 - IP_API_PROTO_UDP IPProto = 17 - IP_API_PROTO_GRE IPProto = 47 - IP_API_PROTO_AH IPProto = 50 - IP_API_PROTO_ESP IPProto = 51 - IP_API_PROTO_EIGRP IPProto = 88 - IP_API_PROTO_OSPF IPProto = 89 - IP_API_PROTO_SCTP IPProto = 132 - IP_API_PROTO_RESERVED IPProto = 255 -) - -var ( - IPProto_name = map[uint32]string{ - 0: "IP_API_PROTO_HOPOPT", - 1: "IP_API_PROTO_ICMP", - 2: "IP_API_PROTO_IGMP", - 6: "IP_API_PROTO_TCP", - 17: "IP_API_PROTO_UDP", - 47: "IP_API_PROTO_GRE", - 50: "IP_API_PROTO_AH", - 51: "IP_API_PROTO_ESP", - 88: "IP_API_PROTO_EIGRP", - 89: "IP_API_PROTO_OSPF", - 132: "IP_API_PROTO_SCTP", - 255: "IP_API_PROTO_RESERVED", - } - IPProto_value = map[string]uint32{ - "IP_API_PROTO_HOPOPT": 0, - "IP_API_PROTO_ICMP": 1, - "IP_API_PROTO_IGMP": 2, - "IP_API_PROTO_TCP": 6, - "IP_API_PROTO_UDP": 17, - "IP_API_PROTO_GRE": 47, - "IP_API_PROTO_AH": 50, - "IP_API_PROTO_ESP": 51, - "IP_API_PROTO_EIGRP": 88, - "IP_API_PROTO_OSPF": 89, - "IP_API_PROTO_SCTP": 132, - "IP_API_PROTO_RESERVED": 255, - } -) - -func (x IPProto) String() string { - s, ok := IPProto_name[uint32(x)] - if ok { - return s - } - return "IPProto(" + strconv.Itoa(int(x)) + ")" -} - -// IPReassType represents VPP binary API enum 'ip_reass_type'. -type IPReassType uint32 - -const ( - IP_REASS_TYPE_FULL IPReassType = 0 - IP_REASS_TYPE_SHALLOW_VIRTUAL IPReassType = 1 -) - -var ( - IPReassType_name = map[uint32]string{ - 0: "IP_REASS_TYPE_FULL", - 1: "IP_REASS_TYPE_SHALLOW_VIRTUAL", - } - IPReassType_value = map[string]uint32{ - "IP_REASS_TYPE_FULL": 0, - "IP_REASS_TYPE_SHALLOW_VIRTUAL": 1, - } -) - -func (x IPReassType) String() string { - s, ok := IPReassType_name[uint32(x)] - if ok { - return s - } - return "IPReassType(" + strconv.Itoa(int(x)) + ")" -} - -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} - -// MfibItfFlags represents VPP binary API enum 'mfib_itf_flags'. -type MfibItfFlags uint32 - -const ( - MFIB_API_ITF_FLAG_NONE MfibItfFlags = 0 - MFIB_API_ITF_FLAG_NEGATE_SIGNAL MfibItfFlags = 1 - MFIB_API_ITF_FLAG_ACCEPT MfibItfFlags = 2 - MFIB_API_ITF_FLAG_FORWARD MfibItfFlags = 4 - MFIB_API_ITF_FLAG_SIGNAL_PRESENT MfibItfFlags = 8 - MFIB_API_ITF_FLAG_DONT_PRESERVE MfibItfFlags = 16 -) - -var ( - MfibItfFlags_name = map[uint32]string{ - 0: "MFIB_API_ITF_FLAG_NONE", - 1: "MFIB_API_ITF_FLAG_NEGATE_SIGNAL", - 2: "MFIB_API_ITF_FLAG_ACCEPT", - 4: "MFIB_API_ITF_FLAG_FORWARD", - 8: "MFIB_API_ITF_FLAG_SIGNAL_PRESENT", - 16: "MFIB_API_ITF_FLAG_DONT_PRESERVE", - } - MfibItfFlags_value = map[string]uint32{ - "MFIB_API_ITF_FLAG_NONE": 0, - "MFIB_API_ITF_FLAG_NEGATE_SIGNAL": 1, - "MFIB_API_ITF_FLAG_ACCEPT": 2, - "MFIB_API_ITF_FLAG_FORWARD": 4, - "MFIB_API_ITF_FLAG_SIGNAL_PRESENT": 8, - "MFIB_API_ITF_FLAG_DONT_PRESERVE": 16, - } -) - -func (x MfibItfFlags) String() string { - s, ok := MfibItfFlags_name[uint32(x)] - if ok { - return s - } - return "MfibItfFlags(" + strconv.Itoa(int(x)) + ")" -} - -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var ( - MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" -} - -// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. -type AddressWithPrefix Prefix - -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 - -// IP4Address represents VPP binary API alias 'ip4_address'. -type IP4Address [4]uint8 - -// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. -type IP4AddressWithPrefix IP4Prefix - -// IP6Address represents VPP binary API alias 'ip6_address'. -type IP6Address [16]uint8 - -// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. -type IP6AddressWithPrefix IP6Prefix - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -// Address represents VPP binary API type 'address'. -type Address struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` -} - -func (*Address) GetTypeName() string { return "address" } - -// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. -type FibMplsLabel struct { - IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"` - Label uint32 `binapi:"u32,name=label" json:"label,omitempty"` - TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` - Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"` -} - -func (*FibMplsLabel) GetTypeName() string { return "fib_mpls_label" } - -// FibPath represents VPP binary API type 'fib_path'. -type FibPath struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` - Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` - Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` - Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"` - Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"` - Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"` - Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"` - NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"` - LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty" struc:"[16]FibMplsLabel"` -} - -func (*FibPath) GetTypeName() string { return "fib_path" } - -// FibPathNh represents VPP binary API type 'fib_path_nh'. -type FibPathNh struct { - Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` - ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` - ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` - ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` -} - -func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } - -// IP4Prefix represents VPP binary API type 'ip4_prefix'. -type IP4Prefix struct { - Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } - -// IP6Prefix represents VPP binary API type 'ip6_prefix'. -type IP6Prefix struct { - Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } - -// IPMroute represents VPP binary API type 'ip_mroute'. -type IPMroute struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - EntryFlags uint32 `binapi:"u32,name=entry_flags" json:"entry_flags,omitempty"` - RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` - Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` - NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` - Paths []MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` -} - -func (*IPMroute) GetTypeName() string { return "ip_mroute" } - -// IPRoute represents VPP binary API type 'ip_route'. -type IPRoute struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` - Paths []FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` -} - -func (*IPRoute) GetTypeName() string { return "ip_route" } - -// IPTable represents VPP binary API type 'ip_table'. -type IPTable struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (*IPTable) GetTypeName() string { return "ip_table" } - -// MfibPath represents VPP binary API type 'mfib_path'. -type MfibPath struct { - ItfFlags MfibItfFlags `binapi:"mfib_itf_flags,name=itf_flags" json:"itf_flags,omitempty"` - Path FibPath `binapi:"fib_path,name=path" json:"path,omitempty"` -} - -func (*MfibPath) GetTypeName() string { return "mfib_path" } - -// Mprefix represents VPP binary API type 'mprefix'. -type Mprefix struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` - GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` - SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` -} - -func (*Mprefix) GetTypeName() string { return "mprefix" } - -// Prefix represents VPP binary API type 'prefix'. -type Prefix struct { - Address Address `binapi:"address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*Prefix) GetTypeName() string { return "prefix" } - -// PrefixMatcher represents VPP binary API type 'prefix_matcher'. -type PrefixMatcher struct { - Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` - Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` -} - -func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } - -// PuntRedirect represents VPP binary API type 'punt_redirect'. -type PuntRedirect struct { - RxSwIfIndex InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` - TxSwIfIndex InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` - Nh Address `binapi:"address,name=nh" json:"nh,omitempty"` -} - -func (*PuntRedirect) GetTypeName() string { return "punt_redirect" } - -// AddressUnion represents VPP binary API union 'address_union'. -type AddressUnion struct { - XXX_UnionData [16]byte -} - -func (*AddressUnion) GetTypeName() string { return "address_union" } - -func AddressUnionIP4(a IP4Address) (u AddressUnion) { - u.SetIP4(a) - return -} -func (u *AddressUnion) SetIP4(a IP4Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -func AddressUnionIP6(a IP6Address) (u AddressUnion) { - u.SetIP6(a) - return -} -func (u *AddressUnion) SetIP6(a IP6Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -// IoamDisable represents VPP binary API message 'ioam_disable'. -type IoamDisable struct { - ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` -} - -func (m *IoamDisable) Reset() { *m = IoamDisable{} } -func (*IoamDisable) GetMessageName() string { return "ioam_disable" } -func (*IoamDisable) GetCrcString() string { return "6b16a45e" } -func (*IoamDisable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IoamDisable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ID - size += 2 - return size -} -func (m *IoamDisable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ID - o.PutUint16(buf[pos:pos+2], uint16(m.ID)) - pos += 2 - return buf, nil -} -func (m *IoamDisable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ID - m.ID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -// IoamDisableReply represents VPP binary API message 'ioam_disable_reply'. -type IoamDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IoamDisableReply) Reset() { *m = IoamDisableReply{} } -func (*IoamDisableReply) GetMessageName() string { return "ioam_disable_reply" } -func (*IoamDisableReply) GetCrcString() string { return "e8d4e804" } -func (*IoamDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IoamDisableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IoamDisableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IoamDisableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IoamEnable represents VPP binary API message 'ioam_enable'. -type IoamEnable struct { - ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` - Seqno bool `binapi:"bool,name=seqno" json:"seqno,omitempty"` - Analyse bool `binapi:"bool,name=analyse" json:"analyse,omitempty"` - PotEnable bool `binapi:"bool,name=pot_enable" json:"pot_enable,omitempty"` - TraceEnable bool `binapi:"bool,name=trace_enable" json:"trace_enable,omitempty"` - NodeID uint32 `binapi:"u32,name=node_id" json:"node_id,omitempty"` -} - -func (m *IoamEnable) Reset() { *m = IoamEnable{} } -func (*IoamEnable) GetMessageName() string { return "ioam_enable" } -func (*IoamEnable) GetCrcString() string { return "51ccd868" } -func (*IoamEnable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IoamEnable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ID - size += 2 - // field[1] m.Seqno - size += 1 - // field[1] m.Analyse - size += 1 - // field[1] m.PotEnable - size += 1 - // field[1] m.TraceEnable - size += 1 - // field[1] m.NodeID - size += 4 - return size -} -func (m *IoamEnable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ID - o.PutUint16(buf[pos:pos+2], uint16(m.ID)) - pos += 2 - // field[1] m.Seqno - if m.Seqno { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Analyse - if m.Analyse { - buf[pos] = 1 - } - pos += 1 - // field[1] m.PotEnable - if m.PotEnable { - buf[pos] = 1 - } - pos += 1 - // field[1] m.TraceEnable - if m.TraceEnable { - buf[pos] = 1 - } - pos += 1 - // field[1] m.NodeID - o.PutUint32(buf[pos:pos+4], uint32(m.NodeID)) - pos += 4 - return buf, nil -} -func (m *IoamEnable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ID - m.ID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.Seqno - m.Seqno = tmp[pos] != 0 - pos += 1 - // field[1] m.Analyse - m.Analyse = tmp[pos] != 0 - pos += 1 - // field[1] m.PotEnable - m.PotEnable = tmp[pos] != 0 - pos += 1 - // field[1] m.TraceEnable - m.TraceEnable = tmp[pos] != 0 - pos += 1 - // field[1] m.NodeID - m.NodeID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IoamEnableReply represents VPP binary API message 'ioam_enable_reply'. -type IoamEnableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IoamEnableReply) Reset() { *m = IoamEnableReply{} } -func (*IoamEnableReply) GetMessageName() string { return "ioam_enable_reply" } -func (*IoamEnableReply) GetCrcString() string { return "e8d4e804" } -func (*IoamEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IoamEnableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IoamEnableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IoamEnableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPAddressDetails represents VPP binary API message 'ip_address_details'. -type IPAddressDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` -} - -func (m *IPAddressDetails) Reset() { *m = IPAddressDetails{} } -func (*IPAddressDetails) GetMessageName() string { return "ip_address_details" } -func (*IPAddressDetails) GetCrcString() string { return "b1199745" } -func (*IPAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPAddressDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 4 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - return size -} -func (m *IPAddressDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) - pos += 4 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - return buf, nil -} -func (m *IPAddressDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - return nil -} - -// IPAddressDump represents VPP binary API message 'ip_address_dump'. -type IPAddressDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *IPAddressDump) Reset() { *m = IPAddressDump{} } -func (*IPAddressDump) GetMessageName() string { return "ip_address_dump" } -func (*IPAddressDump) GetCrcString() string { return "2d033de4" } -func (*IPAddressDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPAddressDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *IPAddressDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPAddressDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del'. -type IPContainerProxyAddDel struct { - Pfx Prefix `binapi:"prefix,name=pfx" json:"pfx,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` -} - -func (m *IPContainerProxyAddDel) Reset() { *m = IPContainerProxyAddDel{} } -func (*IPContainerProxyAddDel) GetMessageName() string { return "ip_container_proxy_add_del" } -func (*IPContainerProxyAddDel) GetCrcString() string { return "91189f40" } -func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPContainerProxyAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Pfx - // field[2] m.Pfx.Address - // field[3] m.Pfx.Address.Af - size += 4 - // field[3] m.Pfx.Address.Un - size += 16 - // field[2] m.Pfx.Len - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsAdd - size += 1 - return size -} -func (m *IPContainerProxyAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Pfx - // field[2] m.Pfx.Address - // field[3] m.Pfx.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Pfx.Address.Af)) - pos += 4 - // field[3] m.Pfx.Address.Un - copy(buf[pos:pos+16], m.Pfx.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Pfx.Len - buf[pos] = uint8(m.Pfx.Len) - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPContainerProxyAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Pfx - // field[2] m.Pfx.Address - // field[3] m.Pfx.Address.Af - m.Pfx.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Pfx.Address.Un - copy(m.Pfx.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Pfx.Len - m.Pfx.Len = uint8(tmp[pos]) - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply'. -type IPContainerProxyAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPContainerProxyAddDelReply) Reset() { *m = IPContainerProxyAddDelReply{} } -func (*IPContainerProxyAddDelReply) GetMessageName() string { - return "ip_container_proxy_add_del_reply" -} -func (*IPContainerProxyAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPContainerProxyAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPContainerProxyAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPContainerProxyAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details'. -type IPContainerProxyDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` -} - -func (m *IPContainerProxyDetails) Reset() { *m = IPContainerProxyDetails{} } -func (*IPContainerProxyDetails) GetMessageName() string { return "ip_container_proxy_details" } -func (*IPContainerProxyDetails) GetCrcString() string { return "0ee460e8" } -func (*IPContainerProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPContainerProxyDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 4 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - return size -} -func (m *IPContainerProxyDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) - pos += 4 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - return buf, nil -} -func (m *IPContainerProxyDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - return nil -} - -// IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump'. -type IPContainerProxyDump struct{} - -func (m *IPContainerProxyDump) Reset() { *m = IPContainerProxyDump{} } -func (*IPContainerProxyDump) GetMessageName() string { return "ip_container_proxy_dump" } -func (*IPContainerProxyDump) GetCrcString() string { return "51077d14" } -func (*IPContainerProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPContainerProxyDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *IPContainerProxyDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *IPContainerProxyDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// IPDetails represents VPP binary API message 'ip_details'. -type IPDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *IPDetails) Reset() { *m = IPDetails{} } -func (*IPDetails) GetMessageName() string { return "ip_details" } -func (*IPDetails) GetCrcString() string { return "eb152d07" } -func (*IPDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *IPDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPDump represents VPP binary API message 'ip_dump'. -type IPDump struct { - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *IPDump) Reset() { *m = IPDump{} } -func (*IPDump) GetMessageName() string { return "ip_dump" } -func (*IPDump) GetCrcString() string { return "98d231ca" } -func (*IPDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *IPDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del'. -type IPMrouteAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` - Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` -} - -func (m *IPMrouteAddDel) Reset() { *m = IPMrouteAddDel{} } -func (*IPMrouteAddDel) GetMessageName() string { return "ip_mroute_add_del" } -func (*IPMrouteAddDel) GetCrcString() string { return "f6627d17" } -func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPMrouteAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.IsMultipath - size += 1 - // field[1] m.Route - // field[2] m.Route.TableID - size += 4 - // field[2] m.Route.EntryFlags - size += 4 - // field[2] m.Route.RpfID - size += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - size += 4 - // field[3] m.Route.Prefix.GrpAddressLength - size += 2 - // field[3] m.Route.Prefix.GrpAddress - size += 16 - // field[3] m.Route.Prefix.SrcAddress - size += 16 - // field[2] m.Route.NPaths - size += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 MfibPath - _ = s2 - if j2 < len(m.Route.Paths) { - s2 = m.Route.Paths[j2] - } - // field[3] s2.ItfFlags - size += 4 - // field[3] s2.Path - // field[4] s2.Path.SwIfIndex - size += 4 - // field[4] s2.Path.TableID - size += 4 - // field[4] s2.Path.RpfID - size += 4 - // field[4] s2.Path.Weight - size += 1 - // field[4] s2.Path.Preference - size += 1 - // field[4] s2.Path.Type - size += 4 - // field[4] s2.Path.Flags - size += 4 - // field[4] s2.Path.Proto - size += 4 - // field[4] s2.Path.Nh - // field[5] s2.Path.Nh.Address - size += 16 - // field[5] s2.Path.Nh.ViaLabel - size += 4 - // field[5] s2.Path.Nh.ObjID - size += 4 - // field[5] s2.Path.Nh.ClassifyTableIndex - size += 4 - // field[4] s2.Path.NLabels - size += 1 - // field[4] s2.Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - var s4 FibMplsLabel - _ = s4 - if j4 < len(s2.Path.LabelStack) { - s4 = s2.Path.LabelStack[j4] - } - // field[5] s4.IsUniform - size += 1 - // field[5] s4.Label - size += 4 - // field[5] s4.TTL - size += 1 - // field[5] s4.Exp - size += 1 - } - } - return size -} -func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.IsMultipath - if m.IsMultipath { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Route - // field[2] m.Route.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) - pos += 4 - // field[2] m.Route.EntryFlags - o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) - pos += 4 - // field[2] m.Route.RpfID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) - pos += 4 - // field[3] m.Route.Prefix.GrpAddressLength - o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) - pos += 2 - // field[3] m.Route.Prefix.GrpAddress - copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) - pos += 16 - // field[3] m.Route.Prefix.SrcAddress - copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) - pos += 16 - // field[2] m.Route.NPaths - buf[pos] = uint8(len(m.Route.Paths)) - pos += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 MfibPath - if j2 < len(m.Route.Paths) { - v2 = m.Route.Paths[j2] - } - // field[3] v2.ItfFlags - o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) - pos += 4 - // field[3] v2.Path - // field[4] v2.Path.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) - pos += 4 - // field[4] v2.Path.TableID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) - pos += 4 - // field[4] v2.Path.RpfID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) - pos += 4 - // field[4] v2.Path.Weight - buf[pos] = uint8(v2.Path.Weight) - pos += 1 - // field[4] v2.Path.Preference - buf[pos] = uint8(v2.Path.Preference) - pos += 1 - // field[4] v2.Path.Type - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) - pos += 4 - // field[4] v2.Path.Flags - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) - pos += 4 - // field[4] v2.Path.Proto - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) - pos += 4 - // field[4] v2.Path.Nh - // field[5] v2.Path.Nh.Address - copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) - pos += 16 - // field[5] v2.Path.Nh.ViaLabel - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) - pos += 4 - // field[5] v2.Path.Nh.ObjID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) - pos += 4 - // field[5] v2.Path.Nh.ClassifyTableIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) - pos += 4 - // field[4] v2.Path.NLabels - buf[pos] = uint8(v2.Path.NLabels) - pos += 1 - // field[4] v2.Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - var v4 FibMplsLabel - if j4 < len(v2.Path.LabelStack) { - v4 = v2.Path.LabelStack[j4] - } - // field[5] v4.IsUniform - buf[pos] = uint8(v4.IsUniform) - pos += 1 - // field[5] v4.Label - o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) - pos += 4 - // field[5] v4.TTL - buf[pos] = uint8(v4.TTL) - pos += 1 - // field[5] v4.Exp - buf[pos] = uint8(v4.Exp) - pos += 1 - } - } - return buf, nil -} -func (m *IPMrouteAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.IsMultipath - m.IsMultipath = tmp[pos] != 0 - pos += 1 - // field[1] m.Route - // field[2] m.Route.TableID - m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.EntryFlags - m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.RpfID - m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Prefix.GrpAddressLength - m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[3] m.Route.Prefix.GrpAddress - copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.Route.Prefix.SrcAddress - copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Route.NPaths - m.Route.NPaths = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.Paths - m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) - for j2 := 0; j2 < int(m.Route.NPaths); j2++ { - // field[3] m.Route.Paths[j2].ItfFlags - m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Path - // field[4] m.Route.Paths[j2].Path.SwIfIndex - m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.TableID - m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.RpfID - m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Weight - m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.Preference - m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.Type - m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Flags - m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Proto - m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Nh - // field[5] m.Route.Paths[j2].Path.Nh.Address - copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel - m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.Nh.ObjID - m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex - m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.NLabels - m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform - m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) - pos += 1 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label - m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL - m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) - pos += 1 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp - m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply'. -type IPMrouteAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` -} - -func (m *IPMrouteAddDelReply) Reset() { *m = IPMrouteAddDelReply{} } -func (*IPMrouteAddDelReply) GetMessageName() string { return "ip_mroute_add_del_reply" } -func (*IPMrouteAddDelReply) GetCrcString() string { return "1992deab" } -func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPMrouteAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.StatsIndex - size += 4 - return size -} -func (m *IPMrouteAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.StatsIndex - o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) - pos += 4 - return buf, nil -} -func (m *IPMrouteAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.StatsIndex - m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPMrouteDetails represents VPP binary API message 'ip_mroute_details'. -type IPMrouteDetails struct { - Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` -} - -func (m *IPMrouteDetails) Reset() { *m = IPMrouteDetails{} } -func (*IPMrouteDetails) GetMessageName() string { return "ip_mroute_details" } -func (*IPMrouteDetails) GetCrcString() string { return "c1cb4b44" } -func (*IPMrouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPMrouteDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Route - // field[2] m.Route.TableID - size += 4 - // field[2] m.Route.EntryFlags - size += 4 - // field[2] m.Route.RpfID - size += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - size += 4 - // field[3] m.Route.Prefix.GrpAddressLength - size += 2 - // field[3] m.Route.Prefix.GrpAddress - size += 16 - // field[3] m.Route.Prefix.SrcAddress - size += 16 - // field[2] m.Route.NPaths - size += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 MfibPath - _ = s2 - if j2 < len(m.Route.Paths) { - s2 = m.Route.Paths[j2] - } - // field[3] s2.ItfFlags - size += 4 - // field[3] s2.Path - // field[4] s2.Path.SwIfIndex - size += 4 - // field[4] s2.Path.TableID - size += 4 - // field[4] s2.Path.RpfID - size += 4 - // field[4] s2.Path.Weight - size += 1 - // field[4] s2.Path.Preference - size += 1 - // field[4] s2.Path.Type - size += 4 - // field[4] s2.Path.Flags - size += 4 - // field[4] s2.Path.Proto - size += 4 - // field[4] s2.Path.Nh - // field[5] s2.Path.Nh.Address - size += 16 - // field[5] s2.Path.Nh.ViaLabel - size += 4 - // field[5] s2.Path.Nh.ObjID - size += 4 - // field[5] s2.Path.Nh.ClassifyTableIndex - size += 4 - // field[4] s2.Path.NLabels - size += 1 - // field[4] s2.Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - var s4 FibMplsLabel - _ = s4 - if j4 < len(s2.Path.LabelStack) { - s4 = s2.Path.LabelStack[j4] - } - // field[5] s4.IsUniform - size += 1 - // field[5] s4.Label - size += 4 - // field[5] s4.TTL - size += 1 - // field[5] s4.Exp - size += 1 - } - } - return size -} -func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Route - // field[2] m.Route.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) - pos += 4 - // field[2] m.Route.EntryFlags - o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) - pos += 4 - // field[2] m.Route.RpfID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) - pos += 4 - // field[3] m.Route.Prefix.GrpAddressLength - o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) - pos += 2 - // field[3] m.Route.Prefix.GrpAddress - copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) - pos += 16 - // field[3] m.Route.Prefix.SrcAddress - copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) - pos += 16 - // field[2] m.Route.NPaths - buf[pos] = uint8(len(m.Route.Paths)) - pos += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 MfibPath - if j2 < len(m.Route.Paths) { - v2 = m.Route.Paths[j2] - } - // field[3] v2.ItfFlags - o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) - pos += 4 - // field[3] v2.Path - // field[4] v2.Path.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) - pos += 4 - // field[4] v2.Path.TableID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) - pos += 4 - // field[4] v2.Path.RpfID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) - pos += 4 - // field[4] v2.Path.Weight - buf[pos] = uint8(v2.Path.Weight) - pos += 1 - // field[4] v2.Path.Preference - buf[pos] = uint8(v2.Path.Preference) - pos += 1 - // field[4] v2.Path.Type - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) - pos += 4 - // field[4] v2.Path.Flags - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) - pos += 4 - // field[4] v2.Path.Proto - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) - pos += 4 - // field[4] v2.Path.Nh - // field[5] v2.Path.Nh.Address - copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) - pos += 16 - // field[5] v2.Path.Nh.ViaLabel - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) - pos += 4 - // field[5] v2.Path.Nh.ObjID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) - pos += 4 - // field[5] v2.Path.Nh.ClassifyTableIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) - pos += 4 - // field[4] v2.Path.NLabels - buf[pos] = uint8(v2.Path.NLabels) - pos += 1 - // field[4] v2.Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - var v4 FibMplsLabel - if j4 < len(v2.Path.LabelStack) { - v4 = v2.Path.LabelStack[j4] - } - // field[5] v4.IsUniform - buf[pos] = uint8(v4.IsUniform) - pos += 1 - // field[5] v4.Label - o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) - pos += 4 - // field[5] v4.TTL - buf[pos] = uint8(v4.TTL) - pos += 1 - // field[5] v4.Exp - buf[pos] = uint8(v4.Exp) - pos += 1 - } - } - return buf, nil -} -func (m *IPMrouteDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Route - // field[2] m.Route.TableID - m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.EntryFlags - m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.RpfID - m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Prefix.GrpAddressLength - m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[3] m.Route.Prefix.GrpAddress - copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.Route.Prefix.SrcAddress - copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Route.NPaths - m.Route.NPaths = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.Paths - m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) - for j2 := 0; j2 < int(m.Route.NPaths); j2++ { - // field[3] m.Route.Paths[j2].ItfFlags - m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Path - // field[4] m.Route.Paths[j2].Path.SwIfIndex - m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.TableID - m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.RpfID - m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Weight - m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.Preference - m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.Type - m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Flags - m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Proto - m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Nh - // field[5] m.Route.Paths[j2].Path.Nh.Address - copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel - m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.Nh.ObjID - m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex - m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.NLabels - m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform - m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) - pos += 1 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label - m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL - m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) - pos += 1 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp - m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// IPMrouteDump represents VPP binary API message 'ip_mroute_dump'. -type IPMrouteDump struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPMrouteDump) Reset() { *m = IPMrouteDump{} } -func (*IPMrouteDump) GetMessageName() string { return "ip_mroute_dump" } -func (*IPMrouteDump) GetCrcString() string { return "b9d2e09e" } -func (*IPMrouteDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPMrouteDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPMrouteDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPMrouteDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPMtableDetails represents VPP binary API message 'ip_mtable_details'. -type IPMtableDetails struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPMtableDetails) Reset() { *m = IPMtableDetails{} } -func (*IPMtableDetails) GetMessageName() string { return "ip_mtable_details" } -func (*IPMtableDetails) GetCrcString() string { return "b9d2e09e" } -func (*IPMtableDetails) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPMtableDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPMtableDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPMtableDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPMtableDump represents VPP binary API message 'ip_mtable_dump'. -type IPMtableDump struct{} - -func (m *IPMtableDump) Reset() { *m = IPMtableDump{} } -func (*IPMtableDump) GetMessageName() string { return "ip_mtable_dump" } -func (*IPMtableDump) GetCrcString() string { return "51077d14" } -func (*IPMtableDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPMtableDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *IPMtableDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *IPMtableDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// IPPuntPolice represents VPP binary API message 'ip_punt_police'. -type IPPuntPolice struct { - PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` -} - -func (m *IPPuntPolice) Reset() { *m = IPPuntPolice{} } -func (*IPPuntPolice) GetMessageName() string { return "ip_punt_police" } -func (*IPPuntPolice) GetCrcString() string { return "db867cea" } -func (*IPPuntPolice) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPPuntPolice) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.PolicerIndex - size += 4 - // field[1] m.IsAdd - size += 1 - // field[1] m.IsIP6 - size += 1 - return size -} -func (m *IPPuntPolice) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.PolicerIndex - o.PutUint32(buf[pos:pos+4], uint32(m.PolicerIndex)) - pos += 4 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.IsIP6 - if m.IsIP6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPPuntPolice) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.PolicerIndex - m.PolicerIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.IsIP6 - m.IsIP6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply'. -type IPPuntPoliceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPPuntPoliceReply) Reset() { *m = IPPuntPoliceReply{} } -func (*IPPuntPoliceReply) GetMessageName() string { return "ip_punt_police_reply" } -func (*IPPuntPoliceReply) GetCrcString() string { return "e8d4e804" } -func (*IPPuntPoliceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPPuntPoliceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPPuntPoliceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPPuntPoliceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPPuntRedirect represents VPP binary API message 'ip_punt_redirect'. -type IPPuntRedirect struct { - Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` -} - -func (m *IPPuntRedirect) Reset() { *m = IPPuntRedirect{} } -func (*IPPuntRedirect) GetMessageName() string { return "ip_punt_redirect" } -func (*IPPuntRedirect) GetCrcString() string { return "a9a5592c" } -func (*IPPuntRedirect) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPPuntRedirect) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - size += 4 - // field[2] m.Punt.TxSwIfIndex - size += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - size += 4 - // field[3] m.Punt.Nh.Un - size += 16 - // field[1] m.IsAdd - size += 1 - return size -} -func (m *IPPuntRedirect) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) - pos += 4 - // field[2] m.Punt.TxSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) - pos += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) - pos += 4 - // field[3] m.Punt.Nh.Un - copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) - pos += 16 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPPuntRedirect) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Punt.TxSwIfIndex - m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Punt.Nh.Un - copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details'. -type IPPuntRedirectDetails struct { - Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` -} - -func (m *IPPuntRedirectDetails) Reset() { *m = IPPuntRedirectDetails{} } -func (*IPPuntRedirectDetails) GetMessageName() string { return "ip_punt_redirect_details" } -func (*IPPuntRedirectDetails) GetCrcString() string { return "3924f5d3" } -func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPPuntRedirectDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - size += 4 - // field[2] m.Punt.TxSwIfIndex - size += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - size += 4 - // field[3] m.Punt.Nh.Un - size += 16 - return size -} -func (m *IPPuntRedirectDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) - pos += 4 - // field[2] m.Punt.TxSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) - pos += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) - pos += 4 - // field[3] m.Punt.Nh.Un - copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) - pos += 16 - return buf, nil -} -func (m *IPPuntRedirectDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Punt.TxSwIfIndex - m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Punt.Nh.Un - copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - return nil -} - -// IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump'. -type IPPuntRedirectDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *IPPuntRedirectDump) Reset() { *m = IPPuntRedirectDump{} } -func (*IPPuntRedirectDump) GetMessageName() string { return "ip_punt_redirect_dump" } -func (*IPPuntRedirectDump) GetCrcString() string { return "2d033de4" } -func (*IPPuntRedirectDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPPuntRedirectDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *IPPuntRedirectDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPPuntRedirectDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply'. -type IPPuntRedirectReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPPuntRedirectReply) Reset() { *m = IPPuntRedirectReply{} } -func (*IPPuntRedirectReply) GetMessageName() string { return "ip_punt_redirect_reply" } -func (*IPPuntRedirectReply) GetCrcString() string { return "e8d4e804" } -func (*IPPuntRedirectReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPPuntRedirectReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPPuntRedirectReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPPuntRedirectReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable'. -type IPReassemblyEnableDisable struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - EnableIP4 bool `binapi:"bool,name=enable_ip4" json:"enable_ip4,omitempty"` - EnableIP6 bool `binapi:"bool,name=enable_ip6" json:"enable_ip6,omitempty"` - Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` -} - -func (m *IPReassemblyEnableDisable) Reset() { *m = IPReassemblyEnableDisable{} } -func (*IPReassemblyEnableDisable) GetMessageName() string { return "ip_reassembly_enable_disable" } -func (*IPReassemblyEnableDisable) GetCrcString() string { return "885c85a6" } -func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPReassemblyEnableDisable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.EnableIP4 - size += 1 - // field[1] m.EnableIP6 - size += 1 - // field[1] m.Type - size += 4 - return size -} -func (m *IPReassemblyEnableDisable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.EnableIP4 - if m.EnableIP4 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.EnableIP6 - if m.EnableIP6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Type - o.PutUint32(buf[pos:pos+4], uint32(m.Type)) - pos += 4 - return buf, nil -} -func (m *IPReassemblyEnableDisable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.EnableIP4 - m.EnableIP4 = tmp[pos] != 0 - pos += 1 - // field[1] m.EnableIP6 - m.EnableIP6 = tmp[pos] != 0 - pos += 1 - // field[1] m.Type - m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply'. -type IPReassemblyEnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPReassemblyEnableDisableReply) Reset() { *m = IPReassemblyEnableDisableReply{} } -func (*IPReassemblyEnableDisableReply) GetMessageName() string { - return "ip_reassembly_enable_disable_reply" -} -func (*IPReassemblyEnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPReassemblyEnableDisableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPReassemblyEnableDisableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPReassemblyEnableDisableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblyGet represents VPP binary API message 'ip_reassembly_get'. -type IPReassemblyGet struct { - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` - Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` -} - -func (m *IPReassemblyGet) Reset() { *m = IPReassemblyGet{} } -func (*IPReassemblyGet) GetMessageName() string { return "ip_reassembly_get" } -func (*IPReassemblyGet) GetCrcString() string { return "ea13ff63" } -func (*IPReassemblyGet) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPReassemblyGet) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsIP6 - size += 1 - // field[1] m.Type - size += 4 - return size -} -func (m *IPReassemblyGet) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsIP6 - if m.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Type - o.PutUint32(buf[pos:pos+4], uint32(m.Type)) - pos += 4 - return buf, nil -} -func (m *IPReassemblyGet) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsIP6 - m.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[1] m.Type - m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply'. -type IPReassemblyGetReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` - MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` - MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` - ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` -} - -func (m *IPReassemblyGetReply) Reset() { *m = IPReassemblyGetReply{} } -func (*IPReassemblyGetReply) GetMessageName() string { return "ip_reassembly_get_reply" } -func (*IPReassemblyGetReply) GetCrcString() string { return "d5eb8d34" } -func (*IPReassemblyGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPReassemblyGetReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.TimeoutMs - size += 4 - // field[1] m.MaxReassemblies - size += 4 - // field[1] m.MaxReassemblyLength - size += 4 - // field[1] m.ExpireWalkIntervalMs - size += 4 - // field[1] m.IsIP6 - size += 1 - return size -} -func (m *IPReassemblyGetReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.TimeoutMs - o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) - pos += 4 - // field[1] m.MaxReassemblies - o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) - pos += 4 - // field[1] m.MaxReassemblyLength - o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) - pos += 4 - // field[1] m.ExpireWalkIntervalMs - o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) - pos += 4 - // field[1] m.IsIP6 - if m.IsIP6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPReassemblyGetReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TimeoutMs - m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MaxReassemblies - m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MaxReassemblyLength - m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ExpireWalkIntervalMs - m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIP6 - m.IsIP6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPReassemblySet represents VPP binary API message 'ip_reassembly_set'. -type IPReassemblySet struct { - TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` - MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` - MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` - ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` - Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` -} - -func (m *IPReassemblySet) Reset() { *m = IPReassemblySet{} } -func (*IPReassemblySet) GetMessageName() string { return "ip_reassembly_set" } -func (*IPReassemblySet) GetCrcString() string { return "16467d25" } -func (*IPReassemblySet) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPReassemblySet) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.TimeoutMs - size += 4 - // field[1] m.MaxReassemblies - size += 4 - // field[1] m.MaxReassemblyLength - size += 4 - // field[1] m.ExpireWalkIntervalMs - size += 4 - // field[1] m.IsIP6 - size += 1 - // field[1] m.Type - size += 4 - return size -} -func (m *IPReassemblySet) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.TimeoutMs - o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) - pos += 4 - // field[1] m.MaxReassemblies - o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) - pos += 4 - // field[1] m.MaxReassemblyLength - o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) - pos += 4 - // field[1] m.ExpireWalkIntervalMs - o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) - pos += 4 - // field[1] m.IsIP6 - if m.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Type - o.PutUint32(buf[pos:pos+4], uint32(m.Type)) - pos += 4 - return buf, nil -} -func (m *IPReassemblySet) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.TimeoutMs - m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MaxReassemblies - m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MaxReassemblyLength - m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ExpireWalkIntervalMs - m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIP6 - m.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[1] m.Type - m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply'. -type IPReassemblySetReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPReassemblySetReply) Reset() { *m = IPReassemblySetReply{} } -func (*IPReassemblySetReply) GetMessageName() string { return "ip_reassembly_set_reply" } -func (*IPReassemblySetReply) GetCrcString() string { return "e8d4e804" } -func (*IPReassemblySetReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPReassemblySetReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPReassemblySetReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPReassemblySetReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPRouteAddDel represents VPP binary API message 'ip_route_add_del'. -type IPRouteAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` - Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` -} - -func (m *IPRouteAddDel) Reset() { *m = IPRouteAddDel{} } -func (*IPRouteAddDel) GetMessageName() string { return "ip_route_add_del" } -func (*IPRouteAddDel) GetCrcString() string { return "c1ff832d" } -func (*IPRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPRouteAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.IsMultipath - size += 1 - // field[1] m.Route - // field[2] m.Route.TableID - size += 4 - // field[2] m.Route.StatsIndex - size += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - size += 4 - // field[4] m.Route.Prefix.Address.Un - size += 16 - // field[3] m.Route.Prefix.Len - size += 1 - // field[2] m.Route.NPaths - size += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 FibPath - _ = s2 - if j2 < len(m.Route.Paths) { - s2 = m.Route.Paths[j2] - } - // field[3] s2.SwIfIndex - size += 4 - // field[3] s2.TableID - size += 4 - // field[3] s2.RpfID - size += 4 - // field[3] s2.Weight - size += 1 - // field[3] s2.Preference - size += 1 - // field[3] s2.Type - size += 4 - // field[3] s2.Flags - size += 4 - // field[3] s2.Proto - size += 4 - // field[3] s2.Nh - // field[4] s2.Nh.Address - size += 16 - // field[4] s2.Nh.ViaLabel - size += 4 - // field[4] s2.Nh.ObjID - size += 4 - // field[4] s2.Nh.ClassifyTableIndex - size += 4 - // field[3] s2.NLabels - size += 1 - // field[3] s2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var s3 FibMplsLabel - _ = s3 - if j3 < len(s2.LabelStack) { - s3 = s2.LabelStack[j3] - } - // field[4] s3.IsUniform - size += 1 - // field[4] s3.Label - size += 4 - // field[4] s3.TTL - size += 1 - // field[4] s3.Exp - size += 1 - } - } - return size -} -func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.IsMultipath - if m.IsMultipath { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Route - // field[2] m.Route.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) - pos += 4 - // field[2] m.Route.StatsIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) - pos += 4 - // field[4] m.Route.Prefix.Address.Un - copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] m.Route.Prefix.Len - buf[pos] = uint8(m.Route.Prefix.Len) - pos += 1 - // field[2] m.Route.NPaths - buf[pos] = uint8(len(m.Route.Paths)) - pos += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 FibPath - if j2 < len(m.Route.Paths) { - v2 = m.Route.Paths[j2] - } - // field[3] v2.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) - pos += 4 - // field[3] v2.TableID - o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) - pos += 4 - // field[3] v2.RpfID - o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) - pos += 4 - // field[3] v2.Weight - buf[pos] = uint8(v2.Weight) - pos += 1 - // field[3] v2.Preference - buf[pos] = uint8(v2.Preference) - pos += 1 - // field[3] v2.Type - o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) - pos += 4 - // field[3] v2.Flags - o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) - pos += 4 - // field[3] v2.Proto - o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) - pos += 4 - // field[3] v2.Nh - // field[4] v2.Nh.Address - copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) - pos += 16 - // field[4] v2.Nh.ViaLabel - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) - pos += 4 - // field[4] v2.Nh.ObjID - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) - pos += 4 - // field[4] v2.Nh.ClassifyTableIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) - pos += 4 - // field[3] v2.NLabels - buf[pos] = uint8(v2.NLabels) - pos += 1 - // field[3] v2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var v3 FibMplsLabel - if j3 < len(v2.LabelStack) { - v3 = v2.LabelStack[j3] - } - // field[4] v3.IsUniform - buf[pos] = uint8(v3.IsUniform) - pos += 1 - // field[4] v3.Label - o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) - pos += 4 - // field[4] v3.TTL - buf[pos] = uint8(v3.TTL) - pos += 1 - // field[4] v3.Exp - buf[pos] = uint8(v3.Exp) - pos += 1 - } - } - return buf, nil -} -func (m *IPRouteAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.IsMultipath - m.IsMultipath = tmp[pos] != 0 - pos += 1 - // field[1] m.Route - // field[2] m.Route.TableID - m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.StatsIndex - m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Prefix.Address.Un - copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.Route.Prefix.Len - m.Route.Prefix.Len = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.NPaths - m.Route.NPaths = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.Paths - m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) - for j2 := 0; j2 < int(m.Route.NPaths); j2++ { - // field[3] m.Route.Paths[j2].SwIfIndex - m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].TableID - m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].RpfID - m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Weight - m.Route.Paths[j2].Weight = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Preference - m.Route.Paths[j2].Preference = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Type - m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Flags - m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Proto - m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Nh - // field[4] m.Route.Paths[j2].Nh.Address - copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[4] m.Route.Paths[j2].Nh.ViaLabel - m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ObjID - m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex - m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].NLabels - m.Route.Paths[j2].NLabels = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].LabelStack - for j3 := 0; j3 < 16; j3++ { - // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform - m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Label - m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].LabelStack[j3].TTL - m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Exp - m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// IPRouteAddDelReply represents VPP binary API message 'ip_route_add_del_reply'. -type IPRouteAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` -} - -func (m *IPRouteAddDelReply) Reset() { *m = IPRouteAddDelReply{} } -func (*IPRouteAddDelReply) GetMessageName() string { return "ip_route_add_del_reply" } -func (*IPRouteAddDelReply) GetCrcString() string { return "1992deab" } -func (*IPRouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPRouteAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.StatsIndex - size += 4 - return size -} -func (m *IPRouteAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.StatsIndex - o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) - pos += 4 - return buf, nil -} -func (m *IPRouteAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.StatsIndex - m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPRouteDetails represents VPP binary API message 'ip_route_details'. -type IPRouteDetails struct { - Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` -} - -func (m *IPRouteDetails) Reset() { *m = IPRouteDetails{} } -func (*IPRouteDetails) GetMessageName() string { return "ip_route_details" } -func (*IPRouteDetails) GetCrcString() string { return "d1ffaae1" } -func (*IPRouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPRouteDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Route - // field[2] m.Route.TableID - size += 4 - // field[2] m.Route.StatsIndex - size += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - size += 4 - // field[4] m.Route.Prefix.Address.Un - size += 16 - // field[3] m.Route.Prefix.Len - size += 1 - // field[2] m.Route.NPaths - size += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 FibPath - _ = s2 - if j2 < len(m.Route.Paths) { - s2 = m.Route.Paths[j2] - } - // field[3] s2.SwIfIndex - size += 4 - // field[3] s2.TableID - size += 4 - // field[3] s2.RpfID - size += 4 - // field[3] s2.Weight - size += 1 - // field[3] s2.Preference - size += 1 - // field[3] s2.Type - size += 4 - // field[3] s2.Flags - size += 4 - // field[3] s2.Proto - size += 4 - // field[3] s2.Nh - // field[4] s2.Nh.Address - size += 16 - // field[4] s2.Nh.ViaLabel - size += 4 - // field[4] s2.Nh.ObjID - size += 4 - // field[4] s2.Nh.ClassifyTableIndex - size += 4 - // field[3] s2.NLabels - size += 1 - // field[3] s2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var s3 FibMplsLabel - _ = s3 - if j3 < len(s2.LabelStack) { - s3 = s2.LabelStack[j3] - } - // field[4] s3.IsUniform - size += 1 - // field[4] s3.Label - size += 4 - // field[4] s3.TTL - size += 1 - // field[4] s3.Exp - size += 1 - } - } - return size -} -func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Route - // field[2] m.Route.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) - pos += 4 - // field[2] m.Route.StatsIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) - pos += 4 - // field[4] m.Route.Prefix.Address.Un - copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] m.Route.Prefix.Len - buf[pos] = uint8(m.Route.Prefix.Len) - pos += 1 - // field[2] m.Route.NPaths - buf[pos] = uint8(len(m.Route.Paths)) - pos += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 FibPath - if j2 < len(m.Route.Paths) { - v2 = m.Route.Paths[j2] - } - // field[3] v2.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) - pos += 4 - // field[3] v2.TableID - o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) - pos += 4 - // field[3] v2.RpfID - o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) - pos += 4 - // field[3] v2.Weight - buf[pos] = uint8(v2.Weight) - pos += 1 - // field[3] v2.Preference - buf[pos] = uint8(v2.Preference) - pos += 1 - // field[3] v2.Type - o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) - pos += 4 - // field[3] v2.Flags - o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) - pos += 4 - // field[3] v2.Proto - o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) - pos += 4 - // field[3] v2.Nh - // field[4] v2.Nh.Address - copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) - pos += 16 - // field[4] v2.Nh.ViaLabel - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) - pos += 4 - // field[4] v2.Nh.ObjID - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) - pos += 4 - // field[4] v2.Nh.ClassifyTableIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) - pos += 4 - // field[3] v2.NLabels - buf[pos] = uint8(v2.NLabels) - pos += 1 - // field[3] v2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var v3 FibMplsLabel - if j3 < len(v2.LabelStack) { - v3 = v2.LabelStack[j3] - } - // field[4] v3.IsUniform - buf[pos] = uint8(v3.IsUniform) - pos += 1 - // field[4] v3.Label - o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) - pos += 4 - // field[4] v3.TTL - buf[pos] = uint8(v3.TTL) - pos += 1 - // field[4] v3.Exp - buf[pos] = uint8(v3.Exp) - pos += 1 - } - } - return buf, nil -} -func (m *IPRouteDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Route - // field[2] m.Route.TableID - m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.StatsIndex - m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Prefix.Address.Un - copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.Route.Prefix.Len - m.Route.Prefix.Len = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.NPaths - m.Route.NPaths = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.Paths - m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) - for j2 := 0; j2 < int(m.Route.NPaths); j2++ { - // field[3] m.Route.Paths[j2].SwIfIndex - m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].TableID - m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].RpfID - m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Weight - m.Route.Paths[j2].Weight = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Preference - m.Route.Paths[j2].Preference = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Type - m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Flags - m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Proto - m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Nh - // field[4] m.Route.Paths[j2].Nh.Address - copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[4] m.Route.Paths[j2].Nh.ViaLabel - m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ObjID - m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex - m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].NLabels - m.Route.Paths[j2].NLabels = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].LabelStack - for j3 := 0; j3 < 16; j3++ { - // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform - m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Label - m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].LabelStack[j3].TTL - m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Exp - m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// IPRouteDump represents VPP binary API message 'ip_route_dump'. -type IPRouteDump struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPRouteDump) Reset() { *m = IPRouteDump{} } -func (*IPRouteDump) GetMessageName() string { return "ip_route_dump" } -func (*IPRouteDump) GetCrcString() string { return "b9d2e09e" } -func (*IPRouteDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPRouteDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPRouteDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPRouteDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. -type IPSourceAndPortRangeCheckAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` - LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty" struc:"[32]uint16"` - HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty" struc:"[32]uint16"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` -} - -func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeCheckAddDel{} } -func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { - return "ip_source_and_port_range_check_add_del" -} -func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { return "8bfc76f2" } -func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPSourceAndPortRangeCheckAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 4 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - // field[1] m.NumberOfRanges - size += 1 - // field[1] m.LowPorts - size += 64 - // field[1] m.HighPorts - size += 64 - // field[1] m.VrfID - size += 4 - return size -} -func (m *IPSourceAndPortRangeCheckAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) - pos += 4 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - // field[1] m.NumberOfRanges - buf[pos] = uint8(m.NumberOfRanges) - pos += 1 - // field[1] m.LowPorts - for i := 0; i < 32; i++ { - var x uint16 - if i < len(m.LowPorts) { - x = uint16(m.LowPorts[i]) - } - o.PutUint16(buf[pos:pos+2], uint16(x)) - pos += 2 - } - // field[1] m.HighPorts - for i := 0; i < 32; i++ { - var x uint16 - if i < len(m.HighPorts) { - x = uint16(m.HighPorts[i]) - } - o.PutUint16(buf[pos:pos+2], uint16(x)) - pos += 2 - } - // field[1] m.VrfID - o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) - pos += 4 - return buf, nil -} -func (m *IPSourceAndPortRangeCheckAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - // field[1] m.NumberOfRanges - m.NumberOfRanges = uint8(tmp[pos]) - pos += 1 - // field[1] m.LowPorts - m.LowPorts = make([]uint16, 32) - for i := 0; i < len(m.LowPorts); i++ { - m.LowPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - } - // field[1] m.HighPorts - m.HighPorts = make([]uint16, 32) - for i := 0; i < len(m.HighPorts); i++ { - m.HighPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - } - // field[1] m.VrfID - m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply'. -type IPSourceAndPortRangeCheckAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPSourceAndPortRangeCheckAddDelReply) Reset() { *m = IPSourceAndPortRangeCheckAddDelReply{} } -func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageName() string { - return "ip_source_and_port_range_check_add_del_reply" -} -func (*IPSourceAndPortRangeCheckAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *IPSourceAndPortRangeCheckAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPSourceAndPortRangeCheckAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPSourceAndPortRangeCheckAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del'. -type IPSourceAndPortRangeCheckInterfaceAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - TCPInVrfID uint32 `binapi:"u32,name=tcp_in_vrf_id" json:"tcp_in_vrf_id,omitempty"` - TCPOutVrfID uint32 `binapi:"u32,name=tcp_out_vrf_id" json:"tcp_out_vrf_id,omitempty"` - UDPInVrfID uint32 `binapi:"u32,name=udp_in_vrf_id" json:"udp_in_vrf_id,omitempty"` - UDPOutVrfID uint32 `binapi:"u32,name=udp_out_vrf_id" json:"udp_out_vrf_id,omitempty"` -} - -func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Reset() { - *m = IPSourceAndPortRangeCheckInterfaceAddDel{} -} -func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageName() string { - return "ip_source_and_port_range_check_interface_add_del" -} -func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetCrcString() string { return "e1ba8987" } -func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.TCPInVrfID - size += 4 - // field[1] m.TCPOutVrfID - size += 4 - // field[1] m.UDPInVrfID - size += 4 - // field[1] m.UDPOutVrfID - size += 4 - return size -} -func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.TCPInVrfID - o.PutUint32(buf[pos:pos+4], uint32(m.TCPInVrfID)) - pos += 4 - // field[1] m.TCPOutVrfID - o.PutUint32(buf[pos:pos+4], uint32(m.TCPOutVrfID)) - pos += 4 - // field[1] m.UDPInVrfID - o.PutUint32(buf[pos:pos+4], uint32(m.UDPInVrfID)) - pos += 4 - // field[1] m.UDPOutVrfID - o.PutUint32(buf[pos:pos+4], uint32(m.UDPOutVrfID)) - pos += 4 - return buf, nil -} -func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TCPInVrfID - m.TCPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TCPOutVrfID - m.TCPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.UDPInVrfID - m.UDPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.UDPOutVrfID - m.UDPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply'. -type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Reset() { - *m = IPSourceAndPortRangeCheckInterfaceAddDelReply{} -} -func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageName() string { - return "ip_source_and_port_range_check_interface_add_del_reply" -} -func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del'. -type IPSourceCheckInterfaceAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - Loose bool `binapi:"bool,name=loose" json:"loose,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *IPSourceCheckInterfaceAddDel) Reset() { *m = IPSourceCheckInterfaceAddDel{} } -func (*IPSourceCheckInterfaceAddDel) GetMessageName() string { - return "ip_source_check_interface_add_del" -} -func (*IPSourceCheckInterfaceAddDel) GetCrcString() string { return "6612356b" } -func (*IPSourceCheckInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPSourceCheckInterfaceAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.Loose - size += 1 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *IPSourceCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Loose - if m.Loose { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *IPSourceCheckInterfaceAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.Loose - m.Loose = tmp[pos] != 0 - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply'. -type IPSourceCheckInterfaceAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPSourceCheckInterfaceAddDelReply) Reset() { *m = IPSourceCheckInterfaceAddDelReply{} } -func (*IPSourceCheckInterfaceAddDelReply) GetMessageName() string { - return "ip_source_check_interface_add_del_reply" -} -func (*IPSourceCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPSourceCheckInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPSourceCheckInterfaceAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPSourceCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPSourceCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPTableAddDel represents VPP binary API message 'ip_table_add_del'. -type IPTableAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableAddDel) Reset() { *m = IPTableAddDel{} } -func (*IPTableAddDel) GetMessageName() string { return "ip_table_add_del" } -func (*IPTableAddDel) GetCrcString() string { return "0ffdaec0" } -func (*IPTableAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply'. -type IPTableAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPTableAddDelReply) Reset() { *m = IPTableAddDelReply{} } -func (*IPTableAddDelReply) GetMessageName() string { return "ip_table_add_del_reply" } -func (*IPTableAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPTableAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPTableAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPTableAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPTableDetails represents VPP binary API message 'ip_table_details'. -type IPTableDetails struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableDetails) Reset() { *m = IPTableDetails{} } -func (*IPTableDetails) GetMessageName() string { return "ip_table_details" } -func (*IPTableDetails) GetCrcString() string { return "c79fca0f" } -func (*IPTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableDump represents VPP binary API message 'ip_table_dump'. -type IPTableDump struct{} - -func (m *IPTableDump) Reset() { *m = IPTableDump{} } -func (*IPTableDump) GetMessageName() string { return "ip_table_dump" } -func (*IPTableDump) GetCrcString() string { return "51077d14" } -func (*IPTableDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *IPTableDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *IPTableDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// IPTableFlush represents VPP binary API message 'ip_table_flush'. -type IPTableFlush struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableFlush) Reset() { *m = IPTableFlush{} } -func (*IPTableFlush) GetMessageName() string { return "ip_table_flush" } -func (*IPTableFlush) GetCrcString() string { return "b9d2e09e" } -func (*IPTableFlush) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableFlush) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableFlush) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableFlush) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableFlushReply represents VPP binary API message 'ip_table_flush_reply'. -type IPTableFlushReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPTableFlushReply) Reset() { *m = IPTableFlushReply{} } -func (*IPTableFlushReply) GetMessageName() string { return "ip_table_flush_reply" } -func (*IPTableFlushReply) GetCrcString() string { return "e8d4e804" } -func (*IPTableFlushReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableFlushReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPTableFlushReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPTableFlushReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPTableReplaceBegin represents VPP binary API message 'ip_table_replace_begin'. -type IPTableReplaceBegin struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableReplaceBegin) Reset() { *m = IPTableReplaceBegin{} } -func (*IPTableReplaceBegin) GetMessageName() string { return "ip_table_replace_begin" } -func (*IPTableReplaceBegin) GetCrcString() string { return "b9d2e09e" } -func (*IPTableReplaceBegin) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableReplaceBegin) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableReplaceBegin) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableReplaceBegin) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableReplaceBeginReply represents VPP binary API message 'ip_table_replace_begin_reply'. -type IPTableReplaceBeginReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPTableReplaceBeginReply) Reset() { *m = IPTableReplaceBeginReply{} } -func (*IPTableReplaceBeginReply) GetMessageName() string { return "ip_table_replace_begin_reply" } -func (*IPTableReplaceBeginReply) GetCrcString() string { return "e8d4e804" } -func (*IPTableReplaceBeginReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableReplaceBeginReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPTableReplaceBeginReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPTableReplaceBeginReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPTableReplaceEnd represents VPP binary API message 'ip_table_replace_end'. -type IPTableReplaceEnd struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableReplaceEnd) Reset() { *m = IPTableReplaceEnd{} } -func (*IPTableReplaceEnd) GetMessageName() string { return "ip_table_replace_end" } -func (*IPTableReplaceEnd) GetCrcString() string { return "b9d2e09e" } -func (*IPTableReplaceEnd) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableReplaceEnd) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableReplaceEnd) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableReplaceEnd) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableReplaceEndReply represents VPP binary API message 'ip_table_replace_end_reply'. -type IPTableReplaceEndReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPTableReplaceEndReply) Reset() { *m = IPTableReplaceEndReply{} } -func (*IPTableReplaceEndReply) GetMessageName() string { return "ip_table_replace_end_reply" } -func (*IPTableReplaceEndReply) GetCrcString() string { return "e8d4e804" } -func (*IPTableReplaceEndReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableReplaceEndReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPTableReplaceEndReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPTableReplaceEndReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details'. -type IPUnnumberedDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IPSwIfIndex InterfaceIndex `binapi:"interface_index,name=ip_sw_if_index" json:"ip_sw_if_index,omitempty"` -} - -func (m *IPUnnumberedDetails) Reset() { *m = IPUnnumberedDetails{} } -func (*IPUnnumberedDetails) GetMessageName() string { return "ip_unnumbered_details" } -func (*IPUnnumberedDetails) GetCrcString() string { return "aa12a483" } -func (*IPUnnumberedDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPUnnumberedDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IPSwIfIndex - size += 4 - return size -} -func (m *IPUnnumberedDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IPSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.IPSwIfIndex)) - pos += 4 - return buf, nil -} -func (m *IPUnnumberedDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IPSwIfIndex - m.IPSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. -type IPUnnumberedDump struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *IPUnnumberedDump) Reset() { *m = IPUnnumberedDump{} } -func (*IPUnnumberedDump) GetMessageName() string { return "ip_unnumbered_dump" } -func (*IPUnnumberedDump) GetCrcString() string { return "f9e6675e" } -func (*IPUnnumberedDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPUnnumberedDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *IPUnnumberedDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *IPUnnumberedDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MfibSignalDetails represents VPP binary API message 'mfib_signal_details'. -type MfibSignalDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` - IPPacketLen uint16 `binapi:"u16,name=ip_packet_len" json:"ip_packet_len,omitempty"` - IPPacketData []byte `binapi:"u8[256],name=ip_packet_data" json:"ip_packet_data,omitempty" struc:"[256]byte"` -} - -func (m *MfibSignalDetails) Reset() { *m = MfibSignalDetails{} } -func (*MfibSignalDetails) GetMessageName() string { return "mfib_signal_details" } -func (*MfibSignalDetails) GetCrcString() string { return "64398a9a" } -func (*MfibSignalDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MfibSignalDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.TableID - size += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Af - size += 4 - // field[2] m.Prefix.GrpAddressLength - size += 2 - // field[2] m.Prefix.GrpAddress - size += 16 - // field[2] m.Prefix.SrcAddress - size += 16 - // field[1] m.IPPacketLen - size += 2 - // field[1] m.IPPacketData - size += 256 - return size -} -func (m *MfibSignalDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Af - o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Af)) - pos += 4 - // field[2] m.Prefix.GrpAddressLength - o.PutUint16(buf[pos:pos+2], uint16(m.Prefix.GrpAddressLength)) - pos += 2 - // field[2] m.Prefix.GrpAddress - copy(buf[pos:pos+16], m.Prefix.GrpAddress.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.SrcAddress - copy(buf[pos:pos+16], m.Prefix.SrcAddress.XXX_UnionData[:]) - pos += 16 - // field[1] m.IPPacketLen - o.PutUint16(buf[pos:pos+2], uint16(m.IPPacketLen)) - pos += 2 - // field[1] m.IPPacketData - for i := 0; i < 256; i++ { - var x uint8 - if i < len(m.IPPacketData) { - x = uint8(m.IPPacketData[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *MfibSignalDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TableID - m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Af - m.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Prefix.GrpAddressLength - m.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.Prefix.GrpAddress - copy(m.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.SrcAddress - copy(m.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[1] m.IPPacketLen - m.IPPacketLen = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.IPPacketData - m.IPPacketData = make([]uint8, 256) - for i := 0; i < len(m.IPPacketData); i++ { - m.IPPacketData[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// MfibSignalDump represents VPP binary API message 'mfib_signal_dump'. -type MfibSignalDump struct{} - -func (m *MfibSignalDump) Reset() { *m = MfibSignalDump{} } -func (*MfibSignalDump) GetMessageName() string { return "mfib_signal_dump" } -func (*MfibSignalDump) GetCrcString() string { return "51077d14" } -func (*MfibSignalDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MfibSignalDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MfibSignalDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MfibSignalDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash'. -type SetIPFlowHash struct { - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` - Src bool `binapi:"bool,name=src" json:"src,omitempty"` - Dst bool `binapi:"bool,name=dst" json:"dst,omitempty"` - Sport bool `binapi:"bool,name=sport" json:"sport,omitempty"` - Dport bool `binapi:"bool,name=dport" json:"dport,omitempty"` - Proto bool `binapi:"bool,name=proto" json:"proto,omitempty"` - Reverse bool `binapi:"bool,name=reverse" json:"reverse,omitempty"` - Symmetric bool `binapi:"bool,name=symmetric" json:"symmetric,omitempty"` -} - -func (m *SetIPFlowHash) Reset() { *m = SetIPFlowHash{} } -func (*SetIPFlowHash) GetMessageName() string { return "set_ip_flow_hash" } -func (*SetIPFlowHash) GetCrcString() string { return "084ee09e" } -func (*SetIPFlowHash) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SetIPFlowHash) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.VrfID - size += 4 - // field[1] m.IsIPv6 - size += 1 - // field[1] m.Src - size += 1 - // field[1] m.Dst - size += 1 - // field[1] m.Sport - size += 1 - // field[1] m.Dport - size += 1 - // field[1] m.Proto - size += 1 - // field[1] m.Reverse - size += 1 - // field[1] m.Symmetric - size += 1 - return size -} -func (m *SetIPFlowHash) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.VrfID - o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Src - if m.Src { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Dst - if m.Dst { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Sport - if m.Sport { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Dport - if m.Dport { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Proto - if m.Proto { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Reverse - if m.Reverse { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Symmetric - if m.Symmetric { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SetIPFlowHash) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.VrfID - m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - // field[1] m.Src - m.Src = tmp[pos] != 0 - pos += 1 - // field[1] m.Dst - m.Dst = tmp[pos] != 0 - pos += 1 - // field[1] m.Sport - m.Sport = tmp[pos] != 0 - pos += 1 - // field[1] m.Dport - m.Dport = tmp[pos] != 0 - pos += 1 - // field[1] m.Proto - m.Proto = tmp[pos] != 0 - pos += 1 - // field[1] m.Reverse - m.Reverse = tmp[pos] != 0 - pos += 1 - // field[1] m.Symmetric - m.Symmetric = tmp[pos] != 0 - pos += 1 - return nil -} - -// SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply'. -type SetIPFlowHashReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SetIPFlowHashReply) Reset() { *m = SetIPFlowHashReply{} } -func (*SetIPFlowHashReply) GetMessageName() string { return "set_ip_flow_hash_reply" } -func (*SetIPFlowHashReply) GetCrcString() string { return "e8d4e804" } -func (*SetIPFlowHashReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SetIPFlowHashReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SetIPFlowHashReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SetIPFlowHashReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable'. -type SwInterfaceIP6EnableDisable struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` -} - -func (m *SwInterfaceIP6EnableDisable) Reset() { *m = SwInterfaceIP6EnableDisable{} } -func (*SwInterfaceIP6EnableDisable) GetMessageName() string { return "sw_interface_ip6_enable_disable" } -func (*SwInterfaceIP6EnableDisable) GetCrcString() string { return "ae6cfcfb" } -func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceIP6EnableDisable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Enable - size += 1 - return size -} -func (m *SwInterfaceIP6EnableDisable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Enable - if m.Enable { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceIP6EnableDisable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Enable - m.Enable = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply'. -type SwInterfaceIP6EnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceIP6EnableDisableReply) Reset() { *m = SwInterfaceIP6EnableDisableReply{} } -func (*SwInterfaceIP6EnableDisableReply) GetMessageName() string { - return "sw_interface_ip6_enable_disable_reply" -} -func (*SwInterfaceIP6EnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceIP6EnableDisableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceIP6EnableDisableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceIP6SetLinkLocalAddress represents VPP binary API message 'sw_interface_ip6_set_link_local_address'. -type SwInterfaceIP6SetLinkLocalAddress struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IP IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` -} - -func (m *SwInterfaceIP6SetLinkLocalAddress) Reset() { *m = SwInterfaceIP6SetLinkLocalAddress{} } -func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageName() string { - return "sw_interface_ip6_set_link_local_address" -} -func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { return "2931d9fa" } -func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceIP6SetLinkLocalAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IP - size += 16 - return size -} -func (m *SwInterfaceIP6SetLinkLocalAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IP - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.IP) { - x = uint8(m.IP[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SwInterfaceIP6SetLinkLocalAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IP - for i := 0; i < len(m.IP); i++ { - m.IP[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SwInterfaceIP6SetLinkLocalAddressReply represents VPP binary API message 'sw_interface_ip6_set_link_local_address_reply'. -type SwInterfaceIP6SetLinkLocalAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceIP6SetLinkLocalAddressReply) Reset() { - *m = SwInterfaceIP6SetLinkLocalAddressReply{} -} -func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageName() string { - return "sw_interface_ip6_set_link_local_address_reply" -} -func (*SwInterfaceIP6SetLinkLocalAddressReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *SwInterfaceIP6SetLinkLocalAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceIP6SetLinkLocalAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceIP6SetLinkLocalAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -func init() { file_ip_binapi_init() } -func file_ip_binapi_init() { - api.RegisterMessage((*IoamDisable)(nil), "ip.IoamDisable") - api.RegisterMessage((*IoamDisableReply)(nil), "ip.IoamDisableReply") - api.RegisterMessage((*IoamEnable)(nil), "ip.IoamEnable") - api.RegisterMessage((*IoamEnableReply)(nil), "ip.IoamEnableReply") - api.RegisterMessage((*IPAddressDetails)(nil), "ip.IPAddressDetails") - api.RegisterMessage((*IPAddressDump)(nil), "ip.IPAddressDump") - api.RegisterMessage((*IPContainerProxyAddDel)(nil), "ip.IPContainerProxyAddDel") - api.RegisterMessage((*IPContainerProxyAddDelReply)(nil), "ip.IPContainerProxyAddDelReply") - api.RegisterMessage((*IPContainerProxyDetails)(nil), "ip.IPContainerProxyDetails") - api.RegisterMessage((*IPContainerProxyDump)(nil), "ip.IPContainerProxyDump") - api.RegisterMessage((*IPDetails)(nil), "ip.IPDetails") - api.RegisterMessage((*IPDump)(nil), "ip.IPDump") - api.RegisterMessage((*IPMrouteAddDel)(nil), "ip.IPMrouteAddDel") - api.RegisterMessage((*IPMrouteAddDelReply)(nil), "ip.IPMrouteAddDelReply") - api.RegisterMessage((*IPMrouteDetails)(nil), "ip.IPMrouteDetails") - api.RegisterMessage((*IPMrouteDump)(nil), "ip.IPMrouteDump") - api.RegisterMessage((*IPMtableDetails)(nil), "ip.IPMtableDetails") - api.RegisterMessage((*IPMtableDump)(nil), "ip.IPMtableDump") - api.RegisterMessage((*IPPuntPolice)(nil), "ip.IPPuntPolice") - api.RegisterMessage((*IPPuntPoliceReply)(nil), "ip.IPPuntPoliceReply") - api.RegisterMessage((*IPPuntRedirect)(nil), "ip.IPPuntRedirect") - api.RegisterMessage((*IPPuntRedirectDetails)(nil), "ip.IPPuntRedirectDetails") - api.RegisterMessage((*IPPuntRedirectDump)(nil), "ip.IPPuntRedirectDump") - api.RegisterMessage((*IPPuntRedirectReply)(nil), "ip.IPPuntRedirectReply") - api.RegisterMessage((*IPReassemblyEnableDisable)(nil), "ip.IPReassemblyEnableDisable") - api.RegisterMessage((*IPReassemblyEnableDisableReply)(nil), "ip.IPReassemblyEnableDisableReply") - api.RegisterMessage((*IPReassemblyGet)(nil), "ip.IPReassemblyGet") - api.RegisterMessage((*IPReassemblyGetReply)(nil), "ip.IPReassemblyGetReply") - api.RegisterMessage((*IPReassemblySet)(nil), "ip.IPReassemblySet") - api.RegisterMessage((*IPReassemblySetReply)(nil), "ip.IPReassemblySetReply") - api.RegisterMessage((*IPRouteAddDel)(nil), "ip.IPRouteAddDel") - api.RegisterMessage((*IPRouteAddDelReply)(nil), "ip.IPRouteAddDelReply") - api.RegisterMessage((*IPRouteDetails)(nil), "ip.IPRouteDetails") - api.RegisterMessage((*IPRouteDump)(nil), "ip.IPRouteDump") - api.RegisterMessage((*IPSourceAndPortRangeCheckAddDel)(nil), "ip.IPSourceAndPortRangeCheckAddDel") - api.RegisterMessage((*IPSourceAndPortRangeCheckAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckAddDelReply") - api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDel") - api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDelReply") - api.RegisterMessage((*IPSourceCheckInterfaceAddDel)(nil), "ip.IPSourceCheckInterfaceAddDel") - api.RegisterMessage((*IPSourceCheckInterfaceAddDelReply)(nil), "ip.IPSourceCheckInterfaceAddDelReply") - api.RegisterMessage((*IPTableAddDel)(nil), "ip.IPTableAddDel") - api.RegisterMessage((*IPTableAddDelReply)(nil), "ip.IPTableAddDelReply") - api.RegisterMessage((*IPTableDetails)(nil), "ip.IPTableDetails") - api.RegisterMessage((*IPTableDump)(nil), "ip.IPTableDump") - api.RegisterMessage((*IPTableFlush)(nil), "ip.IPTableFlush") - api.RegisterMessage((*IPTableFlushReply)(nil), "ip.IPTableFlushReply") - api.RegisterMessage((*IPTableReplaceBegin)(nil), "ip.IPTableReplaceBegin") - api.RegisterMessage((*IPTableReplaceBeginReply)(nil), "ip.IPTableReplaceBeginReply") - api.RegisterMessage((*IPTableReplaceEnd)(nil), "ip.IPTableReplaceEnd") - api.RegisterMessage((*IPTableReplaceEndReply)(nil), "ip.IPTableReplaceEndReply") - api.RegisterMessage((*IPUnnumberedDetails)(nil), "ip.IPUnnumberedDetails") - api.RegisterMessage((*IPUnnumberedDump)(nil), "ip.IPUnnumberedDump") - api.RegisterMessage((*MfibSignalDetails)(nil), "ip.MfibSignalDetails") - api.RegisterMessage((*MfibSignalDump)(nil), "ip.MfibSignalDump") - api.RegisterMessage((*SetIPFlowHash)(nil), "ip.SetIPFlowHash") - api.RegisterMessage((*SetIPFlowHashReply)(nil), "ip.SetIPFlowHashReply") - api.RegisterMessage((*SwInterfaceIP6EnableDisable)(nil), "ip.SwInterfaceIP6EnableDisable") - api.RegisterMessage((*SwInterfaceIP6EnableDisableReply)(nil), "ip.SwInterfaceIP6EnableDisableReply") - api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddress)(nil), "ip.SwInterfaceIP6SetLinkLocalAddress") - api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddressReply)(nil), "ip.SwInterfaceIP6SetLinkLocalAddressReply") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*IoamDisable)(nil), - (*IoamDisableReply)(nil), - (*IoamEnable)(nil), - (*IoamEnableReply)(nil), - (*IPAddressDetails)(nil), - (*IPAddressDump)(nil), - (*IPContainerProxyAddDel)(nil), - (*IPContainerProxyAddDelReply)(nil), - (*IPContainerProxyDetails)(nil), - (*IPContainerProxyDump)(nil), - (*IPDetails)(nil), - (*IPDump)(nil), - (*IPMrouteAddDel)(nil), - (*IPMrouteAddDelReply)(nil), - (*IPMrouteDetails)(nil), - (*IPMrouteDump)(nil), - (*IPMtableDetails)(nil), - (*IPMtableDump)(nil), - (*IPPuntPolice)(nil), - (*IPPuntPoliceReply)(nil), - (*IPPuntRedirect)(nil), - (*IPPuntRedirectDetails)(nil), - (*IPPuntRedirectDump)(nil), - (*IPPuntRedirectReply)(nil), - (*IPReassemblyEnableDisable)(nil), - (*IPReassemblyEnableDisableReply)(nil), - (*IPReassemblyGet)(nil), - (*IPReassemblyGetReply)(nil), - (*IPReassemblySet)(nil), - (*IPReassemblySetReply)(nil), - (*IPRouteAddDel)(nil), - (*IPRouteAddDelReply)(nil), - (*IPRouteDetails)(nil), - (*IPRouteDump)(nil), - (*IPSourceAndPortRangeCheckAddDel)(nil), - (*IPSourceAndPortRangeCheckAddDelReply)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), - (*IPSourceCheckInterfaceAddDel)(nil), - (*IPSourceCheckInterfaceAddDelReply)(nil), - (*IPTableAddDel)(nil), - (*IPTableAddDelReply)(nil), - (*IPTableDetails)(nil), - (*IPTableDump)(nil), - (*IPTableFlush)(nil), - (*IPTableFlushReply)(nil), - (*IPTableReplaceBegin)(nil), - (*IPTableReplaceBeginReply)(nil), - (*IPTableReplaceEnd)(nil), - (*IPTableReplaceEndReply)(nil), - (*IPUnnumberedDetails)(nil), - (*IPUnnumberedDump)(nil), - (*MfibSignalDetails)(nil), - (*MfibSignalDump)(nil), - (*SetIPFlowHash)(nil), - (*SetIPFlowHashReply)(nil), - (*SwInterfaceIP6EnableDisable)(nil), - (*SwInterfaceIP6EnableDisableReply)(nil), - (*SwInterfaceIP6SetLinkLocalAddress)(nil), - (*SwInterfaceIP6SetLinkLocalAddressReply)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/ip/ip_rpc.ba.go b/codec/testdata/binapi2001/ip/ip_rpc.ba.go deleted file mode 100644 index e0580d5..0000000 --- a/codec/testdata/binapi2001/ip/ip_rpc.ba.go +++ /dev/null @@ -1,497 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ip - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for ip module. -type RPCService interface { - DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) - DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) - DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) - DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) - DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) - DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) - DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) - DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) - DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) - DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) - IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) - IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) - IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) - IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) - IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) - IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) - IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) - IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) - IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) - IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) - IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) - IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) - IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) - IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) - IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) - IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) - IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) - SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) - SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) - SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPAddressClient{stream} - return x, nil -} - -type RPCService_DumpIPAddressClient interface { - Recv() (*IPAddressDetails, error) -} - -type serviceClient_DumpIPAddressClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPAddressClient) Recv() (*IPAddressDetails, error) { - m := new(IPAddressDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPContainerProxyClient{stream} - return x, nil -} - -type RPCService_DumpIPContainerProxyClient interface { - Recv() (*IPContainerProxyDetails, error) -} - -type serviceClient_DumpIPContainerProxyClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPContainerProxyClient) Recv() (*IPContainerProxyDetails, error) { - m := new(IPContainerProxyDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPClient{stream} - return x, nil -} - -type RPCService_DumpIPClient interface { - Recv() (*IPDetails, error) -} - -type serviceClient_DumpIPClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPClient) Recv() (*IPDetails, error) { - m := new(IPDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPMrouteClient{stream} - return x, nil -} - -type RPCService_DumpIPMrouteClient interface { - Recv() (*IPMrouteDetails, error) -} - -type serviceClient_DumpIPMrouteClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPMrouteClient) Recv() (*IPMrouteDetails, error) { - m := new(IPMrouteDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPMtableClient{stream} - return x, nil -} - -type RPCService_DumpIPMtableClient interface { - Recv() (*IPMtableDetails, error) -} - -type serviceClient_DumpIPMtableClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPMtableClient) Recv() (*IPMtableDetails, error) { - m := new(IPMtableDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPPuntRedirectClient{stream} - return x, nil -} - -type RPCService_DumpIPPuntRedirectClient interface { - Recv() (*IPPuntRedirectDetails, error) -} - -type serviceClient_DumpIPPuntRedirectClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPPuntRedirectClient) Recv() (*IPPuntRedirectDetails, error) { - m := new(IPPuntRedirectDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPRouteClient{stream} - return x, nil -} - -type RPCService_DumpIPRouteClient interface { - Recv() (*IPRouteDetails, error) -} - -type serviceClient_DumpIPRouteClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPRouteClient) Recv() (*IPRouteDetails, error) { - m := new(IPRouteDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPTableClient{stream} - return x, nil -} - -type RPCService_DumpIPTableClient interface { - Recv() (*IPTableDetails, error) -} - -type serviceClient_DumpIPTableClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPTableClient) Recv() (*IPTableDetails, error) { - m := new(IPTableDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPUnnumberedClient{stream} - return x, nil -} - -type RPCService_DumpIPUnnumberedClient interface { - Recv() (*IPUnnumberedDetails, error) -} - -type serviceClient_DumpIPUnnumberedClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPUnnumberedClient) Recv() (*IPUnnumberedDetails, error) { - m := new(IPUnnumberedDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMfibSignalClient{stream} - return x, nil -} - -type RPCService_DumpMfibSignalClient interface { - Recv() (*MfibSignalDetails, error) -} - -type serviceClient_DumpMfibSignalClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMfibSignalClient) Recv() (*MfibSignalDetails, error) { - m := new(MfibSignalDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { - out := new(IoamDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { - out := new(IoamEnableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { - out := new(IPContainerProxyAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { - out := new(IPMrouteAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { - out := new(IPPuntPoliceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { - out := new(IPPuntRedirectReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { - out := new(IPReassemblyEnableDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { - out := new(IPReassemblyGetReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { - out := new(IPReassemblySetReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { - out := new(IPRouteAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { - out := new(IPSourceAndPortRangeCheckAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { - out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) { - out := new(IPSourceCheckInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { - out := new(IPTableAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) { - out := new(IPTableFlushReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) { - out := new(IPTableReplaceBeginReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) { - out := new(IPTableReplaceEndReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { - out := new(SetIPFlowHashReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { - out := new(SwInterfaceIP6EnableDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { - out := new(SwInterfaceIP6SetLinkLocalAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/codec/testdata/binapi2001/memclnt/memclnt.ba.go b/codec/testdata/binapi2001/memclnt/memclnt.ba.go deleted file mode 100644 index 0b251ce..0000000 --- a/codec/testdata/binapi2001/memclnt/memclnt.ba.go +++ /dev/null @@ -1,1450 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.01-45~g7a071e370~b63 -// source: /usr/share/vpp/api/core/memclnt.api.json - -/* -Package memclnt contains generated code for VPP binary API defined by memclnt.api (version 2.1.0). - -It consists of: - 22 messages - 2 types -*/ -package memclnt - -import ( - "bytes" - "context" - "encoding/binary" - "io" - "math" - "strconv" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "memclnt" - // APIVersion is the API version of this module. - APIVersion = "2.1.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0x8d3dd881 -) - -// MessageTableEntry represents VPP binary API type 'message_table_entry'. -type MessageTableEntry struct { - Index uint16 `binapi:"u16,name=index" json:"index,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (*MessageTableEntry) GetTypeName() string { return "message_table_entry" } - -// ModuleVersion represents VPP binary API type 'module_version'. -type ModuleVersion struct { - Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` - Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` - Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (*ModuleVersion) GetTypeName() string { return "module_version" } - -// APIVersions represents VPP binary API message 'api_versions'. -type APIVersions struct{} - -func (m *APIVersions) Reset() { *m = APIVersions{} } -func (*APIVersions) GetMessageName() string { return "api_versions" } -func (*APIVersions) GetCrcString() string { return "51077d14" } -func (*APIVersions) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *APIVersions) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *APIVersions) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *APIVersions) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// APIVersionsReply represents VPP binary API message 'api_versions_reply'. -type APIVersionsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=APIVersions"` - APIVersions []ModuleVersion `binapi:"module_version[count],name=api_versions" json:"api_versions,omitempty"` -} - -func (m *APIVersionsReply) Reset() { *m = APIVersionsReply{} } -func (*APIVersionsReply) GetMessageName() string { return "api_versions_reply" } -func (*APIVersionsReply) GetCrcString() string { return "5f0d99d6" } -func (*APIVersionsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *APIVersionsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.Count - size += 4 - // field[1] m.APIVersions - for j1 := 0; j1 < len(m.APIVersions); j1++ { - var s1 ModuleVersion - _ = s1 - if j1 < len(m.APIVersions) { - s1 = m.APIVersions[j1] - } - // field[2] s1.Major - size += 4 - // field[2] s1.Minor - size += 4 - // field[2] s1.Patch - size += 4 - // field[2] s1.Name - size += 64 - } - return size -} -func (m *APIVersionsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.APIVersions))) - pos += 4 - // field[1] m.APIVersions - for j1 := 0; j1 < len(m.APIVersions); j1++ { - var v1 ModuleVersion - if j1 < len(m.APIVersions) { - v1 = m.APIVersions[j1] - } - // field[2] v1.Major - o.PutUint32(buf[pos:pos+4], uint32(v1.Major)) - pos += 4 - // field[2] v1.Minor - o.PutUint32(buf[pos:pos+4], uint32(v1.Minor)) - pos += 4 - // field[2] v1.Patch - o.PutUint32(buf[pos:pos+4], uint32(v1.Patch)) - pos += 4 - // field[2] v1.Name - copy(buf[pos:pos+64], v1.Name) - pos += 64 - } - return buf, nil -} -func (m *APIVersionsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.APIVersions - m.APIVersions = make([]ModuleVersion, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.APIVersions[j1].Major - m.APIVersions[j1].Major = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.APIVersions[j1].Minor - m.APIVersions[j1].Minor = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.APIVersions[j1].Patch - m.APIVersions[j1].Patch = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.APIVersions[j1].Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.APIVersions[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - } - return nil -} - -// GetFirstMsgID represents VPP binary API message 'get_first_msg_id'. -type GetFirstMsgID struct { - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (m *GetFirstMsgID) Reset() { *m = GetFirstMsgID{} } -func (*GetFirstMsgID) GetMessageName() string { return "get_first_msg_id" } -func (*GetFirstMsgID) GetCrcString() string { return "ebf79a66" } -func (*GetFirstMsgID) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetFirstMsgID) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Name - size += 64 - return size -} -func (m *GetFirstMsgID) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Name - copy(buf[pos:pos+64], m.Name) - pos += 64 - return buf, nil -} -func (m *GetFirstMsgID) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply'. -type GetFirstMsgIDReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` -} - -func (m *GetFirstMsgIDReply) Reset() { *m = GetFirstMsgIDReply{} } -func (*GetFirstMsgIDReply) GetMessageName() string { return "get_first_msg_id_reply" } -func (*GetFirstMsgIDReply) GetCrcString() string { return "7d337472" } -func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetFirstMsgIDReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.FirstMsgID - size += 2 - return size -} -func (m *GetFirstMsgIDReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.FirstMsgID - o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) - pos += 2 - return buf, nil -} -func (m *GetFirstMsgIDReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.FirstMsgID - m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -// MemclntCreate represents VPP binary API message 'memclnt_create'. -type MemclntCreate struct { - CtxQuota int32 `binapi:"i32,name=ctx_quota" json:"ctx_quota,omitempty"` - InputQueue uint64 `binapi:"u64,name=input_queue" json:"input_queue,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` - APIVersions []uint32 `binapi:"u32[8],name=api_versions" json:"api_versions,omitempty" struc:"[8]uint32"` -} - -func (m *MemclntCreate) Reset() { *m = MemclntCreate{} } -func (*MemclntCreate) GetMessageName() string { return "memclnt_create" } -func (*MemclntCreate) GetCrcString() string { return "9c5e1c2f" } -func (*MemclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemclntCreate) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.CtxQuota - size += 4 - // field[1] m.InputQueue - size += 8 - // field[1] m.Name - size += 64 - // field[1] m.APIVersions - size += 32 - return size -} -func (m *MemclntCreate) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.CtxQuota - o.PutUint32(buf[pos:pos+4], uint32(m.CtxQuota)) - pos += 4 - // field[1] m.InputQueue - o.PutUint64(buf[pos:pos+8], uint64(m.InputQueue)) - pos += 8 - // field[1] m.Name - copy(buf[pos:pos+64], m.Name) - pos += 64 - // field[1] m.APIVersions - for i := 0; i < 8; i++ { - var x uint32 - if i < len(m.APIVersions) { - x = uint32(m.APIVersions[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *MemclntCreate) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.CtxQuota - m.CtxQuota = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.InputQueue - m.InputQueue = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.APIVersions - m.APIVersions = make([]uint32, 8) - for i := 0; i < len(m.APIVersions); i++ { - m.APIVersions[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply'. -type MemclntCreateReply struct { - Response int32 `binapi:"i32,name=response" json:"response,omitempty"` - Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` - MessageTable uint64 `binapi:"u64,name=message_table" json:"message_table,omitempty"` -} - -func (m *MemclntCreateReply) Reset() { *m = MemclntCreateReply{} } -func (*MemclntCreateReply) GetMessageName() string { return "memclnt_create_reply" } -func (*MemclntCreateReply) GetCrcString() string { return "42ec4560" } -func (*MemclntCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemclntCreateReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Response - size += 4 - // field[1] m.Handle - size += 8 - // field[1] m.Index - size += 4 - // field[1] m.MessageTable - size += 8 - return size -} -func (m *MemclntCreateReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Response - o.PutUint32(buf[pos:pos+4], uint32(m.Response)) - pos += 4 - // field[1] m.Handle - o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) - pos += 8 - // field[1] m.Index - o.PutUint32(buf[pos:pos+4], uint32(m.Index)) - pos += 4 - // field[1] m.MessageTable - o.PutUint64(buf[pos:pos+8], uint64(m.MessageTable)) - pos += 8 - return buf, nil -} -func (m *MemclntCreateReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Response - m.Response = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Handle - m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.Index - m.Index = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MessageTable - m.MessageTable = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// MemclntDelete represents VPP binary API message 'memclnt_delete'. -type MemclntDelete struct { - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` - Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` - DoCleanup bool `binapi:"bool,name=do_cleanup" json:"do_cleanup,omitempty"` -} - -func (m *MemclntDelete) Reset() { *m = MemclntDelete{} } -func (*MemclntDelete) GetMessageName() string { return "memclnt_delete" } -func (*MemclntDelete) GetCrcString() string { return "7e1c04e3" } -func (*MemclntDelete) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *MemclntDelete) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Index - size += 4 - // field[1] m.Handle - size += 8 - // field[1] m.DoCleanup - size += 1 - return size -} -func (m *MemclntDelete) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Index - o.PutUint32(buf[pos:pos+4], uint32(m.Index)) - pos += 4 - // field[1] m.Handle - o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) - pos += 8 - // field[1] m.DoCleanup - if m.DoCleanup { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *MemclntDelete) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Index - m.Index = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Handle - m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.DoCleanup - m.DoCleanup = tmp[pos] != 0 - pos += 1 - return nil -} - -// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply'. -type MemclntDeleteReply struct { - Response int32 `binapi:"i32,name=response" json:"response,omitempty"` - Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` -} - -func (m *MemclntDeleteReply) Reset() { *m = MemclntDeleteReply{} } -func (*MemclntDeleteReply) GetMessageName() string { return "memclnt_delete_reply" } -func (*MemclntDeleteReply) GetCrcString() string { return "3d3b6312" } -func (*MemclntDeleteReply) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *MemclntDeleteReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Response - size += 4 - // field[1] m.Handle - size += 8 - return size -} -func (m *MemclntDeleteReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Response - o.PutUint32(buf[pos:pos+4], uint32(m.Response)) - pos += 4 - // field[1] m.Handle - o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) - pos += 8 - return buf, nil -} -func (m *MemclntDeleteReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Response - m.Response = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Handle - m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive'. -type MemclntKeepalive struct{} - -func (m *MemclntKeepalive) Reset() { *m = MemclntKeepalive{} } -func (*MemclntKeepalive) GetMessageName() string { return "memclnt_keepalive" } -func (*MemclntKeepalive) GetCrcString() string { return "51077d14" } -func (*MemclntKeepalive) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemclntKeepalive) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MemclntKeepalive) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MemclntKeepalive) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply'. -type MemclntKeepaliveReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MemclntKeepaliveReply) Reset() { *m = MemclntKeepaliveReply{} } -func (*MemclntKeepaliveReply) GetMessageName() string { return "memclnt_keepalive_reply" } -func (*MemclntKeepaliveReply) GetCrcString() string { return "e8d4e804" } -func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemclntKeepaliveReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MemclntKeepaliveReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MemclntKeepaliveReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout'. -type MemclntReadTimeout struct { - Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` -} - -func (m *MemclntReadTimeout) Reset() { *m = MemclntReadTimeout{} } -func (*MemclntReadTimeout) GetMessageName() string { return "memclnt_read_timeout" } -func (*MemclntReadTimeout) GetCrcString() string { return "c3a3a452" } -func (*MemclntReadTimeout) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *MemclntReadTimeout) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Dummy - size += 1 - return size -} -func (m *MemclntReadTimeout) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Dummy - buf[pos] = uint8(m.Dummy) - pos += 1 - return buf, nil -} -func (m *MemclntReadTimeout) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Dummy - m.Dummy = uint8(tmp[pos]) - pos += 1 - return nil -} - -// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend'. -type MemclntRxThreadSuspend struct { - Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` -} - -func (m *MemclntRxThreadSuspend) Reset() { *m = MemclntRxThreadSuspend{} } -func (*MemclntRxThreadSuspend) GetMessageName() string { return "memclnt_rx_thread_suspend" } -func (*MemclntRxThreadSuspend) GetCrcString() string { return "c3a3a452" } -func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *MemclntRxThreadSuspend) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Dummy - size += 1 - return size -} -func (m *MemclntRxThreadSuspend) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Dummy - buf[pos] = uint8(m.Dummy) - pos += 1 - return buf, nil -} -func (m *MemclntRxThreadSuspend) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Dummy - m.Dummy = uint8(tmp[pos]) - pos += 1 - return nil -} - -// RPCCall represents VPP binary API message 'rpc_call'. -type RPCCall struct { - Function uint64 `binapi:"u64,name=function" json:"function,omitempty"` - Multicast uint8 `binapi:"u8,name=multicast" json:"multicast,omitempty"` - NeedBarrierSync uint8 `binapi:"u8,name=need_barrier_sync" json:"need_barrier_sync,omitempty"` - SendReply uint8 `binapi:"u8,name=send_reply" json:"send_reply,omitempty"` - DataLen uint32 `binapi:"u32,name=data_len" json:"data_len,omitempty" struc:"sizeof=Data"` - Data []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"` -} - -func (m *RPCCall) Reset() { *m = RPCCall{} } -func (*RPCCall) GetMessageName() string { return "rpc_call" } -func (*RPCCall) GetCrcString() string { return "7e8a2c95" } -func (*RPCCall) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *RPCCall) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Function - size += 8 - // field[1] m.Multicast - size += 1 - // field[1] m.NeedBarrierSync - size += 1 - // field[1] m.SendReply - size += 1 - // field[1] m.DataLen - size += 4 - // field[1] m.Data - size += 1 * len(m.Data) - return size -} -func (m *RPCCall) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Function - o.PutUint64(buf[pos:pos+8], uint64(m.Function)) - pos += 8 - // field[1] m.Multicast - buf[pos] = uint8(m.Multicast) - pos += 1 - // field[1] m.NeedBarrierSync - buf[pos] = uint8(m.NeedBarrierSync) - pos += 1 - // field[1] m.SendReply - buf[pos] = uint8(m.SendReply) - pos += 1 - // field[1] m.DataLen - o.PutUint32(buf[pos:pos+4], uint32(len(m.Data))) - pos += 4 - // field[1] m.Data - for i := 0; i < len(m.Data); i++ { - var x uint8 - if i < len(m.Data) { - x = uint8(m.Data[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *RPCCall) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Function - m.Function = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.Multicast - m.Multicast = uint8(tmp[pos]) - pos += 1 - // field[1] m.NeedBarrierSync - m.NeedBarrierSync = uint8(tmp[pos]) - pos += 1 - // field[1] m.SendReply - m.SendReply = uint8(tmp[pos]) - pos += 1 - // field[1] m.DataLen - m.DataLen = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Data - m.Data = make([]uint8, m.DataLen) - for i := 0; i < len(m.Data); i++ { - m.Data[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// RPCCallReply represents VPP binary API message 'rpc_call_reply'. -type RPCCallReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *RPCCallReply) Reset() { *m = RPCCallReply{} } -func (*RPCCallReply) GetMessageName() string { return "rpc_call_reply" } -func (*RPCCallReply) GetCrcString() string { return "e8d4e804" } -func (*RPCCallReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *RPCCallReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *RPCCallReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *RPCCallReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// RxThreadExit represents VPP binary API message 'rx_thread_exit'. -type RxThreadExit struct { - Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` -} - -func (m *RxThreadExit) Reset() { *m = RxThreadExit{} } -func (*RxThreadExit) GetMessageName() string { return "rx_thread_exit" } -func (*RxThreadExit) GetCrcString() string { return "c3a3a452" } -func (*RxThreadExit) GetMessageType() api.MessageType { return api.OtherMessage } - -func (m *RxThreadExit) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Dummy - size += 1 - return size -} -func (m *RxThreadExit) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Dummy - buf[pos] = uint8(m.Dummy) - pos += 1 - return buf, nil -} -func (m *RxThreadExit) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Dummy - m.Dummy = uint8(tmp[pos]) - pos += 1 - return nil -} - -// SockInitShm represents VPP binary API message 'sock_init_shm'. -type SockInitShm struct { - RequestedSize uint32 `binapi:"u32,name=requested_size" json:"requested_size,omitempty"` - Nitems uint8 `binapi:"u8,name=nitems" json:"nitems,omitempty" struc:"sizeof=Configs"` - Configs []uint64 `binapi:"u64[nitems],name=configs" json:"configs,omitempty"` -} - -func (m *SockInitShm) Reset() { *m = SockInitShm{} } -func (*SockInitShm) GetMessageName() string { return "sock_init_shm" } -func (*SockInitShm) GetCrcString() string { return "51646d92" } -func (*SockInitShm) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SockInitShm) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.RequestedSize - size += 4 - // field[1] m.Nitems - size += 1 - // field[1] m.Configs - size += 8 * len(m.Configs) - return size -} -func (m *SockInitShm) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.RequestedSize - o.PutUint32(buf[pos:pos+4], uint32(m.RequestedSize)) - pos += 4 - // field[1] m.Nitems - buf[pos] = uint8(len(m.Configs)) - pos += 1 - // field[1] m.Configs - for i := 0; i < len(m.Configs); i++ { - var x uint64 - if i < len(m.Configs) { - x = uint64(m.Configs[i]) - } - o.PutUint64(buf[pos:pos+8], uint64(x)) - pos += 8 - } - return buf, nil -} -func (m *SockInitShm) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.RequestedSize - m.RequestedSize = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Nitems - m.Nitems = uint8(tmp[pos]) - pos += 1 - // field[1] m.Configs - m.Configs = make([]uint64, m.Nitems) - for i := 0; i < len(m.Configs); i++ { - m.Configs[i] = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - } - return nil -} - -// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply'. -type SockInitShmReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SockInitShmReply) Reset() { *m = SockInitShmReply{} } -func (*SockInitShmReply) GetMessageName() string { return "sock_init_shm_reply" } -func (*SockInitShmReply) GetCrcString() string { return "e8d4e804" } -func (*SockInitShmReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SockInitShmReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SockInitShmReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SockInitShmReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SockclntCreate represents VPP binary API message 'sockclnt_create'. -type SockclntCreate struct { - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (m *SockclntCreate) Reset() { *m = SockclntCreate{} } -func (*SockclntCreate) GetMessageName() string { return "sockclnt_create" } -func (*SockclntCreate) GetCrcString() string { return "455fb9c4" } -func (*SockclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SockclntCreate) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Name - size += 64 - return size -} -func (m *SockclntCreate) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Name - copy(buf[pos:pos+64], m.Name) - pos += 64 - return buf, nil -} -func (m *SockclntCreate) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'. -type SockclntCreateReply struct { - Response int32 `binapi:"i32,name=response" json:"response,omitempty"` - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` - Count uint16 `binapi:"u16,name=count" json:"count,omitempty" struc:"sizeof=MessageTable"` - MessageTable []MessageTableEntry `binapi:"message_table_entry[count],name=message_table" json:"message_table,omitempty"` -} - -func (m *SockclntCreateReply) Reset() { *m = SockclntCreateReply{} } -func (*SockclntCreateReply) GetMessageName() string { return "sockclnt_create_reply" } -func (*SockclntCreateReply) GetCrcString() string { return "35166268" } -func (*SockclntCreateReply) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SockclntCreateReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Response - size += 4 - // field[1] m.Index - size += 4 - // field[1] m.Count - size += 2 - // field[1] m.MessageTable - for j1 := 0; j1 < len(m.MessageTable); j1++ { - var s1 MessageTableEntry - _ = s1 - if j1 < len(m.MessageTable) { - s1 = m.MessageTable[j1] - } - // field[2] s1.Index - size += 2 - // field[2] s1.Name - size += 64 - } - return size -} -func (m *SockclntCreateReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Response - o.PutUint32(buf[pos:pos+4], uint32(m.Response)) - pos += 4 - // field[1] m.Index - o.PutUint32(buf[pos:pos+4], uint32(m.Index)) - pos += 4 - // field[1] m.Count - o.PutUint16(buf[pos:pos+2], uint16(len(m.MessageTable))) - pos += 2 - // field[1] m.MessageTable - for j1 := 0; j1 < len(m.MessageTable); j1++ { - var v1 MessageTableEntry - if j1 < len(m.MessageTable) { - v1 = m.MessageTable[j1] - } - // field[2] v1.Index - o.PutUint16(buf[pos:pos+2], uint16(v1.Index)) - pos += 2 - // field[2] v1.Name - copy(buf[pos:pos+64], v1.Name) - pos += 64 - } - return buf, nil -} -func (m *SockclntCreateReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Response - m.Response = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Index - m.Index = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.MessageTable - m.MessageTable = make([]MessageTableEntry, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.MessageTable[j1].Index - m.MessageTable[j1].Index = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.MessageTable[j1].Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.MessageTable[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - } - return nil -} - -// SockclntDelete represents VPP binary API message 'sockclnt_delete'. -type SockclntDelete struct { - Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` -} - -func (m *SockclntDelete) Reset() { *m = SockclntDelete{} } -func (*SockclntDelete) GetMessageName() string { return "sockclnt_delete" } -func (*SockclntDelete) GetCrcString() string { return "8ac76db6" } -func (*SockclntDelete) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SockclntDelete) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Index - size += 4 - return size -} -func (m *SockclntDelete) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Index - o.PutUint32(buf[pos:pos+4], uint32(m.Index)) - pos += 4 - return buf, nil -} -func (m *SockclntDelete) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Index - m.Index = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'. -type SockclntDeleteReply struct { - Response int32 `binapi:"i32,name=response" json:"response,omitempty"` -} - -func (m *SockclntDeleteReply) Reset() { *m = SockclntDeleteReply{} } -func (*SockclntDeleteReply) GetMessageName() string { return "sockclnt_delete_reply" } -func (*SockclntDeleteReply) GetCrcString() string { return "8f38b1ee" } -func (*SockclntDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SockclntDeleteReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Response - size += 4 - return size -} -func (m *SockclntDeleteReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Response - o.PutUint32(buf[pos:pos+4], uint32(m.Response)) - pos += 4 - return buf, nil -} -func (m *SockclntDeleteReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Response - m.Response = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids'. -type TracePluginMsgIds struct { - PluginName string `binapi:"string[128],name=plugin_name" json:"plugin_name,omitempty" struc:"[128]byte"` - FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` - LastMsgID uint16 `binapi:"u16,name=last_msg_id" json:"last_msg_id,omitempty"` -} - -func (m *TracePluginMsgIds) Reset() { *m = TracePluginMsgIds{} } -func (*TracePluginMsgIds) GetMessageName() string { return "trace_plugin_msg_ids" } -func (*TracePluginMsgIds) GetCrcString() string { return "f476d3ce" } -func (*TracePluginMsgIds) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *TracePluginMsgIds) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.PluginName - size += 128 - // field[1] m.FirstMsgID - size += 2 - // field[1] m.LastMsgID - size += 2 - return size -} -func (m *TracePluginMsgIds) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.PluginName - copy(buf[pos:pos+128], m.PluginName) - pos += 128 - // field[1] m.FirstMsgID - o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) - pos += 2 - // field[1] m.LastMsgID - o.PutUint16(buf[pos:pos+2], uint16(m.LastMsgID)) - pos += 2 - return buf, nil -} -func (m *TracePluginMsgIds) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.PluginName - { - nul := bytes.Index(tmp[pos:pos+128], []byte{0x00}) - m.PluginName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 128 - } - // field[1] m.FirstMsgID - m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.LastMsgID - m.LastMsgID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -func init() { file_memclnt_binapi_init() } -func file_memclnt_binapi_init() { - api.RegisterMessage((*APIVersions)(nil), "memclnt.APIVersions") - api.RegisterMessage((*APIVersionsReply)(nil), "memclnt.APIVersionsReply") - api.RegisterMessage((*GetFirstMsgID)(nil), "memclnt.GetFirstMsgID") - api.RegisterMessage((*GetFirstMsgIDReply)(nil), "memclnt.GetFirstMsgIDReply") - api.RegisterMessage((*MemclntCreate)(nil), "memclnt.MemclntCreate") - api.RegisterMessage((*MemclntCreateReply)(nil), "memclnt.MemclntCreateReply") - api.RegisterMessage((*MemclntDelete)(nil), "memclnt.MemclntDelete") - api.RegisterMessage((*MemclntDeleteReply)(nil), "memclnt.MemclntDeleteReply") - api.RegisterMessage((*MemclntKeepalive)(nil), "memclnt.MemclntKeepalive") - api.RegisterMessage((*MemclntKeepaliveReply)(nil), "memclnt.MemclntKeepaliveReply") - api.RegisterMessage((*MemclntReadTimeout)(nil), "memclnt.MemclntReadTimeout") - api.RegisterMessage((*MemclntRxThreadSuspend)(nil), "memclnt.MemclntRxThreadSuspend") - api.RegisterMessage((*RPCCall)(nil), "memclnt.RPCCall") - api.RegisterMessage((*RPCCallReply)(nil), "memclnt.RPCCallReply") - api.RegisterMessage((*RxThreadExit)(nil), "memclnt.RxThreadExit") - api.RegisterMessage((*SockInitShm)(nil), "memclnt.SockInitShm") - api.RegisterMessage((*SockInitShmReply)(nil), "memclnt.SockInitShmReply") - api.RegisterMessage((*SockclntCreate)(nil), "memclnt.SockclntCreate") - api.RegisterMessage((*SockclntCreateReply)(nil), "memclnt.SockclntCreateReply") - api.RegisterMessage((*SockclntDelete)(nil), "memclnt.SockclntDelete") - api.RegisterMessage((*SockclntDeleteReply)(nil), "memclnt.SockclntDeleteReply") - api.RegisterMessage((*TracePluginMsgIds)(nil), "memclnt.TracePluginMsgIds") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*APIVersions)(nil), - (*APIVersionsReply)(nil), - (*GetFirstMsgID)(nil), - (*GetFirstMsgIDReply)(nil), - (*MemclntCreate)(nil), - (*MemclntCreateReply)(nil), - (*MemclntDelete)(nil), - (*MemclntDeleteReply)(nil), - (*MemclntKeepalive)(nil), - (*MemclntKeepaliveReply)(nil), - (*MemclntReadTimeout)(nil), - (*MemclntRxThreadSuspend)(nil), - (*RPCCall)(nil), - (*RPCCallReply)(nil), - (*RxThreadExit)(nil), - (*SockInitShm)(nil), - (*SockInitShmReply)(nil), - (*SockclntCreate)(nil), - (*SockclntCreateReply)(nil), - (*SockclntDelete)(nil), - (*SockclntDeleteReply)(nil), - (*TracePluginMsgIds)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/memclnt/memclnt_rpc.ba.go b/codec/testdata/binapi2001/memclnt/memclnt_rpc.ba.go deleted file mode 100644 index 05dfc28..0000000 --- a/codec/testdata/binapi2001/memclnt/memclnt_rpc.ba.go +++ /dev/null @@ -1,141 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package memclnt - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for memclnt module. -type RPCService interface { - APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) - GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) - MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) - MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) - MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) - MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error - MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error - RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) - RxThreadExit(ctx context.Context, in *RxThreadExit) error - SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) - SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) - SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) - TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { - out := new(APIVersionsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { - out := new(GetFirstMsgIDReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { - out := new(MemclntCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { - out := new(MemclntDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { - out := new(MemclntKeepaliveReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { - c.ch.SendRequest(in) - return nil -} - -func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { - c.ch.SendRequest(in) - return nil -} - -func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { - out := new(RPCCallReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { - c.ch.SendRequest(in) - return nil -} - -func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { - out := new(SockInitShmReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { - out := new(SockclntCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { - out := new(SockclntDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { - c.ch.SendRequest(in) - return nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/codec/testdata/binapi2001/memif/memif.ba.go b/codec/testdata/binapi2001/memif/memif.ba.go deleted file mode 100644 index 4964117..0000000 --- a/codec/testdata/binapi2001/memif/memif.ba.go +++ /dev/null @@ -1,1052 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.01-45~g7a071e370~b63 -// source: /usr/share/vpp/api/plugins/memif.api.json - -/* -Package memif contains generated code for VPP binary API defined by memif.api (version 3.0.0). - -It consists of: - 2 aliases - 8 enums - 10 messages -*/ -package memif - -import ( - "bytes" - "context" - "encoding/binary" - "io" - "math" - "strconv" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "memif" - // APIVersion is the API version of this module. - APIVersion = "3.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0x88dc56c9 -) - -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) - -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" -} - -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 - -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) - -var ( - IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, - } -) - -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} - -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} - -// MemifMode represents VPP binary API enum 'memif_mode'. -type MemifMode uint32 - -const ( - MEMIF_MODE_API_ETHERNET MemifMode = 0 - MEMIF_MODE_API_IP MemifMode = 1 - MEMIF_MODE_API_PUNT_INJECT MemifMode = 2 -) - -var ( - MemifMode_name = map[uint32]string{ - 0: "MEMIF_MODE_API_ETHERNET", - 1: "MEMIF_MODE_API_IP", - 2: "MEMIF_MODE_API_PUNT_INJECT", - } - MemifMode_value = map[string]uint32{ - "MEMIF_MODE_API_ETHERNET": 0, - "MEMIF_MODE_API_IP": 1, - "MEMIF_MODE_API_PUNT_INJECT": 2, - } -) - -func (x MemifMode) String() string { - s, ok := MemifMode_name[uint32(x)] - if ok { - return s - } - return "MemifMode(" + strconv.Itoa(int(x)) + ")" -} - -// MemifRole represents VPP binary API enum 'memif_role'. -type MemifRole uint32 - -const ( - MEMIF_ROLE_API_MASTER MemifRole = 0 - MEMIF_ROLE_API_SLAVE MemifRole = 1 -) - -var ( - MemifRole_name = map[uint32]string{ - 0: "MEMIF_ROLE_API_MASTER", - 1: "MEMIF_ROLE_API_SLAVE", - } - MemifRole_value = map[string]uint32{ - "MEMIF_ROLE_API_MASTER": 0, - "MEMIF_ROLE_API_SLAVE": 1, - } -) - -func (x MemifRole) String() string { - s, ok := MemifRole_name[uint32(x)] - if ok { - return s - } - return "MemifRole(" + strconv.Itoa(int(x)) + ")" -} - -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var ( - MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" -} - -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -// MemifCreate represents VPP binary API message 'memif_create'. -type MemifCreate struct { - Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` - Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` - RxQueues uint8 `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"` - TxQueues uint8 `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"` - ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` - SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` - BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` - NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"` - HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` - Secret string `binapi:"string[24],name=secret" json:"secret,omitempty" struc:"[24]byte"` -} - -func (m *MemifCreate) Reset() { *m = MemifCreate{} } -func (*MemifCreate) GetMessageName() string { return "memif_create" } -func (*MemifCreate) GetCrcString() string { return "b1b25061" } -func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifCreate) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Role - size += 4 - // field[1] m.Mode - size += 4 - // field[1] m.RxQueues - size += 1 - // field[1] m.TxQueues - size += 1 - // field[1] m.ID - size += 4 - // field[1] m.SocketID - size += 4 - // field[1] m.RingSize - size += 4 - // field[1] m.BufferSize - size += 2 - // field[1] m.NoZeroCopy - size += 1 - // field[1] m.HwAddr - size += 6 - // field[1] m.Secret - size += 24 - return size -} -func (m *MemifCreate) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Role - o.PutUint32(buf[pos:pos+4], uint32(m.Role)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - // field[1] m.RxQueues - buf[pos] = uint8(m.RxQueues) - pos += 1 - // field[1] m.TxQueues - buf[pos] = uint8(m.TxQueues) - pos += 1 - // field[1] m.ID - o.PutUint32(buf[pos:pos+4], uint32(m.ID)) - pos += 4 - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.RingSize - o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) - pos += 4 - // field[1] m.BufferSize - o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) - pos += 2 - // field[1] m.NoZeroCopy - if m.NoZeroCopy { - buf[pos] = 1 - } - pos += 1 - // field[1] m.HwAddr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.HwAddr) { - x = uint8(m.HwAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Secret - copy(buf[pos:pos+24], m.Secret) - pos += 24 - return buf, nil -} -func (m *MemifCreate) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Role - m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.RxQueues - m.RxQueues = uint8(tmp[pos]) - pos += 1 - // field[1] m.TxQueues - m.TxQueues = uint8(tmp[pos]) - pos += 1 - // field[1] m.ID - m.ID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.RingSize - m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.BufferSize - m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.NoZeroCopy - m.NoZeroCopy = tmp[pos] != 0 - pos += 1 - // field[1] m.HwAddr - for i := 0; i < len(m.HwAddr); i++ { - m.HwAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Secret - { - nul := bytes.Index(tmp[pos:pos+24], []byte{0x00}) - m.Secret = codec.DecodeString(tmp[pos : pos+nul]) - pos += 24 - } - return nil -} - -// MemifCreateReply represents VPP binary API message 'memif_create_reply'. -type MemifCreateReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} } -func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" } -func (*MemifCreateReply) GetCrcString() string { return "5383d31f" } -func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifCreateReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *MemifCreateReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemifDelete represents VPP binary API message 'memif_delete'. -type MemifDelete struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *MemifDelete) Reset() { *m = MemifDelete{} } -func (*MemifDelete) GetMessageName() string { return "memif_delete" } -func (*MemifDelete) GetCrcString() string { return "f9e6675e" } -func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifDelete) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *MemifDelete) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *MemifDelete) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemifDeleteReply represents VPP binary API message 'memif_delete_reply'. -type MemifDeleteReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} } -func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" } -func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" } -func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifDeleteReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MemifDeleteReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemifDetails represents VPP binary API message 'memif_details'. -type MemifDetails struct { - SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` - ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` - Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` - Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` - ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"` - SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` - BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` - Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"` -} - -func (m *MemifDetails) Reset() { *m = MemifDetails{} } -func (*MemifDetails) GetMessageName() string { return "memif_details" } -func (*MemifDetails) GetCrcString() string { return "d0382c4c" } -func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.HwAddr - size += 6 - // field[1] m.ID - size += 4 - // field[1] m.Role - size += 4 - // field[1] m.Mode - size += 4 - // field[1] m.ZeroCopy - size += 1 - // field[1] m.SocketID - size += 4 - // field[1] m.RingSize - size += 4 - // field[1] m.BufferSize - size += 2 - // field[1] m.Flags - size += 4 - // field[1] m.IfName - size += 64 - return size -} -func (m *MemifDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.HwAddr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.HwAddr) { - x = uint8(m.HwAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.ID - o.PutUint32(buf[pos:pos+4], uint32(m.ID)) - pos += 4 - // field[1] m.Role - o.PutUint32(buf[pos:pos+4], uint32(m.Role)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - // field[1] m.ZeroCopy - if m.ZeroCopy { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.RingSize - o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) - pos += 4 - // field[1] m.BufferSize - o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) - pos += 2 - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - // field[1] m.IfName - copy(buf[pos:pos+64], m.IfName) - pos += 64 - return buf, nil -} -func (m *MemifDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.HwAddr - for i := 0; i < len(m.HwAddr); i++ { - m.HwAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.ID - m.ID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Role - m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ZeroCopy - m.ZeroCopy = tmp[pos] != 0 - pos += 1 - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.RingSize - m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.BufferSize - m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.Flags - m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IfName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.IfName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// MemifDump represents VPP binary API message 'memif_dump'. -type MemifDump struct{} - -func (m *MemifDump) Reset() { *m = MemifDump{} } -func (*MemifDump) GetMessageName() string { return "memif_dump" } -func (*MemifDump) GetCrcString() string { return "51077d14" } -func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MemifDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MemifDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'. -type MemifSocketFilenameAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` -} - -func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} } -func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" } -func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" } -func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifSocketFilenameAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.SocketID - size += 4 - // field[1] m.SocketFilename - size += 108 - return size -} -func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.SocketFilename - copy(buf[pos:pos+108], m.SocketFilename) - pos += 108 - return buf, nil -} -func (m *MemifSocketFilenameAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SocketFilename - { - nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) - m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) - pos += 108 - } - return nil -} - -// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'. -type MemifSocketFilenameAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} } -func (*MemifSocketFilenameAddDelReply) GetMessageName() string { - return "memif_socket_filename_add_del_reply" -} -func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifSocketFilenameAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MemifSocketFilenameAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'. -type MemifSocketFilenameDetails struct { - SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` -} - -func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} } -func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" } -func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" } -func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifSocketFilenameDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SocketID - size += 4 - // field[1] m.SocketFilename - size += 108 - return size -} -func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.SocketFilename - copy(buf[pos:pos+108], m.SocketFilename) - pos += 108 - return buf, nil -} -func (m *MemifSocketFilenameDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SocketFilename - { - nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) - m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) - pos += 108 - } - return nil -} - -// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'. -type MemifSocketFilenameDump struct{} - -func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} } -func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" } -func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" } -func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifSocketFilenameDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MemifSocketFilenameDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -func init() { file_memif_binapi_init() } -func file_memif_binapi_init() { - api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate") - api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply") - api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete") - api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply") - api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails") - api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump") - api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel") - api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply") - api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails") - api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*MemifCreate)(nil), - (*MemifCreateReply)(nil), - (*MemifDelete)(nil), - (*MemifDeleteReply)(nil), - (*MemifDetails)(nil), - (*MemifDump)(nil), - (*MemifSocketFilenameAddDel)(nil), - (*MemifSocketFilenameAddDelReply)(nil), - (*MemifSocketFilenameDetails)(nil), - (*MemifSocketFilenameDump)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/memif/memif_rpc.ba.go b/codec/testdata/binapi2001/memif/memif_rpc.ba.go deleted file mode 100644 index 8eda8f1..0000000 --- a/codec/testdata/binapi2001/memif/memif_rpc.ba.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package memif - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for memif module. -type RPCService interface { - DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) - DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) - MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) - MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) - MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMemifClient{stream} - return x, nil -} - -type RPCService_DumpMemifClient interface { - Recv() (*MemifDetails, error) -} - -type serviceClient_DumpMemifClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { - m := new(MemifDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMemifSocketFilenameClient{stream} - return x, nil -} - -type RPCService_DumpMemifSocketFilenameClient interface { - Recv() (*MemifSocketFilenameDetails, error) -} - -type serviceClient_DumpMemifSocketFilenameClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { - m := new(MemifSocketFilenameDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { - out := new(MemifCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { - out := new(MemifDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { - out := new(MemifSocketFilenameAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/codec/testdata/binapi2001/sr/sr.ba.go b/codec/testdata/binapi2001/sr/sr.ba.go deleted file mode 100644 index b0e423b..0000000 --- a/codec/testdata/binapi2001/sr/sr.ba.go +++ /dev/null @@ -1,1716 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.01-45~g7a071e370~b63 -// source: /usr/share/vpp/api/core/sr.api.json - -/* -Package sr contains generated code for VPP binary API defined by sr.api (version 1.2.0). - -It consists of: - 20 messages - 3 types -*/ -package sr - -import ( - "bytes" - "context" - "encoding/binary" - "io" - "math" - "strconv" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "sr" - // APIVersion is the API version of this module. - APIVersion = "1.2.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0xbf277f96 -) - -// SrIP6Address represents VPP binary API type 'sr_ip6_address'. -type SrIP6Address struct { - Data []byte `binapi:"u8[16],name=data" json:"data,omitempty" struc:"[16]byte"` -} - -func (*SrIP6Address) GetTypeName() string { return "sr_ip6_address" } - -// Srv6Sid represents VPP binary API type 'srv6_sid'. -type Srv6Sid struct { - Addr []byte `binapi:"u8[16],name=addr" json:"addr,omitempty" struc:"[16]byte"` -} - -func (*Srv6Sid) GetTypeName() string { return "srv6_sid" } - -// Srv6SidList represents VPP binary API type 'srv6_sid_list'. -type Srv6SidList struct { - NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` - Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` - Sids [16]Srv6Sid `binapi:"srv6_sid[16],name=sids" json:"sids,omitempty" struc:"[16]Srv6Sid"` -} - -func (*Srv6SidList) GetTypeName() string { return "srv6_sid_list" } - -// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. -type SrLocalsidAddDel struct { - IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` - Localsid Srv6Sid `binapi:"srv6_sid,name=localsid" json:"localsid,omitempty"` - EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` - Behavior uint8 `binapi:"u8,name=behavior" json:"behavior,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - NhAddr6 []byte `binapi:"u8[16],name=nh_addr6" json:"nh_addr6,omitempty" struc:"[16]byte"` - NhAddr4 []byte `binapi:"u8[4],name=nh_addr4" json:"nh_addr4,omitempty" struc:"[4]byte"` -} - -func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } -func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" } -func (*SrLocalsidAddDel) GetCrcString() string { return "b30489eb" } -func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrLocalsidAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsDel - size += 1 - // field[1] m.Localsid - // field[2] m.Localsid.Addr - size += 16 - // field[1] m.EndPsp - size += 1 - // field[1] m.Behavior - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.VlanIndex - size += 4 - // field[1] m.FibTable - size += 4 - // field[1] m.NhAddr6 - size += 16 - // field[1] m.NhAddr4 - size += 4 - return size -} -func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsDel - buf[pos] = uint8(m.IsDel) - pos += 1 - // field[1] m.Localsid - // field[2] m.Localsid.Addr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.Localsid.Addr) { - x = uint8(m.Localsid.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.EndPsp - buf[pos] = uint8(m.EndPsp) - pos += 1 - // field[1] m.Behavior - buf[pos] = uint8(m.Behavior) - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.VlanIndex - o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) - pos += 4 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.NhAddr6 - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.NhAddr6) { - x = uint8(m.NhAddr6[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.NhAddr4 - for i := 0; i < 4; i++ { - var x uint8 - if i < len(m.NhAddr4) { - x = uint8(m.NhAddr4[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsDel - m.IsDel = uint8(tmp[pos]) - pos += 1 - // field[1] m.Localsid - // field[2] m.Localsid.Addr - m.Localsid.Addr = make([]uint8, 16) - for i := 0; i < len(m.Localsid.Addr); i++ { - m.Localsid.Addr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.EndPsp - m.EndPsp = uint8(tmp[pos]) - pos += 1 - // field[1] m.Behavior - m.Behavior = uint8(tmp[pos]) - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VlanIndex - m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NhAddr6 - m.NhAddr6 = make([]uint8, 16) - for i := 0; i < len(m.NhAddr6); i++ { - m.NhAddr6[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.NhAddr4 - m.NhAddr4 = make([]uint8, 4) - for i := 0; i < len(m.NhAddr4); i++ { - m.NhAddr4[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. -type SrLocalsidAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrLocalsidAddDelReply) Reset() { *m = SrLocalsidAddDelReply{} } -func (*SrLocalsidAddDelReply) GetMessageName() string { return "sr_localsid_add_del_reply" } -func (*SrLocalsidAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrLocalsidAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrLocalsidAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrLocalsidAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. -type SrLocalsidsDetails struct { - Addr Srv6Sid `binapi:"srv6_sid,name=addr" json:"addr,omitempty"` - EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` - Behavior uint16 `binapi:"u16,name=behavior" json:"behavior,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` - XconnectNhAddr6 []byte `binapi:"u8[16],name=xconnect_nh_addr6" json:"xconnect_nh_addr6,omitempty" struc:"[16]byte"` - XconnectNhAddr4 []byte `binapi:"u8[4],name=xconnect_nh_addr4" json:"xconnect_nh_addr4,omitempty" struc:"[4]byte"` - XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` -} - -func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } -func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" } -func (*SrLocalsidsDetails) GetCrcString() string { return "0791babc" } -func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrLocalsidsDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Addr - // field[2] m.Addr.Addr - size += 16 - // field[1] m.EndPsp - size += 1 - // field[1] m.Behavior - size += 2 - // field[1] m.FibTable - size += 4 - // field[1] m.VlanIndex - size += 4 - // field[1] m.XconnectNhAddr6 - size += 16 - // field[1] m.XconnectNhAddr4 - size += 4 - // field[1] m.XconnectIfaceOrVrfTable - size += 4 - return size -} -func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Addr - // field[2] m.Addr.Addr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.Addr.Addr) { - x = uint8(m.Addr.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.EndPsp - buf[pos] = uint8(m.EndPsp) - pos += 1 - // field[1] m.Behavior - o.PutUint16(buf[pos:pos+2], uint16(m.Behavior)) - pos += 2 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.VlanIndex - o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) - pos += 4 - // field[1] m.XconnectNhAddr6 - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.XconnectNhAddr6) { - x = uint8(m.XconnectNhAddr6[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.XconnectNhAddr4 - for i := 0; i < 4; i++ { - var x uint8 - if i < len(m.XconnectNhAddr4) { - x = uint8(m.XconnectNhAddr4[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.XconnectIfaceOrVrfTable - o.PutUint32(buf[pos:pos+4], uint32(m.XconnectIfaceOrVrfTable)) - pos += 4 - return buf, nil -} -func (m *SrLocalsidsDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Addr - // field[2] m.Addr.Addr - m.Addr.Addr = make([]uint8, 16) - for i := 0; i < len(m.Addr.Addr); i++ { - m.Addr.Addr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.EndPsp - m.EndPsp = uint8(tmp[pos]) - pos += 1 - // field[1] m.Behavior - m.Behavior = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VlanIndex - m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.XconnectNhAddr6 - m.XconnectNhAddr6 = make([]uint8, 16) - for i := 0; i < len(m.XconnectNhAddr6); i++ { - m.XconnectNhAddr6[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.XconnectNhAddr4 - m.XconnectNhAddr4 = make([]uint8, 4) - for i := 0; i < len(m.XconnectNhAddr4); i++ { - m.XconnectNhAddr4[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.XconnectIfaceOrVrfTable - m.XconnectIfaceOrVrfTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. -type SrLocalsidsDump struct{} - -func (m *SrLocalsidsDump) Reset() { *m = SrLocalsidsDump{} } -func (*SrLocalsidsDump) GetMessageName() string { return "sr_localsids_dump" } -func (*SrLocalsidsDump) GetCrcString() string { return "51077d14" } -func (*SrLocalsidsDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrLocalsidsDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *SrLocalsidsDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *SrLocalsidsDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. -type SrPoliciesDetails struct { - Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` - Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` - IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"num_sid_lists,omitempty" struc:"sizeof=SidLists"` - SidLists []Srv6SidList `binapi:"srv6_sid_list[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"` -} - -func (m *SrPoliciesDetails) Reset() { *m = SrPoliciesDetails{} } -func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" } -func (*SrPoliciesDetails) GetCrcString() string { return "5087f460" } -func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrPoliciesDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Bsid - // field[2] m.Bsid.Addr - size += 16 - // field[1] m.Type - size += 1 - // field[1] m.IsEncap - size += 1 - // field[1] m.FibTable - size += 4 - // field[1] m.NumSidLists - size += 1 - // field[1] m.SidLists - for j1 := 0; j1 < len(m.SidLists); j1++ { - var s1 Srv6SidList - _ = s1 - if j1 < len(m.SidLists) { - s1 = m.SidLists[j1] - } - // field[2] s1.NumSids - size += 1 - // field[2] s1.Weight - size += 4 - // field[2] s1.Sids - for j2 := 0; j2 < 16; j2++ { - var s2 Srv6Sid - _ = s2 - if j2 < len(s1.Sids) { - s2 = s1.Sids[j2] - } - // field[3] s2.Addr - size += 16 - } - } - return size -} -func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Bsid - // field[2] m.Bsid.Addr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.Bsid.Addr) { - x = uint8(m.Bsid.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Type - buf[pos] = uint8(m.Type) - pos += 1 - // field[1] m.IsEncap - buf[pos] = uint8(m.IsEncap) - pos += 1 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.NumSidLists - buf[pos] = uint8(len(m.SidLists)) - pos += 1 - // field[1] m.SidLists - for j1 := 0; j1 < len(m.SidLists); j1++ { - var v1 Srv6SidList - if j1 < len(m.SidLists) { - v1 = m.SidLists[j1] - } - // field[2] v1.NumSids - buf[pos] = uint8(v1.NumSids) - pos += 1 - // field[2] v1.Weight - o.PutUint32(buf[pos:pos+4], uint32(v1.Weight)) - pos += 4 - // field[2] v1.Sids - for j2 := 0; j2 < 16; j2++ { - var v2 Srv6Sid - if j2 < len(v1.Sids) { - v2 = v1.Sids[j2] - } - // field[3] v2.Addr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v2.Addr) { - x = uint8(v2.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - } - } - return buf, nil -} -func (m *SrPoliciesDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Bsid - // field[2] m.Bsid.Addr - m.Bsid.Addr = make([]uint8, 16) - for i := 0; i < len(m.Bsid.Addr); i++ { - m.Bsid.Addr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Type - m.Type = uint8(tmp[pos]) - pos += 1 - // field[1] m.IsEncap - m.IsEncap = uint8(tmp[pos]) - pos += 1 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NumSidLists - m.NumSidLists = uint8(tmp[pos]) - pos += 1 - // field[1] m.SidLists - m.SidLists = make([]Srv6SidList, int(m.NumSidLists)) - for j1 := 0; j1 < int(m.NumSidLists); j1++ { - // field[2] m.SidLists[j1].NumSids - m.SidLists[j1].NumSids = uint8(tmp[pos]) - pos += 1 - // field[2] m.SidLists[j1].Weight - m.SidLists[j1].Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.SidLists[j1].Sids - for j2 := 0; j2 < 16; j2++ { - // field[3] m.SidLists[j1].Sids[j2].Addr - m.SidLists[j1].Sids[j2].Addr = make([]uint8, 16) - for i := 0; i < len(m.SidLists[j1].Sids[j2].Addr); i++ { - m.SidLists[j1].Sids[j2].Addr[i] = uint8(tmp[pos]) - pos += 1 - } - } - } - return nil -} - -// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. -type SrPoliciesDump struct{} - -func (m *SrPoliciesDump) Reset() { *m = SrPoliciesDump{} } -func (*SrPoliciesDump) GetMessageName() string { return "sr_policies_dump" } -func (*SrPoliciesDump) GetCrcString() string { return "51077d14" } -func (*SrPoliciesDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrPoliciesDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *SrPoliciesDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *SrPoliciesDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. -type SrPolicyAdd struct { - BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` - Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` - IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` - Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` -} - -func (m *SrPolicyAdd) Reset() { *m = SrPolicyAdd{} } -func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" } -func (*SrPolicyAdd) GetCrcString() string { return "4b6e2484" } -func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrPolicyAdd) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.BsidAddr - size += 16 - // field[1] m.Weight - size += 4 - // field[1] m.IsEncap - size += 1 - // field[1] m.Type - size += 1 - // field[1] m.FibTable - size += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - size += 1 - // field[2] m.Sids.Weight - size += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - var s2 Srv6Sid - _ = s2 - if j2 < len(m.Sids.Sids) { - s2 = m.Sids.Sids[j2] - } - // field[3] s2.Addr - size += 16 - } - return size -} -func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.BsidAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.BsidAddr) { - x = uint8(m.BsidAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Weight - o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) - pos += 4 - // field[1] m.IsEncap - buf[pos] = uint8(m.IsEncap) - pos += 1 - // field[1] m.Type - buf[pos] = uint8(m.Type) - pos += 1 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - buf[pos] = uint8(m.Sids.NumSids) - pos += 1 - // field[2] m.Sids.Weight - o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) - pos += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - var v2 Srv6Sid - if j2 < len(m.Sids.Sids) { - v2 = m.Sids.Sids[j2] - } - // field[3] v2.Addr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v2.Addr) { - x = uint8(v2.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - } - return buf, nil -} -func (m *SrPolicyAdd) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.BsidAddr - m.BsidAddr = make([]uint8, 16) - for i := 0; i < len(m.BsidAddr); i++ { - m.BsidAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Weight - m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsEncap - m.IsEncap = uint8(tmp[pos]) - pos += 1 - // field[1] m.Type - m.Type = uint8(tmp[pos]) - pos += 1 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - m.Sids.NumSids = uint8(tmp[pos]) - pos += 1 - // field[2] m.Sids.Weight - m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - // field[3] m.Sids.Sids[j2].Addr - m.Sids.Sids[j2].Addr = make([]uint8, 16) - for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { - m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. -type SrPolicyAddReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrPolicyAddReply) Reset() { *m = SrPolicyAddReply{} } -func (*SrPolicyAddReply) GetMessageName() string { return "sr_policy_add_reply" } -func (*SrPolicyAddReply) GetCrcString() string { return "e8d4e804" } -func (*SrPolicyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrPolicyAddReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrPolicyAddReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrPolicyAddReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrPolicyDel represents VPP binary API message 'sr_policy_del'. -type SrPolicyDel struct { - BsidAddr Srv6Sid `binapi:"srv6_sid,name=bsid_addr" json:"bsid_addr,omitempty"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` -} - -func (m *SrPolicyDel) Reset() { *m = SrPolicyDel{} } -func (*SrPolicyDel) GetMessageName() string { return "sr_policy_del" } -func (*SrPolicyDel) GetCrcString() string { return "e4133171" } -func (*SrPolicyDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrPolicyDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.BsidAddr - // field[2] m.BsidAddr.Addr - size += 16 - // field[1] m.SrPolicyIndex - size += 4 - return size -} -func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.BsidAddr - // field[2] m.BsidAddr.Addr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.BsidAddr.Addr) { - x = uint8(m.BsidAddr.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.SrPolicyIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) - pos += 4 - return buf, nil -} -func (m *SrPolicyDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.BsidAddr - // field[2] m.BsidAddr.Addr - m.BsidAddr.Addr = make([]uint8, 16) - for i := 0; i < len(m.BsidAddr.Addr); i++ { - m.BsidAddr.Addr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.SrPolicyIndex - m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. -type SrPolicyDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrPolicyDelReply) Reset() { *m = SrPolicyDelReply{} } -func (*SrPolicyDelReply) GetMessageName() string { return "sr_policy_del_reply" } -func (*SrPolicyDelReply) GetCrcString() string { return "e8d4e804" } -func (*SrPolicyDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrPolicyDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrPolicyDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrPolicyDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. -type SrPolicyMod struct { - BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - Operation uint8 `binapi:"u8,name=operation" json:"operation,omitempty"` - SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` - Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` - Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` -} - -func (m *SrPolicyMod) Reset() { *m = SrPolicyMod{} } -func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" } -func (*SrPolicyMod) GetCrcString() string { return "c1dfaee0" } -func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrPolicyMod) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.BsidAddr - size += 16 - // field[1] m.SrPolicyIndex - size += 4 - // field[1] m.FibTable - size += 4 - // field[1] m.Operation - size += 1 - // field[1] m.SlIndex - size += 4 - // field[1] m.Weight - size += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - size += 1 - // field[2] m.Sids.Weight - size += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - var s2 Srv6Sid - _ = s2 - if j2 < len(m.Sids.Sids) { - s2 = m.Sids.Sids[j2] - } - // field[3] s2.Addr - size += 16 - } - return size -} -func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.BsidAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.BsidAddr) { - x = uint8(m.BsidAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.SrPolicyIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) - pos += 4 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.Operation - buf[pos] = uint8(m.Operation) - pos += 1 - // field[1] m.SlIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SlIndex)) - pos += 4 - // field[1] m.Weight - o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) - pos += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - buf[pos] = uint8(m.Sids.NumSids) - pos += 1 - // field[2] m.Sids.Weight - o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) - pos += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - var v2 Srv6Sid - if j2 < len(m.Sids.Sids) { - v2 = m.Sids.Sids[j2] - } - // field[3] v2.Addr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v2.Addr) { - x = uint8(v2.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - } - return buf, nil -} -func (m *SrPolicyMod) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.BsidAddr - m.BsidAddr = make([]uint8, 16) - for i := 0; i < len(m.BsidAddr); i++ { - m.BsidAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.SrPolicyIndex - m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Operation - m.Operation = uint8(tmp[pos]) - pos += 1 - // field[1] m.SlIndex - m.SlIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Weight - m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - m.Sids.NumSids = uint8(tmp[pos]) - pos += 1 - // field[2] m.Sids.Weight - m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - // field[3] m.Sids.Sids[j2].Addr - m.Sids.Sids[j2].Addr = make([]uint8, 16) - for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { - m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. -type SrPolicyModReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrPolicyModReply) Reset() { *m = SrPolicyModReply{} } -func (*SrPolicyModReply) GetMessageName() string { return "sr_policy_mod_reply" } -func (*SrPolicyModReply) GetCrcString() string { return "e8d4e804" } -func (*SrPolicyModReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrPolicyModReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrPolicyModReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrPolicyModReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrSetEncapHopLimit represents VPP binary API message 'sr_set_encap_hop_limit'. -type SrSetEncapHopLimit struct { - HopLimit uint8 `binapi:"u8,name=hop_limit" json:"hop_limit,omitempty"` -} - -func (m *SrSetEncapHopLimit) Reset() { *m = SrSetEncapHopLimit{} } -func (*SrSetEncapHopLimit) GetMessageName() string { return "sr_set_encap_hop_limit" } -func (*SrSetEncapHopLimit) GetCrcString() string { return "aa75d7d0" } -func (*SrSetEncapHopLimit) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrSetEncapHopLimit) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.HopLimit - size += 1 - return size -} -func (m *SrSetEncapHopLimit) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.HopLimit - buf[pos] = uint8(m.HopLimit) - pos += 1 - return buf, nil -} -func (m *SrSetEncapHopLimit) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.HopLimit - m.HopLimit = uint8(tmp[pos]) - pos += 1 - return nil -} - -// SrSetEncapHopLimitReply represents VPP binary API message 'sr_set_encap_hop_limit_reply'. -type SrSetEncapHopLimitReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrSetEncapHopLimitReply) Reset() { *m = SrSetEncapHopLimitReply{} } -func (*SrSetEncapHopLimitReply) GetMessageName() string { return "sr_set_encap_hop_limit_reply" } -func (*SrSetEncapHopLimitReply) GetCrcString() string { return "e8d4e804" } -func (*SrSetEncapHopLimitReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrSetEncapHopLimitReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrSetEncapHopLimitReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrSetEncapHopLimitReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. -type SrSetEncapSource struct { - EncapsSource []byte `binapi:"u8[16],name=encaps_source" json:"encaps_source,omitempty" struc:"[16]byte"` -} - -func (m *SrSetEncapSource) Reset() { *m = SrSetEncapSource{} } -func (*SrSetEncapSource) GetMessageName() string { return "sr_set_encap_source" } -func (*SrSetEncapSource) GetCrcString() string { return "d05bb4de" } -func (*SrSetEncapSource) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrSetEncapSource) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.EncapsSource - size += 16 - return size -} -func (m *SrSetEncapSource) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.EncapsSource - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.EncapsSource) { - x = uint8(m.EncapsSource[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SrSetEncapSource) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.EncapsSource - m.EncapsSource = make([]uint8, 16) - for i := 0; i < len(m.EncapsSource); i++ { - m.EncapsSource[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. -type SrSetEncapSourceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrSetEncapSourceReply) Reset() { *m = SrSetEncapSourceReply{} } -func (*SrSetEncapSourceReply) GetMessageName() string { return "sr_set_encap_source_reply" } -func (*SrSetEncapSourceReply) GetCrcString() string { return "e8d4e804" } -func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrSetEncapSourceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrSetEncapSourceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrSetEncapSourceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. -type SrSteeringAddDel struct { - IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` - BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` - MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` -} - -func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } -func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" } -func (*SrSteeringAddDel) GetCrcString() string { return "28b5dcab" } -func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrSteeringAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsDel - size += 1 - // field[1] m.BsidAddr - size += 16 - // field[1] m.SrPolicyIndex - size += 4 - // field[1] m.TableID - size += 4 - // field[1] m.PrefixAddr - size += 16 - // field[1] m.MaskWidth - size += 4 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.TrafficType - size += 1 - return size -} -func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsDel - buf[pos] = uint8(m.IsDel) - pos += 1 - // field[1] m.BsidAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.BsidAddr) { - x = uint8(m.BsidAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.SrPolicyIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) - pos += 4 - // field[1] m.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) - pos += 4 - // field[1] m.PrefixAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.PrefixAddr) { - x = uint8(m.PrefixAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.MaskWidth - o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.TrafficType - buf[pos] = uint8(m.TrafficType) - pos += 1 - return buf, nil -} -func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsDel - m.IsDel = uint8(tmp[pos]) - pos += 1 - // field[1] m.BsidAddr - m.BsidAddr = make([]uint8, 16) - for i := 0; i < len(m.BsidAddr); i++ { - m.BsidAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.SrPolicyIndex - m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TableID - m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.PrefixAddr - m.PrefixAddr = make([]uint8, 16) - for i := 0; i < len(m.PrefixAddr); i++ { - m.PrefixAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.MaskWidth - m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TrafficType - m.TrafficType = uint8(tmp[pos]) - pos += 1 - return nil -} - -// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. -type SrSteeringAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrSteeringAddDelReply) Reset() { *m = SrSteeringAddDelReply{} } -func (*SrSteeringAddDelReply) GetMessageName() string { return "sr_steering_add_del_reply" } -func (*SrSteeringAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrSteeringAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrSteeringAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrSteeringAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. -type SrSteeringPolDetails struct { - TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` - MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` -} - -func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } -func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" } -func (*SrSteeringPolDetails) GetCrcString() string { return "5627d483" } -func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrSteeringPolDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.TrafficType - size += 1 - // field[1] m.FibTable - size += 4 - // field[1] m.PrefixAddr - size += 16 - // field[1] m.MaskWidth - size += 4 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Bsid - // field[2] m.Bsid.Addr - size += 16 - return size -} -func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.TrafficType - buf[pos] = uint8(m.TrafficType) - pos += 1 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.PrefixAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.PrefixAddr) { - x = uint8(m.PrefixAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.MaskWidth - o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Bsid - // field[2] m.Bsid.Addr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.Bsid.Addr) { - x = uint8(m.Bsid.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SrSteeringPolDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.TrafficType - m.TrafficType = uint8(tmp[pos]) - pos += 1 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.PrefixAddr - m.PrefixAddr = make([]uint8, 16) - for i := 0; i < len(m.PrefixAddr); i++ { - m.PrefixAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.MaskWidth - m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Bsid - // field[2] m.Bsid.Addr - m.Bsid.Addr = make([]uint8, 16) - for i := 0; i < len(m.Bsid.Addr); i++ { - m.Bsid.Addr[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. -type SrSteeringPolDump struct{} - -func (m *SrSteeringPolDump) Reset() { *m = SrSteeringPolDump{} } -func (*SrSteeringPolDump) GetMessageName() string { return "sr_steering_pol_dump" } -func (*SrSteeringPolDump) GetCrcString() string { return "51077d14" } -func (*SrSteeringPolDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrSteeringPolDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *SrSteeringPolDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *SrSteeringPolDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -func init() { file_sr_binapi_init() } -func file_sr_binapi_init() { - api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr.SrLocalsidAddDel") - api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr.SrLocalsidAddDelReply") - api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr.SrLocalsidsDetails") - api.RegisterMessage((*SrLocalsidsDump)(nil), "sr.SrLocalsidsDump") - api.RegisterMessage((*SrPoliciesDetails)(nil), "sr.SrPoliciesDetails") - api.RegisterMessage((*SrPoliciesDump)(nil), "sr.SrPoliciesDump") - api.RegisterMessage((*SrPolicyAdd)(nil), "sr.SrPolicyAdd") - api.RegisterMessage((*SrPolicyAddReply)(nil), "sr.SrPolicyAddReply") - api.RegisterMessage((*SrPolicyDel)(nil), "sr.SrPolicyDel") - api.RegisterMessage((*SrPolicyDelReply)(nil), "sr.SrPolicyDelReply") - api.RegisterMessage((*SrPolicyMod)(nil), "sr.SrPolicyMod") - api.RegisterMessage((*SrPolicyModReply)(nil), "sr.SrPolicyModReply") - api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr.SrSetEncapHopLimit") - api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr.SrSetEncapHopLimitReply") - api.RegisterMessage((*SrSetEncapSource)(nil), "sr.SrSetEncapSource") - api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr.SrSetEncapSourceReply") - api.RegisterMessage((*SrSteeringAddDel)(nil), "sr.SrSteeringAddDel") - api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr.SrSteeringAddDelReply") - api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr.SrSteeringPolDetails") - api.RegisterMessage((*SrSteeringPolDump)(nil), "sr.SrSteeringPolDump") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*SrLocalsidAddDel)(nil), - (*SrLocalsidAddDelReply)(nil), - (*SrLocalsidsDetails)(nil), - (*SrLocalsidsDump)(nil), - (*SrPoliciesDetails)(nil), - (*SrPoliciesDump)(nil), - (*SrPolicyAdd)(nil), - (*SrPolicyAddReply)(nil), - (*SrPolicyDel)(nil), - (*SrPolicyDelReply)(nil), - (*SrPolicyMod)(nil), - (*SrPolicyModReply)(nil), - (*SrSetEncapHopLimit)(nil), - (*SrSetEncapHopLimitReply)(nil), - (*SrSetEncapSource)(nil), - (*SrSetEncapSourceReply)(nil), - (*SrSteeringAddDel)(nil), - (*SrSteeringAddDelReply)(nil), - (*SrSteeringPolDetails)(nil), - (*SrSteeringPolDump)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/sr/sr_rpc.ba.go b/codec/testdata/binapi2001/sr/sr_rpc.ba.go deleted file mode 100644 index aeb3cde..0000000 --- a/codec/testdata/binapi2001/sr/sr_rpc.ba.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package sr - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for sr module. -type RPCService interface { - DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) - DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) - DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) - SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) - SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) - SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) - SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) - SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) - SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) - SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSrLocalsidsClient{stream} - return x, nil -} - -type RPCService_DumpSrLocalsidsClient interface { - Recv() (*SrLocalsidsDetails, error) -} - -type serviceClient_DumpSrLocalsidsClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSrLocalsidsClient) Recv() (*SrLocalsidsDetails, error) { - m := new(SrLocalsidsDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSrPoliciesClient{stream} - return x, nil -} - -type RPCService_DumpSrPoliciesClient interface { - Recv() (*SrPoliciesDetails, error) -} - -type serviceClient_DumpSrPoliciesClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSrPoliciesClient) Recv() (*SrPoliciesDetails, error) { - m := new(SrPoliciesDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSrSteeringPolClient{stream} - return x, nil -} - -type RPCService_DumpSrSteeringPolClient interface { - Recv() (*SrSteeringPolDetails, error) -} - -type serviceClient_DumpSrSteeringPolClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSrSteeringPolClient) Recv() (*SrSteeringPolDetails, error) { - m := new(SrSteeringPolDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) { - out := new(SrLocalsidAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) { - out := new(SrPolicyAddReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { - out := new(SrPolicyDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { - out := new(SrPolicyModReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) { - out := new(SrSetEncapHopLimitReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { - out := new(SrSetEncapSourceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { - out := new(SrSteeringAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/codec/testdata/binapi2001/vpe/vpe.ba.go b/codec/testdata/binapi2001/vpe/vpe.ba.go deleted file mode 100644 index e12bca4..0000000 --- a/codec/testdata/binapi2001/vpe/vpe.ba.go +++ /dev/null @@ -1,1701 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.01-45~g7a071e370~b63 -// source: /usr/share/vpp/api/core/vpe.api.json - -/* -Package vpe contains generated code for VPP binary API defined by vpe.api (version 1.6.0). - -It consists of: - 2 aliases - 1 enum - 26 messages - 2 types -*/ -package vpe - -import ( - "bytes" - "context" - "encoding/binary" - "io" - "math" - "strconv" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "vpe" - // APIVersion is the API version of this module. - APIVersion = "1.6.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0xc6c0bcf6 -) - -// LogLevel represents VPP binary API enum 'log_level'. -type LogLevel uint32 - -const ( - VPE_API_LOG_LEVEL_EMERG LogLevel = 0 - VPE_API_LOG_LEVEL_ALERT LogLevel = 1 - VPE_API_LOG_LEVEL_CRIT LogLevel = 2 - VPE_API_LOG_LEVEL_ERR LogLevel = 3 - VPE_API_LOG_LEVEL_WARNING LogLevel = 4 - VPE_API_LOG_LEVEL_NOTICE LogLevel = 5 - VPE_API_LOG_LEVEL_INFO LogLevel = 6 - VPE_API_LOG_LEVEL_DEBUG LogLevel = 7 - VPE_API_LOG_LEVEL_DISABLED LogLevel = 8 -) - -var ( - LogLevel_name = map[uint32]string{ - 0: "VPE_API_LOG_LEVEL_EMERG", - 1: "VPE_API_LOG_LEVEL_ALERT", - 2: "VPE_API_LOG_LEVEL_CRIT", - 3: "VPE_API_LOG_LEVEL_ERR", - 4: "VPE_API_LOG_LEVEL_WARNING", - 5: "VPE_API_LOG_LEVEL_NOTICE", - 6: "VPE_API_LOG_LEVEL_INFO", - 7: "VPE_API_LOG_LEVEL_DEBUG", - 8: "VPE_API_LOG_LEVEL_DISABLED", - } - LogLevel_value = map[string]uint32{ - "VPE_API_LOG_LEVEL_EMERG": 0, - "VPE_API_LOG_LEVEL_ALERT": 1, - "VPE_API_LOG_LEVEL_CRIT": 2, - "VPE_API_LOG_LEVEL_ERR": 3, - "VPE_API_LOG_LEVEL_WARNING": 4, - "VPE_API_LOG_LEVEL_NOTICE": 5, - "VPE_API_LOG_LEVEL_INFO": 6, - "VPE_API_LOG_LEVEL_DEBUG": 7, - "VPE_API_LOG_LEVEL_DISABLED": 8, - } -) - -func (x LogLevel) String() string { - s, ok := LogLevel_name[uint32(x)] - if ok { - return s - } - return "LogLevel(" + strconv.Itoa(int(x)) + ")" -} - -// Timedelta represents VPP binary API alias 'timedelta'. -type Timedelta float64 - -// Timestamp represents VPP binary API alias 'timestamp'. -type Timestamp float64 - -// ThreadData represents VPP binary API type 'thread_data'. -type ThreadData struct { - ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` - Name []byte `binapi:"u8[64],name=name" json:"name,omitempty" struc:"[64]byte"` - Type []byte `binapi:"u8[64],name=type" json:"type,omitempty" struc:"[64]byte"` - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` - CPUID uint32 `binapi:"u32,name=cpu_id" json:"cpu_id,omitempty"` - Core uint32 `binapi:"u32,name=core" json:"core,omitempty"` - CPUSocket uint32 `binapi:"u32,name=cpu_socket" json:"cpu_socket,omitempty"` -} - -func (*ThreadData) GetTypeName() string { return "thread_data" } - -// Version represents VPP binary API type 'version'. -type Version struct { - Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` - Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` - Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` - PreRelease []byte `binapi:"u8[17],name=pre_release" json:"pre_release,omitempty" struc:"[17]byte"` - BuildMetadata []byte `binapi:"u8[17],name=build_metadata" json:"build_metadata,omitempty" struc:"[17]byte"` -} - -func (*Version) GetTypeName() string { return "version" } - -// AddNodeNext represents VPP binary API message 'add_node_next'. -type AddNodeNext struct { - NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` - NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` -} - -func (m *AddNodeNext) Reset() { *m = AddNodeNext{} } -func (*AddNodeNext) GetMessageName() string { return "add_node_next" } -func (*AddNodeNext) GetCrcString() string { return "9ab92f7a" } -func (*AddNodeNext) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AddNodeNext) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.NodeName - size += 64 - // field[1] m.NextName - size += 64 - return size -} -func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.NodeName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NodeName) { - x = uint8(m.NodeName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.NextName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NextName) { - x = uint8(m.NextName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *AddNodeNext) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.NodeName - m.NodeName = make([]uint8, 64) - for i := 0; i < len(m.NodeName); i++ { - m.NodeName[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.NextName - m.NextName = make([]uint8, 64) - for i := 0; i < len(m.NextName); i++ { - m.NextName[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// AddNodeNextReply represents VPP binary API message 'add_node_next_reply'. -type AddNodeNextReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` -} - -func (m *AddNodeNextReply) Reset() { *m = AddNodeNextReply{} } -func (*AddNodeNextReply) GetMessageName() string { return "add_node_next_reply" } -func (*AddNodeNextReply) GetCrcString() string { return "2ed75f32" } -func (*AddNodeNextReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AddNodeNextReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.NextIndex - size += 4 - return size -} -func (m *AddNodeNextReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.NextIndex - o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) - pos += 4 - return buf, nil -} -func (m *AddNodeNextReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NextIndex - m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// Cli represents VPP binary API message 'cli'. -type Cli struct { - CmdInShmem uint64 `binapi:"u64,name=cmd_in_shmem" json:"cmd_in_shmem,omitempty"` -} - -func (m *Cli) Reset() { *m = Cli{} } -func (*Cli) GetMessageName() string { return "cli" } -func (*Cli) GetCrcString() string { return "23bfbfff" } -func (*Cli) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *Cli) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.CmdInShmem - size += 8 - return size -} -func (m *Cli) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.CmdInShmem - o.PutUint64(buf[pos:pos+8], uint64(m.CmdInShmem)) - pos += 8 - return buf, nil -} -func (m *Cli) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.CmdInShmem - m.CmdInShmem = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// CliInband represents VPP binary API message 'cli_inband'. -type CliInband struct { - XXX_CmdLen uint32 `struc:"sizeof=Cmd"` - Cmd string `json:"cmd,omitempty"` -} - -func (m *CliInband) Reset() { *m = CliInband{} } -func (*CliInband) GetMessageName() string { return "cli_inband" } -func (*CliInband) GetCrcString() string { return "f8377302" } -func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CliInband) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Cmd - size += 4 + len(m.Cmd) - return size -} -func (m *CliInband) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Cmd - o.PutUint32(buf[pos:pos+4], uint32(len(m.Cmd))) - pos += 4 - copy(buf[pos:pos+len(m.Cmd)], m.Cmd[:]) - pos += len(m.Cmd) - return buf, nil -} -func (m *CliInband) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Cmd - { - siz := o.Uint32(tmp[pos : pos+4]) - pos += 4 - m.Cmd = codec.DecodeString(tmp[pos : pos+int(siz)]) - pos += len(m.Cmd) - } - return nil -} - -// CliInbandReply represents VPP binary API message 'cli_inband_reply'. -type CliInbandReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - XXX_ReplyLen uint32 `struc:"sizeof=Reply"` - Reply string `json:"reply,omitempty"` -} - -func (m *CliInbandReply) Reset() { *m = CliInbandReply{} } -func (*CliInbandReply) GetMessageName() string { return "cli_inband_reply" } -func (*CliInbandReply) GetCrcString() string { return "05879051" } -func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CliInbandReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.Reply - size += 4 + len(m.Reply) - return size -} -func (m *CliInbandReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.Reply - o.PutUint32(buf[pos:pos+4], uint32(len(m.Reply))) - pos += 4 - copy(buf[pos:pos+len(m.Reply)], m.Reply[:]) - pos += len(m.Reply) - return buf, nil -} -func (m *CliInbandReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Reply - { - siz := o.Uint32(tmp[pos : pos+4]) - pos += 4 - m.Reply = codec.DecodeString(tmp[pos : pos+int(siz)]) - pos += len(m.Reply) - } - return nil -} - -// CliReply represents VPP binary API message 'cli_reply'. -type CliReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` -} - -func (m *CliReply) Reset() { *m = CliReply{} } -func (*CliReply) GetMessageName() string { return "cli_reply" } -func (*CliReply) GetCrcString() string { return "06d68297" } -func (*CliReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CliReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.ReplyInShmem - size += 8 - return size -} -func (m *CliReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.ReplyInShmem - o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) - pos += 8 - return buf, nil -} -func (m *CliReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ReplyInShmem - m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// ControlPing represents VPP binary API message 'control_ping'. -type ControlPing struct{} - -func (m *ControlPing) Reset() { *m = ControlPing{} } -func (*ControlPing) GetMessageName() string { return "control_ping" } -func (*ControlPing) GetCrcString() string { return "51077d14" } -func (*ControlPing) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ControlPing) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ControlPing) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ControlPing) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ControlPingReply represents VPP binary API message 'control_ping_reply'. -type ControlPingReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` - VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` -} - -func (m *ControlPingReply) Reset() { *m = ControlPingReply{} } -func (*ControlPingReply) GetMessageName() string { return "control_ping_reply" } -func (*ControlPingReply) GetCrcString() string { return "f6b0b8ca" } -func (*ControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ControlPingReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.ClientIndex - size += 4 - // field[1] m.VpePID - size += 4 - return size -} -func (m *ControlPingReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.ClientIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) - pos += 4 - // field[1] m.VpePID - o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) - pos += 4 - return buf, nil -} -func (m *ControlPingReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ClientIndex - m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VpePID - m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// GetF64EndianValue represents VPP binary API message 'get_f64_endian_value'. -type GetF64EndianValue struct { - F64One float64 `binapi:"f64,name=f64_one,default=1" json:"f64_one,omitempty"` -} - -func (m *GetF64EndianValue) Reset() { *m = GetF64EndianValue{} } -func (*GetF64EndianValue) GetMessageName() string { return "get_f64_endian_value" } -func (*GetF64EndianValue) GetCrcString() string { return "809fcd44" } -func (*GetF64EndianValue) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetF64EndianValue) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.F64One - size += 8 - return size -} -func (m *GetF64EndianValue) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.F64One - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64One))) - pos += 8 - return buf, nil -} -func (m *GetF64EndianValue) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.F64One - m.F64One = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// GetF64EndianValueReply represents VPP binary API message 'get_f64_endian_value_reply'. -type GetF64EndianValueReply struct { - Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` - F64OneResult float64 `binapi:"f64,name=f64_one_result" json:"f64_one_result,omitempty"` -} - -func (m *GetF64EndianValueReply) Reset() { *m = GetF64EndianValueReply{} } -func (*GetF64EndianValueReply) GetMessageName() string { return "get_f64_endian_value_reply" } -func (*GetF64EndianValueReply) GetCrcString() string { return "7e02e404" } -func (*GetF64EndianValueReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetF64EndianValueReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.F64OneResult - size += 8 - return size -} -func (m *GetF64EndianValueReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.F64OneResult - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64OneResult))) - pos += 8 - return buf, nil -} -func (m *GetF64EndianValueReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.F64OneResult - m.F64OneResult = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// GetF64IncrementByOne represents VPP binary API message 'get_f64_increment_by_one'. -type GetF64IncrementByOne struct { - F64Value float64 `binapi:"f64,name=f64_value,default=1" json:"f64_value,omitempty"` -} - -func (m *GetF64IncrementByOne) Reset() { *m = GetF64IncrementByOne{} } -func (*GetF64IncrementByOne) GetMessageName() string { return "get_f64_increment_by_one" } -func (*GetF64IncrementByOne) GetCrcString() string { return "b64f027e" } -func (*GetF64IncrementByOne) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetF64IncrementByOne) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.F64Value - size += 8 - return size -} -func (m *GetF64IncrementByOne) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.F64Value - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) - pos += 8 - return buf, nil -} -func (m *GetF64IncrementByOne) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.F64Value - m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// GetF64IncrementByOneReply represents VPP binary API message 'get_f64_increment_by_one_reply'. -type GetF64IncrementByOneReply struct { - Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` - F64Value float64 `binapi:"f64,name=f64_value" json:"f64_value,omitempty"` -} - -func (m *GetF64IncrementByOneReply) Reset() { *m = GetF64IncrementByOneReply{} } -func (*GetF64IncrementByOneReply) GetMessageName() string { return "get_f64_increment_by_one_reply" } -func (*GetF64IncrementByOneReply) GetCrcString() string { return "d25dbaa3" } -func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetF64IncrementByOneReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.F64Value - size += 8 - return size -} -func (m *GetF64IncrementByOneReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.F64Value - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) - pos += 8 - return buf, nil -} -func (m *GetF64IncrementByOneReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.F64Value - m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// GetNextIndex represents VPP binary API message 'get_next_index'. -type GetNextIndex struct { - NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` - NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` -} - -func (m *GetNextIndex) Reset() { *m = GetNextIndex{} } -func (*GetNextIndex) GetMessageName() string { return "get_next_index" } -func (*GetNextIndex) GetCrcString() string { return "9ab92f7a" } -func (*GetNextIndex) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetNextIndex) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.NodeName - size += 64 - // field[1] m.NextName - size += 64 - return size -} -func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.NodeName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NodeName) { - x = uint8(m.NodeName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.NextName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NextName) { - x = uint8(m.NextName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *GetNextIndex) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.NodeName - m.NodeName = make([]uint8, 64) - for i := 0; i < len(m.NodeName); i++ { - m.NodeName[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.NextName - m.NextName = make([]uint8, 64) - for i := 0; i < len(m.NextName); i++ { - m.NextName[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// GetNextIndexReply represents VPP binary API message 'get_next_index_reply'. -type GetNextIndexReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` -} - -func (m *GetNextIndexReply) Reset() { *m = GetNextIndexReply{} } -func (*GetNextIndexReply) GetMessageName() string { return "get_next_index_reply" } -func (*GetNextIndexReply) GetCrcString() string { return "2ed75f32" } -func (*GetNextIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetNextIndexReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.NextIndex - size += 4 - return size -} -func (m *GetNextIndexReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.NextIndex - o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) - pos += 4 - return buf, nil -} -func (m *GetNextIndexReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NextIndex - m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// GetNodeGraph represents VPP binary API message 'get_node_graph'. -type GetNodeGraph struct{} - -func (m *GetNodeGraph) Reset() { *m = GetNodeGraph{} } -func (*GetNodeGraph) GetMessageName() string { return "get_node_graph" } -func (*GetNodeGraph) GetCrcString() string { return "51077d14" } -func (*GetNodeGraph) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetNodeGraph) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *GetNodeGraph) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *GetNodeGraph) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply'. -type GetNodeGraphReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` -} - -func (m *GetNodeGraphReply) Reset() { *m = GetNodeGraphReply{} } -func (*GetNodeGraphReply) GetMessageName() string { return "get_node_graph_reply" } -func (*GetNodeGraphReply) GetCrcString() string { return "06d68297" } -func (*GetNodeGraphReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetNodeGraphReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.ReplyInShmem - size += 8 - return size -} -func (m *GetNodeGraphReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.ReplyInShmem - o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) - pos += 8 - return buf, nil -} -func (m *GetNodeGraphReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ReplyInShmem - m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// GetNodeIndex represents VPP binary API message 'get_node_index'. -type GetNodeIndex struct { - NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` -} - -func (m *GetNodeIndex) Reset() { *m = GetNodeIndex{} } -func (*GetNodeIndex) GetMessageName() string { return "get_node_index" } -func (*GetNodeIndex) GetCrcString() string { return "6c9a495d" } -func (*GetNodeIndex) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetNodeIndex) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.NodeName - size += 64 - return size -} -func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.NodeName - for i := 0; i < 64; i++ { - var x uint8 - if i < len(m.NodeName) { - x = uint8(m.NodeName[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *GetNodeIndex) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.NodeName - m.NodeName = make([]uint8, 64) - for i := 0; i < len(m.NodeName); i++ { - m.NodeName[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply'. -type GetNodeIndexReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - NodeIndex uint32 `binapi:"u32,name=node_index" json:"node_index,omitempty"` -} - -func (m *GetNodeIndexReply) Reset() { *m = GetNodeIndexReply{} } -func (*GetNodeIndexReply) GetMessageName() string { return "get_node_index_reply" } -func (*GetNodeIndexReply) GetCrcString() string { return "a8600b89" } -func (*GetNodeIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetNodeIndexReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.NodeIndex - size += 4 - return size -} -func (m *GetNodeIndexReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.NodeIndex - o.PutUint32(buf[pos:pos+4], uint32(m.NodeIndex)) - pos += 4 - return buf, nil -} -func (m *GetNodeIndexReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NodeIndex - m.NodeIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// LogDetails represents VPP binary API message 'log_details'. -type LogDetails struct { - Timestamp Timestamp `binapi:"timestamp,name=timestamp" json:"timestamp,omitempty"` - Level LogLevel `binapi:"log_level,name=level" json:"level,omitempty"` - MsgClass string `binapi:"string[32],name=msg_class" json:"msg_class,omitempty" struc:"[32]byte"` - Message string `binapi:"string[256],name=message" json:"message,omitempty" struc:"[256]byte"` -} - -func (m *LogDetails) Reset() { *m = LogDetails{} } -func (*LogDetails) GetMessageName() string { return "log_details" } -func (*LogDetails) GetCrcString() string { return "255827a1" } -func (*LogDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *LogDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Timestamp - size += 8 - // field[1] m.Level - size += 4 - // field[1] m.MsgClass - size += 32 - // field[1] m.Message - size += 256 - return size -} -func (m *LogDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Timestamp - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.Timestamp))) - pos += 8 - // field[1] m.Level - o.PutUint32(buf[pos:pos+4], uint32(m.Level)) - pos += 4 - // field[1] m.MsgClass - copy(buf[pos:pos+32], m.MsgClass) - pos += 32 - // field[1] m.Message - copy(buf[pos:pos+256], m.Message) - pos += 256 - return buf, nil -} -func (m *LogDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Timestamp - m.Timestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - // field[1] m.Level - m.Level = LogLevel(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MsgClass - { - nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) - m.MsgClass = codec.DecodeString(tmp[pos : pos+nul]) - pos += 32 - } - // field[1] m.Message - { - nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) - m.Message = codec.DecodeString(tmp[pos : pos+nul]) - pos += 256 - } - return nil -} - -// LogDump represents VPP binary API message 'log_dump'. -type LogDump struct { - StartTimestamp Timestamp `binapi:"timestamp,name=start_timestamp" json:"start_timestamp,omitempty"` -} - -func (m *LogDump) Reset() { *m = LogDump{} } -func (*LogDump) GetMessageName() string { return "log_dump" } -func (*LogDump) GetCrcString() string { return "6ab31753" } -func (*LogDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *LogDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.StartTimestamp - size += 8 - return size -} -func (m *LogDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.StartTimestamp - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.StartTimestamp))) - pos += 8 - return buf, nil -} -func (m *LogDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.StartTimestamp - m.StartTimestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// ShowThreads represents VPP binary API message 'show_threads'. -type ShowThreads struct{} - -func (m *ShowThreads) Reset() { *m = ShowThreads{} } -func (*ShowThreads) GetMessageName() string { return "show_threads" } -func (*ShowThreads) GetCrcString() string { return "51077d14" } -func (*ShowThreads) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ShowThreads) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ShowThreads) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ShowThreads) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ShowThreadsReply represents VPP binary API message 'show_threads_reply'. -type ShowThreadsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=ThreadData"` - ThreadData []ThreadData `binapi:"thread_data[count],name=thread_data" json:"thread_data,omitempty"` -} - -func (m *ShowThreadsReply) Reset() { *m = ShowThreadsReply{} } -func (*ShowThreadsReply) GetMessageName() string { return "show_threads_reply" } -func (*ShowThreadsReply) GetCrcString() string { return "f5e0b66f" } -func (*ShowThreadsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ShowThreadsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.Count - size += 4 - // field[1] m.ThreadData - for j1 := 0; j1 < len(m.ThreadData); j1++ { - var s1 ThreadData - _ = s1 - if j1 < len(m.ThreadData) { - s1 = m.ThreadData[j1] - } - // field[2] s1.ID - size += 4 - // field[2] s1.Name - size += 64 - // field[2] s1.Type - size += 64 - // field[2] s1.PID - size += 4 - // field[2] s1.CPUID - size += 4 - // field[2] s1.Core - size += 4 - // field[2] s1.CPUSocket - size += 4 - } - return size -} -func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.ThreadData))) - pos += 4 - // field[1] m.ThreadData - for j1 := 0; j1 < len(m.ThreadData); j1++ { - var v1 ThreadData - if j1 < len(m.ThreadData) { - v1 = m.ThreadData[j1] - } - // field[2] v1.ID - o.PutUint32(buf[pos:pos+4], uint32(v1.ID)) - pos += 4 - // field[2] v1.Name - for i := 0; i < 64; i++ { - var x uint8 - if i < len(v1.Name) { - x = uint8(v1.Name[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.Type - for i := 0; i < 64; i++ { - var x uint8 - if i < len(v1.Type) { - x = uint8(v1.Type[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.PID - o.PutUint32(buf[pos:pos+4], uint32(v1.PID)) - pos += 4 - // field[2] v1.CPUID - o.PutUint32(buf[pos:pos+4], uint32(v1.CPUID)) - pos += 4 - // field[2] v1.Core - o.PutUint32(buf[pos:pos+4], uint32(v1.Core)) - pos += 4 - // field[2] v1.CPUSocket - o.PutUint32(buf[pos:pos+4], uint32(v1.CPUSocket)) - pos += 4 - } - return buf, nil -} -func (m *ShowThreadsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ThreadData - m.ThreadData = make([]ThreadData, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.ThreadData[j1].ID - m.ThreadData[j1].ID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.ThreadData[j1].Name - m.ThreadData[j1].Name = make([]uint8, 64) - for i := 0; i < len(m.ThreadData[j1].Name); i++ { - m.ThreadData[j1].Name[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.ThreadData[j1].Type - m.ThreadData[j1].Type = make([]uint8, 64) - for i := 0; i < len(m.ThreadData[j1].Type); i++ { - m.ThreadData[j1].Type[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.ThreadData[j1].PID - m.ThreadData[j1].PID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.ThreadData[j1].CPUID - m.ThreadData[j1].CPUID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.ThreadData[j1].Core - m.ThreadData[j1].Core = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.ThreadData[j1].CPUSocket - m.ThreadData[j1].CPUSocket = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// ShowVersion represents VPP binary API message 'show_version'. -type ShowVersion struct{} - -func (m *ShowVersion) Reset() { *m = ShowVersion{} } -func (*ShowVersion) GetMessageName() string { return "show_version" } -func (*ShowVersion) GetCrcString() string { return "51077d14" } -func (*ShowVersion) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ShowVersion) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ShowVersion) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ShowVersion) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ShowVersionReply represents VPP binary API message 'show_version_reply'. -type ShowVersionReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Program string `binapi:"string[32],name=program" json:"program,omitempty" struc:"[32]byte"` - Version string `binapi:"string[32],name=version" json:"version,omitempty" struc:"[32]byte"` - BuildDate string `binapi:"string[32],name=build_date" json:"build_date,omitempty" struc:"[32]byte"` - BuildDirectory string `binapi:"string[256],name=build_directory" json:"build_directory,omitempty" struc:"[256]byte"` -} - -func (m *ShowVersionReply) Reset() { *m = ShowVersionReply{} } -func (*ShowVersionReply) GetMessageName() string { return "show_version_reply" } -func (*ShowVersionReply) GetCrcString() string { return "c919bde1" } -func (*ShowVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ShowVersionReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.Program - size += 32 - // field[1] m.Version - size += 32 - // field[1] m.BuildDate - size += 32 - // field[1] m.BuildDirectory - size += 256 - return size -} -func (m *ShowVersionReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.Program - copy(buf[pos:pos+32], m.Program) - pos += 32 - // field[1] m.Version - copy(buf[pos:pos+32], m.Version) - pos += 32 - // field[1] m.BuildDate - copy(buf[pos:pos+32], m.BuildDate) - pos += 32 - // field[1] m.BuildDirectory - copy(buf[pos:pos+256], m.BuildDirectory) - pos += 256 - return buf, nil -} -func (m *ShowVersionReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Program - { - nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) - m.Program = codec.DecodeString(tmp[pos : pos+nul]) - pos += 32 - } - // field[1] m.Version - { - nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) - m.Version = codec.DecodeString(tmp[pos : pos+nul]) - pos += 32 - } - // field[1] m.BuildDate - { - nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) - m.BuildDate = codec.DecodeString(tmp[pos : pos+nul]) - pos += 32 - } - // field[1] m.BuildDirectory - { - nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) - m.BuildDirectory = codec.DecodeString(tmp[pos : pos+nul]) - pos += 256 - } - return nil -} - -// ShowVpeSystemTime represents VPP binary API message 'show_vpe_system_time'. -type ShowVpeSystemTime struct{} - -func (m *ShowVpeSystemTime) Reset() { *m = ShowVpeSystemTime{} } -func (*ShowVpeSystemTime) GetMessageName() string { return "show_vpe_system_time" } -func (*ShowVpeSystemTime) GetCrcString() string { return "51077d14" } -func (*ShowVpeSystemTime) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ShowVpeSystemTime) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ShowVpeSystemTime) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ShowVpeSystemTime) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ShowVpeSystemTimeReply represents VPP binary API message 'show_vpe_system_time_reply'. -type ShowVpeSystemTimeReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - VpeSystemTime Timestamp `binapi:"timestamp,name=vpe_system_time" json:"vpe_system_time,omitempty"` -} - -func (m *ShowVpeSystemTimeReply) Reset() { *m = ShowVpeSystemTimeReply{} } -func (*ShowVpeSystemTimeReply) GetMessageName() string { return "show_vpe_system_time_reply" } -func (*ShowVpeSystemTimeReply) GetCrcString() string { return "7ffd8193" } -func (*ShowVpeSystemTimeReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ShowVpeSystemTimeReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.VpeSystemTime - size += 8 - return size -} -func (m *ShowVpeSystemTimeReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.VpeSystemTime - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.VpeSystemTime))) - pos += 8 - return buf, nil -} -func (m *ShowVpeSystemTimeReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VpeSystemTime - m.VpeSystemTime = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -func init() { file_vpe_binapi_init() } -func file_vpe_binapi_init() { - api.RegisterMessage((*AddNodeNext)(nil), "vpe.AddNodeNext") - api.RegisterMessage((*AddNodeNextReply)(nil), "vpe.AddNodeNextReply") - api.RegisterMessage((*Cli)(nil), "vpe.Cli") - api.RegisterMessage((*CliInband)(nil), "vpe.CliInband") - api.RegisterMessage((*CliInbandReply)(nil), "vpe.CliInbandReply") - api.RegisterMessage((*CliReply)(nil), "vpe.CliReply") - api.RegisterMessage((*ControlPing)(nil), "vpe.ControlPing") - api.RegisterMessage((*ControlPingReply)(nil), "vpe.ControlPingReply") - api.RegisterMessage((*GetF64EndianValue)(nil), "vpe.GetF64EndianValue") - api.RegisterMessage((*GetF64EndianValueReply)(nil), "vpe.GetF64EndianValueReply") - api.RegisterMessage((*GetF64IncrementByOne)(nil), "vpe.GetF64IncrementByOne") - api.RegisterMessage((*GetF64IncrementByOneReply)(nil), "vpe.GetF64IncrementByOneReply") - api.RegisterMessage((*GetNextIndex)(nil), "vpe.GetNextIndex") - api.RegisterMessage((*GetNextIndexReply)(nil), "vpe.GetNextIndexReply") - api.RegisterMessage((*GetNodeGraph)(nil), "vpe.GetNodeGraph") - api.RegisterMessage((*GetNodeGraphReply)(nil), "vpe.GetNodeGraphReply") - api.RegisterMessage((*GetNodeIndex)(nil), "vpe.GetNodeIndex") - api.RegisterMessage((*GetNodeIndexReply)(nil), "vpe.GetNodeIndexReply") - api.RegisterMessage((*LogDetails)(nil), "vpe.LogDetails") - api.RegisterMessage((*LogDump)(nil), "vpe.LogDump") - api.RegisterMessage((*ShowThreads)(nil), "vpe.ShowThreads") - api.RegisterMessage((*ShowThreadsReply)(nil), "vpe.ShowThreadsReply") - api.RegisterMessage((*ShowVersion)(nil), "vpe.ShowVersion") - api.RegisterMessage((*ShowVersionReply)(nil), "vpe.ShowVersionReply") - api.RegisterMessage((*ShowVpeSystemTime)(nil), "vpe.ShowVpeSystemTime") - api.RegisterMessage((*ShowVpeSystemTimeReply)(nil), "vpe.ShowVpeSystemTimeReply") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*AddNodeNext)(nil), - (*AddNodeNextReply)(nil), - (*Cli)(nil), - (*CliInband)(nil), - (*CliInbandReply)(nil), - (*CliReply)(nil), - (*ControlPing)(nil), - (*ControlPingReply)(nil), - (*GetF64EndianValue)(nil), - (*GetF64EndianValueReply)(nil), - (*GetF64IncrementByOne)(nil), - (*GetF64IncrementByOneReply)(nil), - (*GetNextIndex)(nil), - (*GetNextIndexReply)(nil), - (*GetNodeGraph)(nil), - (*GetNodeGraphReply)(nil), - (*GetNodeIndex)(nil), - (*GetNodeIndexReply)(nil), - (*LogDetails)(nil), - (*LogDump)(nil), - (*ShowThreads)(nil), - (*ShowThreadsReply)(nil), - (*ShowVersion)(nil), - (*ShowVersionReply)(nil), - (*ShowVpeSystemTime)(nil), - (*ShowVpeSystemTimeReply)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits diff --git a/codec/testdata/binapi2001/vpe/vpe_rpc.ba.go b/codec/testdata/binapi2001/vpe/vpe_rpc.ba.go deleted file mode 100644 index e81fb91..0000000 --- a/codec/testdata/binapi2001/vpe/vpe_rpc.ba.go +++ /dev/null @@ -1,174 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vpe - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for vpe module. -type RPCService interface { - DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) - AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) - Cli(ctx context.Context, in *Cli) (*CliReply, error) - CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) - ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) - GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) - GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) - GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) - GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) - GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) - ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) - ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) - ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpLogClient{stream} - return x, nil -} - -type RPCService_DumpLogClient interface { - Recv() (*LogDetails, error) -} - -type serviceClient_DumpLogClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpLogClient) Recv() (*LogDetails, error) { - m := new(LogDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { - out := new(AddNodeNextReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { - out := new(CliReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { - out := new(CliInbandReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { - out := new(ControlPingReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { - out := new(GetF64EndianValueReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { - out := new(GetF64IncrementByOneReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { - out := new(GetNextIndexReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { - out := new(GetNodeGraphReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { - out := new(GetNodeIndexReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { - out := new(ShowThreadsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { - out := new(ShowVersionReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { - out := new(ShowVpeSystemTimeReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/core/channel_test.go b/core/channel_test.go index d06e2b3..fa3e58d 100644 --- a/core/channel_test.go +++ b/core/channel_test.go @@ -22,10 +22,10 @@ import ( "git.fd.io/govpp.git/adapter/mock" "git.fd.io/govpp.git/api" - "git.fd.io/govpp.git/examples/binapi/interface_types" - "git.fd.io/govpp.git/examples/binapi/interfaces" - "git.fd.io/govpp.git/examples/binapi/memif" - "git.fd.io/govpp.git/examples/binapi/vpe" + interfaces "git.fd.io/govpp.git/binapi/interface" + "git.fd.io/govpp.git/binapi/interface_types" + "git.fd.io/govpp.git/binapi/memif" + "git.fd.io/govpp.git/binapi/vpe" ) type testCtx struct { diff --git a/core/connection_test.go b/core/connection_test.go index 453bbce..230eea5 100644 --- a/core/connection_test.go +++ b/core/connection_test.go @@ -15,17 +15,18 @@ package core_test import ( - "git.fd.io/govpp.git/examples/binapi/interface_types" "testing" . "github.com/onsi/gomega" "git.fd.io/govpp.git/adapter/mock" "git.fd.io/govpp.git/api" + "git.fd.io/govpp.git/binapi/ethernet_types" + interfaces "git.fd.io/govpp.git/binapi/interface" + "git.fd.io/govpp.git/binapi/interface_types" + "git.fd.io/govpp.git/binapi/vpe" "git.fd.io/govpp.git/codec" "git.fd.io/govpp.git/core" - "git.fd.io/govpp.git/examples/binapi/interfaces" - "git.fd.io/govpp.git/examples/binapi/vpe" ) type testCtx struct { @@ -96,14 +97,14 @@ func TestCodec(t *testing.T) { var msgCodec = codec.DefaultCodec // request - data, err := msgCodec.EncodeMsg(&interfaces.CreateLoopback{MacAddress: interfaces.MacAddress{1, 2, 3, 4, 5, 6}}, 11) + data, err := msgCodec.EncodeMsg(&interfaces.CreateLoopback{MacAddress: ethernet_types.MacAddress{1, 2, 3, 4, 5, 6}}, 11) Expect(err).ShouldNot(HaveOccurred()) Expect(data).ShouldNot(BeEmpty()) msg1 := &interfaces.CreateLoopback{} err = msgCodec.DecodeMsg(data, msg1) Expect(err).ShouldNot(HaveOccurred()) - Expect(msg1.MacAddress).To(BeEquivalentTo(interfaces.MacAddress{1, 2, 3, 4, 5, 6})) + Expect(msg1.MacAddress).To(BeEquivalentTo(ethernet_types.MacAddress{1, 2, 3, 4, 5, 6})) // reply data, err = msgCodec.EncodeMsg(&vpe.ControlPingReply{Retval: 55}, 22) diff --git a/core/stream.go b/core/stream.go index edc3f2b..171b201 100644 --- a/core/stream.go +++ b/core/stream.go @@ -62,8 +62,23 @@ func (c *Connection) NewStream(ctx context.Context) (api.Stream, error) { } func (c *Connection) Invoke(ctx context.Context, req api.Message, reply api.Message) error { - // TODO: implement invoke - panic("not implemented") + stream, err := c.NewStream(ctx) + if err != nil { + return err + } + if err := stream.SendMsg(req); err != nil { + return err + } + msg, err := stream.RecvMsg() + if err != nil { + return err + } + if msg.GetMessageName() != reply.GetMessageName() || + msg.GetCrcString() != reply.GetCrcString() { + return fmt.Errorf("unexpected reply: %T %+v", msg, msg) + } + reflect.ValueOf(reply).Elem().Set(reflect.ValueOf(msg).Elem()) + return nil } func (s *Stream) Context() context.Context { diff --git a/examples/binapi-types/binapi_types.go b/examples/binapi-types/binapi_types.go new file mode 100644 index 0000000..849ad1b --- /dev/null +++ b/examples/binapi-types/binapi_types.go @@ -0,0 +1,137 @@ +// Copyright (c) 2018 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// union-example is an example to show how to use unions in VPP binary API. +package main + +import ( + "fmt" + "log" + + "git.fd.io/govpp.git/binapi/ethernet_types" + "git.fd.io/govpp.git/binapi/ip" + "git.fd.io/govpp.git/binapi/ip_types" + "git.fd.io/govpp.git/codec" +) + +func init() { + log.SetFlags(0) +} + +func main() { + addressUnionExample() + ipAddressExample() + + // convert IP from string form into Address type containing union + convertIP("10.10.1.1") + convertIP("ff80::1") + + // convert IP from string form into Prefix type + convertIPPrefix("20.10.1.1/24") + convertIPPrefix("21.10.1.1") + convertIPPrefix("ff90::1/64") + convertIPPrefix("ff91::1") + + // convert MAC address from string into MacAddress + convertToMacAddress("00:10:ab:4f:00:01") +} + +func addressUnionExample() { + var union ip_types.AddressUnion + + // initialize union using constructors + union = ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 1, 10}) + union = ip_types.AddressUnionIP6(ip_types.IP6Address{0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02}) + + // get union value using getters + ip4 := union.GetIP4() + ip6 := union.GetIP6() + + // set union value using setters + union.SetIP4(ip4) + union.SetIP6(ip6) +} + +func ipAddressExample() { + // parse string into IP address + addrIP4, err := ip_types.ParseAddress("192.168.1.10") + if err != nil { + panic(err) + } + /*addrIP6, err := ip_types.ParseAddress("ff:2::2") + if err != nil { + panic(err) + }*/ + + var msg = ip.IPPuntRedirect{ + IsAdd: true, + Punt: ip.PuntRedirect{ + Nh: addrIP4, + }, + } + + log.Printf("encoding message: %#v", msg) + + var c = codec.DefaultCodec + + b, err := c.EncodeMsg(&msg, 1) + if err != nil { + log.Fatal(err) + } + + // decode into this message + var msg2 ip.IPPuntRedirect + if err := c.DecodeMsg(b, &msg2); err != nil { + log.Fatal(err) + } + log.Printf("decoded message: %#v", msg2) + + // compare the messages + if !msg.Punt.Nh.ToIP().Equal(msg2.Punt.Nh.ToIP()) { + log.Fatal("messages are not equal") + } +} + +func convertIP(ip string) { + addr, err := ip_types.ParseAddress(ip) + if err != nil { + log.Printf("error converting IP to Address: %v", err) + return + } + fmt.Printf("converted IP %q to: %#v\n", ip, addr) + + fmt.Printf("Address converted back to string IP %#v to: %s\n", addr, addr) +} + +func convertIPPrefix(ip string) { + prefix, err := ip_types.ParsePrefix(ip) + if err != nil { + log.Printf("error converting prefix to IP4Prefix: %v", err) + return + } + fmt.Printf("converted prefix %q to: %#v\n", ip, prefix) + + fmt.Printf("IP4Prefix converted back to string prefix %#v to: %s\n", prefix, prefix) +} + +func convertToMacAddress(mac string) { + parsedMac, err := ethernet_types.ParseMacAddress(mac) + if err != nil { + log.Printf("error converting MAC to MacAddress: %v", err) + return + } + fmt.Printf("converted mac %q to: %#v\n", mac, parsedMac) + + fmt.Printf("MacAddress converted back to string %#v to: %s\n", parsedMac, parsedMac) +} diff --git a/examples/binapi/acl/acl.ba.go b/examples/binapi/acl/acl.ba.go deleted file mode 100644 index f191c78..0000000 --- a/examples/binapi/acl/acl.ba.go +++ /dev/null @@ -1,2903 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/plugins/acl.api.json - -/* -Package acl contains generated code for VPP API file acl.api (2.0.0). - -It consists of: - 7 aliases - 11 enums - 38 messages - 8 types - 1 union -*/ -package acl - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" - - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" - ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "acl" - // APIVersion is the API version of this module. - APIVersion = "2.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0x68c4cb37 -) - -// ACLAction represents VPP binary API enum 'acl_action'. -type ACLAction uint8 - -const ( - ACL_ACTION_API_DENY ACLAction = 0 - ACL_ACTION_API_PERMIT ACLAction = 1 - ACL_ACTION_API_PERMIT_REFLECT ACLAction = 2 -) - -var ( - ACLAction_name = map[uint8]string{ - 0: "ACL_ACTION_API_DENY", - 1: "ACL_ACTION_API_PERMIT", - 2: "ACL_ACTION_API_PERMIT_REFLECT", - } - ACLAction_value = map[string]uint8{ - "ACL_ACTION_API_DENY": 0, - "ACL_ACTION_API_PERMIT": 1, - "ACL_ACTION_API_PERMIT_REFLECT": 2, - } -) - -func (x ACLAction) String() string { - s, ok := ACLAction_name[uint8(x)] - if ok { - return s - } - return "ACLAction(" + strconv.Itoa(int(x)) + ")" -} - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -func ParseMAC(mac string) (parsed MacAddress, err error) { - var hw net.HardwareAddr - if hw, err = net.ParseMAC(mac); err != nil { - return - } - copy(parsed[:], hw[:]) - return -} - -func (m *MacAddress) ToString() string { - return net.HardwareAddr(m[:]).String() -} - -// ACLRule represents VPP binary API type 'acl_rule'. -type ACLRule struct { - IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` - SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` - DstPrefix ip_types.Prefix `binapi:"prefix,name=dst_prefix" json:"dst_prefix,omitempty"` - Proto ip_types.IPProto `binapi:"ip_proto,name=proto" json:"proto,omitempty"` - SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` - SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` - DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` - DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` - TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` - TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` -} - -func (*ACLRule) GetTypeName() string { return "acl_rule" } - -// MacipACLRule represents VPP binary API type 'macip_acl_rule'. -type MacipACLRule struct { - IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` - SrcMac MacAddress `binapi:"mac_address,name=src_mac" json:"src_mac,omitempty"` - SrcMacMask MacAddress `binapi:"mac_address,name=src_mac_mask" json:"src_mac_mask,omitempty"` - SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` -} - -func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } - -// ACLAddReplace represents VPP binary API message 'acl_add_replace'. -type ACLAddReplace struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } -func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } -func (*ACLAddReplace) GetCrcString() string { return "1cabdeab" } -func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLAddReplace) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 ACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.SrcPrefix - // field[3] s1.SrcPrefix.Address - // field[4] s1.SrcPrefix.Address.Af - size += 1 - // field[4] s1.SrcPrefix.Address.Un - size += 16 - // field[3] s1.SrcPrefix.Len - size += 1 - // field[2] s1.DstPrefix - // field[3] s1.DstPrefix.Address - // field[4] s1.DstPrefix.Address.Af - size += 1 - // field[4] s1.DstPrefix.Address.Un - size += 16 - // field[3] s1.DstPrefix.Len - size += 1 - // field[2] s1.Proto - size += 1 - // field[2] s1.SrcportOrIcmptypeFirst - size += 2 - // field[2] s1.SrcportOrIcmptypeLast - size += 2 - // field[2] s1.DstportOrIcmpcodeFirst - size += 2 - // field[2] s1.DstportOrIcmpcodeLast - size += 2 - // field[2] s1.TCPFlagsMask - size += 1 - // field[2] s1.TCPFlagsValue - size += 1 - } - return size -} -func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Tag - copy(buf[pos:pos+64], m.Tag) - pos += 64 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 ACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.SrcPrefix - // field[3] v1.SrcPrefix.Address - // field[4] v1.SrcPrefix.Address.Af - buf[pos] = uint8(v1.SrcPrefix.Address.Af) - pos += 1 - // field[4] v1.SrcPrefix.Address.Un - copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] v1.SrcPrefix.Len - buf[pos] = uint8(v1.SrcPrefix.Len) - pos += 1 - // field[2] v1.DstPrefix - // field[3] v1.DstPrefix.Address - // field[4] v1.DstPrefix.Address.Af - buf[pos] = uint8(v1.DstPrefix.Address.Af) - pos += 1 - // field[4] v1.DstPrefix.Address.Un - copy(buf[pos:pos+16], v1.DstPrefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] v1.DstPrefix.Len - buf[pos] = uint8(v1.DstPrefix.Len) - pos += 1 - // field[2] v1.Proto - buf[pos] = uint8(v1.Proto) - pos += 1 - // field[2] v1.SrcportOrIcmptypeFirst - o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) - pos += 2 - // field[2] v1.SrcportOrIcmptypeLast - o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) - pos += 2 - // field[2] v1.DstportOrIcmpcodeFirst - o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) - pos += 2 - // field[2] v1.DstportOrIcmpcodeLast - o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) - pos += 2 - // field[2] v1.TCPFlagsMask - buf[pos] = uint8(v1.TCPFlagsMask) - pos += 1 - // field[2] v1.TCPFlagsValue - buf[pos] = uint8(v1.TCPFlagsValue) - pos += 1 - } - return buf, nil -} -func (m *ACLAddReplace) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Tag = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]ACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = ACLAction(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcPrefix - // field[3] m.R[j1].SrcPrefix.Address - // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.R[j1].SrcPrefix.Address.Un - copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.R[j1].SrcPrefix.Len - m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].DstPrefix - // field[3] m.R[j1].DstPrefix.Address - // field[4] m.R[j1].DstPrefix.Address.Af - m.R[j1].DstPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.R[j1].DstPrefix.Address.Un - copy(m.R[j1].DstPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.R[j1].DstPrefix.Len - m.R[j1].DstPrefix.Len = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].Proto - m.R[j1].Proto = ip_types.IPProto(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcportOrIcmptypeFirst - m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].SrcportOrIcmptypeLast - m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].DstportOrIcmpcodeFirst - m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].DstportOrIcmpcodeLast - m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].TCPFlagsMask - m.R[j1].TCPFlagsMask = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].TCPFlagsValue - m.R[j1].TCPFlagsValue = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply'. -type ACLAddReplaceReply struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLAddReplaceReply) Reset() { *m = ACLAddReplaceReply{} } -func (*ACLAddReplaceReply) GetMessageName() string { return "acl_add_replace_reply" } -func (*ACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } -func (*ACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLAddReplaceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLAddReplaceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLDel represents VPP binary API message 'acl_del'. -type ACLDel struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *ACLDel) Reset() { *m = ACLDel{} } -func (*ACLDel) GetMessageName() string { return "acl_del" } -func (*ACLDel) GetCrcString() string { return "ef34fea4" } -func (*ACLDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *ACLDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *ACLDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLDelReply represents VPP binary API message 'acl_del_reply'. -type ACLDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLDelReply) Reset() { *m = ACLDelReply{} } -func (*ACLDelReply) GetMessageName() string { return "acl_del_reply" } -func (*ACLDelReply) GetCrcString() string { return "e8d4e804" } -func (*ACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLDetails represents VPP binary API message 'acl_details'. -type ACLDetails struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *ACLDetails) Reset() { *m = ACLDetails{} } -func (*ACLDetails) GetMessageName() string { return "acl_details" } -func (*ACLDetails) GetCrcString() string { return "7a97f21c" } -func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 ACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.SrcPrefix - // field[3] s1.SrcPrefix.Address - // field[4] s1.SrcPrefix.Address.Af - size += 1 - // field[4] s1.SrcPrefix.Address.Un - size += 16 - // field[3] s1.SrcPrefix.Len - size += 1 - // field[2] s1.DstPrefix - // field[3] s1.DstPrefix.Address - // field[4] s1.DstPrefix.Address.Af - size += 1 - // field[4] s1.DstPrefix.Address.Un - size += 16 - // field[3] s1.DstPrefix.Len - size += 1 - // field[2] s1.Proto - size += 1 - // field[2] s1.SrcportOrIcmptypeFirst - size += 2 - // field[2] s1.SrcportOrIcmptypeLast - size += 2 - // field[2] s1.DstportOrIcmpcodeFirst - size += 2 - // field[2] s1.DstportOrIcmpcodeLast - size += 2 - // field[2] s1.TCPFlagsMask - size += 1 - // field[2] s1.TCPFlagsValue - size += 1 - } - return size -} -func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Tag - copy(buf[pos:pos+64], m.Tag) - pos += 64 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 ACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.SrcPrefix - // field[3] v1.SrcPrefix.Address - // field[4] v1.SrcPrefix.Address.Af - buf[pos] = uint8(v1.SrcPrefix.Address.Af) - pos += 1 - // field[4] v1.SrcPrefix.Address.Un - copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] v1.SrcPrefix.Len - buf[pos] = uint8(v1.SrcPrefix.Len) - pos += 1 - // field[2] v1.DstPrefix - // field[3] v1.DstPrefix.Address - // field[4] v1.DstPrefix.Address.Af - buf[pos] = uint8(v1.DstPrefix.Address.Af) - pos += 1 - // field[4] v1.DstPrefix.Address.Un - copy(buf[pos:pos+16], v1.DstPrefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] v1.DstPrefix.Len - buf[pos] = uint8(v1.DstPrefix.Len) - pos += 1 - // field[2] v1.Proto - buf[pos] = uint8(v1.Proto) - pos += 1 - // field[2] v1.SrcportOrIcmptypeFirst - o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) - pos += 2 - // field[2] v1.SrcportOrIcmptypeLast - o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) - pos += 2 - // field[2] v1.DstportOrIcmpcodeFirst - o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) - pos += 2 - // field[2] v1.DstportOrIcmpcodeLast - o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) - pos += 2 - // field[2] v1.TCPFlagsMask - buf[pos] = uint8(v1.TCPFlagsMask) - pos += 1 - // field[2] v1.TCPFlagsValue - buf[pos] = uint8(v1.TCPFlagsValue) - pos += 1 - } - return buf, nil -} -func (m *ACLDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Tag = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]ACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = ACLAction(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcPrefix - // field[3] m.R[j1].SrcPrefix.Address - // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.R[j1].SrcPrefix.Address.Un - copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.R[j1].SrcPrefix.Len - m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].DstPrefix - // field[3] m.R[j1].DstPrefix.Address - // field[4] m.R[j1].DstPrefix.Address.Af - m.R[j1].DstPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.R[j1].DstPrefix.Address.Un - copy(m.R[j1].DstPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.R[j1].DstPrefix.Len - m.R[j1].DstPrefix.Len = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].Proto - m.R[j1].Proto = ip_types.IPProto(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcportOrIcmptypeFirst - m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].SrcportOrIcmptypeLast - m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].DstportOrIcmpcodeFirst - m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].DstportOrIcmpcodeLast - m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.R[j1].TCPFlagsMask - m.R[j1].TCPFlagsMask = uint8(tmp[pos]) - pos += 1 - // field[2] m.R[j1].TCPFlagsValue - m.R[j1].TCPFlagsValue = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// ACLDump represents VPP binary API message 'acl_dump'. -type ACLDump struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *ACLDump) Reset() { *m = ACLDump{} } -func (*ACLDump) GetMessageName() string { return "acl_dump" } -func (*ACLDump) GetCrcString() string { return "ef34fea4" } -func (*ACLDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *ACLDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *ACLDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. -type ACLInterfaceAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - IsInput bool `binapi:"bool,name=is_input" json:"is_input,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } -func (*ACLInterfaceAddDel) GetMessageName() string { return "acl_interface_add_del" } -func (*ACLInterfaceAddDel) GetCrcString() string { return "4b54bebd" } -func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.IsInput - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.IsInput - if m.IsInput { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.IsInput - m.IsInput = tmp[pos] != 0 - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply'. -type ACLInterfaceAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLInterfaceAddDelReply) Reset() { *m = ACLInterfaceAddDelReply{} } -func (*ACLInterfaceAddDelReply) GetMessageName() string { return "acl_interface_add_del_reply" } -func (*ACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. -type ACLInterfaceEtypeWhitelistDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` -} - -func (m *ACLInterfaceEtypeWhitelistDetails) Reset() { *m = ACLInterfaceEtypeWhitelistDetails{} } -func (*ACLInterfaceEtypeWhitelistDetails) GetMessageName() string { - return "acl_interface_etype_whitelist_details" -} -func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { return "cc2bfded" } -func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceEtypeWhitelistDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.NInput - size += 1 - // field[1] m.Whitelist - size += 2 * len(m.Whitelist) - return size -} -func (m *ACLInterfaceEtypeWhitelistDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Whitelist)) - pos += 1 - // field[1] m.NInput - buf[pos] = uint8(m.NInput) - pos += 1 - // field[1] m.Whitelist - for i := 0; i < len(m.Whitelist); i++ { - var x uint16 - if i < len(m.Whitelist) { - x = uint16(m.Whitelist[i]) - } - o.PutUint16(buf[pos:pos+2], uint16(x)) - pos += 2 - } - return buf, nil -} -func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.NInput - m.NInput = uint8(tmp[pos]) - pos += 1 - // field[1] m.Whitelist - m.Whitelist = make([]uint16, m.Count) - for i := 0; i < len(m.Whitelist); i++ { - m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - } - return nil -} - -// ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. -type ACLInterfaceEtypeWhitelistDump struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *ACLInterfaceEtypeWhitelistDump) Reset() { *m = ACLInterfaceEtypeWhitelistDump{} } -func (*ACLInterfaceEtypeWhitelistDump) GetMessageName() string { - return "acl_interface_etype_whitelist_dump" -} -func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { return "f9e6675e" } -func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceEtypeWhitelistDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *ACLInterfaceEtypeWhitelistDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. -type ACLInterfaceListDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` -} - -func (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } -func (*ACLInterfaceListDetails) GetMessageName() string { return "acl_interface_list_details" } -func (*ACLInterfaceListDetails) GetCrcString() string { return "e695d256" } -func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceListDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.NInput - size += 1 - // field[1] m.Acls - size += 4 * len(m.Acls) - return size -} -func (m *ACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Acls)) - pos += 1 - // field[1] m.NInput - buf[pos] = uint8(m.NInput) - pos += 1 - // field[1] m.Acls - for i := 0; i < len(m.Acls); i++ { - var x uint32 - if i < len(m.Acls) { - x = uint32(m.Acls[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.NInput - m.NInput = uint8(tmp[pos]) - pos += 1 - // field[1] m.Acls - m.Acls = make([]uint32, m.Count) - for i := 0; i < len(m.Acls); i++ { - m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. -type ACLInterfaceListDump struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4.294967295e+09" json:"sw_if_index,omitempty"` -} - -func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } -func (*ACLInterfaceListDump) GetMessageName() string { return "acl_interface_list_dump" } -func (*ACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } -func (*ACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceListDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *ACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceListDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. -type ACLInterfaceSetACLList struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` -} - -func (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } -func (*ACLInterfaceSetACLList) GetMessageName() string { return "acl_interface_set_acl_list" } -func (*ACLInterfaceSetACLList) GetCrcString() string { return "473982bd" } -func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceSetACLList) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.NInput - size += 1 - // field[1] m.Acls - size += 4 * len(m.Acls) - return size -} -func (m *ACLInterfaceSetACLList) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Acls)) - pos += 1 - // field[1] m.NInput - buf[pos] = uint8(m.NInput) - pos += 1 - // field[1] m.Acls - for i := 0; i < len(m.Acls); i++ { - var x uint32 - if i < len(m.Acls) { - x = uint32(m.Acls[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *ACLInterfaceSetACLList) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.NInput - m.NInput = uint8(tmp[pos]) - pos += 1 - // field[1] m.Acls - m.Acls = make([]uint32, m.Count) - for i := 0; i < len(m.Acls); i++ { - m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply'. -type ACLInterfaceSetACLListReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLInterfaceSetACLListReply) Reset() { *m = ACLInterfaceSetACLListReply{} } -func (*ACLInterfaceSetACLListReply) GetMessageName() string { - return "acl_interface_set_acl_list_reply" -} -func (*ACLInterfaceSetACLListReply) GetCrcString() string { return "e8d4e804" } -func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceSetACLListReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLInterfaceSetACLListReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceSetACLListReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. -type ACLInterfaceSetEtypeWhitelist struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` - NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` - Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` -} - -func (m *ACLInterfaceSetEtypeWhitelist) Reset() { *m = ACLInterfaceSetEtypeWhitelist{} } -func (*ACLInterfaceSetEtypeWhitelist) GetMessageName() string { - return "acl_interface_set_etype_whitelist" -} -func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { return "3f5c2d2d" } -func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLInterfaceSetEtypeWhitelist) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.NInput - size += 1 - // field[1] m.Whitelist - size += 2 * len(m.Whitelist) - return size -} -func (m *ACLInterfaceSetEtypeWhitelist) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Whitelist)) - pos += 1 - // field[1] m.NInput - buf[pos] = uint8(m.NInput) - pos += 1 - // field[1] m.Whitelist - for i := 0; i < len(m.Whitelist); i++ { - var x uint16 - if i < len(m.Whitelist) { - x = uint16(m.Whitelist[i]) - } - o.PutUint16(buf[pos:pos+2], uint16(x)) - pos += 2 - } - return buf, nil -} -func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.NInput - m.NInput = uint8(tmp[pos]) - pos += 1 - // field[1] m.Whitelist - m.Whitelist = make([]uint16, m.Count) - for i := 0; i < len(m.Whitelist); i++ { - m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - } - return nil -} - -// ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply'. -type ACLInterfaceSetEtypeWhitelistReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLInterfaceSetEtypeWhitelistReply) Reset() { *m = ACLInterfaceSetEtypeWhitelistReply{} } -func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageName() string { - return "acl_interface_set_etype_whitelist_reply" -} -func (*ACLInterfaceSetEtypeWhitelistReply) GetCrcString() string { return "e8d4e804" } -func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLInterfaceSetEtypeWhitelistReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLInterfaceSetEtypeWhitelistReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLInterfaceSetEtypeWhitelistReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping'. -type ACLPluginControlPing struct{} - -func (m *ACLPluginControlPing) Reset() { *m = ACLPluginControlPing{} } -func (*ACLPluginControlPing) GetMessageName() string { return "acl_plugin_control_ping" } -func (*ACLPluginControlPing) GetCrcString() string { return "51077d14" } -func (*ACLPluginControlPing) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLPluginControlPing) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ACLPluginControlPing) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ACLPluginControlPing) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply'. -type ACLPluginControlPingReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` - VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` -} - -func (m *ACLPluginControlPingReply) Reset() { *m = ACLPluginControlPingReply{} } -func (*ACLPluginControlPingReply) GetMessageName() string { return "acl_plugin_control_ping_reply" } -func (*ACLPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } -func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLPluginControlPingReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.ClientIndex - size += 4 - // field[1] m.VpePID - size += 4 - return size -} -func (m *ACLPluginControlPingReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.ClientIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) - pos += 4 - // field[1] m.VpePID - o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) - pos += 4 - return buf, nil -} -func (m *ACLPluginControlPingReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ClientIndex - m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VpePID - m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries'. -type ACLPluginGetConnTableMaxEntries struct{} - -func (m *ACLPluginGetConnTableMaxEntries) Reset() { *m = ACLPluginGetConnTableMaxEntries{} } -func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { - return "acl_plugin_get_conn_table_max_entries" -} -func (*ACLPluginGetConnTableMaxEntries) GetCrcString() string { return "51077d14" } -func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLPluginGetConnTableMaxEntries) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ACLPluginGetConnTableMaxEntries) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ACLPluginGetConnTableMaxEntries) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply'. -type ACLPluginGetConnTableMaxEntriesReply struct { - ConnTableMaxEntries uint64 `binapi:"u64,name=conn_table_max_entries" json:"conn_table_max_entries,omitempty"` -} - -func (m *ACLPluginGetConnTableMaxEntriesReply) Reset() { *m = ACLPluginGetConnTableMaxEntriesReply{} } -func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageName() string { - return "acl_plugin_get_conn_table_max_entries_reply" -} -func (*ACLPluginGetConnTableMaxEntriesReply) GetCrcString() string { return "7a096d3d" } -func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *ACLPluginGetConnTableMaxEntriesReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ConnTableMaxEntries - size += 8 - return size -} -func (m *ACLPluginGetConnTableMaxEntriesReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ConnTableMaxEntries - o.PutUint64(buf[pos:pos+8], uint64(m.ConnTableMaxEntries)) - pos += 8 - return buf, nil -} -func (m *ACLPluginGetConnTableMaxEntriesReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ConnTableMaxEntries - m.ConnTableMaxEntries = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version'. -type ACLPluginGetVersion struct{} - -func (m *ACLPluginGetVersion) Reset() { *m = ACLPluginGetVersion{} } -func (*ACLPluginGetVersion) GetMessageName() string { return "acl_plugin_get_version" } -func (*ACLPluginGetVersion) GetCrcString() string { return "51077d14" } -func (*ACLPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLPluginGetVersion) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ACLPluginGetVersion) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ACLPluginGetVersion) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply'. -type ACLPluginGetVersionReply struct { - Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` - Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` -} - -func (m *ACLPluginGetVersionReply) Reset() { *m = ACLPluginGetVersionReply{} } -func (*ACLPluginGetVersionReply) GetMessageName() string { return "acl_plugin_get_version_reply" } -func (*ACLPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } -func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLPluginGetVersionReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Major - size += 4 - // field[1] m.Minor - size += 4 - return size -} -func (m *ACLPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Major - o.PutUint32(buf[pos:pos+4], uint32(m.Major)) - pos += 4 - // field[1] m.Minor - o.PutUint32(buf[pos:pos+4], uint32(m.Minor)) - pos += 4 - return buf, nil -} -func (m *ACLPluginGetVersionReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Major - m.Major = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Minor - m.Minor = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// ACLStatsIntfCountersEnable represents VPP binary API message 'acl_stats_intf_counters_enable'. -type ACLStatsIntfCountersEnable struct { - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` -} - -func (m *ACLStatsIntfCountersEnable) Reset() { *m = ACLStatsIntfCountersEnable{} } -func (*ACLStatsIntfCountersEnable) GetMessageName() string { return "acl_stats_intf_counters_enable" } -func (*ACLStatsIntfCountersEnable) GetCrcString() string { return "b3e225d2" } -func (*ACLStatsIntfCountersEnable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ACLStatsIntfCountersEnable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Enable - size += 1 - return size -} -func (m *ACLStatsIntfCountersEnable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Enable - if m.Enable { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *ACLStatsIntfCountersEnable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Enable - m.Enable = tmp[pos] != 0 - pos += 1 - return nil -} - -// ACLStatsIntfCountersEnableReply represents VPP binary API message 'acl_stats_intf_counters_enable_reply'. -type ACLStatsIntfCountersEnableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *ACLStatsIntfCountersEnableReply) Reset() { *m = ACLStatsIntfCountersEnableReply{} } -func (*ACLStatsIntfCountersEnableReply) GetMessageName() string { - return "acl_stats_intf_counters_enable_reply" -} -func (*ACLStatsIntfCountersEnableReply) GetCrcString() string { return "e8d4e804" } -func (*ACLStatsIntfCountersEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ACLStatsIntfCountersEnableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *ACLStatsIntfCountersEnableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *ACLStatsIntfCountersEnableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLAdd represents VPP binary API message 'macip_acl_add'. -type MacipACLAdd struct { - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } -func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } -func (*MacipACLAdd) GetCrcString() string { return "d648fd0a" } -func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLAdd) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 MacipACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.SrcMac - size += 6 - // field[2] s1.SrcMacMask - size += 6 - // field[2] s1.SrcPrefix - // field[3] s1.SrcPrefix.Address - // field[4] s1.SrcPrefix.Address.Af - size += 1 - // field[4] s1.SrcPrefix.Address.Un - size += 16 - // field[3] s1.SrcPrefix.Len - size += 1 - } - return size -} -func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Tag - copy(buf[pos:pos+64], m.Tag) - pos += 64 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 MacipACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.SrcMac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMac) { - x = uint8(v1.SrcMac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcMacMask - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMacMask) { - x = uint8(v1.SrcMacMask[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcPrefix - // field[3] v1.SrcPrefix.Address - // field[4] v1.SrcPrefix.Address.Af - buf[pos] = uint8(v1.SrcPrefix.Address.Af) - pos += 1 - // field[4] v1.SrcPrefix.Address.Un - copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] v1.SrcPrefix.Len - buf[pos] = uint8(v1.SrcPrefix.Len) - pos += 1 - } - return buf, nil -} -func (m *MacipACLAdd) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Tag - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Tag = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]MacipACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = ACLAction(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcMac - for i := 0; i < len(m.R[j1].SrcMac); i++ { - m.R[j1].SrcMac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcMacMask - for i := 0; i < len(m.R[j1].SrcMacMask); i++ { - m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcPrefix - // field[3] m.R[j1].SrcPrefix.Address - // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.R[j1].SrcPrefix.Address.Un - copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.R[j1].SrcPrefix.Len - m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. -type MacipACLAddReplace struct { - ACLIndex uint32 `binapi:"u32,name=acl_index,default=4.294967295e+09" json:"acl_index,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } -func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } -func (*MacipACLAddReplace) GetCrcString() string { return "e34402a7" } -func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLAddReplace) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 MacipACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.SrcMac - size += 6 - // field[2] s1.SrcMacMask - size += 6 - // field[2] s1.SrcPrefix - // field[3] s1.SrcPrefix.Address - // field[4] s1.SrcPrefix.Address.Af - size += 1 - // field[4] s1.SrcPrefix.Address.Un - size += 16 - // field[3] s1.SrcPrefix.Len - size += 1 - } - return size -} -func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Tag - copy(buf[pos:pos+64], m.Tag) - pos += 64 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 MacipACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.SrcMac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMac) { - x = uint8(v1.SrcMac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcMacMask - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMacMask) { - x = uint8(v1.SrcMacMask[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcPrefix - // field[3] v1.SrcPrefix.Address - // field[4] v1.SrcPrefix.Address.Af - buf[pos] = uint8(v1.SrcPrefix.Address.Af) - pos += 1 - // field[4] v1.SrcPrefix.Address.Un - copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] v1.SrcPrefix.Len - buf[pos] = uint8(v1.SrcPrefix.Len) - pos += 1 - } - return buf, nil -} -func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Tag = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]MacipACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = ACLAction(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcMac - for i := 0; i < len(m.R[j1].SrcMac); i++ { - m.R[j1].SrcMac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcMacMask - for i := 0; i < len(m.R[j1].SrcMacMask); i++ { - m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcPrefix - // field[3] m.R[j1].SrcPrefix.Address - // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.R[j1].SrcPrefix.Address.Un - copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.R[j1].SrcPrefix.Len - m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply'. -type MacipACLAddReplaceReply struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MacipACLAddReplaceReply) Reset() { *m = MacipACLAddReplaceReply{} } -func (*MacipACLAddReplaceReply) GetMessageName() string { return "macip_acl_add_replace_reply" } -func (*MacipACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } -func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLAddReplaceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Retval - size += 4 - return size -} -func (m *MacipACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MacipACLAddReplaceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply'. -type MacipACLAddReply struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MacipACLAddReply) Reset() { *m = MacipACLAddReply{} } -func (*MacipACLAddReply) GetMessageName() string { return "macip_acl_add_reply" } -func (*MacipACLAddReply) GetCrcString() string { return "ac407b0c" } -func (*MacipACLAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLAddReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Retval - size += 4 - return size -} -func (m *MacipACLAddReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MacipACLAddReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLDel represents VPP binary API message 'macip_acl_del'. -type MacipACLDel struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *MacipACLDel) Reset() { *m = MacipACLDel{} } -func (*MacipACLDel) GetMessageName() string { return "macip_acl_del" } -func (*MacipACLDel) GetCrcString() string { return "ef34fea4" } -func (*MacipACLDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *MacipACLDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *MacipACLDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply'. -type MacipACLDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MacipACLDelReply) Reset() { *m = MacipACLDelReply{} } -func (*MacipACLDelReply) GetMessageName() string { return "macip_acl_del_reply" } -func (*MacipACLDelReply) GetCrcString() string { return "e8d4e804" } -func (*MacipACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MacipACLDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MacipACLDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLDetails represents VPP binary API message 'macip_acl_details'. -type MacipACLDetails struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` - R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` -} - -func (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } -func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } -func (*MacipACLDetails) GetCrcString() string { return "57c7482f" } -func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - // field[1] m.Tag - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var s1 MacipACLRule - _ = s1 - if j1 < len(m.R) { - s1 = m.R[j1] - } - // field[2] s1.IsPermit - size += 1 - // field[2] s1.SrcMac - size += 6 - // field[2] s1.SrcMacMask - size += 6 - // field[2] s1.SrcPrefix - // field[3] s1.SrcPrefix.Address - // field[4] s1.SrcPrefix.Address.Af - size += 1 - // field[4] s1.SrcPrefix.Address.Un - size += 16 - // field[3] s1.SrcPrefix.Len - size += 1 - } - return size -} -func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - // field[1] m.Tag - copy(buf[pos:pos+64], m.Tag) - pos += 64 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) - pos += 4 - // field[1] m.R - for j1 := 0; j1 < len(m.R); j1++ { - var v1 MacipACLRule - if j1 < len(m.R) { - v1 = m.R[j1] - } - // field[2] v1.IsPermit - buf[pos] = uint8(v1.IsPermit) - pos += 1 - // field[2] v1.SrcMac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMac) { - x = uint8(v1.SrcMac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcMacMask - for i := 0; i < 6; i++ { - var x uint8 - if i < len(v1.SrcMacMask) { - x = uint8(v1.SrcMacMask[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[2] v1.SrcPrefix - // field[3] v1.SrcPrefix.Address - // field[4] v1.SrcPrefix.Address.Af - buf[pos] = uint8(v1.SrcPrefix.Address.Af) - pos += 1 - // field[4] v1.SrcPrefix.Address.Un - copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] v1.SrcPrefix.Len - buf[pos] = uint8(v1.SrcPrefix.Len) - pos += 1 - } - return buf, nil -} -func (m *MacipACLDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Tag = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.R - m.R = make([]MacipACLRule, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.R[j1].IsPermit - m.R[j1].IsPermit = ACLAction(tmp[pos]) - pos += 1 - // field[2] m.R[j1].SrcMac - for i := 0; i < len(m.R[j1].SrcMac); i++ { - m.R[j1].SrcMac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcMacMask - for i := 0; i < len(m.R[j1].SrcMacMask); i++ { - m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) - pos += 1 - } - // field[2] m.R[j1].SrcPrefix - // field[3] m.R[j1].SrcPrefix.Address - // field[4] m.R[j1].SrcPrefix.Address.Af - m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.R[j1].SrcPrefix.Address.Un - copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.R[j1].SrcPrefix.Len - m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// MacipACLDump represents VPP binary API message 'macip_acl_dump'. -type MacipACLDump struct { - ACLIndex uint32 `binapi:"u32,name=acl_index,default=4.294967295e+09" json:"acl_index,omitempty"` -} - -func (m *MacipACLDump) Reset() { *m = MacipACLDump{} } -func (*MacipACLDump) GetMessageName() string { return "macip_acl_dump" } -func (*MacipACLDump) GetCrcString() string { return "ef34fea4" } -func (*MacipACLDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *MacipACLDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *MacipACLDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. -type MacipACLInterfaceAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` -} - -func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } -func (*MacipACLInterfaceAddDel) GetMessageName() string { return "macip_acl_interface_add_del" } -func (*MacipACLInterfaceAddDel) GetCrcString() string { return "4b8690b1" } -func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLInterfaceAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.ACLIndex - size += 4 - return size -} -func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.ACLIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) - pos += 4 - return buf, nil -} -func (m *MacipACLInterfaceAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ACLIndex - m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply'. -type MacipACLInterfaceAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MacipACLInterfaceAddDelReply) Reset() { *m = MacipACLInterfaceAddDelReply{} } -func (*MacipACLInterfaceAddDelReply) GetMessageName() string { - return "macip_acl_interface_add_del_reply" -} -func (*MacipACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLInterfaceAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MacipACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MacipACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get'. -type MacipACLInterfaceGet struct{} - -func (m *MacipACLInterfaceGet) Reset() { *m = MacipACLInterfaceGet{} } -func (*MacipACLInterfaceGet) GetMessageName() string { return "macip_acl_interface_get" } -func (*MacipACLInterfaceGet) GetCrcString() string { return "51077d14" } -func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLInterfaceGet) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MacipACLInterfaceGet) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MacipACLInterfaceGet) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply'. -type MacipACLInterfaceGetReply struct { - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` -} - -func (m *MacipACLInterfaceGetReply) Reset() { *m = MacipACLInterfaceGetReply{} } -func (*MacipACLInterfaceGetReply) GetMessageName() string { return "macip_acl_interface_get_reply" } -func (*MacipACLInterfaceGetReply) GetCrcString() string { return "accf9b05" } -func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLInterfaceGetReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Count - size += 4 - // field[1] m.Acls - size += 4 * len(m.Acls) - return size -} -func (m *MacipACLInterfaceGetReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.Acls))) - pos += 4 - // field[1] m.Acls - for i := 0; i < len(m.Acls); i++ { - var x uint32 - if i < len(m.Acls) { - x = uint32(m.Acls[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *MacipACLInterfaceGetReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Acls - m.Acls = make([]uint32, m.Count) - for i := 0; i < len(m.Acls); i++ { - m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. -type MacipACLInterfaceListDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` - Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` -} - -func (m *MacipACLInterfaceListDetails) Reset() { *m = MacipACLInterfaceListDetails{} } -func (*MacipACLInterfaceListDetails) GetMessageName() string { - return "macip_acl_interface_list_details" -} -func (*MacipACLInterfaceListDetails) GetCrcString() string { return "a0c5d56d" } -func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MacipACLInterfaceListDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Count - size += 1 - // field[1] m.Acls - size += 4 * len(m.Acls) - return size -} -func (m *MacipACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Count - buf[pos] = uint8(len(m.Acls)) - pos += 1 - // field[1] m.Acls - for i := 0; i < len(m.Acls); i++ { - var x uint32 - if i < len(m.Acls) { - x = uint32(m.Acls[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint8(tmp[pos]) - pos += 1 - // field[1] m.Acls - m.Acls = make([]uint32, m.Count) - for i := 0; i < len(m.Acls); i++ { - m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. -type MacipACLInterfaceListDump struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } -func (*MacipACLInterfaceListDump) GetMessageName() string { return "macip_acl_interface_list_dump" } -func (*MacipACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } -func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MacipACLInterfaceListDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *MacipACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *MacipACLInterfaceListDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -func init() { file_acl_binapi_init() } -func file_acl_binapi_init() { - api.RegisterMessage((*ACLAddReplace)(nil), "acl.ACLAddReplace") - api.RegisterMessage((*ACLAddReplaceReply)(nil), "acl.ACLAddReplaceReply") - api.RegisterMessage((*ACLDel)(nil), "acl.ACLDel") - api.RegisterMessage((*ACLDelReply)(nil), "acl.ACLDelReply") - api.RegisterMessage((*ACLDetails)(nil), "acl.ACLDetails") - api.RegisterMessage((*ACLDump)(nil), "acl.ACLDump") - api.RegisterMessage((*ACLInterfaceAddDel)(nil), "acl.ACLInterfaceAddDel") - api.RegisterMessage((*ACLInterfaceAddDelReply)(nil), "acl.ACLInterfaceAddDelReply") - api.RegisterMessage((*ACLInterfaceEtypeWhitelistDetails)(nil), "acl.ACLInterfaceEtypeWhitelistDetails") - api.RegisterMessage((*ACLInterfaceEtypeWhitelistDump)(nil), "acl.ACLInterfaceEtypeWhitelistDump") - api.RegisterMessage((*ACLInterfaceListDetails)(nil), "acl.ACLInterfaceListDetails") - api.RegisterMessage((*ACLInterfaceListDump)(nil), "acl.ACLInterfaceListDump") - api.RegisterMessage((*ACLInterfaceSetACLList)(nil), "acl.ACLInterfaceSetACLList") - api.RegisterMessage((*ACLInterfaceSetACLListReply)(nil), "acl.ACLInterfaceSetACLListReply") - api.RegisterMessage((*ACLInterfaceSetEtypeWhitelist)(nil), "acl.ACLInterfaceSetEtypeWhitelist") - api.RegisterMessage((*ACLInterfaceSetEtypeWhitelistReply)(nil), "acl.ACLInterfaceSetEtypeWhitelistReply") - api.RegisterMessage((*ACLPluginControlPing)(nil), "acl.ACLPluginControlPing") - api.RegisterMessage((*ACLPluginControlPingReply)(nil), "acl.ACLPluginControlPingReply") - api.RegisterMessage((*ACLPluginGetConnTableMaxEntries)(nil), "acl.ACLPluginGetConnTableMaxEntries") - api.RegisterMessage((*ACLPluginGetConnTableMaxEntriesReply)(nil), "acl.ACLPluginGetConnTableMaxEntriesReply") - api.RegisterMessage((*ACLPluginGetVersion)(nil), "acl.ACLPluginGetVersion") - api.RegisterMessage((*ACLPluginGetVersionReply)(nil), "acl.ACLPluginGetVersionReply") - api.RegisterMessage((*ACLStatsIntfCountersEnable)(nil), "acl.ACLStatsIntfCountersEnable") - api.RegisterMessage((*ACLStatsIntfCountersEnableReply)(nil), "acl.ACLStatsIntfCountersEnableReply") - api.RegisterMessage((*MacipACLAdd)(nil), "acl.MacipACLAdd") - api.RegisterMessage((*MacipACLAddReplace)(nil), "acl.MacipACLAddReplace") - api.RegisterMessage((*MacipACLAddReplaceReply)(nil), "acl.MacipACLAddReplaceReply") - api.RegisterMessage((*MacipACLAddReply)(nil), "acl.MacipACLAddReply") - api.RegisterMessage((*MacipACLDel)(nil), "acl.MacipACLDel") - api.RegisterMessage((*MacipACLDelReply)(nil), "acl.MacipACLDelReply") - api.RegisterMessage((*MacipACLDetails)(nil), "acl.MacipACLDetails") - api.RegisterMessage((*MacipACLDump)(nil), "acl.MacipACLDump") - api.RegisterMessage((*MacipACLInterfaceAddDel)(nil), "acl.MacipACLInterfaceAddDel") - api.RegisterMessage((*MacipACLInterfaceAddDelReply)(nil), "acl.MacipACLInterfaceAddDelReply") - api.RegisterMessage((*MacipACLInterfaceGet)(nil), "acl.MacipACLInterfaceGet") - api.RegisterMessage((*MacipACLInterfaceGetReply)(nil), "acl.MacipACLInterfaceGetReply") - api.RegisterMessage((*MacipACLInterfaceListDetails)(nil), "acl.MacipACLInterfaceListDetails") - api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*ACLAddReplace)(nil), - (*ACLAddReplaceReply)(nil), - (*ACLDel)(nil), - (*ACLDelReply)(nil), - (*ACLDetails)(nil), - (*ACLDump)(nil), - (*ACLInterfaceAddDel)(nil), - (*ACLInterfaceAddDelReply)(nil), - (*ACLInterfaceEtypeWhitelistDetails)(nil), - (*ACLInterfaceEtypeWhitelistDump)(nil), - (*ACLInterfaceListDetails)(nil), - (*ACLInterfaceListDump)(nil), - (*ACLInterfaceSetACLList)(nil), - (*ACLInterfaceSetACLListReply)(nil), - (*ACLInterfaceSetEtypeWhitelist)(nil), - (*ACLInterfaceSetEtypeWhitelistReply)(nil), - (*ACLPluginControlPing)(nil), - (*ACLPluginControlPingReply)(nil), - (*ACLPluginGetConnTableMaxEntries)(nil), - (*ACLPluginGetConnTableMaxEntriesReply)(nil), - (*ACLPluginGetVersion)(nil), - (*ACLPluginGetVersionReply)(nil), - (*ACLStatsIntfCountersEnable)(nil), - (*ACLStatsIntfCountersEnableReply)(nil), - (*MacipACLAdd)(nil), - (*MacipACLAddReplace)(nil), - (*MacipACLAddReplaceReply)(nil), - (*MacipACLAddReply)(nil), - (*MacipACLDel)(nil), - (*MacipACLDelReply)(nil), - (*MacipACLDetails)(nil), - (*MacipACLDump)(nil), - (*MacipACLInterfaceAddDel)(nil), - (*MacipACLInterfaceAddDelReply)(nil), - (*MacipACLInterfaceGet)(nil), - (*MacipACLInterfaceGetReply)(nil), - (*MacipACLInterfaceListDetails)(nil), - (*MacipACLInterfaceListDump)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/acl/acl_rpc.ba.go b/examples/binapi/acl/acl_rpc.ba.go deleted file mode 100644 index 62b10c3..0000000 --- a/examples/binapi/acl/acl_rpc.ba.go +++ /dev/null @@ -1,302 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package acl - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for acl module. -type RPCService interface { - DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) - DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) - DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) - DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) - DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) - ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) - ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) - ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) - ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) - ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) - ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) - ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) - ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) - ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) - MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) - MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) - MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) - MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) - MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpACLClient{stream} - return x, nil -} - -type RPCService_DumpACLClient interface { - Recv() (*ACLDetails, error) -} - -type serviceClient_DumpACLClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpACLClient) Recv() (*ACLDetails, error) { - m := new(ACLDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpACLInterfaceEtypeWhitelistClient{stream} - return x, nil -} - -type RPCService_DumpACLInterfaceEtypeWhitelistClient interface { - Recv() (*ACLInterfaceEtypeWhitelistDetails, error) -} - -type serviceClient_DumpACLInterfaceEtypeWhitelistClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpACLInterfaceEtypeWhitelistClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { - m := new(ACLInterfaceEtypeWhitelistDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpACLInterfaceListClient{stream} - return x, nil -} - -type RPCService_DumpACLInterfaceListClient interface { - Recv() (*ACLInterfaceListDetails, error) -} - -type serviceClient_DumpACLInterfaceListClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpACLInterfaceListClient) Recv() (*ACLInterfaceListDetails, error) { - m := new(ACLInterfaceListDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMacipACLClient{stream} - return x, nil -} - -type RPCService_DumpMacipACLClient interface { - Recv() (*MacipACLDetails, error) -} - -type serviceClient_DumpMacipACLClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMacipACLClient) Recv() (*MacipACLDetails, error) { - m := new(MacipACLDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMacipACLInterfaceListClient{stream} - return x, nil -} - -type RPCService_DumpMacipACLInterfaceListClient interface { - Recv() (*MacipACLInterfaceListDetails, error) -} - -type serviceClient_DumpMacipACLInterfaceListClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMacipACLInterfaceListClient) Recv() (*MacipACLInterfaceListDetails, error) { - m := new(MacipACLInterfaceListDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { - out := new(ACLAddReplaceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { - out := new(ACLDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { - out := new(ACLInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { - out := new(ACLInterfaceSetACLListReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { - out := new(ACLInterfaceSetEtypeWhitelistReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { - out := new(ACLPluginControlPingReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { - out := new(ACLPluginGetConnTableMaxEntriesReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { - out := new(ACLPluginGetVersionReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) { - out := new(ACLStatsIntfCountersEnableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { - out := new(MacipACLAddReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { - out := new(MacipACLAddReplaceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { - out := new(MacipACLDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { - out := new(MacipACLInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { - out := new(MacipACLInterfaceGetReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/examples/binapi/af_packet/af_packet.ba.go b/examples/binapi/af_packet/af_packet.ba.go deleted file mode 100644 index 5dc2850..0000000 --- a/examples/binapi/af_packet/af_packet.ba.go +++ /dev/null @@ -1,530 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/af_packet.api.json - -/* -Package af_packet contains generated code for VPP API file af_packet.api (2.0.0). - -It consists of: - 2 aliases - 6 enums - 8 messages -*/ -package af_packet - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" - - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "af_packet" - // APIVersion is the API version of this module. - APIVersion = "2.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0xe0b6c022 -) - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -func ParseMAC(mac string) (parsed MacAddress, err error) { - var hw net.HardwareAddr - if hw, err = net.ParseMAC(mac); err != nil { - return - } - copy(parsed[:], hw[:]) - return -} - -func (m *MacAddress) ToString() string { - return net.HardwareAddr(m[:]).String() -} - -// AfPacketCreate represents VPP binary API message 'af_packet_create'. -type AfPacketCreate struct { - HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` - UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"` - HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` -} - -func (m *AfPacketCreate) Reset() { *m = AfPacketCreate{} } -func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" } -func (*AfPacketCreate) GetCrcString() string { return "a190415f" } -func (*AfPacketCreate) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AfPacketCreate) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.HwAddr - size += 6 - // field[1] m.UseRandomHwAddr - size += 1 - // field[1] m.HostIfName - size += 64 - return size -} -func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.HwAddr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.HwAddr) { - x = uint8(m.HwAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.UseRandomHwAddr - if m.UseRandomHwAddr { - buf[pos] = 1 - } - pos += 1 - // field[1] m.HostIfName - copy(buf[pos:pos+64], m.HostIfName) - pos += 64 - return buf, nil -} -func (m *AfPacketCreate) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.HwAddr - for i := 0; i < len(m.HwAddr); i++ { - m.HwAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.UseRandomHwAddr - m.UseRandomHwAddr = tmp[pos] != 0 - pos += 1 - // field[1] m.HostIfName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'. -type AfPacketCreateReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *AfPacketCreateReply) Reset() { *m = AfPacketCreateReply{} } -func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" } -func (*AfPacketCreateReply) GetCrcString() string { return "5383d31f" } -func (*AfPacketCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AfPacketCreateReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *AfPacketCreateReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// AfPacketDelete represents VPP binary API message 'af_packet_delete'. -type AfPacketDelete struct { - HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` -} - -func (m *AfPacketDelete) Reset() { *m = AfPacketDelete{} } -func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" } -func (*AfPacketDelete) GetCrcString() string { return "863fa648" } -func (*AfPacketDelete) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AfPacketDelete) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.HostIfName - size += 64 - return size -} -func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.HostIfName - copy(buf[pos:pos+64], m.HostIfName) - pos += 64 - return buf, nil -} -func (m *AfPacketDelete) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.HostIfName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply'. -type AfPacketDeleteReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *AfPacketDeleteReply) Reset() { *m = AfPacketDeleteReply{} } -func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" } -func (*AfPacketDeleteReply) GetCrcString() string { return "e8d4e804" } -func (*AfPacketDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AfPacketDeleteReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *AfPacketDeleteReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// AfPacketDetails represents VPP binary API message 'af_packet_details'. -type AfPacketDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` -} - -func (m *AfPacketDetails) Reset() { *m = AfPacketDetails{} } -func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" } -func (*AfPacketDetails) GetCrcString() string { return "58c7c042" } -func (*AfPacketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AfPacketDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.HostIfName - size += 64 - return size -} -func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.HostIfName - copy(buf[pos:pos+64], m.HostIfName) - pos += 64 - return buf, nil -} -func (m *AfPacketDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.HostIfName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// AfPacketDump represents VPP binary API message 'af_packet_dump'. -type AfPacketDump struct{} - -func (m *AfPacketDump) Reset() { *m = AfPacketDump{} } -func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" } -func (*AfPacketDump) GetCrcString() string { return "51077d14" } -func (*AfPacketDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AfPacketDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *AfPacketDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'. -type AfPacketSetL4CksumOffload struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Set bool `binapi:"bool,name=set" json:"set,omitempty"` -} - -func (m *AfPacketSetL4CksumOffload) Reset() { *m = AfPacketSetL4CksumOffload{} } -func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" } -func (*AfPacketSetL4CksumOffload) GetCrcString() string { return "319cd5c8" } -func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AfPacketSetL4CksumOffload) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Set - size += 1 - return size -} -func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Set - if m.Set { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *AfPacketSetL4CksumOffload) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Set - m.Set = tmp[pos] != 0 - pos += 1 - return nil -} - -// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply'. -type AfPacketSetL4CksumOffloadReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} } -func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string { - return "af_packet_set_l4_cksum_offload_reply" -} -func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" } -func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AfPacketSetL4CksumOffloadReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -func init() { file_af_packet_binapi_init() } -func file_af_packet_binapi_init() { - api.RegisterMessage((*AfPacketCreate)(nil), "af_packet.AfPacketCreate") - api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet.AfPacketCreateReply") - api.RegisterMessage((*AfPacketDelete)(nil), "af_packet.AfPacketDelete") - api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet.AfPacketDeleteReply") - api.RegisterMessage((*AfPacketDetails)(nil), "af_packet.AfPacketDetails") - api.RegisterMessage((*AfPacketDump)(nil), "af_packet.AfPacketDump") - api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet.AfPacketSetL4CksumOffload") - api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*AfPacketCreate)(nil), - (*AfPacketCreateReply)(nil), - (*AfPacketDelete)(nil), - (*AfPacketDeleteReply)(nil), - (*AfPacketDetails)(nil), - (*AfPacketDump)(nil), - (*AfPacketSetL4CksumOffload)(nil), - (*AfPacketSetL4CksumOffloadReply)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/af_packet/af_packet_rpc.ba.go b/examples/binapi/af_packet/af_packet_rpc.ba.go deleted file mode 100644 index d2df47a..0000000 --- a/examples/binapi/af_packet/af_packet_rpc.ba.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package af_packet - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for af_packet module. -type RPCService interface { - DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) - AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) - AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) - AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpAfPacketClient{stream} - return x, nil -} - -type RPCService_DumpAfPacketClient interface { - Recv() (*AfPacketDetails, error) -} - -type serviceClient_DumpAfPacketClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpAfPacketClient) Recv() (*AfPacketDetails, error) { - m := new(AfPacketDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { - out := new(AfPacketCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { - out := new(AfPacketDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { - out := new(AfPacketSetL4CksumOffloadReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/examples/binapi/fib_types/fib_types.ba.go b/examples/binapi/fib_types/fib_types.ba.go deleted file mode 100644 index 9050e85..0000000 --- a/examples/binapi/fib_types/fib_types.ba.go +++ /dev/null @@ -1,255 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/fib_types.api.json - -/* -Package fib_types contains generated code for VPP API file fib_types.api (2.0.0). - -It consists of: - 5 aliases - 7 enums - 9 types - 1 union -*/ -package fib_types - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" - - ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "fib_types" - // APIVersion is the API version of this module. - APIVersion = "2.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0xd6a5938 -) - -type AddressFamily = ip_types.AddressFamily - -// FibPathFlags represents VPP binary API enum 'fib_path_flags'. -type FibPathFlags uint32 - -const ( - FIB_API_PATH_FLAG_NONE FibPathFlags = 0 - FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 - FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 - FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 -) - -var ( - FibPathFlags_name = map[uint32]string{ - 0: "FIB_API_PATH_FLAG_NONE", - 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", - 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", - 4: "FIB_API_PATH_FLAG_POP_PW_CW", - } - FibPathFlags_value = map[string]uint32{ - "FIB_API_PATH_FLAG_NONE": 0, - "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, - "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, - "FIB_API_PATH_FLAG_POP_PW_CW": 4, - } -) - -func (x FibPathFlags) String() string { - s, ok := FibPathFlags_name[uint32(x)] - if ok { - return s - } - return "FibPathFlags(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. -type FibPathNhProto uint32 - -const ( - FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 - FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 - FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 - FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 - FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 -) - -var ( - FibPathNhProto_name = map[uint32]string{ - 0: "FIB_API_PATH_NH_PROTO_IP4", - 1: "FIB_API_PATH_NH_PROTO_IP6", - 2: "FIB_API_PATH_NH_PROTO_MPLS", - 3: "FIB_API_PATH_NH_PROTO_ETHERNET", - 4: "FIB_API_PATH_NH_PROTO_BIER", - } - FibPathNhProto_value = map[string]uint32{ - "FIB_API_PATH_NH_PROTO_IP4": 0, - "FIB_API_PATH_NH_PROTO_IP6": 1, - "FIB_API_PATH_NH_PROTO_MPLS": 2, - "FIB_API_PATH_NH_PROTO_ETHERNET": 3, - "FIB_API_PATH_NH_PROTO_BIER": 4, - } -) - -func (x FibPathNhProto) String() string { - s, ok := FibPathNhProto_name[uint32(x)] - if ok { - return s - } - return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")" -} - -// FibPathType represents VPP binary API enum 'fib_path_type'. -type FibPathType uint32 - -const ( - FIB_API_PATH_TYPE_NORMAL FibPathType = 0 - FIB_API_PATH_TYPE_LOCAL FibPathType = 1 - FIB_API_PATH_TYPE_DROP FibPathType = 2 - FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 - FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 - FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 - FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 - FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 - FIB_API_PATH_TYPE_DVR FibPathType = 8 - FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 - FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 -) - -var ( - FibPathType_name = map[uint32]string{ - 0: "FIB_API_PATH_TYPE_NORMAL", - 1: "FIB_API_PATH_TYPE_LOCAL", - 2: "FIB_API_PATH_TYPE_DROP", - 3: "FIB_API_PATH_TYPE_UDP_ENCAP", - 4: "FIB_API_PATH_TYPE_BIER_IMP", - 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", - 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", - 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", - 8: "FIB_API_PATH_TYPE_DVR", - 9: "FIB_API_PATH_TYPE_INTERFACE_RX", - 10: "FIB_API_PATH_TYPE_CLASSIFY", - } - FibPathType_value = map[string]uint32{ - "FIB_API_PATH_TYPE_NORMAL": 0, - "FIB_API_PATH_TYPE_LOCAL": 1, - "FIB_API_PATH_TYPE_DROP": 2, - "FIB_API_PATH_TYPE_UDP_ENCAP": 3, - "FIB_API_PATH_TYPE_BIER_IMP": 4, - "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, - "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, - "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, - "FIB_API_PATH_TYPE_DVR": 8, - "FIB_API_PATH_TYPE_INTERFACE_RX": 9, - "FIB_API_PATH_TYPE_CLASSIFY": 10, - } -) - -func (x FibPathType) String() string { - s, ok := FibPathType_name[uint32(x)] - if ok { - return s - } - return "FibPathType(" + strconv.Itoa(int(x)) + ")" -} - -type IPDscp = ip_types.IPDscp - -type IPEcn = ip_types.IPEcn - -type IPProto = ip_types.IPProto - -type AddressWithPrefix = ip_types.AddressWithPrefix - -type IP4Address = ip_types.IP4Address - -type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix - -type IP6Address = ip_types.IP6Address - -type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix - -type Address = ip_types.Address - -// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. -type FibMplsLabel struct { - IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"` - Label uint32 `binapi:"u32,name=label" json:"label,omitempty"` - TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` - Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"` -} - -func (*FibMplsLabel) GetTypeName() string { return "fib_mpls_label" } - -// FibPath represents VPP binary API type 'fib_path'. -type FibPath struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` - Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` - Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` - Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"` - Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"` - Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"` - Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"` - NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"` - LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty" struc:"[16]FibMplsLabel"` -} - -func (*FibPath) GetTypeName() string { return "fib_path" } - -// FibPathNh represents VPP binary API type 'fib_path_nh'. -type FibPathNh struct { - Address ip_types.AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` - ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` - ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` - ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` -} - -func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } - -type IP4Prefix = ip_types.IP4Prefix - -type IP6Prefix = ip_types.IP6Prefix - -type Mprefix = ip_types.Mprefix - -type Prefix = ip_types.Prefix - -type PrefixMatcher = ip_types.PrefixMatcher - -type AddressUnion = ip_types.AddressUnion - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/gen.go b/examples/binapi/gen.go deleted file mode 100644 index fe08d7f..0000000 --- a/examples/binapi/gen.go +++ /dev/null @@ -1,5 +0,0 @@ -package binapi - -// Generate Go code from the VPP APIs located in the /usr/share/vpp/api directory. - -//go:generate binapi-generator --import-types=false mactime af_packet interface interface_types ip vpe sr acl memif ip_types fib_types diff --git a/examples/binapi/interface_types/interface_types.ba.go b/examples/binapi/interface_types/interface_types.ba.go deleted file mode 100644 index 1c0a72c..0000000 --- a/examples/binapi/interface_types/interface_types.ba.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/interface_types.api.json - -/* -Package interface_types contains generated code for VPP API file interface_types.api (). - -It consists of: - 1 alias - 6 enums -*/ -package interface_types - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "interface_types" - // APIVersion is the API version of this module. - APIVersion = "" - // VersionCrc is the CRC of this module. - VersionCrc = 0x23822dac -) - -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -var ( - IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", - } - IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, - } -) - -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" -} - -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 - -const ( - IF_API_TYPE_HARDWARE IfType = 0 - IF_API_TYPE_SUB IfType = 1 - IF_API_TYPE_P2P IfType = 2 - IF_API_TYPE_PIPE IfType = 3 -) - -var ( - IfType_name = map[uint32]string{ - 0: "IF_API_TYPE_HARDWARE", - 1: "IF_API_TYPE_SUB", - 2: "IF_API_TYPE_P2P", - 3: "IF_API_TYPE_PIPE", - } - IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 0, - "IF_API_TYPE_SUB": 1, - "IF_API_TYPE_P2P": 2, - "IF_API_TYPE_PIPE": 3, - } -) - -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return "IfType(" + strconv.Itoa(int(x)) + ")" -} - -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var ( - LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", - } - LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, - } -) - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" -} - -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 0 - MTU_PROTO_API_IP4 MtuProto = 1 - MTU_PROTO_API_IP6 MtuProto = 2 - MTU_PROTO_API_MPLS MtuProto = 3 -) - -var ( - MtuProto_name = map[uint32]string{ - 0: "MTU_PROTO_API_L3", - 1: "MTU_PROTO_API_IP4", - 2: "MTU_PROTO_API_IP6", - 3: "MTU_PROTO_API_MPLS", - } - MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 0, - "MTU_PROTO_API_IP4": 1, - "MTU_PROTO_API_IP6": 2, - "MTU_PROTO_API_MPLS": 3, - } -) - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return "MtuProto(" + strconv.Itoa(int(x)) + ")" -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var ( - RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", - } - RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, - } -) - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return "RxMode(" + strconv.Itoa(int(x)) + ")" -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var ( - SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", - } - SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, - } -) - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" -} - -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/interfaces/interfaces.ba.go b/examples/binapi/interfaces/interfaces.ba.go deleted file mode 100644 index 8b9176c..0000000 --- a/examples/binapi/interfaces/interfaces.ba.go +++ /dev/null @@ -1,3640 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/interface.api.json - -/* -Package interfaces contains generated code for VPP API file interface.api (3.2.2). - -It consists of: - 7 aliases - 10 enums - 57 messages - 6 types - 1 union -*/ -package interfaces - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" - - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" - ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "interface" - // APIVersion is the API version of this module. - APIVersion = "3.2.2" - // VersionCrc is the CRC of this module. - VersionCrc = 0x58d4cf5a -) - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -func ParseMAC(mac string) (parsed MacAddress, err error) { - var hw net.HardwareAddr - if hw, err = net.ParseMAC(mac); err != nil { - return - } - copy(parsed[:], hw[:]) - return -} - -func (m *MacAddress) ToString() string { - return net.HardwareAddr(m[:]).String() -} - -// CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. -type CollectDetailedInterfaceStats struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` -} - -func (m *CollectDetailedInterfaceStats) Reset() { *m = CollectDetailedInterfaceStats{} } -func (*CollectDetailedInterfaceStats) GetMessageName() string { - return "collect_detailed_interface_stats" -} -func (*CollectDetailedInterfaceStats) GetCrcString() string { return "5501adee" } -func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CollectDetailedInterfaceStats) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.EnableDisable - size += 1 - return size -} -func (m *CollectDetailedInterfaceStats) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.EnableDisable - if m.EnableDisable { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *CollectDetailedInterfaceStats) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.EnableDisable - m.EnableDisable = tmp[pos] != 0 - pos += 1 - return nil -} - -// CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply'. -type CollectDetailedInterfaceStatsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *CollectDetailedInterfaceStatsReply) Reset() { *m = CollectDetailedInterfaceStatsReply{} } -func (*CollectDetailedInterfaceStatsReply) GetMessageName() string { - return "collect_detailed_interface_stats_reply" -} -func (*CollectDetailedInterfaceStatsReply) GetCrcString() string { return "e8d4e804" } -func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CollectDetailedInterfaceStatsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *CollectDetailedInterfaceStatsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *CollectDetailedInterfaceStatsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateLoopback represents VPP binary API message 'create_loopback'. -type CreateLoopback struct { - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` -} - -func (m *CreateLoopback) Reset() { *m = CreateLoopback{} } -func (*CreateLoopback) GetMessageName() string { return "create_loopback" } -func (*CreateLoopback) GetCrcString() string { return "42bb5d22" } -func (*CreateLoopback) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CreateLoopback) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.MacAddress - size += 6 - return size -} -func (m *CreateLoopback) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *CreateLoopback) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance'. -type CreateLoopbackInstance struct { - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` - IsSpecified bool `binapi:"bool,name=is_specified" json:"is_specified,omitempty"` - UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"` -} - -func (m *CreateLoopbackInstance) Reset() { *m = CreateLoopbackInstance{} } -func (*CreateLoopbackInstance) GetMessageName() string { return "create_loopback_instance" } -func (*CreateLoopbackInstance) GetCrcString() string { return "d36a3ee2" } -func (*CreateLoopbackInstance) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CreateLoopbackInstance) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.MacAddress - size += 6 - // field[1] m.IsSpecified - size += 1 - // field[1] m.UserInstance - size += 4 - return size -} -func (m *CreateLoopbackInstance) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.IsSpecified - if m.IsSpecified { - buf[pos] = 1 - } - pos += 1 - // field[1] m.UserInstance - o.PutUint32(buf[pos:pos+4], uint32(m.UserInstance)) - pos += 4 - return buf, nil -} -func (m *CreateLoopbackInstance) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.IsSpecified - m.IsSpecified = tmp[pos] != 0 - pos += 1 - // field[1] m.UserInstance - m.UserInstance = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply'. -type CreateLoopbackInstanceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *CreateLoopbackInstanceReply) Reset() { *m = CreateLoopbackInstanceReply{} } -func (*CreateLoopbackInstanceReply) GetMessageName() string { return "create_loopback_instance_reply" } -func (*CreateLoopbackInstanceReply) GetCrcString() string { return "5383d31f" } -func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CreateLoopbackInstanceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *CreateLoopbackInstanceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *CreateLoopbackInstanceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateLoopbackReply represents VPP binary API message 'create_loopback_reply'. -type CreateLoopbackReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *CreateLoopbackReply) Reset() { *m = CreateLoopbackReply{} } -func (*CreateLoopbackReply) GetMessageName() string { return "create_loopback_reply" } -func (*CreateLoopbackReply) GetCrcString() string { return "5383d31f" } -func (*CreateLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CreateLoopbackReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *CreateLoopbackReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *CreateLoopbackReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateSubif represents VPP binary API message 'create_subif'. -type CreateSubif struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` - SubIfFlags interface_types.SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` - OuterVlanID uint16 `binapi:"u16,name=outer_vlan_id" json:"outer_vlan_id,omitempty"` - InnerVlanID uint16 `binapi:"u16,name=inner_vlan_id" json:"inner_vlan_id,omitempty"` -} - -func (m *CreateSubif) Reset() { *m = CreateSubif{} } -func (*CreateSubif) GetMessageName() string { return "create_subif" } -func (*CreateSubif) GetCrcString() string { return "cb371063" } -func (*CreateSubif) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CreateSubif) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.SubID - size += 4 - // field[1] m.SubIfFlags - size += 4 - // field[1] m.OuterVlanID - size += 2 - // field[1] m.InnerVlanID - size += 2 - return size -} -func (m *CreateSubif) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.SubID - o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) - pos += 4 - // field[1] m.SubIfFlags - o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) - pos += 4 - // field[1] m.OuterVlanID - o.PutUint16(buf[pos:pos+2], uint16(m.OuterVlanID)) - pos += 2 - // field[1] m.InnerVlanID - o.PutUint16(buf[pos:pos+2], uint16(m.InnerVlanID)) - pos += 2 - return buf, nil -} -func (m *CreateSubif) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SubID - m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SubIfFlags - m.SubIfFlags = interface_types.SubIfFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.OuterVlanID - m.OuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.InnerVlanID - m.InnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -// CreateSubifReply represents VPP binary API message 'create_subif_reply'. -type CreateSubifReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *CreateSubifReply) Reset() { *m = CreateSubifReply{} } -func (*CreateSubifReply) GetMessageName() string { return "create_subif_reply" } -func (*CreateSubifReply) GetCrcString() string { return "5383d31f" } -func (*CreateSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CreateSubifReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *CreateSubifReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *CreateSubifReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateVlanSubif represents VPP binary API message 'create_vlan_subif'. -type CreateVlanSubif struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - VlanID uint32 `binapi:"u32,name=vlan_id" json:"vlan_id,omitempty"` -} - -func (m *CreateVlanSubif) Reset() { *m = CreateVlanSubif{} } -func (*CreateVlanSubif) GetMessageName() string { return "create_vlan_subif" } -func (*CreateVlanSubif) GetCrcString() string { return "af34ac8b" } -func (*CreateVlanSubif) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CreateVlanSubif) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.VlanID - size += 4 - return size -} -func (m *CreateVlanSubif) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.VlanID - o.PutUint32(buf[pos:pos+4], uint32(m.VlanID)) - pos += 4 - return buf, nil -} -func (m *CreateVlanSubif) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VlanID - m.VlanID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply'. -type CreateVlanSubifReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *CreateVlanSubifReply) Reset() { *m = CreateVlanSubifReply{} } -func (*CreateVlanSubifReply) GetMessageName() string { return "create_vlan_subif_reply" } -func (*CreateVlanSubifReply) GetCrcString() string { return "5383d31f" } -func (*CreateVlanSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CreateVlanSubifReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *CreateVlanSubifReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *CreateVlanSubifReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// DeleteLoopback represents VPP binary API message 'delete_loopback'. -type DeleteLoopback struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *DeleteLoopback) Reset() { *m = DeleteLoopback{} } -func (*DeleteLoopback) GetMessageName() string { return "delete_loopback" } -func (*DeleteLoopback) GetCrcString() string { return "f9e6675e" } -func (*DeleteLoopback) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *DeleteLoopback) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *DeleteLoopback) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *DeleteLoopback) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply'. -type DeleteLoopbackReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DeleteLoopbackReply) Reset() { *m = DeleteLoopbackReply{} } -func (*DeleteLoopbackReply) GetMessageName() string { return "delete_loopback_reply" } -func (*DeleteLoopbackReply) GetCrcString() string { return "e8d4e804" } -func (*DeleteLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *DeleteLoopbackReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *DeleteLoopbackReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *DeleteLoopbackReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// DeleteSubif represents VPP binary API message 'delete_subif'. -type DeleteSubif struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *DeleteSubif) Reset() { *m = DeleteSubif{} } -func (*DeleteSubif) GetMessageName() string { return "delete_subif" } -func (*DeleteSubif) GetCrcString() string { return "f9e6675e" } -func (*DeleteSubif) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *DeleteSubif) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *DeleteSubif) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *DeleteSubif) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// DeleteSubifReply represents VPP binary API message 'delete_subif_reply'. -type DeleteSubifReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *DeleteSubifReply) Reset() { *m = DeleteSubifReply{} } -func (*DeleteSubifReply) GetMessageName() string { return "delete_subif_reply" } -func (*DeleteSubifReply) GetCrcString() string { return "e8d4e804" } -func (*DeleteSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *DeleteSubifReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *DeleteSubifReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *DeleteSubifReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu'. -type HwInterfaceSetMtu struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` -} - -func (m *HwInterfaceSetMtu) Reset() { *m = HwInterfaceSetMtu{} } -func (*HwInterfaceSetMtu) GetMessageName() string { return "hw_interface_set_mtu" } -func (*HwInterfaceSetMtu) GetCrcString() string { return "e6746899" } -func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *HwInterfaceSetMtu) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Mtu - size += 2 - return size -} -func (m *HwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Mtu - o.PutUint16(buf[pos:pos+2], uint16(m.Mtu)) - pos += 2 - return buf, nil -} -func (m *HwInterfaceSetMtu) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mtu - m.Mtu = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -// HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply'. -type HwInterfaceSetMtuReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *HwInterfaceSetMtuReply) Reset() { *m = HwInterfaceSetMtuReply{} } -func (*HwInterfaceSetMtuReply) GetMessageName() string { return "hw_interface_set_mtu_reply" } -func (*HwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } -func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *HwInterfaceSetMtuReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *HwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *HwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber'. -type InterfaceNameRenumber struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - NewShowDevInstance uint32 `binapi:"u32,name=new_show_dev_instance" json:"new_show_dev_instance,omitempty"` -} - -func (m *InterfaceNameRenumber) Reset() { *m = InterfaceNameRenumber{} } -func (*InterfaceNameRenumber) GetMessageName() string { return "interface_name_renumber" } -func (*InterfaceNameRenumber) GetCrcString() string { return "2b8858b8" } -func (*InterfaceNameRenumber) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *InterfaceNameRenumber) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.NewShowDevInstance - size += 4 - return size -} -func (m *InterfaceNameRenumber) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.NewShowDevInstance - o.PutUint32(buf[pos:pos+4], uint32(m.NewShowDevInstance)) - pos += 4 - return buf, nil -} -func (m *InterfaceNameRenumber) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NewShowDevInstance - m.NewShowDevInstance = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply'. -type InterfaceNameRenumberReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *InterfaceNameRenumberReply) Reset() { *m = InterfaceNameRenumberReply{} } -func (*InterfaceNameRenumberReply) GetMessageName() string { return "interface_name_renumber_reply" } -func (*InterfaceNameRenumberReply) GetCrcString() string { return "e8d4e804" } -func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *InterfaceNameRenumberReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *InterfaceNameRenumberReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *InterfaceNameRenumberReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address'. -type SwInterfaceAddDelAddress struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` - Prefix ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` -} - -func (m *SwInterfaceAddDelAddress) Reset() { *m = SwInterfaceAddDelAddress{} } -func (*SwInterfaceAddDelAddress) GetMessageName() string { return "sw_interface_add_del_address" } -func (*SwInterfaceAddDelAddress) GetCrcString() string { return "5803d5c4" } -func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceAddDelAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsAdd - size += 1 - // field[1] m.DelAll - size += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 1 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - return size -} -func (m *SwInterfaceAddDelAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.DelAll - if m.DelAll { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - buf[pos] = uint8(m.Prefix.Address.Af) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - return buf, nil -} -func (m *SwInterfaceAddDelAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.DelAll - m.DelAll = tmp[pos] != 0 - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - return nil -} - -// SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply'. -type SwInterfaceAddDelAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceAddDelAddressReply) Reset() { *m = SwInterfaceAddDelAddressReply{} } -func (*SwInterfaceAddDelAddressReply) GetMessageName() string { - return "sw_interface_add_del_address_reply" -} -func (*SwInterfaceAddDelAddressReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceAddDelAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceAddDelAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceAddDelAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceAddDelMacAddress represents VPP binary API message 'sw_interface_add_del_mac_address'. -type SwInterfaceAddDelMacAddress struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` - Addr MacAddress `binapi:"mac_address,name=addr" json:"addr,omitempty"` - IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` -} - -func (m *SwInterfaceAddDelMacAddress) Reset() { *m = SwInterfaceAddDelMacAddress{} } -func (*SwInterfaceAddDelMacAddress) GetMessageName() string { - return "sw_interface_add_del_mac_address" -} -func (*SwInterfaceAddDelMacAddress) GetCrcString() string { return "638bb9f4" } -func (*SwInterfaceAddDelMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceAddDelMacAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Addr - size += 6 - // field[1] m.IsAdd - size += 1 - return size -} -func (m *SwInterfaceAddDelMacAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Addr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.Addr) { - x = uint8(m.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.IsAdd - buf[pos] = uint8(m.IsAdd) - pos += 1 - return buf, nil -} -func (m *SwInterfaceAddDelMacAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Addr - for i := 0; i < len(m.Addr); i++ { - m.Addr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.IsAdd - m.IsAdd = uint8(tmp[pos]) - pos += 1 - return nil -} - -// SwInterfaceAddDelMacAddressReply represents VPP binary API message 'sw_interface_add_del_mac_address_reply'. -type SwInterfaceAddDelMacAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceAddDelMacAddressReply) Reset() { *m = SwInterfaceAddDelMacAddressReply{} } -func (*SwInterfaceAddDelMacAddressReply) GetMessageName() string { - return "sw_interface_add_del_mac_address_reply" -} -func (*SwInterfaceAddDelMacAddressReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceAddDelMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceAddDelMacAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceAddDelMacAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceAddDelMacAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceAddressReplaceBegin represents VPP binary API message 'sw_interface_address_replace_begin'. -type SwInterfaceAddressReplaceBegin struct{} - -func (m *SwInterfaceAddressReplaceBegin) Reset() { *m = SwInterfaceAddressReplaceBegin{} } -func (*SwInterfaceAddressReplaceBegin) GetMessageName() string { - return "sw_interface_address_replace_begin" -} -func (*SwInterfaceAddressReplaceBegin) GetCrcString() string { return "51077d14" } -func (*SwInterfaceAddressReplaceBegin) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceAddressReplaceBegin) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *SwInterfaceAddressReplaceBegin) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *SwInterfaceAddressReplaceBegin) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// SwInterfaceAddressReplaceBeginReply represents VPP binary API message 'sw_interface_address_replace_begin_reply'. -type SwInterfaceAddressReplaceBeginReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceAddressReplaceBeginReply) Reset() { *m = SwInterfaceAddressReplaceBeginReply{} } -func (*SwInterfaceAddressReplaceBeginReply) GetMessageName() string { - return "sw_interface_address_replace_begin_reply" -} -func (*SwInterfaceAddressReplaceBeginReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceAddressReplaceBeginReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceAddressReplaceBeginReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceAddressReplaceBeginReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceAddressReplaceBeginReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceAddressReplaceEnd represents VPP binary API message 'sw_interface_address_replace_end'. -type SwInterfaceAddressReplaceEnd struct{} - -func (m *SwInterfaceAddressReplaceEnd) Reset() { *m = SwInterfaceAddressReplaceEnd{} } -func (*SwInterfaceAddressReplaceEnd) GetMessageName() string { - return "sw_interface_address_replace_end" -} -func (*SwInterfaceAddressReplaceEnd) GetCrcString() string { return "51077d14" } -func (*SwInterfaceAddressReplaceEnd) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceAddressReplaceEnd) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *SwInterfaceAddressReplaceEnd) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *SwInterfaceAddressReplaceEnd) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// SwInterfaceAddressReplaceEndReply represents VPP binary API message 'sw_interface_address_replace_end_reply'. -type SwInterfaceAddressReplaceEndReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceAddressReplaceEndReply) Reset() { *m = SwInterfaceAddressReplaceEndReply{} } -func (*SwInterfaceAddressReplaceEndReply) GetMessageName() string { - return "sw_interface_address_replace_end_reply" -} -func (*SwInterfaceAddressReplaceEndReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceAddressReplaceEndReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceAddressReplaceEndReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceAddressReplaceEndReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceAddressReplaceEndReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. -type SwInterfaceClearStats struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *SwInterfaceClearStats) Reset() { *m = SwInterfaceClearStats{} } -func (*SwInterfaceClearStats) GetMessageName() string { return "sw_interface_clear_stats" } -func (*SwInterfaceClearStats) GetCrcString() string { return "f9e6675e" } -func (*SwInterfaceClearStats) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceClearStats) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *SwInterfaceClearStats) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceClearStats) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply'. -type SwInterfaceClearStatsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceClearStatsReply) Reset() { *m = SwInterfaceClearStatsReply{} } -func (*SwInterfaceClearStatsReply) GetMessageName() string { return "sw_interface_clear_stats_reply" } -func (*SwInterfaceClearStatsReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceClearStatsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceClearStatsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceClearStatsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. -type SwInterfaceDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - SupSwIfIndex uint32 `binapi:"u32,name=sup_sw_if_index" json:"sup_sw_if_index,omitempty"` - L2Address MacAddress `binapi:"mac_address,name=l2_address" json:"l2_address,omitempty"` - Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - Type interface_types.IfType `binapi:"if_type,name=type" json:"type,omitempty"` - LinkDuplex interface_types.LinkDuplex `binapi:"link_duplex,name=link_duplex" json:"link_duplex,omitempty"` - LinkSpeed uint32 `binapi:"u32,name=link_speed" json:"link_speed,omitempty"` - LinkMtu uint16 `binapi:"u16,name=link_mtu" json:"link_mtu,omitempty"` - Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` - SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` - SubNumberOfTags uint8 `binapi:"u8,name=sub_number_of_tags" json:"sub_number_of_tags,omitempty"` - SubOuterVlanID uint16 `binapi:"u16,name=sub_outer_vlan_id" json:"sub_outer_vlan_id,omitempty"` - SubInnerVlanID uint16 `binapi:"u16,name=sub_inner_vlan_id" json:"sub_inner_vlan_id,omitempty"` - SubIfFlags interface_types.SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` - VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` - VtrPushDot1q uint32 `binapi:"u32,name=vtr_push_dot1q" json:"vtr_push_dot1q,omitempty"` - VtrTag1 uint32 `binapi:"u32,name=vtr_tag1" json:"vtr_tag1,omitempty"` - VtrTag2 uint32 `binapi:"u32,name=vtr_tag2" json:"vtr_tag2,omitempty"` - OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` - BDmac MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` - BSmac MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` - BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` - ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` - InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty" struc:"[64]byte"` - InterfaceDevType string `binapi:"string[64],name=interface_dev_type" json:"interface_dev_type,omitempty" struc:"[64]byte"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` -} - -func (m *SwInterfaceDetails) Reset() { *m = SwInterfaceDetails{} } -func (*SwInterfaceDetails) GetMessageName() string { return "sw_interface_details" } -func (*SwInterfaceDetails) GetCrcString() string { return "17b69fa2" } -func (*SwInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.SupSwIfIndex - size += 4 - // field[1] m.L2Address - size += 6 - // field[1] m.Flags - size += 4 - // field[1] m.Type - size += 4 - // field[1] m.LinkDuplex - size += 4 - // field[1] m.LinkSpeed - size += 4 - // field[1] m.LinkMtu - size += 2 - // field[1] m.Mtu - size += 16 - // field[1] m.SubID - size += 4 - // field[1] m.SubNumberOfTags - size += 1 - // field[1] m.SubOuterVlanID - size += 2 - // field[1] m.SubInnerVlanID - size += 2 - // field[1] m.SubIfFlags - size += 4 - // field[1] m.VtrOp - size += 4 - // field[1] m.VtrPushDot1q - size += 4 - // field[1] m.VtrTag1 - size += 4 - // field[1] m.VtrTag2 - size += 4 - // field[1] m.OuterTag - size += 2 - // field[1] m.BDmac - size += 6 - // field[1] m.BSmac - size += 6 - // field[1] m.BVlanid - size += 2 - // field[1] m.ISid - size += 4 - // field[1] m.InterfaceName - size += 64 - // field[1] m.InterfaceDevType - size += 64 - // field[1] m.Tag - size += 64 - return size -} -func (m *SwInterfaceDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.SupSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SupSwIfIndex)) - pos += 4 - // field[1] m.L2Address - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.L2Address) { - x = uint8(m.L2Address[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - // field[1] m.Type - o.PutUint32(buf[pos:pos+4], uint32(m.Type)) - pos += 4 - // field[1] m.LinkDuplex - o.PutUint32(buf[pos:pos+4], uint32(m.LinkDuplex)) - pos += 4 - // field[1] m.LinkSpeed - o.PutUint32(buf[pos:pos+4], uint32(m.LinkSpeed)) - pos += 4 - // field[1] m.LinkMtu - o.PutUint16(buf[pos:pos+2], uint16(m.LinkMtu)) - pos += 2 - // field[1] m.Mtu - for i := 0; i < 4; i++ { - var x uint32 - if i < len(m.Mtu) { - x = uint32(m.Mtu[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - // field[1] m.SubID - o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) - pos += 4 - // field[1] m.SubNumberOfTags - buf[pos] = uint8(m.SubNumberOfTags) - pos += 1 - // field[1] m.SubOuterVlanID - o.PutUint16(buf[pos:pos+2], uint16(m.SubOuterVlanID)) - pos += 2 - // field[1] m.SubInnerVlanID - o.PutUint16(buf[pos:pos+2], uint16(m.SubInnerVlanID)) - pos += 2 - // field[1] m.SubIfFlags - o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) - pos += 4 - // field[1] m.VtrOp - o.PutUint32(buf[pos:pos+4], uint32(m.VtrOp)) - pos += 4 - // field[1] m.VtrPushDot1q - o.PutUint32(buf[pos:pos+4], uint32(m.VtrPushDot1q)) - pos += 4 - // field[1] m.VtrTag1 - o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag1)) - pos += 4 - // field[1] m.VtrTag2 - o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag2)) - pos += 4 - // field[1] m.OuterTag - o.PutUint16(buf[pos:pos+2], uint16(m.OuterTag)) - pos += 2 - // field[1] m.BDmac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.BDmac) { - x = uint8(m.BDmac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.BSmac - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.BSmac) { - x = uint8(m.BSmac[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.BVlanid - o.PutUint16(buf[pos:pos+2], uint16(m.BVlanid)) - pos += 2 - // field[1] m.ISid - o.PutUint32(buf[pos:pos+4], uint32(m.ISid)) - pos += 4 - // field[1] m.InterfaceName - copy(buf[pos:pos+64], m.InterfaceName) - pos += 64 - // field[1] m.InterfaceDevType - copy(buf[pos:pos+64], m.InterfaceDevType) - pos += 64 - // field[1] m.Tag - copy(buf[pos:pos+64], m.Tag) - pos += 64 - return buf, nil -} -func (m *SwInterfaceDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SupSwIfIndex - m.SupSwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.L2Address - for i := 0; i < len(m.L2Address); i++ { - m.L2Address[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Flags - m.Flags = interface_types.IfStatusFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Type - m.Type = interface_types.IfType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.LinkDuplex - m.LinkDuplex = interface_types.LinkDuplex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.LinkSpeed - m.LinkSpeed = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.LinkMtu - m.LinkMtu = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.Mtu - m.Mtu = make([]uint32, 4) - for i := 0; i < len(m.Mtu); i++ { - m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - // field[1] m.SubID - m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SubNumberOfTags - m.SubNumberOfTags = uint8(tmp[pos]) - pos += 1 - // field[1] m.SubOuterVlanID - m.SubOuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.SubInnerVlanID - m.SubInnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.SubIfFlags - m.SubIfFlags = interface_types.SubIfFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VtrOp - m.VtrOp = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VtrPushDot1q - m.VtrPushDot1q = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VtrTag1 - m.VtrTag1 = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VtrTag2 - m.VtrTag2 = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.OuterTag - m.OuterTag = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.BDmac - for i := 0; i < len(m.BDmac); i++ { - m.BDmac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.BSmac - for i := 0; i < len(m.BSmac); i++ { - m.BSmac[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.BVlanid - m.BVlanid = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.ISid - m.ISid = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.InterfaceName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.InterfaceName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.InterfaceDevType - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.InterfaceDevType = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.Tag - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Tag = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. -type SwInterfaceDump struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4.294967295e+09" json:"sw_if_index,omitempty"` - NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"` - XXX_NameFilterLen uint32 `struc:"sizeof=NameFilter"` - NameFilter string `json:"name_filter,omitempty"` -} - -func (m *SwInterfaceDump) Reset() { *m = SwInterfaceDump{} } -func (*SwInterfaceDump) GetMessageName() string { return "sw_interface_dump" } -func (*SwInterfaceDump) GetCrcString() string { return "aa610c27" } -func (*SwInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.NameFilterValid - size += 1 - // field[1] m.NameFilter - size += 4 + len(m.NameFilter) - return size -} -func (m *SwInterfaceDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.NameFilterValid - if m.NameFilterValid { - buf[pos] = 1 - } - pos += 1 - // field[1] m.NameFilter - o.PutUint32(buf[pos:pos+4], uint32(len(m.NameFilter))) - pos += 4 - copy(buf[pos:pos+len(m.NameFilter)], m.NameFilter[:]) - pos += len(m.NameFilter) - return buf, nil -} -func (m *SwInterfaceDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NameFilterValid - m.NameFilterValid = tmp[pos] != 0 - pos += 1 - // field[1] m.NameFilter - { - siz := o.Uint32(tmp[pos : pos+4]) - pos += 4 - m.NameFilter = codec.DecodeString(tmp[pos : pos+int(siz)]) - pos += len(m.NameFilter) - } - return nil -} - -// SwInterfaceEvent represents VPP binary API message 'sw_interface_event'. -type SwInterfaceEvent struct { - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - Deleted bool `binapi:"bool,name=deleted" json:"deleted,omitempty"` -} - -func (m *SwInterfaceEvent) Reset() { *m = SwInterfaceEvent{} } -func (*SwInterfaceEvent) GetMessageName() string { return "sw_interface_event" } -func (*SwInterfaceEvent) GetCrcString() string { return "f709f78d" } -func (*SwInterfaceEvent) GetMessageType() api.MessageType { return api.EventMessage } - -func (m *SwInterfaceEvent) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.PID - size += 4 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Flags - size += 4 - // field[1] m.Deleted - size += 1 - return size -} -func (m *SwInterfaceEvent) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.PID - o.PutUint32(buf[pos:pos+4], uint32(m.PID)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - // field[1] m.Deleted - if m.Deleted { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceEvent) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.PID - m.PID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Flags - m.Flags = interface_types.IfStatusFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Deleted - m.Deleted = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address'. -type SwInterfaceGetMacAddress struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *SwInterfaceGetMacAddress) Reset() { *m = SwInterfaceGetMacAddress{} } -func (*SwInterfaceGetMacAddress) GetMessageName() string { return "sw_interface_get_mac_address" } -func (*SwInterfaceGetMacAddress) GetCrcString() string { return "f9e6675e" } -func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceGetMacAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *SwInterfaceGetMacAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceGetMacAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply'. -type SwInterfaceGetMacAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` -} - -func (m *SwInterfaceGetMacAddressReply) Reset() { *m = SwInterfaceGetMacAddressReply{} } -func (*SwInterfaceGetMacAddressReply) GetMessageName() string { - return "sw_interface_get_mac_address_reply" -} -func (*SwInterfaceGetMacAddressReply) GetCrcString() string { return "40ef2c08" } -func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceGetMacAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.MacAddress - size += 6 - return size -} -func (m *SwInterfaceGetMacAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SwInterfaceGetMacAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table'. -type SwInterfaceGetTable struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *SwInterfaceGetTable) Reset() { *m = SwInterfaceGetTable{} } -func (*SwInterfaceGetTable) GetMessageName() string { return "sw_interface_get_table" } -func (*SwInterfaceGetTable) GetCrcString() string { return "2d033de4" } -func (*SwInterfaceGetTable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceGetTable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *SwInterfaceGetTable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceGetTable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply'. -type SwInterfaceGetTableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` -} - -func (m *SwInterfaceGetTableReply) Reset() { *m = SwInterfaceGetTableReply{} } -func (*SwInterfaceGetTableReply) GetMessageName() string { return "sw_interface_get_table_reply" } -func (*SwInterfaceGetTableReply) GetCrcString() string { return "a6eb0109" } -func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceGetTableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.VrfID - size += 4 - return size -} -func (m *SwInterfaceGetTableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.VrfID - o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceGetTableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VrfID - m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details'. -type SwInterfaceRxPlacementDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` - WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` - Mode interface_types.RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` -} - -func (m *SwInterfaceRxPlacementDetails) Reset() { *m = SwInterfaceRxPlacementDetails{} } -func (*SwInterfaceRxPlacementDetails) GetMessageName() string { - return "sw_interface_rx_placement_details" -} -func (*SwInterfaceRxPlacementDetails) GetCrcString() string { return "f6d7d024" } -func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceRxPlacementDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.QueueID - size += 4 - // field[1] m.WorkerID - size += 4 - // field[1] m.Mode - size += 4 - return size -} -func (m *SwInterfaceRxPlacementDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.QueueID - o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) - pos += 4 - // field[1] m.WorkerID - o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceRxPlacementDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.QueueID - m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.WorkerID - m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = interface_types.RxMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump'. -type SwInterfaceRxPlacementDump struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *SwInterfaceRxPlacementDump) Reset() { *m = SwInterfaceRxPlacementDump{} } -func (*SwInterfaceRxPlacementDump) GetMessageName() string { return "sw_interface_rx_placement_dump" } -func (*SwInterfaceRxPlacementDump) GetCrcString() string { return "f9e6675e" } -func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceRxPlacementDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *SwInterfaceRxPlacementDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceRxPlacementDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags'. -type SwInterfaceSetFlags struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` -} - -func (m *SwInterfaceSetFlags) Reset() { *m = SwInterfaceSetFlags{} } -func (*SwInterfaceSetFlags) GetMessageName() string { return "sw_interface_set_flags" } -func (*SwInterfaceSetFlags) GetCrcString() string { return "6a2b491a" } -func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetFlags) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Flags - size += 4 - return size -} -func (m *SwInterfaceSetFlags) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetFlags) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Flags - m.Flags = interface_types.IfStatusFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply'. -type SwInterfaceSetFlagsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetFlagsReply) Reset() { *m = SwInterfaceSetFlagsReply{} } -func (*SwInterfaceSetFlagsReply) GetMessageName() string { return "sw_interface_set_flags_reply" } -func (*SwInterfaceSetFlagsReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetFlagsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetFlagsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetFlagsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast'. -type SwInterfaceSetIPDirectedBroadcast struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` -} - -func (m *SwInterfaceSetIPDirectedBroadcast) Reset() { *m = SwInterfaceSetIPDirectedBroadcast{} } -func (*SwInterfaceSetIPDirectedBroadcast) GetMessageName() string { - return "sw_interface_set_ip_directed_broadcast" -} -func (*SwInterfaceSetIPDirectedBroadcast) GetCrcString() string { return "ae6cfcfb" } -func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetIPDirectedBroadcast) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Enable - size += 1 - return size -} -func (m *SwInterfaceSetIPDirectedBroadcast) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Enable - if m.Enable { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceSetIPDirectedBroadcast) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Enable - m.Enable = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply'. -type SwInterfaceSetIPDirectedBroadcastReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetIPDirectedBroadcastReply) Reset() { - *m = SwInterfaceSetIPDirectedBroadcastReply{} -} -func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageName() string { - return "sw_interface_set_ip_directed_broadcast_reply" -} -func (*SwInterfaceSetIPDirectedBroadcastReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *SwInterfaceSetIPDirectedBroadcastReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetIPDirectedBroadcastReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetIPDirectedBroadcastReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address'. -type SwInterfaceSetMacAddress struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` -} - -func (m *SwInterfaceSetMacAddress) Reset() { *m = SwInterfaceSetMacAddress{} } -func (*SwInterfaceSetMacAddress) GetMessageName() string { return "sw_interface_set_mac_address" } -func (*SwInterfaceSetMacAddress) GetCrcString() string { return "6aca746a" } -func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetMacAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.MacAddress - size += 6 - return size -} -func (m *SwInterfaceSetMacAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SwInterfaceSetMacAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply'. -type SwInterfaceSetMacAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetMacAddressReply) Reset() { *m = SwInterfaceSetMacAddressReply{} } -func (*SwInterfaceSetMacAddressReply) GetMessageName() string { - return "sw_interface_set_mac_address_reply" -} -func (*SwInterfaceSetMacAddressReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetMacAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetMacAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetMacAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu'. -type SwInterfaceSetMtu struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` -} - -func (m *SwInterfaceSetMtu) Reset() { *m = SwInterfaceSetMtu{} } -func (*SwInterfaceSetMtu) GetMessageName() string { return "sw_interface_set_mtu" } -func (*SwInterfaceSetMtu) GetCrcString() string { return "5cbe85e5" } -func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetMtu) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Mtu - size += 16 - return size -} -func (m *SwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Mtu - for i := 0; i < 4; i++ { - var x uint32 - if i < len(m.Mtu) { - x = uint32(m.Mtu[i]) - } - o.PutUint32(buf[pos:pos+4], uint32(x)) - pos += 4 - } - return buf, nil -} -func (m *SwInterfaceSetMtu) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mtu - m.Mtu = make([]uint32, 4) - for i := 0; i < len(m.Mtu); i++ { - m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply'. -type SwInterfaceSetMtuReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetMtuReply) Reset() { *m = SwInterfaceSetMtuReply{} } -func (*SwInterfaceSetMtuReply) GetMessageName() string { return "sw_interface_set_mtu_reply" } -func (*SwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetMtuReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode'. -type SwInterfaceSetRxMode struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - QueueIDValid bool `binapi:"bool,name=queue_id_valid" json:"queue_id_valid,omitempty"` - QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` - Mode interface_types.RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` -} - -func (m *SwInterfaceSetRxMode) Reset() { *m = SwInterfaceSetRxMode{} } -func (*SwInterfaceSetRxMode) GetMessageName() string { return "sw_interface_set_rx_mode" } -func (*SwInterfaceSetRxMode) GetCrcString() string { return "780f5cee" } -func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetRxMode) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.QueueIDValid - size += 1 - // field[1] m.QueueID - size += 4 - // field[1] m.Mode - size += 4 - return size -} -func (m *SwInterfaceSetRxMode) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.QueueIDValid - if m.QueueIDValid { - buf[pos] = 1 - } - pos += 1 - // field[1] m.QueueID - o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetRxMode) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.QueueIDValid - m.QueueIDValid = tmp[pos] != 0 - pos += 1 - // field[1] m.QueueID - m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = interface_types.RxMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply'. -type SwInterfaceSetRxModeReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetRxModeReply) Reset() { *m = SwInterfaceSetRxModeReply{} } -func (*SwInterfaceSetRxModeReply) GetMessageName() string { return "sw_interface_set_rx_mode_reply" } -func (*SwInterfaceSetRxModeReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetRxModeReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetRxModeReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetRxModeReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement'. -type SwInterfaceSetRxPlacement struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` - WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` - IsMain bool `binapi:"bool,name=is_main" json:"is_main,omitempty"` -} - -func (m *SwInterfaceSetRxPlacement) Reset() { *m = SwInterfaceSetRxPlacement{} } -func (*SwInterfaceSetRxPlacement) GetMessageName() string { return "sw_interface_set_rx_placement" } -func (*SwInterfaceSetRxPlacement) GetCrcString() string { return "db65f3c9" } -func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetRxPlacement) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.QueueID - size += 4 - // field[1] m.WorkerID - size += 4 - // field[1] m.IsMain - size += 1 - return size -} -func (m *SwInterfaceSetRxPlacement) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.QueueID - o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) - pos += 4 - // field[1] m.WorkerID - o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) - pos += 4 - // field[1] m.IsMain - if m.IsMain { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceSetRxPlacement) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.QueueID - m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.WorkerID - m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsMain - m.IsMain = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply'. -type SwInterfaceSetRxPlacementReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetRxPlacementReply) Reset() { *m = SwInterfaceSetRxPlacementReply{} } -func (*SwInterfaceSetRxPlacementReply) GetMessageName() string { - return "sw_interface_set_rx_placement_reply" -} -func (*SwInterfaceSetRxPlacementReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetRxPlacementReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetRxPlacementReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetRxPlacementReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table'. -type SwInterfaceSetTable struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` -} - -func (m *SwInterfaceSetTable) Reset() { *m = SwInterfaceSetTable{} } -func (*SwInterfaceSetTable) GetMessageName() string { return "sw_interface_set_table" } -func (*SwInterfaceSetTable) GetCrcString() string { return "df42a577" } -func (*SwInterfaceSetTable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetTable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - // field[1] m.VrfID - size += 4 - return size -} -func (m *SwInterfaceSetTable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.VrfID - o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetTable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - // field[1] m.VrfID - m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply'. -type SwInterfaceSetTableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetTableReply) Reset() { *m = SwInterfaceSetTableReply{} } -func (*SwInterfaceSetTableReply) GetMessageName() string { return "sw_interface_set_table_reply" } -func (*SwInterfaceSetTableReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetTableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetTableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetTableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered'. -type SwInterfaceSetUnnumbered struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - UnnumberedSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=unnumbered_sw_if_index" json:"unnumbered_sw_if_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` -} - -func (m *SwInterfaceSetUnnumbered) Reset() { *m = SwInterfaceSetUnnumbered{} } -func (*SwInterfaceSetUnnumbered) GetMessageName() string { return "sw_interface_set_unnumbered" } -func (*SwInterfaceSetUnnumbered) GetCrcString() string { return "938ef33b" } -func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceSetUnnumbered) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.UnnumberedSwIfIndex - size += 4 - // field[1] m.IsAdd - size += 1 - return size -} -func (m *SwInterfaceSetUnnumbered) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.UnnumberedSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.UnnumberedSwIfIndex)) - pos += 4 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceSetUnnumbered) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.UnnumberedSwIfIndex - m.UnnumberedSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply'. -type SwInterfaceSetUnnumberedReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceSetUnnumberedReply) Reset() { *m = SwInterfaceSetUnnumberedReply{} } -func (*SwInterfaceSetUnnumberedReply) GetMessageName() string { - return "sw_interface_set_unnumbered_reply" -} -func (*SwInterfaceSetUnnumberedReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceSetUnnumberedReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceSetUnnumberedReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceSetUnnumberedReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. -type SwInterfaceTagAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` -} - -func (m *SwInterfaceTagAddDel) Reset() { *m = SwInterfaceTagAddDel{} } -func (*SwInterfaceTagAddDel) GetMessageName() string { return "sw_interface_tag_add_del" } -func (*SwInterfaceTagAddDel) GetCrcString() string { return "426f8bc1" } -func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceTagAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Tag - size += 64 - return size -} -func (m *SwInterfaceTagAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Tag - copy(buf[pos:pos+64], m.Tag) - pos += 64 - return buf, nil -} -func (m *SwInterfaceTagAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Tag - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Tag = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply'. -type SwInterfaceTagAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceTagAddDelReply) Reset() { *m = SwInterfaceTagAddDelReply{} } -func (*SwInterfaceTagAddDelReply) GetMessageName() string { return "sw_interface_tag_add_del_reply" } -func (*SwInterfaceTagAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceTagAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceTagAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceTagAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// WantInterfaceEvents represents VPP binary API message 'want_interface_events'. -type WantInterfaceEvents struct { - EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` -} - -func (m *WantInterfaceEvents) Reset() { *m = WantInterfaceEvents{} } -func (*WantInterfaceEvents) GetMessageName() string { return "want_interface_events" } -func (*WantInterfaceEvents) GetCrcString() string { return "476f5a08" } -func (*WantInterfaceEvents) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *WantInterfaceEvents) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.EnableDisable - size += 4 - // field[1] m.PID - size += 4 - return size -} -func (m *WantInterfaceEvents) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.EnableDisable - o.PutUint32(buf[pos:pos+4], uint32(m.EnableDisable)) - pos += 4 - // field[1] m.PID - o.PutUint32(buf[pos:pos+4], uint32(m.PID)) - pos += 4 - return buf, nil -} -func (m *WantInterfaceEvents) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.EnableDisable - m.EnableDisable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.PID - m.PID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply'. -type WantInterfaceEventsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *WantInterfaceEventsReply) Reset() { *m = WantInterfaceEventsReply{} } -func (*WantInterfaceEventsReply) GetMessageName() string { return "want_interface_events_reply" } -func (*WantInterfaceEventsReply) GetCrcString() string { return "e8d4e804" } -func (*WantInterfaceEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *WantInterfaceEventsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *WantInterfaceEventsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *WantInterfaceEventsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -func init() { file_interfaces_binapi_init() } -func file_interfaces_binapi_init() { - api.RegisterMessage((*CollectDetailedInterfaceStats)(nil), "interface.CollectDetailedInterfaceStats") - api.RegisterMessage((*CollectDetailedInterfaceStatsReply)(nil), "interface.CollectDetailedInterfaceStatsReply") - api.RegisterMessage((*CreateLoopback)(nil), "interface.CreateLoopback") - api.RegisterMessage((*CreateLoopbackInstance)(nil), "interface.CreateLoopbackInstance") - api.RegisterMessage((*CreateLoopbackInstanceReply)(nil), "interface.CreateLoopbackInstanceReply") - api.RegisterMessage((*CreateLoopbackReply)(nil), "interface.CreateLoopbackReply") - api.RegisterMessage((*CreateSubif)(nil), "interface.CreateSubif") - api.RegisterMessage((*CreateSubifReply)(nil), "interface.CreateSubifReply") - api.RegisterMessage((*CreateVlanSubif)(nil), "interface.CreateVlanSubif") - api.RegisterMessage((*CreateVlanSubifReply)(nil), "interface.CreateVlanSubifReply") - api.RegisterMessage((*DeleteLoopback)(nil), "interface.DeleteLoopback") - api.RegisterMessage((*DeleteLoopbackReply)(nil), "interface.DeleteLoopbackReply") - api.RegisterMessage((*DeleteSubif)(nil), "interface.DeleteSubif") - api.RegisterMessage((*DeleteSubifReply)(nil), "interface.DeleteSubifReply") - api.RegisterMessage((*HwInterfaceSetMtu)(nil), "interface.HwInterfaceSetMtu") - api.RegisterMessage((*HwInterfaceSetMtuReply)(nil), "interface.HwInterfaceSetMtuReply") - api.RegisterMessage((*InterfaceNameRenumber)(nil), "interface.InterfaceNameRenumber") - api.RegisterMessage((*InterfaceNameRenumberReply)(nil), "interface.InterfaceNameRenumberReply") - api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "interface.SwInterfaceAddDelAddress") - api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "interface.SwInterfaceAddDelAddressReply") - api.RegisterMessage((*SwInterfaceAddDelMacAddress)(nil), "interface.SwInterfaceAddDelMacAddress") - api.RegisterMessage((*SwInterfaceAddDelMacAddressReply)(nil), "interface.SwInterfaceAddDelMacAddressReply") - api.RegisterMessage((*SwInterfaceAddressReplaceBegin)(nil), "interface.SwInterfaceAddressReplaceBegin") - api.RegisterMessage((*SwInterfaceAddressReplaceBeginReply)(nil), "interface.SwInterfaceAddressReplaceBeginReply") - api.RegisterMessage((*SwInterfaceAddressReplaceEnd)(nil), "interface.SwInterfaceAddressReplaceEnd") - api.RegisterMessage((*SwInterfaceAddressReplaceEndReply)(nil), "interface.SwInterfaceAddressReplaceEndReply") - api.RegisterMessage((*SwInterfaceClearStats)(nil), "interface.SwInterfaceClearStats") - api.RegisterMessage((*SwInterfaceClearStatsReply)(nil), "interface.SwInterfaceClearStatsReply") - api.RegisterMessage((*SwInterfaceDetails)(nil), "interface.SwInterfaceDetails") - api.RegisterMessage((*SwInterfaceDump)(nil), "interface.SwInterfaceDump") - api.RegisterMessage((*SwInterfaceEvent)(nil), "interface.SwInterfaceEvent") - api.RegisterMessage((*SwInterfaceGetMacAddress)(nil), "interface.SwInterfaceGetMacAddress") - api.RegisterMessage((*SwInterfaceGetMacAddressReply)(nil), "interface.SwInterfaceGetMacAddressReply") - api.RegisterMessage((*SwInterfaceGetTable)(nil), "interface.SwInterfaceGetTable") - api.RegisterMessage((*SwInterfaceGetTableReply)(nil), "interface.SwInterfaceGetTableReply") - api.RegisterMessage((*SwInterfaceRxPlacementDetails)(nil), "interface.SwInterfaceRxPlacementDetails") - api.RegisterMessage((*SwInterfaceRxPlacementDump)(nil), "interface.SwInterfaceRxPlacementDump") - api.RegisterMessage((*SwInterfaceSetFlags)(nil), "interface.SwInterfaceSetFlags") - api.RegisterMessage((*SwInterfaceSetFlagsReply)(nil), "interface.SwInterfaceSetFlagsReply") - api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcast)(nil), "interface.SwInterfaceSetIPDirectedBroadcast") - api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcastReply)(nil), "interface.SwInterfaceSetIPDirectedBroadcastReply") - api.RegisterMessage((*SwInterfaceSetMacAddress)(nil), "interface.SwInterfaceSetMacAddress") - api.RegisterMessage((*SwInterfaceSetMacAddressReply)(nil), "interface.SwInterfaceSetMacAddressReply") - api.RegisterMessage((*SwInterfaceSetMtu)(nil), "interface.SwInterfaceSetMtu") - api.RegisterMessage((*SwInterfaceSetMtuReply)(nil), "interface.SwInterfaceSetMtuReply") - api.RegisterMessage((*SwInterfaceSetRxMode)(nil), "interface.SwInterfaceSetRxMode") - api.RegisterMessage((*SwInterfaceSetRxModeReply)(nil), "interface.SwInterfaceSetRxModeReply") - api.RegisterMessage((*SwInterfaceSetRxPlacement)(nil), "interface.SwInterfaceSetRxPlacement") - api.RegisterMessage((*SwInterfaceSetRxPlacementReply)(nil), "interface.SwInterfaceSetRxPlacementReply") - api.RegisterMessage((*SwInterfaceSetTable)(nil), "interface.SwInterfaceSetTable") - api.RegisterMessage((*SwInterfaceSetTableReply)(nil), "interface.SwInterfaceSetTableReply") - api.RegisterMessage((*SwInterfaceSetUnnumbered)(nil), "interface.SwInterfaceSetUnnumbered") - api.RegisterMessage((*SwInterfaceSetUnnumberedReply)(nil), "interface.SwInterfaceSetUnnumberedReply") - api.RegisterMessage((*SwInterfaceTagAddDel)(nil), "interface.SwInterfaceTagAddDel") - api.RegisterMessage((*SwInterfaceTagAddDelReply)(nil), "interface.SwInterfaceTagAddDelReply") - api.RegisterMessage((*WantInterfaceEvents)(nil), "interface.WantInterfaceEvents") - api.RegisterMessage((*WantInterfaceEventsReply)(nil), "interface.WantInterfaceEventsReply") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*CollectDetailedInterfaceStats)(nil), - (*CollectDetailedInterfaceStatsReply)(nil), - (*CreateLoopback)(nil), - (*CreateLoopbackInstance)(nil), - (*CreateLoopbackInstanceReply)(nil), - (*CreateLoopbackReply)(nil), - (*CreateSubif)(nil), - (*CreateSubifReply)(nil), - (*CreateVlanSubif)(nil), - (*CreateVlanSubifReply)(nil), - (*DeleteLoopback)(nil), - (*DeleteLoopbackReply)(nil), - (*DeleteSubif)(nil), - (*DeleteSubifReply)(nil), - (*HwInterfaceSetMtu)(nil), - (*HwInterfaceSetMtuReply)(nil), - (*InterfaceNameRenumber)(nil), - (*InterfaceNameRenumberReply)(nil), - (*SwInterfaceAddDelAddress)(nil), - (*SwInterfaceAddDelAddressReply)(nil), - (*SwInterfaceAddDelMacAddress)(nil), - (*SwInterfaceAddDelMacAddressReply)(nil), - (*SwInterfaceAddressReplaceBegin)(nil), - (*SwInterfaceAddressReplaceBeginReply)(nil), - (*SwInterfaceAddressReplaceEnd)(nil), - (*SwInterfaceAddressReplaceEndReply)(nil), - (*SwInterfaceClearStats)(nil), - (*SwInterfaceClearStatsReply)(nil), - (*SwInterfaceDetails)(nil), - (*SwInterfaceDump)(nil), - (*SwInterfaceEvent)(nil), - (*SwInterfaceGetMacAddress)(nil), - (*SwInterfaceGetMacAddressReply)(nil), - (*SwInterfaceGetTable)(nil), - (*SwInterfaceGetTableReply)(nil), - (*SwInterfaceRxPlacementDetails)(nil), - (*SwInterfaceRxPlacementDump)(nil), - (*SwInterfaceSetFlags)(nil), - (*SwInterfaceSetFlagsReply)(nil), - (*SwInterfaceSetIPDirectedBroadcast)(nil), - (*SwInterfaceSetIPDirectedBroadcastReply)(nil), - (*SwInterfaceSetMacAddress)(nil), - (*SwInterfaceSetMacAddressReply)(nil), - (*SwInterfaceSetMtu)(nil), - (*SwInterfaceSetMtuReply)(nil), - (*SwInterfaceSetRxMode)(nil), - (*SwInterfaceSetRxModeReply)(nil), - (*SwInterfaceSetRxPlacement)(nil), - (*SwInterfaceSetRxPlacementReply)(nil), - (*SwInterfaceSetTable)(nil), - (*SwInterfaceSetTableReply)(nil), - (*SwInterfaceSetUnnumbered)(nil), - (*SwInterfaceSetUnnumberedReply)(nil), - (*SwInterfaceTagAddDel)(nil), - (*SwInterfaceTagAddDelReply)(nil), - (*WantInterfaceEvents)(nil), - (*WantInterfaceEventsReply)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/interfaces/interfaces_rpc.ba.go b/examples/binapi/interfaces/interfaces_rpc.ba.go deleted file mode 100644 index a7235a8..0000000 --- a/examples/binapi/interfaces/interfaces_rpc.ba.go +++ /dev/null @@ -1,341 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package interfaces - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for interface module. -type RPCService interface { - DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) - DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) - CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) - CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) - CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) - CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) - CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) - DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) - DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) - HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) - InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) - SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) - SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) - SwInterfaceAddressReplaceBegin(ctx context.Context, in *SwInterfaceAddressReplaceBegin) (*SwInterfaceAddressReplaceBeginReply, error) - SwInterfaceAddressReplaceEnd(ctx context.Context, in *SwInterfaceAddressReplaceEnd) (*SwInterfaceAddressReplaceEndReply, error) - SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) - SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) - SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) - SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) - SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) - SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) - SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) - SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) - SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) - SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) - SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) - SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) - WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSwInterfaceClient{stream} - return x, nil -} - -type RPCService_DumpSwInterfaceClient interface { - Recv() (*SwInterfaceDetails, error) -} - -type serviceClient_DumpSwInterfaceClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSwInterfaceClient) Recv() (*SwInterfaceDetails, error) { - m := new(SwInterfaceDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSwInterfaceRxPlacementClient{stream} - return x, nil -} - -type RPCService_DumpSwInterfaceRxPlacementClient interface { - Recv() (*SwInterfaceRxPlacementDetails, error) -} - -type serviceClient_DumpSwInterfaceRxPlacementClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSwInterfaceRxPlacementClient) Recv() (*SwInterfaceRxPlacementDetails, error) { - m := new(SwInterfaceRxPlacementDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { - out := new(CollectDetailedInterfaceStatsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { - out := new(CreateLoopbackReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { - out := new(CreateLoopbackInstanceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { - out := new(CreateSubifReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { - out := new(CreateVlanSubifReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { - out := new(DeleteLoopbackReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { - out := new(DeleteSubifReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { - out := new(HwInterfaceSetMtuReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { - out := new(InterfaceNameRenumberReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { - out := new(SwInterfaceAddDelAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { - out := new(SwInterfaceAddDelMacAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceAddressReplaceBegin(ctx context.Context, in *SwInterfaceAddressReplaceBegin) (*SwInterfaceAddressReplaceBeginReply, error) { - out := new(SwInterfaceAddressReplaceBeginReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceAddressReplaceEnd(ctx context.Context, in *SwInterfaceAddressReplaceEnd) (*SwInterfaceAddressReplaceEndReply, error) { - out := new(SwInterfaceAddressReplaceEndReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { - out := new(SwInterfaceClearStatsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { - out := new(SwInterfaceGetMacAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { - out := new(SwInterfaceGetTableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { - out := new(SwInterfaceSetFlagsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { - out := new(SwInterfaceSetIPDirectedBroadcastReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { - out := new(SwInterfaceSetMacAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { - out := new(SwInterfaceSetMtuReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { - out := new(SwInterfaceSetRxModeReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { - out := new(SwInterfaceSetRxPlacementReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { - out := new(SwInterfaceSetTableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { - out := new(SwInterfaceSetUnnumberedReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { - out := new(SwInterfaceTagAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { - out := new(WantInterfaceEventsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/examples/binapi/ip/ip.ba.go b/examples/binapi/ip/ip.ba.go deleted file mode 100644 index ed8640b..0000000 --- a/examples/binapi/ip/ip.ba.go +++ /dev/null @@ -1,5317 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/ip.api.json - -/* -Package ip contains generated code for VPP API file ip.api (3.0.1). - -It consists of: - 7 aliases - 15 enums - 60 messages - 14 types - 1 union -*/ -package ip - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" - - fib_types "git.fd.io/govpp.git/examples/binapi/fib_types" - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "ip" - // APIVersion is the API version of this module. - APIVersion = "3.0.1" - // VersionCrc is the CRC of this module. - VersionCrc = 0x765d74b1 -) - -// IPReassType represents VPP binary API enum 'ip_reass_type'. -type IPReassType uint32 - -const ( - IP_REASS_TYPE_FULL IPReassType = 0 - IP_REASS_TYPE_SHALLOW_VIRTUAL IPReassType = 1 -) - -var ( - IPReassType_name = map[uint32]string{ - 0: "IP_REASS_TYPE_FULL", - 1: "IP_REASS_TYPE_SHALLOW_VIRTUAL", - } - IPReassType_value = map[string]uint32{ - "IP_REASS_TYPE_FULL": 0, - "IP_REASS_TYPE_SHALLOW_VIRTUAL": 1, - } -) - -func (x IPReassType) String() string { - s, ok := IPReassType_name[uint32(x)] - if ok { - return s - } - return "IPReassType(" + strconv.Itoa(int(x)) + ")" -} - -// MfibItfFlags represents VPP binary API enum 'mfib_itf_flags'. -type MfibItfFlags uint32 - -const ( - MFIB_API_ITF_FLAG_NONE MfibItfFlags = 0 - MFIB_API_ITF_FLAG_NEGATE_SIGNAL MfibItfFlags = 1 - MFIB_API_ITF_FLAG_ACCEPT MfibItfFlags = 2 - MFIB_API_ITF_FLAG_FORWARD MfibItfFlags = 4 - MFIB_API_ITF_FLAG_SIGNAL_PRESENT MfibItfFlags = 8 - MFIB_API_ITF_FLAG_DONT_PRESERVE MfibItfFlags = 16 -) - -var ( - MfibItfFlags_name = map[uint32]string{ - 0: "MFIB_API_ITF_FLAG_NONE", - 1: "MFIB_API_ITF_FLAG_NEGATE_SIGNAL", - 2: "MFIB_API_ITF_FLAG_ACCEPT", - 4: "MFIB_API_ITF_FLAG_FORWARD", - 8: "MFIB_API_ITF_FLAG_SIGNAL_PRESENT", - 16: "MFIB_API_ITF_FLAG_DONT_PRESERVE", - } - MfibItfFlags_value = map[string]uint32{ - "MFIB_API_ITF_FLAG_NONE": 0, - "MFIB_API_ITF_FLAG_NEGATE_SIGNAL": 1, - "MFIB_API_ITF_FLAG_ACCEPT": 2, - "MFIB_API_ITF_FLAG_FORWARD": 4, - "MFIB_API_ITF_FLAG_SIGNAL_PRESENT": 8, - "MFIB_API_ITF_FLAG_DONT_PRESERVE": 16, - } -) - -func (x MfibItfFlags) String() string { - s, ok := MfibItfFlags_name[uint32(x)] - if ok { - return s - } - return "MfibItfFlags(" + strconv.Itoa(int(x)) + ")" -} - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -func ParseMAC(mac string) (parsed MacAddress, err error) { - var hw net.HardwareAddr - if hw, err = net.ParseMAC(mac); err != nil { - return - } - copy(parsed[:], hw[:]) - return -} - -func (m *MacAddress) ToString() string { - return net.HardwareAddr(m[:]).String() -} - -// IPMroute represents VPP binary API type 'ip_mroute'. -type IPMroute struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - EntryFlags uint32 `binapi:"u32,name=entry_flags" json:"entry_flags,omitempty"` - RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` - Prefix fib_types.Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` - NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` - Paths []MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` -} - -func (*IPMroute) GetTypeName() string { return "ip_mroute" } - -// IPRoute represents VPP binary API type 'ip_route'. -type IPRoute struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` - Prefix fib_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` - Paths []fib_types.FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` -} - -func (*IPRoute) GetTypeName() string { return "ip_route" } - -// IPTable represents VPP binary API type 'ip_table'. -type IPTable struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` -} - -func (*IPTable) GetTypeName() string { return "ip_table" } - -// MfibPath represents VPP binary API type 'mfib_path'. -type MfibPath struct { - ItfFlags MfibItfFlags `binapi:"mfib_itf_flags,name=itf_flags" json:"itf_flags,omitempty"` - Path fib_types.FibPath `binapi:"fib_path,name=path" json:"path,omitempty"` -} - -func (*MfibPath) GetTypeName() string { return "mfib_path" } - -// PuntRedirect represents VPP binary API type 'punt_redirect'. -type PuntRedirect struct { - RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` - TxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` - Nh fib_types.Address `binapi:"address,name=nh" json:"nh,omitempty"` -} - -func (*PuntRedirect) GetTypeName() string { return "punt_redirect" } - -// IoamDisable represents VPP binary API message 'ioam_disable'. -type IoamDisable struct { - ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` -} - -func (m *IoamDisable) Reset() { *m = IoamDisable{} } -func (*IoamDisable) GetMessageName() string { return "ioam_disable" } -func (*IoamDisable) GetCrcString() string { return "6b16a45e" } -func (*IoamDisable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IoamDisable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ID - size += 2 - return size -} -func (m *IoamDisable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ID - o.PutUint16(buf[pos:pos+2], uint16(m.ID)) - pos += 2 - return buf, nil -} -func (m *IoamDisable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ID - m.ID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - return nil -} - -// IoamDisableReply represents VPP binary API message 'ioam_disable_reply'. -type IoamDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IoamDisableReply) Reset() { *m = IoamDisableReply{} } -func (*IoamDisableReply) GetMessageName() string { return "ioam_disable_reply" } -func (*IoamDisableReply) GetCrcString() string { return "e8d4e804" } -func (*IoamDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IoamDisableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IoamDisableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IoamDisableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IoamEnable represents VPP binary API message 'ioam_enable'. -type IoamEnable struct { - ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` - Seqno bool `binapi:"bool,name=seqno" json:"seqno,omitempty"` - Analyse bool `binapi:"bool,name=analyse" json:"analyse,omitempty"` - PotEnable bool `binapi:"bool,name=pot_enable" json:"pot_enable,omitempty"` - TraceEnable bool `binapi:"bool,name=trace_enable" json:"trace_enable,omitempty"` - NodeID uint32 `binapi:"u32,name=node_id" json:"node_id,omitempty"` -} - -func (m *IoamEnable) Reset() { *m = IoamEnable{} } -func (*IoamEnable) GetMessageName() string { return "ioam_enable" } -func (*IoamEnable) GetCrcString() string { return "51ccd868" } -func (*IoamEnable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IoamEnable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.ID - size += 2 - // field[1] m.Seqno - size += 1 - // field[1] m.Analyse - size += 1 - // field[1] m.PotEnable - size += 1 - // field[1] m.TraceEnable - size += 1 - // field[1] m.NodeID - size += 4 - return size -} -func (m *IoamEnable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.ID - o.PutUint16(buf[pos:pos+2], uint16(m.ID)) - pos += 2 - // field[1] m.Seqno - if m.Seqno { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Analyse - if m.Analyse { - buf[pos] = 1 - } - pos += 1 - // field[1] m.PotEnable - if m.PotEnable { - buf[pos] = 1 - } - pos += 1 - // field[1] m.TraceEnable - if m.TraceEnable { - buf[pos] = 1 - } - pos += 1 - // field[1] m.NodeID - o.PutUint32(buf[pos:pos+4], uint32(m.NodeID)) - pos += 4 - return buf, nil -} -func (m *IoamEnable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.ID - m.ID = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.Seqno - m.Seqno = tmp[pos] != 0 - pos += 1 - // field[1] m.Analyse - m.Analyse = tmp[pos] != 0 - pos += 1 - // field[1] m.PotEnable - m.PotEnable = tmp[pos] != 0 - pos += 1 - // field[1] m.TraceEnable - m.TraceEnable = tmp[pos] != 0 - pos += 1 - // field[1] m.NodeID - m.NodeID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IoamEnableReply represents VPP binary API message 'ioam_enable_reply'. -type IoamEnableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IoamEnableReply) Reset() { *m = IoamEnableReply{} } -func (*IoamEnableReply) GetMessageName() string { return "ioam_enable_reply" } -func (*IoamEnableReply) GetCrcString() string { return "e8d4e804" } -func (*IoamEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IoamEnableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IoamEnableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IoamEnableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPAddressDetails represents VPP binary API message 'ip_address_details'. -type IPAddressDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Prefix fib_types.AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` -} - -func (m *IPAddressDetails) Reset() { *m = IPAddressDetails{} } -func (*IPAddressDetails) GetMessageName() string { return "ip_address_details" } -func (*IPAddressDetails) GetCrcString() string { return "b1199745" } -func (*IPAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPAddressDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 1 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - return size -} -func (m *IPAddressDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - buf[pos] = uint8(m.Prefix.Address.Af) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - return buf, nil -} -func (m *IPAddressDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - return nil -} - -// IPAddressDump represents VPP binary API message 'ip_address_dump'. -type IPAddressDump struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *IPAddressDump) Reset() { *m = IPAddressDump{} } -func (*IPAddressDump) GetMessageName() string { return "ip_address_dump" } -func (*IPAddressDump) GetCrcString() string { return "2d033de4" } -func (*IPAddressDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPAddressDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *IPAddressDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPAddressDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del'. -type IPContainerProxyAddDel struct { - Pfx fib_types.Prefix `binapi:"prefix,name=pfx" json:"pfx,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` -} - -func (m *IPContainerProxyAddDel) Reset() { *m = IPContainerProxyAddDel{} } -func (*IPContainerProxyAddDel) GetMessageName() string { return "ip_container_proxy_add_del" } -func (*IPContainerProxyAddDel) GetCrcString() string { return "91189f40" } -func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPContainerProxyAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Pfx - // field[2] m.Pfx.Address - // field[3] m.Pfx.Address.Af - size += 1 - // field[3] m.Pfx.Address.Un - size += 16 - // field[2] m.Pfx.Len - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsAdd - size += 1 - return size -} -func (m *IPContainerProxyAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Pfx - // field[2] m.Pfx.Address - // field[3] m.Pfx.Address.Af - buf[pos] = uint8(m.Pfx.Address.Af) - pos += 1 - // field[3] m.Pfx.Address.Un - copy(buf[pos:pos+16], m.Pfx.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Pfx.Len - buf[pos] = uint8(m.Pfx.Len) - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPContainerProxyAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Pfx - // field[2] m.Pfx.Address - // field[3] m.Pfx.Address.Af - m.Pfx.Address.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Pfx.Address.Un - copy(m.Pfx.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Pfx.Len - m.Pfx.Len = uint8(tmp[pos]) - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply'. -type IPContainerProxyAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPContainerProxyAddDelReply) Reset() { *m = IPContainerProxyAddDelReply{} } -func (*IPContainerProxyAddDelReply) GetMessageName() string { - return "ip_container_proxy_add_del_reply" -} -func (*IPContainerProxyAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPContainerProxyAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPContainerProxyAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPContainerProxyAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details'. -type IPContainerProxyDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Prefix fib_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` -} - -func (m *IPContainerProxyDetails) Reset() { *m = IPContainerProxyDetails{} } -func (*IPContainerProxyDetails) GetMessageName() string { return "ip_container_proxy_details" } -func (*IPContainerProxyDetails) GetCrcString() string { return "0ee460e8" } -func (*IPContainerProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPContainerProxyDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 1 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - return size -} -func (m *IPContainerProxyDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - buf[pos] = uint8(m.Prefix.Address.Af) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - return buf, nil -} -func (m *IPContainerProxyDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - return nil -} - -// IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump'. -type IPContainerProxyDump struct{} - -func (m *IPContainerProxyDump) Reset() { *m = IPContainerProxyDump{} } -func (*IPContainerProxyDump) GetMessageName() string { return "ip_container_proxy_dump" } -func (*IPContainerProxyDump) GetCrcString() string { return "51077d14" } -func (*IPContainerProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPContainerProxyDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *IPContainerProxyDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *IPContainerProxyDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// IPDetails represents VPP binary API message 'ip_details'. -type IPDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *IPDetails) Reset() { *m = IPDetails{} } -func (*IPDetails) GetMessageName() string { return "ip_details" } -func (*IPDetails) GetCrcString() string { return "eb152d07" } -func (*IPDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *IPDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPDump represents VPP binary API message 'ip_dump'. -type IPDump struct { - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *IPDump) Reset() { *m = IPDump{} } -func (*IPDump) GetMessageName() string { return "ip_dump" } -func (*IPDump) GetCrcString() string { return "98d231ca" } -func (*IPDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *IPDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del'. -type IPMrouteAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` - Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` -} - -func (m *IPMrouteAddDel) Reset() { *m = IPMrouteAddDel{} } -func (*IPMrouteAddDel) GetMessageName() string { return "ip_mroute_add_del" } -func (*IPMrouteAddDel) GetCrcString() string { return "f6627d17" } -func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPMrouteAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.IsMultipath - size += 1 - // field[1] m.Route - // field[2] m.Route.TableID - size += 4 - // field[2] m.Route.EntryFlags - size += 4 - // field[2] m.Route.RpfID - size += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - size += 1 - // field[3] m.Route.Prefix.GrpAddressLength - size += 2 - // field[3] m.Route.Prefix.GrpAddress - size += 16 - // field[3] m.Route.Prefix.SrcAddress - size += 16 - // field[2] m.Route.NPaths - size += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 MfibPath - _ = s2 - if j2 < len(m.Route.Paths) { - s2 = m.Route.Paths[j2] - } - // field[3] s2.ItfFlags - size += 4 - // field[3] s2.Path - // field[4] s2.Path.SwIfIndex - size += 4 - // field[4] s2.Path.TableID - size += 4 - // field[4] s2.Path.RpfID - size += 4 - // field[4] s2.Path.Weight - size += 1 - // field[4] s2.Path.Preference - size += 1 - // field[4] s2.Path.Type - size += 4 - // field[4] s2.Path.Flags - size += 4 - // field[4] s2.Path.Proto - size += 4 - // field[4] s2.Path.Nh - // field[5] s2.Path.Nh.Address - size += 16 - // field[5] s2.Path.Nh.ViaLabel - size += 4 - // field[5] s2.Path.Nh.ObjID - size += 4 - // field[5] s2.Path.Nh.ClassifyTableIndex - size += 4 - // field[4] s2.Path.NLabels - size += 1 - // field[4] s2.Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - var s4 fib_types.FibMplsLabel - _ = s4 - if j4 < len(s2.Path.LabelStack) { - s4 = s2.Path.LabelStack[j4] - } - // field[5] s4.IsUniform - size += 1 - // field[5] s4.Label - size += 4 - // field[5] s4.TTL - size += 1 - // field[5] s4.Exp - size += 1 - } - } - return size -} -func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.IsMultipath - if m.IsMultipath { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Route - // field[2] m.Route.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) - pos += 4 - // field[2] m.Route.EntryFlags - o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) - pos += 4 - // field[2] m.Route.RpfID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - buf[pos] = uint8(m.Route.Prefix.Af) - pos += 1 - // field[3] m.Route.Prefix.GrpAddressLength - o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) - pos += 2 - // field[3] m.Route.Prefix.GrpAddress - copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) - pos += 16 - // field[3] m.Route.Prefix.SrcAddress - copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) - pos += 16 - // field[2] m.Route.NPaths - buf[pos] = uint8(len(m.Route.Paths)) - pos += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 MfibPath - if j2 < len(m.Route.Paths) { - v2 = m.Route.Paths[j2] - } - // field[3] v2.ItfFlags - o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) - pos += 4 - // field[3] v2.Path - // field[4] v2.Path.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) - pos += 4 - // field[4] v2.Path.TableID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) - pos += 4 - // field[4] v2.Path.RpfID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) - pos += 4 - // field[4] v2.Path.Weight - buf[pos] = uint8(v2.Path.Weight) - pos += 1 - // field[4] v2.Path.Preference - buf[pos] = uint8(v2.Path.Preference) - pos += 1 - // field[4] v2.Path.Type - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) - pos += 4 - // field[4] v2.Path.Flags - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) - pos += 4 - // field[4] v2.Path.Proto - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) - pos += 4 - // field[4] v2.Path.Nh - // field[5] v2.Path.Nh.Address - copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) - pos += 16 - // field[5] v2.Path.Nh.ViaLabel - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) - pos += 4 - // field[5] v2.Path.Nh.ObjID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) - pos += 4 - // field[5] v2.Path.Nh.ClassifyTableIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) - pos += 4 - // field[4] v2.Path.NLabels - buf[pos] = uint8(v2.Path.NLabels) - pos += 1 - // field[4] v2.Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - var v4 fib_types.FibMplsLabel - if j4 < len(v2.Path.LabelStack) { - v4 = v2.Path.LabelStack[j4] - } - // field[5] v4.IsUniform - buf[pos] = uint8(v4.IsUniform) - pos += 1 - // field[5] v4.Label - o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) - pos += 4 - // field[5] v4.TTL - buf[pos] = uint8(v4.TTL) - pos += 1 - // field[5] v4.Exp - buf[pos] = uint8(v4.Exp) - pos += 1 - } - } - return buf, nil -} -func (m *IPMrouteAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.IsMultipath - m.IsMultipath = tmp[pos] != 0 - pos += 1 - // field[1] m.Route - // field[2] m.Route.TableID - m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.EntryFlags - m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.RpfID - m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - m.Route.Prefix.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Route.Prefix.GrpAddressLength - m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[3] m.Route.Prefix.GrpAddress - copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.Route.Prefix.SrcAddress - copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Route.NPaths - m.Route.NPaths = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.Paths - m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) - for j2 := 0; j2 < int(m.Route.NPaths); j2++ { - // field[3] m.Route.Paths[j2].ItfFlags - m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Path - // field[4] m.Route.Paths[j2].Path.SwIfIndex - m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.TableID - m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.RpfID - m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Weight - m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.Preference - m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.Type - m.Route.Paths[j2].Path.Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Flags - m.Route.Paths[j2].Path.Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Proto - m.Route.Paths[j2].Path.Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Nh - // field[5] m.Route.Paths[j2].Path.Nh.Address - copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel - m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.Nh.ObjID - m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex - m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.NLabels - m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform - m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) - pos += 1 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label - m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL - m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) - pos += 1 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp - m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply'. -type IPMrouteAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` -} - -func (m *IPMrouteAddDelReply) Reset() { *m = IPMrouteAddDelReply{} } -func (*IPMrouteAddDelReply) GetMessageName() string { return "ip_mroute_add_del_reply" } -func (*IPMrouteAddDelReply) GetCrcString() string { return "1992deab" } -func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPMrouteAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.StatsIndex - size += 4 - return size -} -func (m *IPMrouteAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.StatsIndex - o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) - pos += 4 - return buf, nil -} -func (m *IPMrouteAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.StatsIndex - m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPMrouteDetails represents VPP binary API message 'ip_mroute_details'. -type IPMrouteDetails struct { - Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` -} - -func (m *IPMrouteDetails) Reset() { *m = IPMrouteDetails{} } -func (*IPMrouteDetails) GetMessageName() string { return "ip_mroute_details" } -func (*IPMrouteDetails) GetCrcString() string { return "c1cb4b44" } -func (*IPMrouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPMrouteDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Route - // field[2] m.Route.TableID - size += 4 - // field[2] m.Route.EntryFlags - size += 4 - // field[2] m.Route.RpfID - size += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - size += 1 - // field[3] m.Route.Prefix.GrpAddressLength - size += 2 - // field[3] m.Route.Prefix.GrpAddress - size += 16 - // field[3] m.Route.Prefix.SrcAddress - size += 16 - // field[2] m.Route.NPaths - size += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 MfibPath - _ = s2 - if j2 < len(m.Route.Paths) { - s2 = m.Route.Paths[j2] - } - // field[3] s2.ItfFlags - size += 4 - // field[3] s2.Path - // field[4] s2.Path.SwIfIndex - size += 4 - // field[4] s2.Path.TableID - size += 4 - // field[4] s2.Path.RpfID - size += 4 - // field[4] s2.Path.Weight - size += 1 - // field[4] s2.Path.Preference - size += 1 - // field[4] s2.Path.Type - size += 4 - // field[4] s2.Path.Flags - size += 4 - // field[4] s2.Path.Proto - size += 4 - // field[4] s2.Path.Nh - // field[5] s2.Path.Nh.Address - size += 16 - // field[5] s2.Path.Nh.ViaLabel - size += 4 - // field[5] s2.Path.Nh.ObjID - size += 4 - // field[5] s2.Path.Nh.ClassifyTableIndex - size += 4 - // field[4] s2.Path.NLabels - size += 1 - // field[4] s2.Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - var s4 fib_types.FibMplsLabel - _ = s4 - if j4 < len(s2.Path.LabelStack) { - s4 = s2.Path.LabelStack[j4] - } - // field[5] s4.IsUniform - size += 1 - // field[5] s4.Label - size += 4 - // field[5] s4.TTL - size += 1 - // field[5] s4.Exp - size += 1 - } - } - return size -} -func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Route - // field[2] m.Route.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) - pos += 4 - // field[2] m.Route.EntryFlags - o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) - pos += 4 - // field[2] m.Route.RpfID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - buf[pos] = uint8(m.Route.Prefix.Af) - pos += 1 - // field[3] m.Route.Prefix.GrpAddressLength - o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) - pos += 2 - // field[3] m.Route.Prefix.GrpAddress - copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) - pos += 16 - // field[3] m.Route.Prefix.SrcAddress - copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) - pos += 16 - // field[2] m.Route.NPaths - buf[pos] = uint8(len(m.Route.Paths)) - pos += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 MfibPath - if j2 < len(m.Route.Paths) { - v2 = m.Route.Paths[j2] - } - // field[3] v2.ItfFlags - o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) - pos += 4 - // field[3] v2.Path - // field[4] v2.Path.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) - pos += 4 - // field[4] v2.Path.TableID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) - pos += 4 - // field[4] v2.Path.RpfID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) - pos += 4 - // field[4] v2.Path.Weight - buf[pos] = uint8(v2.Path.Weight) - pos += 1 - // field[4] v2.Path.Preference - buf[pos] = uint8(v2.Path.Preference) - pos += 1 - // field[4] v2.Path.Type - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) - pos += 4 - // field[4] v2.Path.Flags - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) - pos += 4 - // field[4] v2.Path.Proto - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) - pos += 4 - // field[4] v2.Path.Nh - // field[5] v2.Path.Nh.Address - copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) - pos += 16 - // field[5] v2.Path.Nh.ViaLabel - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) - pos += 4 - // field[5] v2.Path.Nh.ObjID - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) - pos += 4 - // field[5] v2.Path.Nh.ClassifyTableIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) - pos += 4 - // field[4] v2.Path.NLabels - buf[pos] = uint8(v2.Path.NLabels) - pos += 1 - // field[4] v2.Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - var v4 fib_types.FibMplsLabel - if j4 < len(v2.Path.LabelStack) { - v4 = v2.Path.LabelStack[j4] - } - // field[5] v4.IsUniform - buf[pos] = uint8(v4.IsUniform) - pos += 1 - // field[5] v4.Label - o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) - pos += 4 - // field[5] v4.TTL - buf[pos] = uint8(v4.TTL) - pos += 1 - // field[5] v4.Exp - buf[pos] = uint8(v4.Exp) - pos += 1 - } - } - return buf, nil -} -func (m *IPMrouteDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Route - // field[2] m.Route.TableID - m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.EntryFlags - m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.RpfID - m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Af - m.Route.Prefix.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Route.Prefix.GrpAddressLength - m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[3] m.Route.Prefix.GrpAddress - copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.Route.Prefix.SrcAddress - copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Route.NPaths - m.Route.NPaths = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.Paths - m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) - for j2 := 0; j2 < int(m.Route.NPaths); j2++ { - // field[3] m.Route.Paths[j2].ItfFlags - m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Path - // field[4] m.Route.Paths[j2].Path.SwIfIndex - m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.TableID - m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.RpfID - m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Weight - m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.Preference - m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.Type - m.Route.Paths[j2].Path.Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Flags - m.Route.Paths[j2].Path.Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Proto - m.Route.Paths[j2].Path.Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.Nh - // field[5] m.Route.Paths[j2].Path.Nh.Address - copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel - m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.Nh.ObjID - m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex - m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Path.NLabels - m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].Path.LabelStack - for j4 := 0; j4 < 16; j4++ { - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform - m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) - pos += 1 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label - m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL - m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) - pos += 1 - // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp - m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// IPMrouteDump represents VPP binary API message 'ip_mroute_dump'. -type IPMrouteDump struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPMrouteDump) Reset() { *m = IPMrouteDump{} } -func (*IPMrouteDump) GetMessageName() string { return "ip_mroute_dump" } -func (*IPMrouteDump) GetCrcString() string { return "b9d2e09e" } -func (*IPMrouteDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPMrouteDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPMrouteDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPMrouteDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPMtableDetails represents VPP binary API message 'ip_mtable_details'. -type IPMtableDetails struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPMtableDetails) Reset() { *m = IPMtableDetails{} } -func (*IPMtableDetails) GetMessageName() string { return "ip_mtable_details" } -func (*IPMtableDetails) GetCrcString() string { return "b9d2e09e" } -func (*IPMtableDetails) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPMtableDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPMtableDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPMtableDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPMtableDump represents VPP binary API message 'ip_mtable_dump'. -type IPMtableDump struct{} - -func (m *IPMtableDump) Reset() { *m = IPMtableDump{} } -func (*IPMtableDump) GetMessageName() string { return "ip_mtable_dump" } -func (*IPMtableDump) GetCrcString() string { return "51077d14" } -func (*IPMtableDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPMtableDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *IPMtableDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *IPMtableDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// IPPuntPolice represents VPP binary API message 'ip_punt_police'. -type IPPuntPolice struct { - PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"` - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` -} - -func (m *IPPuntPolice) Reset() { *m = IPPuntPolice{} } -func (*IPPuntPolice) GetMessageName() string { return "ip_punt_police" } -func (*IPPuntPolice) GetCrcString() string { return "db867cea" } -func (*IPPuntPolice) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPPuntPolice) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.PolicerIndex - size += 4 - // field[1] m.IsAdd - size += 1 - // field[1] m.IsIP6 - size += 1 - return size -} -func (m *IPPuntPolice) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.PolicerIndex - o.PutUint32(buf[pos:pos+4], uint32(m.PolicerIndex)) - pos += 4 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.IsIP6 - if m.IsIP6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPPuntPolice) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.PolicerIndex - m.PolicerIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.IsIP6 - m.IsIP6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply'. -type IPPuntPoliceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPPuntPoliceReply) Reset() { *m = IPPuntPoliceReply{} } -func (*IPPuntPoliceReply) GetMessageName() string { return "ip_punt_police_reply" } -func (*IPPuntPoliceReply) GetCrcString() string { return "e8d4e804" } -func (*IPPuntPoliceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPPuntPoliceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPPuntPoliceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPPuntPoliceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPPuntRedirect represents VPP binary API message 'ip_punt_redirect'. -type IPPuntRedirect struct { - Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` -} - -func (m *IPPuntRedirect) Reset() { *m = IPPuntRedirect{} } -func (*IPPuntRedirect) GetMessageName() string { return "ip_punt_redirect" } -func (*IPPuntRedirect) GetCrcString() string { return "a9a5592c" } -func (*IPPuntRedirect) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPPuntRedirect) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - size += 4 - // field[2] m.Punt.TxSwIfIndex - size += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - size += 1 - // field[3] m.Punt.Nh.Un - size += 16 - // field[1] m.IsAdd - size += 1 - return size -} -func (m *IPPuntRedirect) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) - pos += 4 - // field[2] m.Punt.TxSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) - pos += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - buf[pos] = uint8(m.Punt.Nh.Af) - pos += 1 - // field[3] m.Punt.Nh.Un - copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) - pos += 16 - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPPuntRedirect) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - m.Punt.RxSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Punt.TxSwIfIndex - m.Punt.TxSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - m.Punt.Nh.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Punt.Nh.Un - copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details'. -type IPPuntRedirectDetails struct { - Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` -} - -func (m *IPPuntRedirectDetails) Reset() { *m = IPPuntRedirectDetails{} } -func (*IPPuntRedirectDetails) GetMessageName() string { return "ip_punt_redirect_details" } -func (*IPPuntRedirectDetails) GetCrcString() string { return "3924f5d3" } -func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPPuntRedirectDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - size += 4 - // field[2] m.Punt.TxSwIfIndex - size += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - size += 1 - // field[3] m.Punt.Nh.Un - size += 16 - return size -} -func (m *IPPuntRedirectDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) - pos += 4 - // field[2] m.Punt.TxSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) - pos += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - buf[pos] = uint8(m.Punt.Nh.Af) - pos += 1 - // field[3] m.Punt.Nh.Un - copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) - pos += 16 - return buf, nil -} -func (m *IPPuntRedirectDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Punt - // field[2] m.Punt.RxSwIfIndex - m.Punt.RxSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Punt.TxSwIfIndex - m.Punt.TxSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Punt.Nh - // field[3] m.Punt.Nh.Af - m.Punt.Nh.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Punt.Nh.Un - copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - return nil -} - -// IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump'. -type IPPuntRedirectDump struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` -} - -func (m *IPPuntRedirectDump) Reset() { *m = IPPuntRedirectDump{} } -func (*IPPuntRedirectDump) GetMessageName() string { return "ip_punt_redirect_dump" } -func (*IPPuntRedirectDump) GetCrcString() string { return "2d033de4" } -func (*IPPuntRedirectDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPPuntRedirectDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IsIPv6 - size += 1 - return size -} -func (m *IPPuntRedirectDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPPuntRedirectDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply'. -type IPPuntRedirectReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPPuntRedirectReply) Reset() { *m = IPPuntRedirectReply{} } -func (*IPPuntRedirectReply) GetMessageName() string { return "ip_punt_redirect_reply" } -func (*IPPuntRedirectReply) GetCrcString() string { return "e8d4e804" } -func (*IPPuntRedirectReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPPuntRedirectReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPPuntRedirectReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPPuntRedirectReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable'. -type IPReassemblyEnableDisable struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - EnableIP4 bool `binapi:"bool,name=enable_ip4" json:"enable_ip4,omitempty"` - EnableIP6 bool `binapi:"bool,name=enable_ip6" json:"enable_ip6,omitempty"` - Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` -} - -func (m *IPReassemblyEnableDisable) Reset() { *m = IPReassemblyEnableDisable{} } -func (*IPReassemblyEnableDisable) GetMessageName() string { return "ip_reassembly_enable_disable" } -func (*IPReassemblyEnableDisable) GetCrcString() string { return "885c85a6" } -func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPReassemblyEnableDisable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.EnableIP4 - size += 1 - // field[1] m.EnableIP6 - size += 1 - // field[1] m.Type - size += 4 - return size -} -func (m *IPReassemblyEnableDisable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.EnableIP4 - if m.EnableIP4 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.EnableIP6 - if m.EnableIP6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Type - o.PutUint32(buf[pos:pos+4], uint32(m.Type)) - pos += 4 - return buf, nil -} -func (m *IPReassemblyEnableDisable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.EnableIP4 - m.EnableIP4 = tmp[pos] != 0 - pos += 1 - // field[1] m.EnableIP6 - m.EnableIP6 = tmp[pos] != 0 - pos += 1 - // field[1] m.Type - m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply'. -type IPReassemblyEnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPReassemblyEnableDisableReply) Reset() { *m = IPReassemblyEnableDisableReply{} } -func (*IPReassemblyEnableDisableReply) GetMessageName() string { - return "ip_reassembly_enable_disable_reply" -} -func (*IPReassemblyEnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPReassemblyEnableDisableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPReassemblyEnableDisableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPReassemblyEnableDisableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblyGet represents VPP binary API message 'ip_reassembly_get'. -type IPReassemblyGet struct { - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` - Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` -} - -func (m *IPReassemblyGet) Reset() { *m = IPReassemblyGet{} } -func (*IPReassemblyGet) GetMessageName() string { return "ip_reassembly_get" } -func (*IPReassemblyGet) GetCrcString() string { return "ea13ff63" } -func (*IPReassemblyGet) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPReassemblyGet) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsIP6 - size += 1 - // field[1] m.Type - size += 4 - return size -} -func (m *IPReassemblyGet) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsIP6 - if m.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Type - o.PutUint32(buf[pos:pos+4], uint32(m.Type)) - pos += 4 - return buf, nil -} -func (m *IPReassemblyGet) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsIP6 - m.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[1] m.Type - m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply'. -type IPReassemblyGetReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` - MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` - MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` - ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` -} - -func (m *IPReassemblyGetReply) Reset() { *m = IPReassemblyGetReply{} } -func (*IPReassemblyGetReply) GetMessageName() string { return "ip_reassembly_get_reply" } -func (*IPReassemblyGetReply) GetCrcString() string { return "d5eb8d34" } -func (*IPReassemblyGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPReassemblyGetReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.TimeoutMs - size += 4 - // field[1] m.MaxReassemblies - size += 4 - // field[1] m.MaxReassemblyLength - size += 4 - // field[1] m.ExpireWalkIntervalMs - size += 4 - // field[1] m.IsIP6 - size += 1 - return size -} -func (m *IPReassemblyGetReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.TimeoutMs - o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) - pos += 4 - // field[1] m.MaxReassemblies - o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) - pos += 4 - // field[1] m.MaxReassemblyLength - o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) - pos += 4 - // field[1] m.ExpireWalkIntervalMs - o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) - pos += 4 - // field[1] m.IsIP6 - if m.IsIP6 { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *IPReassemblyGetReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TimeoutMs - m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MaxReassemblies - m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MaxReassemblyLength - m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ExpireWalkIntervalMs - m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIP6 - m.IsIP6 = tmp[pos] != 0 - pos += 1 - return nil -} - -// IPReassemblySet represents VPP binary API message 'ip_reassembly_set'. -type IPReassemblySet struct { - TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` - MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` - MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` - ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` - IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` - Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` -} - -func (m *IPReassemblySet) Reset() { *m = IPReassemblySet{} } -func (*IPReassemblySet) GetMessageName() string { return "ip_reassembly_set" } -func (*IPReassemblySet) GetCrcString() string { return "16467d25" } -func (*IPReassemblySet) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPReassemblySet) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.TimeoutMs - size += 4 - // field[1] m.MaxReassemblies - size += 4 - // field[1] m.MaxReassemblyLength - size += 4 - // field[1] m.ExpireWalkIntervalMs - size += 4 - // field[1] m.IsIP6 - size += 1 - // field[1] m.Type - size += 4 - return size -} -func (m *IPReassemblySet) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.TimeoutMs - o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) - pos += 4 - // field[1] m.MaxReassemblies - o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) - pos += 4 - // field[1] m.MaxReassemblyLength - o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) - pos += 4 - // field[1] m.ExpireWalkIntervalMs - o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) - pos += 4 - // field[1] m.IsIP6 - if m.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Type - o.PutUint32(buf[pos:pos+4], uint32(m.Type)) - pos += 4 - return buf, nil -} -func (m *IPReassemblySet) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.TimeoutMs - m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MaxReassemblies - m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MaxReassemblyLength - m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ExpireWalkIntervalMs - m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIP6 - m.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[1] m.Type - m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply'. -type IPReassemblySetReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPReassemblySetReply) Reset() { *m = IPReassemblySetReply{} } -func (*IPReassemblySetReply) GetMessageName() string { return "ip_reassembly_set_reply" } -func (*IPReassemblySetReply) GetCrcString() string { return "e8d4e804" } -func (*IPReassemblySetReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPReassemblySetReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPReassemblySetReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPReassemblySetReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPRouteAddDel represents VPP binary API message 'ip_route_add_del'. -type IPRouteAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` - Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` -} - -func (m *IPRouteAddDel) Reset() { *m = IPRouteAddDel{} } -func (*IPRouteAddDel) GetMessageName() string { return "ip_route_add_del" } -func (*IPRouteAddDel) GetCrcString() string { return "c1ff832d" } -func (*IPRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPRouteAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.IsMultipath - size += 1 - // field[1] m.Route - // field[2] m.Route.TableID - size += 4 - // field[2] m.Route.StatsIndex - size += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - size += 1 - // field[4] m.Route.Prefix.Address.Un - size += 16 - // field[3] m.Route.Prefix.Len - size += 1 - // field[2] m.Route.NPaths - size += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 fib_types.FibPath - _ = s2 - if j2 < len(m.Route.Paths) { - s2 = m.Route.Paths[j2] - } - // field[3] s2.SwIfIndex - size += 4 - // field[3] s2.TableID - size += 4 - // field[3] s2.RpfID - size += 4 - // field[3] s2.Weight - size += 1 - // field[3] s2.Preference - size += 1 - // field[3] s2.Type - size += 4 - // field[3] s2.Flags - size += 4 - // field[3] s2.Proto - size += 4 - // field[3] s2.Nh - // field[4] s2.Nh.Address - size += 16 - // field[4] s2.Nh.ViaLabel - size += 4 - // field[4] s2.Nh.ObjID - size += 4 - // field[4] s2.Nh.ClassifyTableIndex - size += 4 - // field[3] s2.NLabels - size += 1 - // field[3] s2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var s3 fib_types.FibMplsLabel - _ = s3 - if j3 < len(s2.LabelStack) { - s3 = s2.LabelStack[j3] - } - // field[4] s3.IsUniform - size += 1 - // field[4] s3.Label - size += 4 - // field[4] s3.TTL - size += 1 - // field[4] s3.Exp - size += 1 - } - } - return size -} -func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.IsMultipath - if m.IsMultipath { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Route - // field[2] m.Route.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) - pos += 4 - // field[2] m.Route.StatsIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - buf[pos] = uint8(m.Route.Prefix.Address.Af) - pos += 1 - // field[4] m.Route.Prefix.Address.Un - copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] m.Route.Prefix.Len - buf[pos] = uint8(m.Route.Prefix.Len) - pos += 1 - // field[2] m.Route.NPaths - buf[pos] = uint8(len(m.Route.Paths)) - pos += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 fib_types.FibPath - if j2 < len(m.Route.Paths) { - v2 = m.Route.Paths[j2] - } - // field[3] v2.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) - pos += 4 - // field[3] v2.TableID - o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) - pos += 4 - // field[3] v2.RpfID - o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) - pos += 4 - // field[3] v2.Weight - buf[pos] = uint8(v2.Weight) - pos += 1 - // field[3] v2.Preference - buf[pos] = uint8(v2.Preference) - pos += 1 - // field[3] v2.Type - o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) - pos += 4 - // field[3] v2.Flags - o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) - pos += 4 - // field[3] v2.Proto - o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) - pos += 4 - // field[3] v2.Nh - // field[4] v2.Nh.Address - copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) - pos += 16 - // field[4] v2.Nh.ViaLabel - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) - pos += 4 - // field[4] v2.Nh.ObjID - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) - pos += 4 - // field[4] v2.Nh.ClassifyTableIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) - pos += 4 - // field[3] v2.NLabels - buf[pos] = uint8(v2.NLabels) - pos += 1 - // field[3] v2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var v3 fib_types.FibMplsLabel - if j3 < len(v2.LabelStack) { - v3 = v2.LabelStack[j3] - } - // field[4] v3.IsUniform - buf[pos] = uint8(v3.IsUniform) - pos += 1 - // field[4] v3.Label - o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) - pos += 4 - // field[4] v3.TTL - buf[pos] = uint8(v3.TTL) - pos += 1 - // field[4] v3.Exp - buf[pos] = uint8(v3.Exp) - pos += 1 - } - } - return buf, nil -} -func (m *IPRouteAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.IsMultipath - m.IsMultipath = tmp[pos] != 0 - pos += 1 - // field[1] m.Route - // field[2] m.Route.TableID - m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.StatsIndex - m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.Route.Prefix.Address.Un - copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.Route.Prefix.Len - m.Route.Prefix.Len = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.NPaths - m.Route.NPaths = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.Paths - m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths)) - for j2 := 0; j2 < int(m.Route.NPaths); j2++ { - // field[3] m.Route.Paths[j2].SwIfIndex - m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].TableID - m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].RpfID - m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Weight - m.Route.Paths[j2].Weight = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Preference - m.Route.Paths[j2].Preference = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Type - m.Route.Paths[j2].Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Flags - m.Route.Paths[j2].Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Proto - m.Route.Paths[j2].Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Nh - // field[4] m.Route.Paths[j2].Nh.Address - copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[4] m.Route.Paths[j2].Nh.ViaLabel - m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ObjID - m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex - m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].NLabels - m.Route.Paths[j2].NLabels = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].LabelStack - for j3 := 0; j3 < 16; j3++ { - // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform - m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Label - m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].LabelStack[j3].TTL - m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Exp - m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// IPRouteAddDelReply represents VPP binary API message 'ip_route_add_del_reply'. -type IPRouteAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` -} - -func (m *IPRouteAddDelReply) Reset() { *m = IPRouteAddDelReply{} } -func (*IPRouteAddDelReply) GetMessageName() string { return "ip_route_add_del_reply" } -func (*IPRouteAddDelReply) GetCrcString() string { return "1992deab" } -func (*IPRouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPRouteAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.StatsIndex - size += 4 - return size -} -func (m *IPRouteAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.StatsIndex - o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) - pos += 4 - return buf, nil -} -func (m *IPRouteAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.StatsIndex - m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPRouteDetails represents VPP binary API message 'ip_route_details'. -type IPRouteDetails struct { - Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` -} - -func (m *IPRouteDetails) Reset() { *m = IPRouteDetails{} } -func (*IPRouteDetails) GetMessageName() string { return "ip_route_details" } -func (*IPRouteDetails) GetCrcString() string { return "d1ffaae1" } -func (*IPRouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPRouteDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Route - // field[2] m.Route.TableID - size += 4 - // field[2] m.Route.StatsIndex - size += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - size += 1 - // field[4] m.Route.Prefix.Address.Un - size += 16 - // field[3] m.Route.Prefix.Len - size += 1 - // field[2] m.Route.NPaths - size += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 fib_types.FibPath - _ = s2 - if j2 < len(m.Route.Paths) { - s2 = m.Route.Paths[j2] - } - // field[3] s2.SwIfIndex - size += 4 - // field[3] s2.TableID - size += 4 - // field[3] s2.RpfID - size += 4 - // field[3] s2.Weight - size += 1 - // field[3] s2.Preference - size += 1 - // field[3] s2.Type - size += 4 - // field[3] s2.Flags - size += 4 - // field[3] s2.Proto - size += 4 - // field[3] s2.Nh - // field[4] s2.Nh.Address - size += 16 - // field[4] s2.Nh.ViaLabel - size += 4 - // field[4] s2.Nh.ObjID - size += 4 - // field[4] s2.Nh.ClassifyTableIndex - size += 4 - // field[3] s2.NLabels - size += 1 - // field[3] s2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var s3 fib_types.FibMplsLabel - _ = s3 - if j3 < len(s2.LabelStack) { - s3 = s2.LabelStack[j3] - } - // field[4] s3.IsUniform - size += 1 - // field[4] s3.Label - size += 4 - // field[4] s3.TTL - size += 1 - // field[4] s3.Exp - size += 1 - } - } - return size -} -func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Route - // field[2] m.Route.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) - pos += 4 - // field[2] m.Route.StatsIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - buf[pos] = uint8(m.Route.Prefix.Address.Af) - pos += 1 - // field[4] m.Route.Prefix.Address.Un - copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] m.Route.Prefix.Len - buf[pos] = uint8(m.Route.Prefix.Len) - pos += 1 - // field[2] m.Route.NPaths - buf[pos] = uint8(len(m.Route.Paths)) - pos += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 fib_types.FibPath - if j2 < len(m.Route.Paths) { - v2 = m.Route.Paths[j2] - } - // field[3] v2.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) - pos += 4 - // field[3] v2.TableID - o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) - pos += 4 - // field[3] v2.RpfID - o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) - pos += 4 - // field[3] v2.Weight - buf[pos] = uint8(v2.Weight) - pos += 1 - // field[3] v2.Preference - buf[pos] = uint8(v2.Preference) - pos += 1 - // field[3] v2.Type - o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) - pos += 4 - // field[3] v2.Flags - o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) - pos += 4 - // field[3] v2.Proto - o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) - pos += 4 - // field[3] v2.Nh - // field[4] v2.Nh.Address - copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) - pos += 16 - // field[4] v2.Nh.ViaLabel - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) - pos += 4 - // field[4] v2.Nh.ObjID - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) - pos += 4 - // field[4] v2.Nh.ClassifyTableIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) - pos += 4 - // field[3] v2.NLabels - buf[pos] = uint8(v2.NLabels) - pos += 1 - // field[3] v2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var v3 fib_types.FibMplsLabel - if j3 < len(v2.LabelStack) { - v3 = v2.LabelStack[j3] - } - // field[4] v3.IsUniform - buf[pos] = uint8(v3.IsUniform) - pos += 1 - // field[4] v3.Label - o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) - pos += 4 - // field[4] v3.TTL - buf[pos] = uint8(v3.TTL) - pos += 1 - // field[4] v3.Exp - buf[pos] = uint8(v3.Exp) - pos += 1 - } - } - return buf, nil -} -func (m *IPRouteDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Route - // field[2] m.Route.TableID - m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.StatsIndex - m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.Route.Prefix.Address.Un - copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.Route.Prefix.Len - m.Route.Prefix.Len = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.NPaths - m.Route.NPaths = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.Paths - m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths)) - for j2 := 0; j2 < int(m.Route.NPaths); j2++ { - // field[3] m.Route.Paths[j2].SwIfIndex - m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].TableID - m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].RpfID - m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Weight - m.Route.Paths[j2].Weight = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Preference - m.Route.Paths[j2].Preference = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Type - m.Route.Paths[j2].Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Flags - m.Route.Paths[j2].Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Proto - m.Route.Paths[j2].Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Nh - // field[4] m.Route.Paths[j2].Nh.Address - copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[4] m.Route.Paths[j2].Nh.ViaLabel - m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ObjID - m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex - m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].NLabels - m.Route.Paths[j2].NLabels = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].LabelStack - for j3 := 0; j3 < 16; j3++ { - // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform - m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Label - m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].LabelStack[j3].TTL - m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Exp - m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// IPRouteDump represents VPP binary API message 'ip_route_dump'. -type IPRouteDump struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPRouteDump) Reset() { *m = IPRouteDump{} } -func (*IPRouteDump) GetMessageName() string { return "ip_route_dump" } -func (*IPRouteDump) GetCrcString() string { return "b9d2e09e" } -func (*IPRouteDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPRouteDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPRouteDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPRouteDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPRouteLookup represents VPP binary API message 'ip_route_lookup'. -type IPRouteLookup struct { - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - Exact uint8 `binapi:"u8,name=exact" json:"exact,omitempty"` - Prefix fib_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` -} - -func (m *IPRouteLookup) Reset() { *m = IPRouteLookup{} } -func (*IPRouteLookup) GetMessageName() string { return "ip_route_lookup" } -func (*IPRouteLookup) GetCrcString() string { return "e2986185" } -func (*IPRouteLookup) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPRouteLookup) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.TableID - size += 4 - // field[1] m.Exact - size += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 1 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - return size -} -func (m *IPRouteLookup) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) - pos += 4 - // field[1] m.Exact - buf[pos] = uint8(m.Exact) - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - buf[pos] = uint8(m.Prefix.Address.Af) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - return buf, nil -} -func (m *IPRouteLookup) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.TableID - m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Exact - m.Exact = uint8(tmp[pos]) - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - return nil -} - -// IPRouteLookupReply represents VPP binary API message 'ip_route_lookup_reply'. -type IPRouteLookupReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` -} - -func (m *IPRouteLookupReply) Reset() { *m = IPRouteLookupReply{} } -func (*IPRouteLookupReply) GetMessageName() string { return "ip_route_lookup_reply" } -func (*IPRouteLookupReply) GetCrcString() string { return "ae99de8e" } -func (*IPRouteLookupReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPRouteLookupReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.Route - // field[2] m.Route.TableID - size += 4 - // field[2] m.Route.StatsIndex - size += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - size += 1 - // field[4] m.Route.Prefix.Address.Un - size += 16 - // field[3] m.Route.Prefix.Len - size += 1 - // field[2] m.Route.NPaths - size += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var s2 fib_types.FibPath - _ = s2 - if j2 < len(m.Route.Paths) { - s2 = m.Route.Paths[j2] - } - // field[3] s2.SwIfIndex - size += 4 - // field[3] s2.TableID - size += 4 - // field[3] s2.RpfID - size += 4 - // field[3] s2.Weight - size += 1 - // field[3] s2.Preference - size += 1 - // field[3] s2.Type - size += 4 - // field[3] s2.Flags - size += 4 - // field[3] s2.Proto - size += 4 - // field[3] s2.Nh - // field[4] s2.Nh.Address - size += 16 - // field[4] s2.Nh.ViaLabel - size += 4 - // field[4] s2.Nh.ObjID - size += 4 - // field[4] s2.Nh.ClassifyTableIndex - size += 4 - // field[3] s2.NLabels - size += 1 - // field[3] s2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var s3 fib_types.FibMplsLabel - _ = s3 - if j3 < len(s2.LabelStack) { - s3 = s2.LabelStack[j3] - } - // field[4] s3.IsUniform - size += 1 - // field[4] s3.Label - size += 4 - // field[4] s3.TTL - size += 1 - // field[4] s3.Exp - size += 1 - } - } - return size -} -func (m *IPRouteLookupReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.Route - // field[2] m.Route.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) - pos += 4 - // field[2] m.Route.StatsIndex - o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - buf[pos] = uint8(m.Route.Prefix.Address.Af) - pos += 1 - // field[4] m.Route.Prefix.Address.Un - copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[3] m.Route.Prefix.Len - buf[pos] = uint8(m.Route.Prefix.Len) - pos += 1 - // field[2] m.Route.NPaths - buf[pos] = uint8(len(m.Route.Paths)) - pos += 1 - // field[2] m.Route.Paths - for j2 := 0; j2 < len(m.Route.Paths); j2++ { - var v2 fib_types.FibPath - if j2 < len(m.Route.Paths) { - v2 = m.Route.Paths[j2] - } - // field[3] v2.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) - pos += 4 - // field[3] v2.TableID - o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) - pos += 4 - // field[3] v2.RpfID - o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) - pos += 4 - // field[3] v2.Weight - buf[pos] = uint8(v2.Weight) - pos += 1 - // field[3] v2.Preference - buf[pos] = uint8(v2.Preference) - pos += 1 - // field[3] v2.Type - o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) - pos += 4 - // field[3] v2.Flags - o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) - pos += 4 - // field[3] v2.Proto - o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) - pos += 4 - // field[3] v2.Nh - // field[4] v2.Nh.Address - copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) - pos += 16 - // field[4] v2.Nh.ViaLabel - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) - pos += 4 - // field[4] v2.Nh.ObjID - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) - pos += 4 - // field[4] v2.Nh.ClassifyTableIndex - o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) - pos += 4 - // field[3] v2.NLabels - buf[pos] = uint8(v2.NLabels) - pos += 1 - // field[3] v2.LabelStack - for j3 := 0; j3 < 16; j3++ { - var v3 fib_types.FibMplsLabel - if j3 < len(v2.LabelStack) { - v3 = v2.LabelStack[j3] - } - // field[4] v3.IsUniform - buf[pos] = uint8(v3.IsUniform) - pos += 1 - // field[4] v3.Label - o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) - pos += 4 - // field[4] v3.TTL - buf[pos] = uint8(v3.TTL) - pos += 1 - // field[4] v3.Exp - buf[pos] = uint8(v3.Exp) - pos += 1 - } - } - return buf, nil -} -func (m *IPRouteLookupReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Route - // field[2] m.Route.TableID - m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.StatsIndex - m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Route.Prefix - // field[3] m.Route.Prefix.Address - // field[4] m.Route.Prefix.Address.Af - m.Route.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[4] m.Route.Prefix.Address.Un - copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[3] m.Route.Prefix.Len - m.Route.Prefix.Len = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.NPaths - m.Route.NPaths = uint8(tmp[pos]) - pos += 1 - // field[2] m.Route.Paths - m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths)) - for j2 := 0; j2 < int(m.Route.NPaths); j2++ { - // field[3] m.Route.Paths[j2].SwIfIndex - m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].TableID - m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].RpfID - m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Weight - m.Route.Paths[j2].Weight = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Preference - m.Route.Paths[j2].Preference = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].Type - m.Route.Paths[j2].Type = fib_types.FibPathType(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Flags - m.Route.Paths[j2].Flags = fib_types.FibPathFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Proto - m.Route.Paths[j2].Proto = fib_types.FibPathNhProto(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].Nh - // field[4] m.Route.Paths[j2].Nh.Address - copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[4] m.Route.Paths[j2].Nh.ViaLabel - m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ObjID - m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex - m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[3] m.Route.Paths[j2].NLabels - m.Route.Paths[j2].NLabels = uint8(tmp[pos]) - pos += 1 - // field[3] m.Route.Paths[j2].LabelStack - for j3 := 0; j3 < 16; j3++ { - // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform - m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Label - m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[4] m.Route.Paths[j2].LabelStack[j3].TTL - m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) - pos += 1 - // field[4] m.Route.Paths[j2].LabelStack[j3].Exp - m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. -type IPSourceAndPortRangeCheckAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - Prefix fib_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` - LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty" struc:"[32]uint16"` - HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty" struc:"[32]uint16"` - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` -} - -func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeCheckAddDel{} } -func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { - return "ip_source_and_port_range_check_add_del" -} -func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { return "8bfc76f2" } -func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPSourceAndPortRangeCheckAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 1 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - // field[1] m.NumberOfRanges - size += 1 - // field[1] m.LowPorts - size += 64 - // field[1] m.HighPorts - size += 64 - // field[1] m.VrfID - size += 4 - return size -} -func (m *IPSourceAndPortRangeCheckAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - buf[pos] = uint8(m.Prefix.Address.Af) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - // field[1] m.NumberOfRanges - buf[pos] = uint8(m.NumberOfRanges) - pos += 1 - // field[1] m.LowPorts - for i := 0; i < 32; i++ { - var x uint16 - if i < len(m.LowPorts) { - x = uint16(m.LowPorts[i]) - } - o.PutUint16(buf[pos:pos+2], uint16(x)) - pos += 2 - } - // field[1] m.HighPorts - for i := 0; i < 32; i++ { - var x uint16 - if i < len(m.HighPorts) { - x = uint16(m.HighPorts[i]) - } - o.PutUint16(buf[pos:pos+2], uint16(x)) - pos += 2 - } - // field[1] m.VrfID - o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) - pos += 4 - return buf, nil -} -func (m *IPSourceAndPortRangeCheckAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - // field[1] m.NumberOfRanges - m.NumberOfRanges = uint8(tmp[pos]) - pos += 1 - // field[1] m.LowPorts - m.LowPorts = make([]uint16, 32) - for i := 0; i < len(m.LowPorts); i++ { - m.LowPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - } - // field[1] m.HighPorts - m.HighPorts = make([]uint16, 32) - for i := 0; i < len(m.HighPorts); i++ { - m.HighPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - } - // field[1] m.VrfID - m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply'. -type IPSourceAndPortRangeCheckAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPSourceAndPortRangeCheckAddDelReply) Reset() { *m = IPSourceAndPortRangeCheckAddDelReply{} } -func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageName() string { - return "ip_source_and_port_range_check_add_del_reply" -} -func (*IPSourceAndPortRangeCheckAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *IPSourceAndPortRangeCheckAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPSourceAndPortRangeCheckAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPSourceAndPortRangeCheckAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del'. -type IPSourceAndPortRangeCheckInterfaceAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - TCPInVrfID uint32 `binapi:"u32,name=tcp_in_vrf_id" json:"tcp_in_vrf_id,omitempty"` - TCPOutVrfID uint32 `binapi:"u32,name=tcp_out_vrf_id" json:"tcp_out_vrf_id,omitempty"` - UDPInVrfID uint32 `binapi:"u32,name=udp_in_vrf_id" json:"udp_in_vrf_id,omitempty"` - UDPOutVrfID uint32 `binapi:"u32,name=udp_out_vrf_id" json:"udp_out_vrf_id,omitempty"` -} - -func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Reset() { - *m = IPSourceAndPortRangeCheckInterfaceAddDel{} -} -func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageName() string { - return "ip_source_and_port_range_check_interface_add_del" -} -func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetCrcString() string { return "e1ba8987" } -func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageType { - return api.RequestMessage -} - -func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.TCPInVrfID - size += 4 - // field[1] m.TCPOutVrfID - size += 4 - // field[1] m.UDPInVrfID - size += 4 - // field[1] m.UDPOutVrfID - size += 4 - return size -} -func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.TCPInVrfID - o.PutUint32(buf[pos:pos+4], uint32(m.TCPInVrfID)) - pos += 4 - // field[1] m.TCPOutVrfID - o.PutUint32(buf[pos:pos+4], uint32(m.TCPOutVrfID)) - pos += 4 - // field[1] m.UDPInVrfID - o.PutUint32(buf[pos:pos+4], uint32(m.UDPInVrfID)) - pos += 4 - // field[1] m.UDPOutVrfID - o.PutUint32(buf[pos:pos+4], uint32(m.UDPOutVrfID)) - pos += 4 - return buf, nil -} -func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TCPInVrfID - m.TCPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TCPOutVrfID - m.TCPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.UDPInVrfID - m.UDPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.UDPOutVrfID - m.UDPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply'. -type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Reset() { - *m = IPSourceAndPortRangeCheckInterfaceAddDelReply{} -} -func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageName() string { - return "ip_source_and_port_range_check_interface_add_del_reply" -} -func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPTableAddDel represents VPP binary API message 'ip_table_add_del'. -type IPTableAddDel struct { - IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableAddDel) Reset() { *m = IPTableAddDel{} } -func (*IPTableAddDel) GetMessageName() string { return "ip_table_add_del" } -func (*IPTableAddDel) GetCrcString() string { return "0ffdaec0" } -func (*IPTableAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply'. -type IPTableAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPTableAddDelReply) Reset() { *m = IPTableAddDelReply{} } -func (*IPTableAddDelReply) GetMessageName() string { return "ip_table_add_del_reply" } -func (*IPTableAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*IPTableAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPTableAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPTableAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPTableDetails represents VPP binary API message 'ip_table_details'. -type IPTableDetails struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableDetails) Reset() { *m = IPTableDetails{} } -func (*IPTableDetails) GetMessageName() string { return "ip_table_details" } -func (*IPTableDetails) GetCrcString() string { return "c79fca0f" } -func (*IPTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableDump represents VPP binary API message 'ip_table_dump'. -type IPTableDump struct{} - -func (m *IPTableDump) Reset() { *m = IPTableDump{} } -func (*IPTableDump) GetMessageName() string { return "ip_table_dump" } -func (*IPTableDump) GetCrcString() string { return "51077d14" } -func (*IPTableDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *IPTableDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *IPTableDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// IPTableFlush represents VPP binary API message 'ip_table_flush'. -type IPTableFlush struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableFlush) Reset() { *m = IPTableFlush{} } -func (*IPTableFlush) GetMessageName() string { return "ip_table_flush" } -func (*IPTableFlush) GetCrcString() string { return "b9d2e09e" } -func (*IPTableFlush) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableFlush) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableFlush) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableFlush) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableFlushReply represents VPP binary API message 'ip_table_flush_reply'. -type IPTableFlushReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPTableFlushReply) Reset() { *m = IPTableFlushReply{} } -func (*IPTableFlushReply) GetMessageName() string { return "ip_table_flush_reply" } -func (*IPTableFlushReply) GetCrcString() string { return "e8d4e804" } -func (*IPTableFlushReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableFlushReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPTableFlushReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPTableFlushReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPTableReplaceBegin represents VPP binary API message 'ip_table_replace_begin'. -type IPTableReplaceBegin struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableReplaceBegin) Reset() { *m = IPTableReplaceBegin{} } -func (*IPTableReplaceBegin) GetMessageName() string { return "ip_table_replace_begin" } -func (*IPTableReplaceBegin) GetCrcString() string { return "b9d2e09e" } -func (*IPTableReplaceBegin) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableReplaceBegin) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableReplaceBegin) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableReplaceBegin) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableReplaceBeginReply represents VPP binary API message 'ip_table_replace_begin_reply'. -type IPTableReplaceBeginReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPTableReplaceBeginReply) Reset() { *m = IPTableReplaceBeginReply{} } -func (*IPTableReplaceBeginReply) GetMessageName() string { return "ip_table_replace_begin_reply" } -func (*IPTableReplaceBeginReply) GetCrcString() string { return "e8d4e804" } -func (*IPTableReplaceBeginReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableReplaceBeginReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPTableReplaceBeginReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPTableReplaceBeginReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPTableReplaceEnd represents VPP binary API message 'ip_table_replace_end'. -type IPTableReplaceEnd struct { - Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` -} - -func (m *IPTableReplaceEnd) Reset() { *m = IPTableReplaceEnd{} } -func (*IPTableReplaceEnd) GetMessageName() string { return "ip_table_replace_end" } -func (*IPTableReplaceEnd) GetCrcString() string { return "b9d2e09e" } -func (*IPTableReplaceEnd) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPTableReplaceEnd) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Table - // field[2] m.Table.TableID - size += 4 - // field[2] m.Table.IsIP6 - size += 1 - // field[2] m.Table.Name - size += 64 - return size -} -func (m *IPTableReplaceEnd) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Table - // field[2] m.Table.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) - pos += 4 - // field[2] m.Table.IsIP6 - if m.Table.IsIP6 { - buf[pos] = 1 - } - pos += 1 - // field[2] m.Table.Name - copy(buf[pos:pos+64], m.Table.Name) - pos += 64 - return buf, nil -} -func (m *IPTableReplaceEnd) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Table - // field[2] m.Table.TableID - m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Table.IsIP6 - m.Table.IsIP6 = tmp[pos] != 0 - pos += 1 - // field[2] m.Table.Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// IPTableReplaceEndReply represents VPP binary API message 'ip_table_replace_end_reply'. -type IPTableReplaceEndReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *IPTableReplaceEndReply) Reset() { *m = IPTableReplaceEndReply{} } -func (*IPTableReplaceEndReply) GetMessageName() string { return "ip_table_replace_end_reply" } -func (*IPTableReplaceEndReply) GetCrcString() string { return "e8d4e804" } -func (*IPTableReplaceEndReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPTableReplaceEndReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *IPTableReplaceEndReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *IPTableReplaceEndReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details'. -type IPUnnumberedDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IPSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=ip_sw_if_index" json:"ip_sw_if_index,omitempty"` -} - -func (m *IPUnnumberedDetails) Reset() { *m = IPUnnumberedDetails{} } -func (*IPUnnumberedDetails) GetMessageName() string { return "ip_unnumbered_details" } -func (*IPUnnumberedDetails) GetCrcString() string { return "aa12a483" } -func (*IPUnnumberedDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *IPUnnumberedDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IPSwIfIndex - size += 4 - return size -} -func (m *IPUnnumberedDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IPSwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.IPSwIfIndex)) - pos += 4 - return buf, nil -} -func (m *IPUnnumberedDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IPSwIfIndex - m.IPSwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. -type IPUnnumberedDump struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4.294967295e+09" json:"sw_if_index,omitempty"` -} - -func (m *IPUnnumberedDump) Reset() { *m = IPUnnumberedDump{} } -func (*IPUnnumberedDump) GetMessageName() string { return "ip_unnumbered_dump" } -func (*IPUnnumberedDump) GetCrcString() string { return "f9e6675e" } -func (*IPUnnumberedDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *IPUnnumberedDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *IPUnnumberedDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *IPUnnumberedDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MfibSignalDetails represents VPP binary API message 'mfib_signal_details'. -type MfibSignalDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - Prefix fib_types.Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` - IPPacketLen uint16 `binapi:"u16,name=ip_packet_len" json:"ip_packet_len,omitempty"` - IPPacketData []byte `binapi:"u8[256],name=ip_packet_data" json:"ip_packet_data,omitempty" struc:"[256]byte"` -} - -func (m *MfibSignalDetails) Reset() { *m = MfibSignalDetails{} } -func (*MfibSignalDetails) GetMessageName() string { return "mfib_signal_details" } -func (*MfibSignalDetails) GetCrcString() string { return "64398a9a" } -func (*MfibSignalDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MfibSignalDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.TableID - size += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Af - size += 1 - // field[2] m.Prefix.GrpAddressLength - size += 2 - // field[2] m.Prefix.GrpAddress - size += 16 - // field[2] m.Prefix.SrcAddress - size += 16 - // field[1] m.IPPacketLen - size += 2 - // field[1] m.IPPacketData - size += 256 - return size -} -func (m *MfibSignalDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Af - buf[pos] = uint8(m.Prefix.Af) - pos += 1 - // field[2] m.Prefix.GrpAddressLength - o.PutUint16(buf[pos:pos+2], uint16(m.Prefix.GrpAddressLength)) - pos += 2 - // field[2] m.Prefix.GrpAddress - copy(buf[pos:pos+16], m.Prefix.GrpAddress.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.SrcAddress - copy(buf[pos:pos+16], m.Prefix.SrcAddress.XXX_UnionData[:]) - pos += 16 - // field[1] m.IPPacketLen - o.PutUint16(buf[pos:pos+2], uint16(m.IPPacketLen)) - pos += 2 - // field[1] m.IPPacketData - for i := 0; i < 256; i++ { - var x uint8 - if i < len(m.IPPacketData) { - x = uint8(m.IPPacketData[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *MfibSignalDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TableID - m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Af - m.Prefix.Af = fib_types.AddressFamily(tmp[pos]) - pos += 1 - // field[2] m.Prefix.GrpAddressLength - m.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[2] m.Prefix.GrpAddress - copy(m.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.SrcAddress - copy(m.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[1] m.IPPacketLen - m.IPPacketLen = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.IPPacketData - m.IPPacketData = make([]uint8, 256) - for i := 0; i < len(m.IPPacketData); i++ { - m.IPPacketData[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// MfibSignalDump represents VPP binary API message 'mfib_signal_dump'. -type MfibSignalDump struct{} - -func (m *MfibSignalDump) Reset() { *m = MfibSignalDump{} } -func (*MfibSignalDump) GetMessageName() string { return "mfib_signal_dump" } -func (*MfibSignalDump) GetCrcString() string { return "51077d14" } -func (*MfibSignalDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MfibSignalDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MfibSignalDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MfibSignalDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash'. -type SetIPFlowHash struct { - VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` - IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` - Src bool `binapi:"bool,name=src" json:"src,omitempty"` - Dst bool `binapi:"bool,name=dst" json:"dst,omitempty"` - Sport bool `binapi:"bool,name=sport" json:"sport,omitempty"` - Dport bool `binapi:"bool,name=dport" json:"dport,omitempty"` - Proto bool `binapi:"bool,name=proto" json:"proto,omitempty"` - Reverse bool `binapi:"bool,name=reverse" json:"reverse,omitempty"` - Symmetric bool `binapi:"bool,name=symmetric" json:"symmetric,omitempty"` -} - -func (m *SetIPFlowHash) Reset() { *m = SetIPFlowHash{} } -func (*SetIPFlowHash) GetMessageName() string { return "set_ip_flow_hash" } -func (*SetIPFlowHash) GetCrcString() string { return "084ee09e" } -func (*SetIPFlowHash) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SetIPFlowHash) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.VrfID - size += 4 - // field[1] m.IsIPv6 - size += 1 - // field[1] m.Src - size += 1 - // field[1] m.Dst - size += 1 - // field[1] m.Sport - size += 1 - // field[1] m.Dport - size += 1 - // field[1] m.Proto - size += 1 - // field[1] m.Reverse - size += 1 - // field[1] m.Symmetric - size += 1 - return size -} -func (m *SetIPFlowHash) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.VrfID - o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) - pos += 4 - // field[1] m.IsIPv6 - if m.IsIPv6 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Src - if m.Src { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Dst - if m.Dst { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Sport - if m.Sport { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Dport - if m.Dport { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Proto - if m.Proto { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Reverse - if m.Reverse { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Symmetric - if m.Symmetric { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SetIPFlowHash) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.VrfID - m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsIPv6 - m.IsIPv6 = tmp[pos] != 0 - pos += 1 - // field[1] m.Src - m.Src = tmp[pos] != 0 - pos += 1 - // field[1] m.Dst - m.Dst = tmp[pos] != 0 - pos += 1 - // field[1] m.Sport - m.Sport = tmp[pos] != 0 - pos += 1 - // field[1] m.Dport - m.Dport = tmp[pos] != 0 - pos += 1 - // field[1] m.Proto - m.Proto = tmp[pos] != 0 - pos += 1 - // field[1] m.Reverse - m.Reverse = tmp[pos] != 0 - pos += 1 - // field[1] m.Symmetric - m.Symmetric = tmp[pos] != 0 - pos += 1 - return nil -} - -// SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply'. -type SetIPFlowHashReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SetIPFlowHashReply) Reset() { *m = SetIPFlowHashReply{} } -func (*SetIPFlowHashReply) GetMessageName() string { return "set_ip_flow_hash_reply" } -func (*SetIPFlowHashReply) GetCrcString() string { return "e8d4e804" } -func (*SetIPFlowHashReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SetIPFlowHashReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SetIPFlowHashReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SetIPFlowHashReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable'. -type SwInterfaceIP6EnableDisable struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` -} - -func (m *SwInterfaceIP6EnableDisable) Reset() { *m = SwInterfaceIP6EnableDisable{} } -func (*SwInterfaceIP6EnableDisable) GetMessageName() string { return "sw_interface_ip6_enable_disable" } -func (*SwInterfaceIP6EnableDisable) GetCrcString() string { return "ae6cfcfb" } -func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceIP6EnableDisable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Enable - size += 1 - return size -} -func (m *SwInterfaceIP6EnableDisable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Enable - if m.Enable { - buf[pos] = 1 - } - pos += 1 - return buf, nil -} -func (m *SwInterfaceIP6EnableDisable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Enable - m.Enable = tmp[pos] != 0 - pos += 1 - return nil -} - -// SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply'. -type SwInterfaceIP6EnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceIP6EnableDisableReply) Reset() { *m = SwInterfaceIP6EnableDisableReply{} } -func (*SwInterfaceIP6EnableDisableReply) GetMessageName() string { - return "sw_interface_ip6_enable_disable_reply" -} -func (*SwInterfaceIP6EnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SwInterfaceIP6EnableDisableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceIP6EnableDisableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SwInterfaceIP6SetLinkLocalAddress represents VPP binary API message 'sw_interface_ip6_set_link_local_address'. -type SwInterfaceIP6SetLinkLocalAddress struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - IP fib_types.IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` -} - -func (m *SwInterfaceIP6SetLinkLocalAddress) Reset() { *m = SwInterfaceIP6SetLinkLocalAddress{} } -func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageName() string { - return "sw_interface_ip6_set_link_local_address" -} -func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { return "2931d9fa" } -func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SwInterfaceIP6SetLinkLocalAddress) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.IP - size += 16 - return size -} -func (m *SwInterfaceIP6SetLinkLocalAddress) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.IP - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.IP) { - x = uint8(m.IP[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SwInterfaceIP6SetLinkLocalAddress) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IP - for i := 0; i < len(m.IP); i++ { - m.IP[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SwInterfaceIP6SetLinkLocalAddressReply represents VPP binary API message 'sw_interface_ip6_set_link_local_address_reply'. -type SwInterfaceIP6SetLinkLocalAddressReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SwInterfaceIP6SetLinkLocalAddressReply) Reset() { - *m = SwInterfaceIP6SetLinkLocalAddressReply{} -} -func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageName() string { - return "sw_interface_ip6_set_link_local_address_reply" -} -func (*SwInterfaceIP6SetLinkLocalAddressReply) GetCrcString() string { return "e8d4e804" } -func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageType() api.MessageType { - return api.ReplyMessage -} - -func (m *SwInterfaceIP6SetLinkLocalAddressReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SwInterfaceIP6SetLinkLocalAddressReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SwInterfaceIP6SetLinkLocalAddressReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -func init() { file_ip_binapi_init() } -func file_ip_binapi_init() { - api.RegisterMessage((*IoamDisable)(nil), "ip.IoamDisable") - api.RegisterMessage((*IoamDisableReply)(nil), "ip.IoamDisableReply") - api.RegisterMessage((*IoamEnable)(nil), "ip.IoamEnable") - api.RegisterMessage((*IoamEnableReply)(nil), "ip.IoamEnableReply") - api.RegisterMessage((*IPAddressDetails)(nil), "ip.IPAddressDetails") - api.RegisterMessage((*IPAddressDump)(nil), "ip.IPAddressDump") - api.RegisterMessage((*IPContainerProxyAddDel)(nil), "ip.IPContainerProxyAddDel") - api.RegisterMessage((*IPContainerProxyAddDelReply)(nil), "ip.IPContainerProxyAddDelReply") - api.RegisterMessage((*IPContainerProxyDetails)(nil), "ip.IPContainerProxyDetails") - api.RegisterMessage((*IPContainerProxyDump)(nil), "ip.IPContainerProxyDump") - api.RegisterMessage((*IPDetails)(nil), "ip.IPDetails") - api.RegisterMessage((*IPDump)(nil), "ip.IPDump") - api.RegisterMessage((*IPMrouteAddDel)(nil), "ip.IPMrouteAddDel") - api.RegisterMessage((*IPMrouteAddDelReply)(nil), "ip.IPMrouteAddDelReply") - api.RegisterMessage((*IPMrouteDetails)(nil), "ip.IPMrouteDetails") - api.RegisterMessage((*IPMrouteDump)(nil), "ip.IPMrouteDump") - api.RegisterMessage((*IPMtableDetails)(nil), "ip.IPMtableDetails") - api.RegisterMessage((*IPMtableDump)(nil), "ip.IPMtableDump") - api.RegisterMessage((*IPPuntPolice)(nil), "ip.IPPuntPolice") - api.RegisterMessage((*IPPuntPoliceReply)(nil), "ip.IPPuntPoliceReply") - api.RegisterMessage((*IPPuntRedirect)(nil), "ip.IPPuntRedirect") - api.RegisterMessage((*IPPuntRedirectDetails)(nil), "ip.IPPuntRedirectDetails") - api.RegisterMessage((*IPPuntRedirectDump)(nil), "ip.IPPuntRedirectDump") - api.RegisterMessage((*IPPuntRedirectReply)(nil), "ip.IPPuntRedirectReply") - api.RegisterMessage((*IPReassemblyEnableDisable)(nil), "ip.IPReassemblyEnableDisable") - api.RegisterMessage((*IPReassemblyEnableDisableReply)(nil), "ip.IPReassemblyEnableDisableReply") - api.RegisterMessage((*IPReassemblyGet)(nil), "ip.IPReassemblyGet") - api.RegisterMessage((*IPReassemblyGetReply)(nil), "ip.IPReassemblyGetReply") - api.RegisterMessage((*IPReassemblySet)(nil), "ip.IPReassemblySet") - api.RegisterMessage((*IPReassemblySetReply)(nil), "ip.IPReassemblySetReply") - api.RegisterMessage((*IPRouteAddDel)(nil), "ip.IPRouteAddDel") - api.RegisterMessage((*IPRouteAddDelReply)(nil), "ip.IPRouteAddDelReply") - api.RegisterMessage((*IPRouteDetails)(nil), "ip.IPRouteDetails") - api.RegisterMessage((*IPRouteDump)(nil), "ip.IPRouteDump") - api.RegisterMessage((*IPRouteLookup)(nil), "ip.IPRouteLookup") - api.RegisterMessage((*IPRouteLookupReply)(nil), "ip.IPRouteLookupReply") - api.RegisterMessage((*IPSourceAndPortRangeCheckAddDel)(nil), "ip.IPSourceAndPortRangeCheckAddDel") - api.RegisterMessage((*IPSourceAndPortRangeCheckAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckAddDelReply") - api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDel") - api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDelReply") - api.RegisterMessage((*IPTableAddDel)(nil), "ip.IPTableAddDel") - api.RegisterMessage((*IPTableAddDelReply)(nil), "ip.IPTableAddDelReply") - api.RegisterMessage((*IPTableDetails)(nil), "ip.IPTableDetails") - api.RegisterMessage((*IPTableDump)(nil), "ip.IPTableDump") - api.RegisterMessage((*IPTableFlush)(nil), "ip.IPTableFlush") - api.RegisterMessage((*IPTableFlushReply)(nil), "ip.IPTableFlushReply") - api.RegisterMessage((*IPTableReplaceBegin)(nil), "ip.IPTableReplaceBegin") - api.RegisterMessage((*IPTableReplaceBeginReply)(nil), "ip.IPTableReplaceBeginReply") - api.RegisterMessage((*IPTableReplaceEnd)(nil), "ip.IPTableReplaceEnd") - api.RegisterMessage((*IPTableReplaceEndReply)(nil), "ip.IPTableReplaceEndReply") - api.RegisterMessage((*IPUnnumberedDetails)(nil), "ip.IPUnnumberedDetails") - api.RegisterMessage((*IPUnnumberedDump)(nil), "ip.IPUnnumberedDump") - api.RegisterMessage((*MfibSignalDetails)(nil), "ip.MfibSignalDetails") - api.RegisterMessage((*MfibSignalDump)(nil), "ip.MfibSignalDump") - api.RegisterMessage((*SetIPFlowHash)(nil), "ip.SetIPFlowHash") - api.RegisterMessage((*SetIPFlowHashReply)(nil), "ip.SetIPFlowHashReply") - api.RegisterMessage((*SwInterfaceIP6EnableDisable)(nil), "ip.SwInterfaceIP6EnableDisable") - api.RegisterMessage((*SwInterfaceIP6EnableDisableReply)(nil), "ip.SwInterfaceIP6EnableDisableReply") - api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddress)(nil), "ip.SwInterfaceIP6SetLinkLocalAddress") - api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddressReply)(nil), "ip.SwInterfaceIP6SetLinkLocalAddressReply") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*IoamDisable)(nil), - (*IoamDisableReply)(nil), - (*IoamEnable)(nil), - (*IoamEnableReply)(nil), - (*IPAddressDetails)(nil), - (*IPAddressDump)(nil), - (*IPContainerProxyAddDel)(nil), - (*IPContainerProxyAddDelReply)(nil), - (*IPContainerProxyDetails)(nil), - (*IPContainerProxyDump)(nil), - (*IPDetails)(nil), - (*IPDump)(nil), - (*IPMrouteAddDel)(nil), - (*IPMrouteAddDelReply)(nil), - (*IPMrouteDetails)(nil), - (*IPMrouteDump)(nil), - (*IPMtableDetails)(nil), - (*IPMtableDump)(nil), - (*IPPuntPolice)(nil), - (*IPPuntPoliceReply)(nil), - (*IPPuntRedirect)(nil), - (*IPPuntRedirectDetails)(nil), - (*IPPuntRedirectDump)(nil), - (*IPPuntRedirectReply)(nil), - (*IPReassemblyEnableDisable)(nil), - (*IPReassemblyEnableDisableReply)(nil), - (*IPReassemblyGet)(nil), - (*IPReassemblyGetReply)(nil), - (*IPReassemblySet)(nil), - (*IPReassemblySetReply)(nil), - (*IPRouteAddDel)(nil), - (*IPRouteAddDelReply)(nil), - (*IPRouteDetails)(nil), - (*IPRouteDump)(nil), - (*IPRouteLookup)(nil), - (*IPRouteLookupReply)(nil), - (*IPSourceAndPortRangeCheckAddDel)(nil), - (*IPSourceAndPortRangeCheckAddDelReply)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), - (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), - (*IPTableAddDel)(nil), - (*IPTableAddDelReply)(nil), - (*IPTableDetails)(nil), - (*IPTableDump)(nil), - (*IPTableFlush)(nil), - (*IPTableFlushReply)(nil), - (*IPTableReplaceBegin)(nil), - (*IPTableReplaceBeginReply)(nil), - (*IPTableReplaceEnd)(nil), - (*IPTableReplaceEndReply)(nil), - (*IPUnnumberedDetails)(nil), - (*IPUnnumberedDump)(nil), - (*MfibSignalDetails)(nil), - (*MfibSignalDump)(nil), - (*SetIPFlowHash)(nil), - (*SetIPFlowHashReply)(nil), - (*SwInterfaceIP6EnableDisable)(nil), - (*SwInterfaceIP6EnableDisableReply)(nil), - (*SwInterfaceIP6SetLinkLocalAddress)(nil), - (*SwInterfaceIP6SetLinkLocalAddressReply)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/ip/ip_rpc.ba.go b/examples/binapi/ip/ip_rpc.ba.go deleted file mode 100644 index d1bbd08..0000000 --- a/examples/binapi/ip/ip_rpc.ba.go +++ /dev/null @@ -1,497 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package ip - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for ip module. -type RPCService interface { - DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) - DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) - DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) - DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) - DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) - DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) - DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) - DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) - DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) - DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) - IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) - IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) - IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) - IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) - IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) - IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) - IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) - IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) - IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) - IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) - IPRouteLookup(ctx context.Context, in *IPRouteLookup) (*IPRouteLookupReply, error) - IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) - IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) - IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) - IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) - IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) - IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) - SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) - SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) - SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPAddressClient{stream} - return x, nil -} - -type RPCService_DumpIPAddressClient interface { - Recv() (*IPAddressDetails, error) -} - -type serviceClient_DumpIPAddressClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPAddressClient) Recv() (*IPAddressDetails, error) { - m := new(IPAddressDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPContainerProxyClient{stream} - return x, nil -} - -type RPCService_DumpIPContainerProxyClient interface { - Recv() (*IPContainerProxyDetails, error) -} - -type serviceClient_DumpIPContainerProxyClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPContainerProxyClient) Recv() (*IPContainerProxyDetails, error) { - m := new(IPContainerProxyDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPClient{stream} - return x, nil -} - -type RPCService_DumpIPClient interface { - Recv() (*IPDetails, error) -} - -type serviceClient_DumpIPClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPClient) Recv() (*IPDetails, error) { - m := new(IPDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPMrouteClient{stream} - return x, nil -} - -type RPCService_DumpIPMrouteClient interface { - Recv() (*IPMrouteDetails, error) -} - -type serviceClient_DumpIPMrouteClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPMrouteClient) Recv() (*IPMrouteDetails, error) { - m := new(IPMrouteDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPMtableClient{stream} - return x, nil -} - -type RPCService_DumpIPMtableClient interface { - Recv() (*IPMtableDetails, error) -} - -type serviceClient_DumpIPMtableClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPMtableClient) Recv() (*IPMtableDetails, error) { - m := new(IPMtableDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPPuntRedirectClient{stream} - return x, nil -} - -type RPCService_DumpIPPuntRedirectClient interface { - Recv() (*IPPuntRedirectDetails, error) -} - -type serviceClient_DumpIPPuntRedirectClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPPuntRedirectClient) Recv() (*IPPuntRedirectDetails, error) { - m := new(IPPuntRedirectDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPRouteClient{stream} - return x, nil -} - -type RPCService_DumpIPRouteClient interface { - Recv() (*IPRouteDetails, error) -} - -type serviceClient_DumpIPRouteClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPRouteClient) Recv() (*IPRouteDetails, error) { - m := new(IPRouteDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPTableClient{stream} - return x, nil -} - -type RPCService_DumpIPTableClient interface { - Recv() (*IPTableDetails, error) -} - -type serviceClient_DumpIPTableClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPTableClient) Recv() (*IPTableDetails, error) { - m := new(IPTableDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPUnnumberedClient{stream} - return x, nil -} - -type RPCService_DumpIPUnnumberedClient interface { - Recv() (*IPUnnumberedDetails, error) -} - -type serviceClient_DumpIPUnnumberedClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPUnnumberedClient) Recv() (*IPUnnumberedDetails, error) { - m := new(IPUnnumberedDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMfibSignalClient{stream} - return x, nil -} - -type RPCService_DumpMfibSignalClient interface { - Recv() (*MfibSignalDetails, error) -} - -type serviceClient_DumpMfibSignalClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMfibSignalClient) Recv() (*MfibSignalDetails, error) { - m := new(MfibSignalDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { - out := new(IoamDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { - out := new(IoamEnableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { - out := new(IPContainerProxyAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { - out := new(IPMrouteAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { - out := new(IPPuntPoliceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { - out := new(IPPuntRedirectReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { - out := new(IPReassemblyEnableDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { - out := new(IPReassemblyGetReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { - out := new(IPReassemblySetReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { - out := new(IPRouteAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPRouteLookup(ctx context.Context, in *IPRouteLookup) (*IPRouteLookupReply, error) { - out := new(IPRouteLookupReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { - out := new(IPSourceAndPortRangeCheckAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { - out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { - out := new(IPTableAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) { - out := new(IPTableFlushReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) { - out := new(IPTableReplaceBeginReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) { - out := new(IPTableReplaceEndReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { - out := new(SetIPFlowHashReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { - out := new(SwInterfaceIP6EnableDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { - out := new(SwInterfaceIP6SetLinkLocalAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/examples/binapi/ip_types/ip_types.ba.go b/examples/binapi/ip_types/ip_types.ba.go deleted file mode 100644 index fc7fa87..0000000 --- a/examples/binapi/ip_types/ip_types.ba.go +++ /dev/null @@ -1,436 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/ip_types.api.json - -/* -Package ip_types contains generated code for VPP API file ip_types.api (3.0.0). - -It consists of: - 5 aliases - 4 enums - 6 types - 1 union -*/ -package ip_types - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "ip_types" - // APIVersion is the API version of this module. - APIVersion = "3.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0x9cb1c2e2 -) - -// AddressFamily represents VPP binary API enum 'address_family'. -type AddressFamily uint8 - -const ( - ADDRESS_IP4 AddressFamily = 0 - ADDRESS_IP6 AddressFamily = 1 -) - -var ( - AddressFamily_name = map[uint8]string{ - 0: "ADDRESS_IP4", - 1: "ADDRESS_IP6", - } - AddressFamily_value = map[string]uint8{ - "ADDRESS_IP4": 0, - "ADDRESS_IP6": 1, - } -) - -func (x AddressFamily) String() string { - s, ok := AddressFamily_name[uint8(x)] - if ok { - return s - } - return "AddressFamily(" + strconv.Itoa(int(x)) + ")" -} - -// IPDscp represents VPP binary API enum 'ip_dscp'. -type IPDscp uint8 - -const ( - IP_API_DSCP_CS0 IPDscp = 0 - IP_API_DSCP_CS1 IPDscp = 8 - IP_API_DSCP_AF11 IPDscp = 10 - IP_API_DSCP_AF12 IPDscp = 12 - IP_API_DSCP_AF13 IPDscp = 14 - IP_API_DSCP_CS2 IPDscp = 16 - IP_API_DSCP_AF21 IPDscp = 18 - IP_API_DSCP_AF22 IPDscp = 20 - IP_API_DSCP_AF23 IPDscp = 22 - IP_API_DSCP_CS3 IPDscp = 24 - IP_API_DSCP_AF31 IPDscp = 26 - IP_API_DSCP_AF32 IPDscp = 28 - IP_API_DSCP_AF33 IPDscp = 30 - IP_API_DSCP_CS4 IPDscp = 32 - IP_API_DSCP_AF41 IPDscp = 34 - IP_API_DSCP_AF42 IPDscp = 36 - IP_API_DSCP_AF43 IPDscp = 38 - IP_API_DSCP_CS5 IPDscp = 40 - IP_API_DSCP_EF IPDscp = 46 - IP_API_DSCP_CS6 IPDscp = 48 - IP_API_DSCP_CS7 IPDscp = 50 -) - -var ( - IPDscp_name = map[uint8]string{ - 0: "IP_API_DSCP_CS0", - 8: "IP_API_DSCP_CS1", - 10: "IP_API_DSCP_AF11", - 12: "IP_API_DSCP_AF12", - 14: "IP_API_DSCP_AF13", - 16: "IP_API_DSCP_CS2", - 18: "IP_API_DSCP_AF21", - 20: "IP_API_DSCP_AF22", - 22: "IP_API_DSCP_AF23", - 24: "IP_API_DSCP_CS3", - 26: "IP_API_DSCP_AF31", - 28: "IP_API_DSCP_AF32", - 30: "IP_API_DSCP_AF33", - 32: "IP_API_DSCP_CS4", - 34: "IP_API_DSCP_AF41", - 36: "IP_API_DSCP_AF42", - 38: "IP_API_DSCP_AF43", - 40: "IP_API_DSCP_CS5", - 46: "IP_API_DSCP_EF", - 48: "IP_API_DSCP_CS6", - 50: "IP_API_DSCP_CS7", - } - IPDscp_value = map[string]uint8{ - "IP_API_DSCP_CS0": 0, - "IP_API_DSCP_CS1": 8, - "IP_API_DSCP_AF11": 10, - "IP_API_DSCP_AF12": 12, - "IP_API_DSCP_AF13": 14, - "IP_API_DSCP_CS2": 16, - "IP_API_DSCP_AF21": 18, - "IP_API_DSCP_AF22": 20, - "IP_API_DSCP_AF23": 22, - "IP_API_DSCP_CS3": 24, - "IP_API_DSCP_AF31": 26, - "IP_API_DSCP_AF32": 28, - "IP_API_DSCP_AF33": 30, - "IP_API_DSCP_CS4": 32, - "IP_API_DSCP_AF41": 34, - "IP_API_DSCP_AF42": 36, - "IP_API_DSCP_AF43": 38, - "IP_API_DSCP_CS5": 40, - "IP_API_DSCP_EF": 46, - "IP_API_DSCP_CS6": 48, - "IP_API_DSCP_CS7": 50, - } -) - -func (x IPDscp) String() string { - s, ok := IPDscp_name[uint8(x)] - if ok { - return s - } - return "IPDscp(" + strconv.Itoa(int(x)) + ")" -} - -// IPEcn represents VPP binary API enum 'ip_ecn'. -type IPEcn uint8 - -const ( - IP_API_ECN_NONE IPEcn = 0 - IP_API_ECN_ECT0 IPEcn = 1 - IP_API_ECN_ECT1 IPEcn = 2 - IP_API_ECN_CE IPEcn = 3 -) - -var ( - IPEcn_name = map[uint8]string{ - 0: "IP_API_ECN_NONE", - 1: "IP_API_ECN_ECT0", - 2: "IP_API_ECN_ECT1", - 3: "IP_API_ECN_CE", - } - IPEcn_value = map[string]uint8{ - "IP_API_ECN_NONE": 0, - "IP_API_ECN_ECT0": 1, - "IP_API_ECN_ECT1": 2, - "IP_API_ECN_CE": 3, - } -) - -func (x IPEcn) String() string { - s, ok := IPEcn_name[uint8(x)] - if ok { - return s - } - return "IPEcn(" + strconv.Itoa(int(x)) + ")" -} - -// IPProto represents VPP binary API enum 'ip_proto'. -type IPProto uint8 - -const ( - IP_API_PROTO_HOPOPT IPProto = 0 - IP_API_PROTO_ICMP IPProto = 1 - IP_API_PROTO_IGMP IPProto = 2 - IP_API_PROTO_TCP IPProto = 6 - IP_API_PROTO_UDP IPProto = 17 - IP_API_PROTO_GRE IPProto = 47 - IP_API_PROTO_ESP IPProto = 50 - IP_API_PROTO_AH IPProto = 51 - IP_API_PROTO_ICMP6 IPProto = 58 - IP_API_PROTO_EIGRP IPProto = 88 - IP_API_PROTO_OSPF IPProto = 89 - IP_API_PROTO_SCTP IPProto = 132 - IP_API_PROTO_RESERVED IPProto = 255 -) - -var ( - IPProto_name = map[uint8]string{ - 0: "IP_API_PROTO_HOPOPT", - 1: "IP_API_PROTO_ICMP", - 2: "IP_API_PROTO_IGMP", - 6: "IP_API_PROTO_TCP", - 17: "IP_API_PROTO_UDP", - 47: "IP_API_PROTO_GRE", - 50: "IP_API_PROTO_ESP", - 51: "IP_API_PROTO_AH", - 58: "IP_API_PROTO_ICMP6", - 88: "IP_API_PROTO_EIGRP", - 89: "IP_API_PROTO_OSPF", - 132: "IP_API_PROTO_SCTP", - 255: "IP_API_PROTO_RESERVED", - } - IPProto_value = map[string]uint8{ - "IP_API_PROTO_HOPOPT": 0, - "IP_API_PROTO_ICMP": 1, - "IP_API_PROTO_IGMP": 2, - "IP_API_PROTO_TCP": 6, - "IP_API_PROTO_UDP": 17, - "IP_API_PROTO_GRE": 47, - "IP_API_PROTO_ESP": 50, - "IP_API_PROTO_AH": 51, - "IP_API_PROTO_ICMP6": 58, - "IP_API_PROTO_EIGRP": 88, - "IP_API_PROTO_OSPF": 89, - "IP_API_PROTO_SCTP": 132, - "IP_API_PROTO_RESERVED": 255, - } -) - -func (x IPProto) String() string { - s, ok := IPProto_name[uint8(x)] - if ok { - return s - } - return "IPProto(" + strconv.Itoa(int(x)) + ")" -} - -// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. -type AddressWithPrefix Prefix - -// IP4Address represents VPP binary API alias 'ip4_address'. -type IP4Address [4]uint8 - -// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. -type IP4AddressWithPrefix IP4Prefix - -// IP6Address represents VPP binary API alias 'ip6_address'. -type IP6Address [16]uint8 - -// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. -type IP6AddressWithPrefix IP6Prefix - -// Address represents VPP binary API type 'address'. -type Address struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` -} - -func (*Address) GetTypeName() string { return "address" } - -func ParseAddress(ip string) (Address, error) { - var address Address - netIP := net.ParseIP(ip) - if netIP == nil { - return address, fmt.Errorf("invalid address: %s", ip) - } - if ip4 := netIP.To4(); ip4 == nil { - address.Af = ADDRESS_IP6 - var ip6addr IP6Address - copy(ip6addr[:], netIP.To16()) - address.Un.SetIP6(ip6addr) - } else { - address.Af = ADDRESS_IP4 - var ip4addr IP4Address - copy(ip4addr[:], netIP.To4()) - address.Un.SetIP4(ip4addr) - } - return address, nil -} - -func (a *Address) ToString() string { - var ip string - if a.Af == ADDRESS_IP6 { - ip6Address := a.Un.GetIP6() - ip = net.IP(ip6Address[:]).To16().String() - } else { - ip4Address := a.Un.GetIP4() - ip = net.IP(ip4Address[:]).To4().String() - } - return ip -} - -// IP4Prefix represents VPP binary API type 'ip4_prefix'. -type IP4Prefix struct { - Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } - -// IP6Prefix represents VPP binary API type 'ip6_prefix'. -type IP6Prefix struct { - Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } - -// Mprefix represents VPP binary API type 'mprefix'. -type Mprefix struct { - Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` - GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` - GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` - SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` -} - -func (*Mprefix) GetTypeName() string { return "mprefix" } - -// Prefix represents VPP binary API type 'prefix'. -type Prefix struct { - Address Address `binapi:"address,name=address" json:"address,omitempty"` - Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` -} - -func (*Prefix) GetTypeName() string { return "prefix" } - -func ParsePrefix(ip string) (prefix Prefix, err error) { - hasPrefix := strings.Contains(ip, "/") - if hasPrefix { - netIP, network, err := net.ParseCIDR(ip) - if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %v", ip, err) - } - maskSize, _ := network.Mask.Size() - prefix.Len = byte(maskSize) - prefix.Address, err = ParseAddress(netIP.String()) - if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %v", ip, err) - } - } else { - netIP := net.ParseIP(ip) - defaultMaskSize, _ := net.CIDRMask(32, 32).Size() - if netIP.To4() == nil { - defaultMaskSize, _ = net.CIDRMask(128, 128).Size() - } - prefix.Len = byte(defaultMaskSize) - prefix.Address, err = ParseAddress(netIP.String()) - if err != nil { - return Prefix{}, fmt.Errorf("invalid IP %s: %v", ip, err) - } - } - return prefix, nil -} - -func (p *Prefix) ToString() string { - ip := p.Address.ToString() - return ip + "/" + strconv.Itoa(int(p.Len)) -} - -// PrefixMatcher represents VPP binary API type 'prefix_matcher'. -type PrefixMatcher struct { - Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` - Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` -} - -func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } - -// AddressUnion represents VPP binary API union 'address_union'. -type AddressUnion struct { - XXX_UnionData [16]byte -} - -func (*AddressUnion) GetTypeName() string { return "address_union" } - -func AddressUnionIP4(a IP4Address) (u AddressUnion) { - u.SetIP4(a) - return -} -func (u *AddressUnion) SetIP4(a IP4Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP4() (a IP4Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -func AddressUnionIP6(a IP6Address) (u AddressUnion) { - u.SetIP6(a) - return -} -func (u *AddressUnion) SetIP6(a IP6Address) { - var b = new(bytes.Buffer) - if err := struc.Pack(b, &a); err != nil { - return - } - copy(u.XXX_UnionData[:], b.Bytes()) -} -func (u *AddressUnion) GetIP6() (a IP6Address) { - var b = bytes.NewReader(u.XXX_UnionData[:]) - struc.Unpack(b, &a) - return -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/mactime/mactime.ba.go b/examples/binapi/mactime/mactime.ba.go deleted file mode 100644 index 7b9a0b2..0000000 --- a/examples/binapi/mactime/mactime.ba.go +++ /dev/null @@ -1,689 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/plugins/mactime.api.json - -/* -Package mactime contains generated code for VPP API file mactime.api (2.0.0). - -It consists of: - 2 aliases - 6 enums - 7 messages - 2 types -*/ -package mactime - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" - - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "mactime" - // APIVersion is the API version of this module. - APIVersion = "2.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0x9283d3e -) - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -func ParseMAC(mac string) (parsed MacAddress, err error) { - var hw net.HardwareAddr - if hw, err = net.ParseMAC(mac); err != nil { - return - } - copy(parsed[:], hw[:]) - return -} - -func (m *MacAddress) ToString() string { - return net.HardwareAddr(m[:]).String() -} - -// MactimeTimeRange represents VPP binary API type 'mactime_time_range'. -type MactimeTimeRange struct { - Start float64 `binapi:"f64,name=start" json:"start,omitempty"` - End float64 `binapi:"f64,name=end" json:"end,omitempty"` -} - -func (*MactimeTimeRange) GetTypeName() string { return "mactime_time_range" } - -// TimeRange represents VPP binary API type 'time_range'. -type TimeRange struct { - Start float64 `binapi:"f64,name=start" json:"start,omitempty"` - End float64 `binapi:"f64,name=end" json:"end,omitempty"` -} - -func (*TimeRange) GetTypeName() string { return "time_range" } - -// MactimeAddDelRange represents VPP binary API message 'mactime_add_del_range'. -type MactimeAddDelRange struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - Drop bool `binapi:"bool,name=drop" json:"drop,omitempty"` - Allow bool `binapi:"bool,name=allow" json:"allow,omitempty"` - AllowQuota uint8 `binapi:"u8,name=allow_quota" json:"allow_quota,omitempty"` - NoUDP10001 bool `binapi:"bool,name=no_udp_10001" json:"no_udp_10001,omitempty"` - DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"` - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` - DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty" struc:"[64]byte"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=Ranges"` - Ranges []TimeRange `binapi:"time_range[count],name=ranges" json:"ranges,omitempty"` -} - -func (m *MactimeAddDelRange) Reset() { *m = MactimeAddDelRange{} } -func (*MactimeAddDelRange) GetMessageName() string { return "mactime_add_del_range" } -func (*MactimeAddDelRange) GetCrcString() string { return "101858ef" } -func (*MactimeAddDelRange) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MactimeAddDelRange) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.Drop - size += 1 - // field[1] m.Allow - size += 1 - // field[1] m.AllowQuota - size += 1 - // field[1] m.NoUDP10001 - size += 1 - // field[1] m.DataQuota - size += 8 - // field[1] m.MacAddress - size += 6 - // field[1] m.DeviceName - size += 64 - // field[1] m.Count - size += 4 - // field[1] m.Ranges - for j1 := 0; j1 < len(m.Ranges); j1++ { - var s1 TimeRange - _ = s1 - if j1 < len(m.Ranges) { - s1 = m.Ranges[j1] - } - // field[2] s1.Start - size += 8 - // field[2] s1.End - size += 8 - } - return size -} -func (m *MactimeAddDelRange) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Drop - if m.Drop { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Allow - if m.Allow { - buf[pos] = 1 - } - pos += 1 - // field[1] m.AllowQuota - buf[pos] = uint8(m.AllowQuota) - pos += 1 - // field[1] m.NoUDP10001 - if m.NoUDP10001 { - buf[pos] = 1 - } - pos += 1 - // field[1] m.DataQuota - o.PutUint64(buf[pos:pos+8], uint64(m.DataQuota)) - pos += 8 - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.DeviceName - copy(buf[pos:pos+64], m.DeviceName) - pos += 64 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.Ranges))) - pos += 4 - // field[1] m.Ranges - for j1 := 0; j1 < len(m.Ranges); j1++ { - var v1 TimeRange - if j1 < len(m.Ranges) { - v1 = m.Ranges[j1] - } - // field[2] v1.Start - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.Start))) - pos += 8 - // field[2] v1.End - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.End))) - pos += 8 - } - return buf, nil -} -func (m *MactimeAddDelRange) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.Drop - m.Drop = tmp[pos] != 0 - pos += 1 - // field[1] m.Allow - m.Allow = tmp[pos] != 0 - pos += 1 - // field[1] m.AllowQuota - m.AllowQuota = uint8(tmp[pos]) - pos += 1 - // field[1] m.NoUDP10001 - m.NoUDP10001 = tmp[pos] != 0 - pos += 1 - // field[1] m.DataQuota - m.DataQuota = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.DeviceName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.DeviceName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Ranges - m.Ranges = make([]TimeRange, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.Ranges[j1].Start - m.Ranges[j1].Start = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - // field[2] m.Ranges[j1].End - m.Ranges[j1].End = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - } - return nil -} - -// MactimeAddDelRangeReply represents VPP binary API message 'mactime_add_del_range_reply'. -type MactimeAddDelRangeReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MactimeAddDelRangeReply) Reset() { *m = MactimeAddDelRangeReply{} } -func (*MactimeAddDelRangeReply) GetMessageName() string { return "mactime_add_del_range_reply" } -func (*MactimeAddDelRangeReply) GetCrcString() string { return "e8d4e804" } -func (*MactimeAddDelRangeReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MactimeAddDelRangeReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MactimeAddDelRangeReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MactimeAddDelRangeReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MactimeDetails represents VPP binary API message 'mactime_details'. -type MactimeDetails struct { - PoolIndex uint32 `binapi:"u32,name=pool_index" json:"pool_index,omitempty"` - MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` - DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"` - DataUsedInRange uint64 `binapi:"u64,name=data_used_in_range" json:"data_used_in_range,omitempty"` - Flags uint32 `binapi:"u32,name=flags" json:"flags,omitempty"` - DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty" struc:"[64]byte"` - Nranges uint32 `binapi:"u32,name=nranges" json:"nranges,omitempty" struc:"sizeof=Ranges"` - Ranges []MactimeTimeRange `binapi:"mactime_time_range[nranges],name=ranges" json:"ranges,omitempty"` -} - -func (m *MactimeDetails) Reset() { *m = MactimeDetails{} } -func (*MactimeDetails) GetMessageName() string { return "mactime_details" } -func (*MactimeDetails) GetCrcString() string { return "44921c06" } -func (*MactimeDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MactimeDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.PoolIndex - size += 4 - // field[1] m.MacAddress - size += 6 - // field[1] m.DataQuota - size += 8 - // field[1] m.DataUsedInRange - size += 8 - // field[1] m.Flags - size += 4 - // field[1] m.DeviceName - size += 64 - // field[1] m.Nranges - size += 4 - // field[1] m.Ranges - for j1 := 0; j1 < len(m.Ranges); j1++ { - var s1 MactimeTimeRange - _ = s1 - if j1 < len(m.Ranges) { - s1 = m.Ranges[j1] - } - // field[2] s1.Start - size += 8 - // field[2] s1.End - size += 8 - } - return size -} -func (m *MactimeDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.PoolIndex - o.PutUint32(buf[pos:pos+4], uint32(m.PoolIndex)) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.MacAddress) { - x = uint8(m.MacAddress[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.DataQuota - o.PutUint64(buf[pos:pos+8], uint64(m.DataQuota)) - pos += 8 - // field[1] m.DataUsedInRange - o.PutUint64(buf[pos:pos+8], uint64(m.DataUsedInRange)) - pos += 8 - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - // field[1] m.DeviceName - copy(buf[pos:pos+64], m.DeviceName) - pos += 64 - // field[1] m.Nranges - o.PutUint32(buf[pos:pos+4], uint32(len(m.Ranges))) - pos += 4 - // field[1] m.Ranges - for j1 := 0; j1 < len(m.Ranges); j1++ { - var v1 MactimeTimeRange - if j1 < len(m.Ranges) { - v1 = m.Ranges[j1] - } - // field[2] v1.Start - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.Start))) - pos += 8 - // field[2] v1.End - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.End))) - pos += 8 - } - return buf, nil -} -func (m *MactimeDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.PoolIndex - m.PoolIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MacAddress - for i := 0; i < len(m.MacAddress); i++ { - m.MacAddress[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.DataQuota - m.DataQuota = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.DataUsedInRange - m.DataUsedInRange = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - // field[1] m.Flags - m.Flags = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.DeviceName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.DeviceName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.Nranges - m.Nranges = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Ranges - m.Ranges = make([]MactimeTimeRange, int(m.Nranges)) - for j1 := 0; j1 < int(m.Nranges); j1++ { - // field[2] m.Ranges[j1].Start - m.Ranges[j1].Start = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - // field[2] m.Ranges[j1].End - m.Ranges[j1].End = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - } - return nil -} - -// MactimeDump represents VPP binary API message 'mactime_dump'. -type MactimeDump struct { - MyTableEpoch uint32 `binapi:"u32,name=my_table_epoch" json:"my_table_epoch,omitempty"` -} - -func (m *MactimeDump) Reset() { *m = MactimeDump{} } -func (*MactimeDump) GetMessageName() string { return "mactime_dump" } -func (*MactimeDump) GetCrcString() string { return "8f454e23" } -func (*MactimeDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MactimeDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.MyTableEpoch - size += 4 - return size -} -func (m *MactimeDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.MyTableEpoch - o.PutUint32(buf[pos:pos+4], uint32(m.MyTableEpoch)) - pos += 4 - return buf, nil -} -func (m *MactimeDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.MyTableEpoch - m.MyTableEpoch = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MactimeDumpReply represents VPP binary API message 'mactime_dump_reply'. -type MactimeDumpReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - TableEpoch uint32 `binapi:"u32,name=table_epoch" json:"table_epoch,omitempty"` -} - -func (m *MactimeDumpReply) Reset() { *m = MactimeDumpReply{} } -func (*MactimeDumpReply) GetMessageName() string { return "mactime_dump_reply" } -func (*MactimeDumpReply) GetCrcString() string { return "49bcc753" } -func (*MactimeDumpReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MactimeDumpReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.TableEpoch - size += 4 - return size -} -func (m *MactimeDumpReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.TableEpoch - o.PutUint32(buf[pos:pos+4], uint32(m.TableEpoch)) - pos += 4 - return buf, nil -} -func (m *MactimeDumpReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TableEpoch - m.TableEpoch = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MactimeEnableDisable represents VPP binary API message 'mactime_enable_disable'. -type MactimeEnableDisable struct { - EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *MactimeEnableDisable) Reset() { *m = MactimeEnableDisable{} } -func (*MactimeEnableDisable) GetMessageName() string { return "mactime_enable_disable" } -func (*MactimeEnableDisable) GetCrcString() string { return "3865946c" } -func (*MactimeEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MactimeEnableDisable) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.EnableDisable - size += 1 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *MactimeEnableDisable) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.EnableDisable - if m.EnableDisable { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *MactimeEnableDisable) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.EnableDisable - m.EnableDisable = tmp[pos] != 0 - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MactimeEnableDisableReply represents VPP binary API message 'mactime_enable_disable_reply'. -type MactimeEnableDisableReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MactimeEnableDisableReply) Reset() { *m = MactimeEnableDisableReply{} } -func (*MactimeEnableDisableReply) GetMessageName() string { return "mactime_enable_disable_reply" } -func (*MactimeEnableDisableReply) GetCrcString() string { return "e8d4e804" } -func (*MactimeEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MactimeEnableDisableReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MactimeEnableDisableReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MactimeEnableDisableReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -func init() { file_mactime_binapi_init() } -func file_mactime_binapi_init() { - api.RegisterMessage((*MactimeAddDelRange)(nil), "mactime.MactimeAddDelRange") - api.RegisterMessage((*MactimeAddDelRangeReply)(nil), "mactime.MactimeAddDelRangeReply") - api.RegisterMessage((*MactimeDetails)(nil), "mactime.MactimeDetails") - api.RegisterMessage((*MactimeDump)(nil), "mactime.MactimeDump") - api.RegisterMessage((*MactimeDumpReply)(nil), "mactime.MactimeDumpReply") - api.RegisterMessage((*MactimeEnableDisable)(nil), "mactime.MactimeEnableDisable") - api.RegisterMessage((*MactimeEnableDisableReply)(nil), "mactime.MactimeEnableDisableReply") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*MactimeAddDelRange)(nil), - (*MactimeAddDelRangeReply)(nil), - (*MactimeDetails)(nil), - (*MactimeDump)(nil), - (*MactimeDumpReply)(nil), - (*MactimeEnableDisable)(nil), - (*MactimeEnableDisableReply)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/mactime/mactime_rpc.ba.go b/examples/binapi/mactime/mactime_rpc.ba.go deleted file mode 100644 index c35b708..0000000 --- a/examples/binapi/mactime/mactime_rpc.ba.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package mactime - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for mactime module. -type RPCService interface { - DumpMactime(ctx context.Context, in *MactimeDump) (RPCService_DumpMactimeClient, error) - MactimeAddDelRange(ctx context.Context, in *MactimeAddDelRange) (*MactimeAddDelRangeReply, error) - MactimeEnableDisable(ctx context.Context, in *MactimeEnableDisable) (*MactimeEnableDisableReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpMactime(ctx context.Context, in *MactimeDump) (RPCService_DumpMactimeClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMactimeClient{stream} - return x, nil -} - -type RPCService_DumpMactimeClient interface { - Recv() (*MactimeDetails, error) -} - -type serviceClient_DumpMactimeClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMactimeClient) Recv() (*MactimeDetails, error) { - m := new(MactimeDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) MactimeAddDelRange(ctx context.Context, in *MactimeAddDelRange) (*MactimeAddDelRangeReply, error) { - out := new(MactimeAddDelRangeReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MactimeEnableDisable(ctx context.Context, in *MactimeEnableDisable) (*MactimeEnableDisableReply, error) { - out := new(MactimeEnableDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/examples/binapi/memif/memif.ba.go b/examples/binapi/memif/memif.ba.go deleted file mode 100644 index bea3160..0000000 --- a/examples/binapi/memif/memif.ba.go +++ /dev/null @@ -1,857 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/plugins/memif.api.json - -/* -Package memif contains generated code for VPP API file memif.api (3.0.0). - -It consists of: - 2 aliases - 8 enums - 10 messages -*/ -package memif - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" - - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "memif" - // APIVersion is the API version of this module. - APIVersion = "3.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0x1a1c95b8 -) - -// MemifMode represents VPP binary API enum 'memif_mode'. -type MemifMode uint32 - -const ( - MEMIF_MODE_API_ETHERNET MemifMode = 0 - MEMIF_MODE_API_IP MemifMode = 1 - MEMIF_MODE_API_PUNT_INJECT MemifMode = 2 -) - -var ( - MemifMode_name = map[uint32]string{ - 0: "MEMIF_MODE_API_ETHERNET", - 1: "MEMIF_MODE_API_IP", - 2: "MEMIF_MODE_API_PUNT_INJECT", - } - MemifMode_value = map[string]uint32{ - "MEMIF_MODE_API_ETHERNET": 0, - "MEMIF_MODE_API_IP": 1, - "MEMIF_MODE_API_PUNT_INJECT": 2, - } -) - -func (x MemifMode) String() string { - s, ok := MemifMode_name[uint32(x)] - if ok { - return s - } - return "MemifMode(" + strconv.Itoa(int(x)) + ")" -} - -// MemifRole represents VPP binary API enum 'memif_role'. -type MemifRole uint32 - -const ( - MEMIF_ROLE_API_MASTER MemifRole = 0 - MEMIF_ROLE_API_SLAVE MemifRole = 1 -) - -var ( - MemifRole_name = map[uint32]string{ - 0: "MEMIF_ROLE_API_MASTER", - 1: "MEMIF_ROLE_API_SLAVE", - } - MemifRole_value = map[string]uint32{ - "MEMIF_ROLE_API_MASTER": 0, - "MEMIF_ROLE_API_SLAVE": 1, - } -) - -func (x MemifRole) String() string { - s, ok := MemifRole_name[uint32(x)] - if ok { - return s - } - return "MemifRole(" + strconv.Itoa(int(x)) + ")" -} - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -func ParseMAC(mac string) (parsed MacAddress, err error) { - var hw net.HardwareAddr - if hw, err = net.ParseMAC(mac); err != nil { - return - } - copy(parsed[:], hw[:]) - return -} - -func (m *MacAddress) ToString() string { - return net.HardwareAddr(m[:]).String() -} - -// MemifCreate represents VPP binary API message 'memif_create'. -type MemifCreate struct { - Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` - Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` - RxQueues uint8 `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"` - TxQueues uint8 `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"` - ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` - SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` - BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` - NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"` - HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` - Secret string `binapi:"string[24],name=secret" json:"secret,omitempty" struc:"[24]byte"` -} - -func (m *MemifCreate) Reset() { *m = MemifCreate{} } -func (*MemifCreate) GetMessageName() string { return "memif_create" } -func (*MemifCreate) GetCrcString() string { return "b1b25061" } -func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifCreate) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Role - size += 4 - // field[1] m.Mode - size += 4 - // field[1] m.RxQueues - size += 1 - // field[1] m.TxQueues - size += 1 - // field[1] m.ID - size += 4 - // field[1] m.SocketID - size += 4 - // field[1] m.RingSize - size += 4 - // field[1] m.BufferSize - size += 2 - // field[1] m.NoZeroCopy - size += 1 - // field[1] m.HwAddr - size += 6 - // field[1] m.Secret - size += 24 - return size -} -func (m *MemifCreate) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Role - o.PutUint32(buf[pos:pos+4], uint32(m.Role)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - // field[1] m.RxQueues - buf[pos] = uint8(m.RxQueues) - pos += 1 - // field[1] m.TxQueues - buf[pos] = uint8(m.TxQueues) - pos += 1 - // field[1] m.ID - o.PutUint32(buf[pos:pos+4], uint32(m.ID)) - pos += 4 - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.RingSize - o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) - pos += 4 - // field[1] m.BufferSize - o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) - pos += 2 - // field[1] m.NoZeroCopy - if m.NoZeroCopy { - buf[pos] = 1 - } - pos += 1 - // field[1] m.HwAddr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.HwAddr) { - x = uint8(m.HwAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Secret - copy(buf[pos:pos+24], m.Secret) - pos += 24 - return buf, nil -} -func (m *MemifCreate) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Role - m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.RxQueues - m.RxQueues = uint8(tmp[pos]) - pos += 1 - // field[1] m.TxQueues - m.TxQueues = uint8(tmp[pos]) - pos += 1 - // field[1] m.ID - m.ID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.RingSize - m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.BufferSize - m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.NoZeroCopy - m.NoZeroCopy = tmp[pos] != 0 - pos += 1 - // field[1] m.HwAddr - for i := 0; i < len(m.HwAddr); i++ { - m.HwAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Secret - { - nul := bytes.Index(tmp[pos:pos+24], []byte{0x00}) - m.Secret = codec.DecodeString(tmp[pos : pos+nul]) - pos += 24 - } - return nil -} - -// MemifCreateReply represents VPP binary API message 'memif_create_reply'. -type MemifCreateReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} } -func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" } -func (*MemifCreateReply) GetCrcString() string { return "5383d31f" } -func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifCreateReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *MemifCreateReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemifDelete represents VPP binary API message 'memif_delete'. -type MemifDelete struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` -} - -func (m *MemifDelete) Reset() { *m = MemifDelete{} } -func (*MemifDelete) GetMessageName() string { return "memif_delete" } -func (*MemifDelete) GetCrcString() string { return "f9e6675e" } -func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifDelete) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - return size -} -func (m *MemifDelete) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *MemifDelete) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemifDeleteReply represents VPP binary API message 'memif_delete_reply'. -type MemifDeleteReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} } -func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" } -func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" } -func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifDeleteReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MemifDeleteReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemifDetails represents VPP binary API message 'memif_details'. -type MemifDetails struct { - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` - ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` - Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` - Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` - ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"` - SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` - BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` - Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"` -} - -func (m *MemifDetails) Reset() { *m = MemifDetails{} } -func (*MemifDetails) GetMessageName() string { return "memif_details" } -func (*MemifDetails) GetCrcString() string { return "d0382c4c" } -func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SwIfIndex - size += 4 - // field[1] m.HwAddr - size += 6 - // field[1] m.ID - size += 4 - // field[1] m.Role - size += 4 - // field[1] m.Mode - size += 4 - // field[1] m.ZeroCopy - size += 1 - // field[1] m.SocketID - size += 4 - // field[1] m.RingSize - size += 4 - // field[1] m.BufferSize - size += 2 - // field[1] m.Flags - size += 4 - // field[1] m.IfName - size += 64 - return size -} -func (m *MemifDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.HwAddr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.HwAddr) { - x = uint8(m.HwAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.ID - o.PutUint32(buf[pos:pos+4], uint32(m.ID)) - pos += 4 - // field[1] m.Role - o.PutUint32(buf[pos:pos+4], uint32(m.Role)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - // field[1] m.ZeroCopy - if m.ZeroCopy { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.RingSize - o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) - pos += 4 - // field[1] m.BufferSize - o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) - pos += 2 - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - // field[1] m.IfName - copy(buf[pos:pos+64], m.IfName) - pos += 64 - return buf, nil -} -func (m *MemifDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.HwAddr - for i := 0; i < len(m.HwAddr); i++ { - m.HwAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.ID - m.ID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Role - m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ZeroCopy - m.ZeroCopy = tmp[pos] != 0 - pos += 1 - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.RingSize - m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.BufferSize - m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.Flags - m.Flags = interface_types.IfStatusFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IfName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.IfName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// MemifDump represents VPP binary API message 'memif_dump'. -type MemifDump struct{} - -func (m *MemifDump) Reset() { *m = MemifDump{} } -func (*MemifDump) GetMessageName() string { return "memif_dump" } -func (*MemifDump) GetCrcString() string { return "51077d14" } -func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MemifDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MemifDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'. -type MemifSocketFilenameAddDel struct { - IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` - SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` -} - -func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} } -func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" } -func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" } -func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifSocketFilenameAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsAdd - size += 1 - // field[1] m.SocketID - size += 4 - // field[1] m.SocketFilename - size += 108 - return size -} -func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.SocketFilename - copy(buf[pos:pos+108], m.SocketFilename) - pos += 108 - return buf, nil -} -func (m *MemifSocketFilenameAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SocketFilename - { - nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) - m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) - pos += 108 - } - return nil -} - -// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'. -type MemifSocketFilenameAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} } -func (*MemifSocketFilenameAddDelReply) GetMessageName() string { - return "memif_socket_filename_add_del_reply" -} -func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifSocketFilenameAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MemifSocketFilenameAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'. -type MemifSocketFilenameDetails struct { - SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` -} - -func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} } -func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" } -func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" } -func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *MemifSocketFilenameDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.SocketID - size += 4 - // field[1] m.SocketFilename - size += 108 - return size -} -func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.SocketFilename - copy(buf[pos:pos+108], m.SocketFilename) - pos += 108 - return buf, nil -} -func (m *MemifSocketFilenameDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SocketFilename - { - nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) - m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) - pos += 108 - } - return nil -} - -// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'. -type MemifSocketFilenameDump struct{} - -func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} } -func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" } -func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" } -func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *MemifSocketFilenameDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *MemifSocketFilenameDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -func init() { file_memif_binapi_init() } -func file_memif_binapi_init() { - api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate") - api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply") - api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete") - api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply") - api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails") - api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump") - api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel") - api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply") - api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails") - api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*MemifCreate)(nil), - (*MemifCreateReply)(nil), - (*MemifDelete)(nil), - (*MemifDeleteReply)(nil), - (*MemifDetails)(nil), - (*MemifDump)(nil), - (*MemifSocketFilenameAddDel)(nil), - (*MemifSocketFilenameAddDelReply)(nil), - (*MemifSocketFilenameDetails)(nil), - (*MemifSocketFilenameDump)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/memif/memif_rpc.ba.go b/examples/binapi/memif/memif_rpc.ba.go deleted file mode 100644 index 8eda8f1..0000000 --- a/examples/binapi/memif/memif_rpc.ba.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package memif - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for memif module. -type RPCService interface { - DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) - DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) - MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) - MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) - MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMemifClient{stream} - return x, nil -} - -type RPCService_DumpMemifClient interface { - Recv() (*MemifDetails, error) -} - -type serviceClient_DumpMemifClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { - m := new(MemifDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMemifSocketFilenameClient{stream} - return x, nil -} - -type RPCService_DumpMemifSocketFilenameClient interface { - Recv() (*MemifSocketFilenameDetails, error) -} - -type serviceClient_DumpMemifSocketFilenameClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { - m := new(MemifSocketFilenameDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { - out := new(MemifCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { - out := new(MemifDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { - out := new(MemifSocketFilenameAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/examples/binapi/sr/sr.ba.go b/examples/binapi/sr/sr.ba.go deleted file mode 100644 index 1803585..0000000 --- a/examples/binapi/sr/sr.ba.go +++ /dev/null @@ -1,1784 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/sr.api.json - -/* -Package sr contains generated code for VPP API file sr.api (2.0.0). - -It consists of: - 6 aliases - 13 enums - 20 messages - 7 types - 1 union -*/ -package sr - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" - - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" - ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "sr" - // APIVersion is the API version of this module. - APIVersion = "2.0.0" - // VersionCrc is the CRC of this module. - VersionCrc = 0xd85c77ca -) - -// SrBehavior represents VPP binary API enum 'sr_behavior'. -type SrBehavior uint8 - -const ( - SR_BEHAVIOR_API_END SrBehavior = 1 - SR_BEHAVIOR_API_X SrBehavior = 2 - SR_BEHAVIOR_API_T SrBehavior = 3 - SR_BEHAVIOR_API_D_FIRST SrBehavior = 4 - SR_BEHAVIOR_API_DX2 SrBehavior = 5 - SR_BEHAVIOR_API_DX6 SrBehavior = 6 - SR_BEHAVIOR_API_DX4 SrBehavior = 7 - SR_BEHAVIOR_API_DT6 SrBehavior = 8 - SR_BEHAVIOR_API_DT4 SrBehavior = 9 - SR_BEHAVIOR_API_LAST SrBehavior = 10 -) - -var ( - SrBehavior_name = map[uint8]string{ - 1: "SR_BEHAVIOR_API_END", - 2: "SR_BEHAVIOR_API_X", - 3: "SR_BEHAVIOR_API_T", - 4: "SR_BEHAVIOR_API_D_FIRST", - 5: "SR_BEHAVIOR_API_DX2", - 6: "SR_BEHAVIOR_API_DX6", - 7: "SR_BEHAVIOR_API_DX4", - 8: "SR_BEHAVIOR_API_DT6", - 9: "SR_BEHAVIOR_API_DT4", - 10: "SR_BEHAVIOR_API_LAST", - } - SrBehavior_value = map[string]uint8{ - "SR_BEHAVIOR_API_END": 1, - "SR_BEHAVIOR_API_X": 2, - "SR_BEHAVIOR_API_T": 3, - "SR_BEHAVIOR_API_D_FIRST": 4, - "SR_BEHAVIOR_API_DX2": 5, - "SR_BEHAVIOR_API_DX6": 6, - "SR_BEHAVIOR_API_DX4": 7, - "SR_BEHAVIOR_API_DT6": 8, - "SR_BEHAVIOR_API_DT4": 9, - "SR_BEHAVIOR_API_LAST": 10, - } -) - -func (x SrBehavior) String() string { - s, ok := SrBehavior_name[uint8(x)] - if ok { - return s - } - return "SrBehavior(" + strconv.Itoa(int(x)) + ")" -} - -// SrPolicyOp represents VPP binary API enum 'sr_policy_op'. -type SrPolicyOp uint8 - -const ( - SR_POLICY_OP_API_NONE SrPolicyOp = 0 - SR_POLICY_OP_API_ADD SrPolicyOp = 1 - SR_POLICY_OP_API_DEL SrPolicyOp = 2 - SR_POLICY_OP_API_MOD SrPolicyOp = 3 -) - -var ( - SrPolicyOp_name = map[uint8]string{ - 0: "SR_POLICY_OP_API_NONE", - 1: "SR_POLICY_OP_API_ADD", - 2: "SR_POLICY_OP_API_DEL", - 3: "SR_POLICY_OP_API_MOD", - } - SrPolicyOp_value = map[string]uint8{ - "SR_POLICY_OP_API_NONE": 0, - "SR_POLICY_OP_API_ADD": 1, - "SR_POLICY_OP_API_DEL": 2, - "SR_POLICY_OP_API_MOD": 3, - } -) - -func (x SrPolicyOp) String() string { - s, ok := SrPolicyOp_name[uint8(x)] - if ok { - return s - } - return "SrPolicyOp(" + strconv.Itoa(int(x)) + ")" -} - -// SrSteer represents VPP binary API enum 'sr_steer'. -type SrSteer uint8 - -const ( - SR_STEER_API_L2 SrSteer = 2 - SR_STEER_API_IPV4 SrSteer = 4 - SR_STEER_API_IPV6 SrSteer = 6 -) - -var ( - SrSteer_name = map[uint8]string{ - 2: "SR_STEER_API_L2", - 4: "SR_STEER_API_IPV4", - 6: "SR_STEER_API_IPV6", - } - SrSteer_value = map[string]uint8{ - "SR_STEER_API_L2": 2, - "SR_STEER_API_IPV4": 4, - "SR_STEER_API_IPV6": 6, - } -) - -func (x SrSteer) String() string { - s, ok := SrSteer_name[uint8(x)] - if ok { - return s - } - return "SrSteer(" + strconv.Itoa(int(x)) + ")" -} - -// Srv6SidList represents VPP binary API type 'srv6_sid_list'. -type Srv6SidList struct { - NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` - Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` - Sids [16]ip_types.IP6Address `binapi:"ip6_address[16],name=sids" json:"sids,omitempty" struc:"[16]ip_types.IP6Address"` -} - -func (*Srv6SidList) GetTypeName() string { return "srv6_sid_list" } - -// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. -type SrLocalsidAddDel struct { - IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"` - Localsid ip_types.IP6Address `binapi:"ip6_address,name=localsid" json:"localsid,omitempty"` - EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` - Behavior SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4.294967295e+09" json:"sw_if_index,omitempty"` - VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - NhAddr ip_types.Address `binapi:"address,name=nh_addr" json:"nh_addr,omitempty"` -} - -func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } -func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" } -func (*SrLocalsidAddDel) GetCrcString() string { return "26fa3309" } -func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrLocalsidAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsDel - size += 1 - // field[1] m.Localsid - size += 16 - // field[1] m.EndPsp - size += 1 - // field[1] m.Behavior - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.VlanIndex - size += 4 - // field[1] m.FibTable - size += 4 - // field[1] m.NhAddr - // field[2] m.NhAddr.Af - size += 1 - // field[2] m.NhAddr.Un - size += 16 - return size -} -func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsDel - if m.IsDel { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Localsid - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.Localsid) { - x = uint8(m.Localsid[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.EndPsp - if m.EndPsp { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Behavior - buf[pos] = uint8(m.Behavior) - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.VlanIndex - o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) - pos += 4 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.NhAddr - // field[2] m.NhAddr.Af - buf[pos] = uint8(m.NhAddr.Af) - pos += 1 - // field[2] m.NhAddr.Un - copy(buf[pos:pos+16], m.NhAddr.Un.XXX_UnionData[:]) - pos += 16 - return buf, nil -} -func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsDel - m.IsDel = tmp[pos] != 0 - pos += 1 - // field[1] m.Localsid - for i := 0; i < len(m.Localsid); i++ { - m.Localsid[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.EndPsp - m.EndPsp = tmp[pos] != 0 - pos += 1 - // field[1] m.Behavior - m.Behavior = SrBehavior(tmp[pos]) - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VlanIndex - m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NhAddr - // field[2] m.NhAddr.Af - m.NhAddr.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[2] m.NhAddr.Un - copy(m.NhAddr.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - return nil -} - -// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. -type SrLocalsidAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrLocalsidAddDelReply) Reset() { *m = SrLocalsidAddDelReply{} } -func (*SrLocalsidAddDelReply) GetMessageName() string { return "sr_localsid_add_del_reply" } -func (*SrLocalsidAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrLocalsidAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrLocalsidAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrLocalsidAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. -type SrLocalsidsDetails struct { - Addr ip_types.IP6Address `binapi:"ip6_address,name=addr" json:"addr,omitempty"` - EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"` - Behavior SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` - XconnectNhAddr ip_types.Address `binapi:"address,name=xconnect_nh_addr" json:"xconnect_nh_addr,omitempty"` - XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` -} - -func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } -func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" } -func (*SrLocalsidsDetails) GetCrcString() string { return "6a6c0265" } -func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrLocalsidsDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Addr - size += 16 - // field[1] m.EndPsp - size += 1 - // field[1] m.Behavior - size += 1 - // field[1] m.FibTable - size += 4 - // field[1] m.VlanIndex - size += 4 - // field[1] m.XconnectNhAddr - // field[2] m.XconnectNhAddr.Af - size += 1 - // field[2] m.XconnectNhAddr.Un - size += 16 - // field[1] m.XconnectIfaceOrVrfTable - size += 4 - return size -} -func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Addr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.Addr) { - x = uint8(m.Addr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.EndPsp - if m.EndPsp { - buf[pos] = 1 - } - pos += 1 - // field[1] m.Behavior - buf[pos] = uint8(m.Behavior) - pos += 1 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.VlanIndex - o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) - pos += 4 - // field[1] m.XconnectNhAddr - // field[2] m.XconnectNhAddr.Af - buf[pos] = uint8(m.XconnectNhAddr.Af) - pos += 1 - // field[2] m.XconnectNhAddr.Un - copy(buf[pos:pos+16], m.XconnectNhAddr.Un.XXX_UnionData[:]) - pos += 16 - // field[1] m.XconnectIfaceOrVrfTable - o.PutUint32(buf[pos:pos+4], uint32(m.XconnectIfaceOrVrfTable)) - pos += 4 - return buf, nil -} -func (m *SrLocalsidsDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Addr - for i := 0; i < len(m.Addr); i++ { - m.Addr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.EndPsp - m.EndPsp = tmp[pos] != 0 - pos += 1 - // field[1] m.Behavior - m.Behavior = SrBehavior(tmp[pos]) - pos += 1 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VlanIndex - m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.XconnectNhAddr - // field[2] m.XconnectNhAddr.Af - m.XconnectNhAddr.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[2] m.XconnectNhAddr.Un - copy(m.XconnectNhAddr.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[1] m.XconnectIfaceOrVrfTable - m.XconnectIfaceOrVrfTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. -type SrLocalsidsDump struct{} - -func (m *SrLocalsidsDump) Reset() { *m = SrLocalsidsDump{} } -func (*SrLocalsidsDump) GetMessageName() string { return "sr_localsids_dump" } -func (*SrLocalsidsDump) GetCrcString() string { return "51077d14" } -func (*SrLocalsidsDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrLocalsidsDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *SrLocalsidsDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *SrLocalsidsDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. -type SrPoliciesDetails struct { - Bsid ip_types.IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` - IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` - IsEncap bool `binapi:"bool,name=is_encap" json:"is_encap,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"num_sid_lists,omitempty" struc:"sizeof=SidLists"` - SidLists []Srv6SidList `binapi:"srv6_sid_list[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"` -} - -func (m *SrPoliciesDetails) Reset() { *m = SrPoliciesDetails{} } -func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" } -func (*SrPoliciesDetails) GetCrcString() string { return "07ec2d93" } -func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrPoliciesDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Bsid - size += 16 - // field[1] m.IsSpray - size += 1 - // field[1] m.IsEncap - size += 1 - // field[1] m.FibTable - size += 4 - // field[1] m.NumSidLists - size += 1 - // field[1] m.SidLists - for j1 := 0; j1 < len(m.SidLists); j1++ { - var s1 Srv6SidList - _ = s1 - if j1 < len(m.SidLists) { - s1 = m.SidLists[j1] - } - // field[2] s1.NumSids - size += 1 - // field[2] s1.Weight - size += 4 - // field[2] s1.Sids - for j2 := 0; j2 < 16; j2++ { - var s2 ip_types.IP6Address - _ = s2 - if j2 < len(s1.Sids) { - s2 = s1.Sids[j2] - } - size += 16 - } - } - return size -} -func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Bsid - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.Bsid) { - x = uint8(m.Bsid[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.IsSpray - if m.IsSpray { - buf[pos] = 1 - } - pos += 1 - // field[1] m.IsEncap - if m.IsEncap { - buf[pos] = 1 - } - pos += 1 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.NumSidLists - buf[pos] = uint8(len(m.SidLists)) - pos += 1 - // field[1] m.SidLists - for j1 := 0; j1 < len(m.SidLists); j1++ { - var v1 Srv6SidList - if j1 < len(m.SidLists) { - v1 = m.SidLists[j1] - } - // field[2] v1.NumSids - buf[pos] = uint8(v1.NumSids) - pos += 1 - // field[2] v1.Weight - o.PutUint32(buf[pos:pos+4], uint32(v1.Weight)) - pos += 4 - // field[2] v1.Sids - for j2 := 0; j2 < 16; j2++ { - var v2 ip_types.IP6Address - if j2 < len(v1.Sids) { - v2 = v1.Sids[j2] - } - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v2) { - x = uint8(v2[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - } - } - return buf, nil -} -func (m *SrPoliciesDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Bsid - for i := 0; i < len(m.Bsid); i++ { - m.Bsid[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.IsSpray - m.IsSpray = tmp[pos] != 0 - pos += 1 - // field[1] m.IsEncap - m.IsEncap = tmp[pos] != 0 - pos += 1 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NumSidLists - m.NumSidLists = uint8(tmp[pos]) - pos += 1 - // field[1] m.SidLists - m.SidLists = make([]Srv6SidList, int(m.NumSidLists)) - for j1 := 0; j1 < int(m.NumSidLists); j1++ { - // field[2] m.SidLists[j1].NumSids - m.SidLists[j1].NumSids = uint8(tmp[pos]) - pos += 1 - // field[2] m.SidLists[j1].Weight - m.SidLists[j1].Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.SidLists[j1].Sids - for j2 := 0; j2 < 16; j2++ { - for i := 0; i < len(m.SidLists[j1].Sids[j2]); i++ { - m.SidLists[j1].Sids[j2][i] = uint8(tmp[pos]) - pos += 1 - } - } - } - return nil -} - -// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. -type SrPoliciesDump struct{} - -func (m *SrPoliciesDump) Reset() { *m = SrPoliciesDump{} } -func (*SrPoliciesDump) GetMessageName() string { return "sr_policies_dump" } -func (*SrPoliciesDump) GetCrcString() string { return "51077d14" } -func (*SrPoliciesDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrPoliciesDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *SrPoliciesDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *SrPoliciesDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. -type SrPolicyAdd struct { - BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` - Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` - IsEncap bool `binapi:"bool,name=is_encap" json:"is_encap,omitempty"` - IsSpray bool `binapi:"bool,name=is_spray" json:"is_spray,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` -} - -func (m *SrPolicyAdd) Reset() { *m = SrPolicyAdd{} } -func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" } -func (*SrPolicyAdd) GetCrcString() string { return "ec79ee6a" } -func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrPolicyAdd) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.BsidAddr - size += 16 - // field[1] m.Weight - size += 4 - // field[1] m.IsEncap - size += 1 - // field[1] m.IsSpray - size += 1 - // field[1] m.FibTable - size += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - size += 1 - // field[2] m.Sids.Weight - size += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - var s2 ip_types.IP6Address - _ = s2 - if j2 < len(m.Sids.Sids) { - s2 = m.Sids.Sids[j2] - } - size += 16 - } - return size -} -func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.BsidAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.BsidAddr) { - x = uint8(m.BsidAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Weight - o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) - pos += 4 - // field[1] m.IsEncap - if m.IsEncap { - buf[pos] = 1 - } - pos += 1 - // field[1] m.IsSpray - if m.IsSpray { - buf[pos] = 1 - } - pos += 1 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - buf[pos] = uint8(m.Sids.NumSids) - pos += 1 - // field[2] m.Sids.Weight - o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) - pos += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - var v2 ip_types.IP6Address - if j2 < len(m.Sids.Sids) { - v2 = m.Sids.Sids[j2] - } - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v2) { - x = uint8(v2[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - } - return buf, nil -} -func (m *SrPolicyAdd) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.BsidAddr - for i := 0; i < len(m.BsidAddr); i++ { - m.BsidAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Weight - m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IsEncap - m.IsEncap = tmp[pos] != 0 - pos += 1 - // field[1] m.IsSpray - m.IsSpray = tmp[pos] != 0 - pos += 1 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - m.Sids.NumSids = uint8(tmp[pos]) - pos += 1 - // field[2] m.Sids.Weight - m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - for i := 0; i < len(m.Sids.Sids[j2]); i++ { - m.Sids.Sids[j2][i] = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. -type SrPolicyAddReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrPolicyAddReply) Reset() { *m = SrPolicyAddReply{} } -func (*SrPolicyAddReply) GetMessageName() string { return "sr_policy_add_reply" } -func (*SrPolicyAddReply) GetCrcString() string { return "e8d4e804" } -func (*SrPolicyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrPolicyAddReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrPolicyAddReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrPolicyAddReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrPolicyDel represents VPP binary API message 'sr_policy_del'. -type SrPolicyDel struct { - BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` -} - -func (m *SrPolicyDel) Reset() { *m = SrPolicyDel{} } -func (*SrPolicyDel) GetMessageName() string { return "sr_policy_del" } -func (*SrPolicyDel) GetCrcString() string { return "cb4d48d5" } -func (*SrPolicyDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrPolicyDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.BsidAddr - size += 16 - // field[1] m.SrPolicyIndex - size += 4 - return size -} -func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.BsidAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.BsidAddr) { - x = uint8(m.BsidAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.SrPolicyIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) - pos += 4 - return buf, nil -} -func (m *SrPolicyDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.BsidAddr - for i := 0; i < len(m.BsidAddr); i++ { - m.BsidAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.SrPolicyIndex - m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. -type SrPolicyDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrPolicyDelReply) Reset() { *m = SrPolicyDelReply{} } -func (*SrPolicyDelReply) GetMessageName() string { return "sr_policy_del_reply" } -func (*SrPolicyDelReply) GetCrcString() string { return "e8d4e804" } -func (*SrPolicyDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrPolicyDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrPolicyDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrPolicyDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. -type SrPolicyMod struct { - BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - Operation SrPolicyOp `binapi:"sr_policy_op,name=operation" json:"operation,omitempty"` - SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` - Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` - Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` -} - -func (m *SrPolicyMod) Reset() { *m = SrPolicyMod{} } -func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" } -func (*SrPolicyMod) GetCrcString() string { return "e531a102" } -func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrPolicyMod) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.BsidAddr - size += 16 - // field[1] m.SrPolicyIndex - size += 4 - // field[1] m.FibTable - size += 4 - // field[1] m.Operation - size += 1 - // field[1] m.SlIndex - size += 4 - // field[1] m.Weight - size += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - size += 1 - // field[2] m.Sids.Weight - size += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - var s2 ip_types.IP6Address - _ = s2 - if j2 < len(m.Sids.Sids) { - s2 = m.Sids.Sids[j2] - } - size += 16 - } - return size -} -func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.BsidAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.BsidAddr) { - x = uint8(m.BsidAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.SrPolicyIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) - pos += 4 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.Operation - buf[pos] = uint8(m.Operation) - pos += 1 - // field[1] m.SlIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SlIndex)) - pos += 4 - // field[1] m.Weight - o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) - pos += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - buf[pos] = uint8(m.Sids.NumSids) - pos += 1 - // field[2] m.Sids.Weight - o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) - pos += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - var v2 ip_types.IP6Address - if j2 < len(m.Sids.Sids) { - v2 = m.Sids.Sids[j2] - } - for i := 0; i < 16; i++ { - var x uint8 - if i < len(v2) { - x = uint8(v2[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - } - return buf, nil -} -func (m *SrPolicyMod) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.BsidAddr - for i := 0; i < len(m.BsidAddr); i++ { - m.BsidAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.SrPolicyIndex - m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Operation - m.Operation = SrPolicyOp(tmp[pos]) - pos += 1 - // field[1] m.SlIndex - m.SlIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Weight - m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Sids - // field[2] m.Sids.NumSids - m.Sids.NumSids = uint8(tmp[pos]) - pos += 1 - // field[2] m.Sids.Weight - m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.Sids.Sids - for j2 := 0; j2 < 16; j2++ { - for i := 0; i < len(m.Sids.Sids[j2]); i++ { - m.Sids.Sids[j2][i] = uint8(tmp[pos]) - pos += 1 - } - } - return nil -} - -// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. -type SrPolicyModReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrPolicyModReply) Reset() { *m = SrPolicyModReply{} } -func (*SrPolicyModReply) GetMessageName() string { return "sr_policy_mod_reply" } -func (*SrPolicyModReply) GetCrcString() string { return "e8d4e804" } -func (*SrPolicyModReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrPolicyModReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrPolicyModReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrPolicyModReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrSetEncapHopLimit represents VPP binary API message 'sr_set_encap_hop_limit'. -type SrSetEncapHopLimit struct { - HopLimit uint8 `binapi:"u8,name=hop_limit" json:"hop_limit,omitempty"` -} - -func (m *SrSetEncapHopLimit) Reset() { *m = SrSetEncapHopLimit{} } -func (*SrSetEncapHopLimit) GetMessageName() string { return "sr_set_encap_hop_limit" } -func (*SrSetEncapHopLimit) GetCrcString() string { return "aa75d7d0" } -func (*SrSetEncapHopLimit) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrSetEncapHopLimit) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.HopLimit - size += 1 - return size -} -func (m *SrSetEncapHopLimit) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.HopLimit - buf[pos] = uint8(m.HopLimit) - pos += 1 - return buf, nil -} -func (m *SrSetEncapHopLimit) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.HopLimit - m.HopLimit = uint8(tmp[pos]) - pos += 1 - return nil -} - -// SrSetEncapHopLimitReply represents VPP binary API message 'sr_set_encap_hop_limit_reply'. -type SrSetEncapHopLimitReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrSetEncapHopLimitReply) Reset() { *m = SrSetEncapHopLimitReply{} } -func (*SrSetEncapHopLimitReply) GetMessageName() string { return "sr_set_encap_hop_limit_reply" } -func (*SrSetEncapHopLimitReply) GetCrcString() string { return "e8d4e804" } -func (*SrSetEncapHopLimitReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrSetEncapHopLimitReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrSetEncapHopLimitReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrSetEncapHopLimitReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. -type SrSetEncapSource struct { - EncapsSource ip_types.IP6Address `binapi:"ip6_address,name=encaps_source" json:"encaps_source,omitempty"` -} - -func (m *SrSetEncapSource) Reset() { *m = SrSetEncapSource{} } -func (*SrSetEncapSource) GetMessageName() string { return "sr_set_encap_source" } -func (*SrSetEncapSource) GetCrcString() string { return "d3bad5e1" } -func (*SrSetEncapSource) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrSetEncapSource) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.EncapsSource - size += 16 - return size -} -func (m *SrSetEncapSource) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.EncapsSource - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.EncapsSource) { - x = uint8(m.EncapsSource[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SrSetEncapSource) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.EncapsSource - for i := 0; i < len(m.EncapsSource); i++ { - m.EncapsSource[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. -type SrSetEncapSourceReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrSetEncapSourceReply) Reset() { *m = SrSetEncapSourceReply{} } -func (*SrSetEncapSourceReply) GetMessageName() string { return "sr_set_encap_source_reply" } -func (*SrSetEncapSourceReply) GetCrcString() string { return "e8d4e804" } -func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrSetEncapSourceReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrSetEncapSourceReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrSetEncapSourceReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. -type SrSteeringAddDel struct { - IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"` - BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"` - SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` - TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` - Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - TrafficType SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` -} - -func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } -func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" } -func (*SrSteeringAddDel) GetCrcString() string { return "3711dace" } -func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrSteeringAddDel) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.IsDel - size += 1 - // field[1] m.BsidAddr - size += 16 - // field[1] m.SrPolicyIndex - size += 4 - // field[1] m.TableID - size += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 1 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.TrafficType - size += 1 - return size -} -func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsDel - if m.IsDel { - buf[pos] = 1 - } - pos += 1 - // field[1] m.BsidAddr - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.BsidAddr) { - x = uint8(m.BsidAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.SrPolicyIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) - pos += 4 - // field[1] m.TableID - o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - buf[pos] = uint8(m.Prefix.Address.Af) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.TrafficType - buf[pos] = uint8(m.TrafficType) - pos += 1 - return buf, nil -} -func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsDel - m.IsDel = tmp[pos] != 0 - pos += 1 - // field[1] m.BsidAddr - for i := 0; i < len(m.BsidAddr); i++ { - m.BsidAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.SrPolicyIndex - m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TableID - m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.TrafficType - m.TrafficType = SrSteer(tmp[pos]) - pos += 1 - return nil -} - -// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. -type SrSteeringAddDelReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` -} - -func (m *SrSteeringAddDelReply) Reset() { *m = SrSteeringAddDelReply{} } -func (*SrSteeringAddDelReply) GetMessageName() string { return "sr_steering_add_del_reply" } -func (*SrSteeringAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrSteeringAddDelReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - return size -} -func (m *SrSteeringAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *SrSteeringAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. -type SrSteeringPolDetails struct { - TrafficType SrSteer `binapi:"sr_steer,name=traffic_type" json:"traffic_type,omitempty"` - FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` - Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` - SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` - Bsid ip_types.IP6Address `binapi:"ip6_address,name=bsid" json:"bsid,omitempty"` -} - -func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } -func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" } -func (*SrSteeringPolDetails) GetCrcString() string { return "1c1ee786" } -func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *SrSteeringPolDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.TrafficType - size += 1 - // field[1] m.FibTable - size += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - size += 1 - // field[3] m.Prefix.Address.Un - size += 16 - // field[2] m.Prefix.Len - size += 1 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.Bsid - size += 16 - return size -} -func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.TrafficType - buf[pos] = uint8(m.TrafficType) - pos += 1 - // field[1] m.FibTable - o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - buf[pos] = uint8(m.Prefix.Address.Af) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) - pos += 16 - // field[2] m.Prefix.Len - buf[pos] = uint8(m.Prefix.Len) - pos += 1 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.Bsid - for i := 0; i < 16; i++ { - var x uint8 - if i < len(m.Bsid) { - x = uint8(m.Bsid[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - return buf, nil -} -func (m *SrSteeringPolDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.TrafficType - m.TrafficType = SrSteer(tmp[pos]) - pos += 1 - // field[1] m.FibTable - m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Prefix - // field[2] m.Prefix.Address - // field[3] m.Prefix.Address.Af - m.Prefix.Address.Af = ip_types.AddressFamily(tmp[pos]) - pos += 1 - // field[3] m.Prefix.Address.Un - copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) - pos += 16 - // field[2] m.Prefix.Len - m.Prefix.Len = uint8(tmp[pos]) - pos += 1 - // field[1] m.SwIfIndex - m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Bsid - for i := 0; i < len(m.Bsid); i++ { - m.Bsid[i] = uint8(tmp[pos]) - pos += 1 - } - return nil -} - -// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. -type SrSteeringPolDump struct{} - -func (m *SrSteeringPolDump) Reset() { *m = SrSteeringPolDump{} } -func (*SrSteeringPolDump) GetMessageName() string { return "sr_steering_pol_dump" } -func (*SrSteeringPolDump) GetCrcString() string { return "51077d14" } -func (*SrSteeringPolDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *SrSteeringPolDump) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *SrSteeringPolDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *SrSteeringPolDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -func init() { file_sr_binapi_init() } -func file_sr_binapi_init() { - api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr.SrLocalsidAddDel") - api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr.SrLocalsidAddDelReply") - api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr.SrLocalsidsDetails") - api.RegisterMessage((*SrLocalsidsDump)(nil), "sr.SrLocalsidsDump") - api.RegisterMessage((*SrPoliciesDetails)(nil), "sr.SrPoliciesDetails") - api.RegisterMessage((*SrPoliciesDump)(nil), "sr.SrPoliciesDump") - api.RegisterMessage((*SrPolicyAdd)(nil), "sr.SrPolicyAdd") - api.RegisterMessage((*SrPolicyAddReply)(nil), "sr.SrPolicyAddReply") - api.RegisterMessage((*SrPolicyDel)(nil), "sr.SrPolicyDel") - api.RegisterMessage((*SrPolicyDelReply)(nil), "sr.SrPolicyDelReply") - api.RegisterMessage((*SrPolicyMod)(nil), "sr.SrPolicyMod") - api.RegisterMessage((*SrPolicyModReply)(nil), "sr.SrPolicyModReply") - api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr.SrSetEncapHopLimit") - api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr.SrSetEncapHopLimitReply") - api.RegisterMessage((*SrSetEncapSource)(nil), "sr.SrSetEncapSource") - api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr.SrSetEncapSourceReply") - api.RegisterMessage((*SrSteeringAddDel)(nil), "sr.SrSteeringAddDel") - api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr.SrSteeringAddDelReply") - api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr.SrSteeringPolDetails") - api.RegisterMessage((*SrSteeringPolDump)(nil), "sr.SrSteeringPolDump") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*SrLocalsidAddDel)(nil), - (*SrLocalsidAddDelReply)(nil), - (*SrLocalsidsDetails)(nil), - (*SrLocalsidsDump)(nil), - (*SrPoliciesDetails)(nil), - (*SrPoliciesDump)(nil), - (*SrPolicyAdd)(nil), - (*SrPolicyAddReply)(nil), - (*SrPolicyDel)(nil), - (*SrPolicyDelReply)(nil), - (*SrPolicyMod)(nil), - (*SrPolicyModReply)(nil), - (*SrSetEncapHopLimit)(nil), - (*SrSetEncapHopLimitReply)(nil), - (*SrSetEncapSource)(nil), - (*SrSetEncapSourceReply)(nil), - (*SrSteeringAddDel)(nil), - (*SrSteeringAddDelReply)(nil), - (*SrSteeringPolDetails)(nil), - (*SrSteeringPolDump)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/sr/sr_rpc.ba.go b/examples/binapi/sr/sr_rpc.ba.go deleted file mode 100644 index aeb3cde..0000000 --- a/examples/binapi/sr/sr_rpc.ba.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package sr - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for sr module. -type RPCService interface { - DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) - DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) - DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) - SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) - SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) - SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) - SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) - SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) - SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) - SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSrLocalsidsClient{stream} - return x, nil -} - -type RPCService_DumpSrLocalsidsClient interface { - Recv() (*SrLocalsidsDetails, error) -} - -type serviceClient_DumpSrLocalsidsClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSrLocalsidsClient) Recv() (*SrLocalsidsDetails, error) { - m := new(SrLocalsidsDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSrPoliciesClient{stream} - return x, nil -} - -type RPCService_DumpSrPoliciesClient interface { - Recv() (*SrPoliciesDetails, error) -} - -type serviceClient_DumpSrPoliciesClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSrPoliciesClient) Recv() (*SrPoliciesDetails, error) { - m := new(SrPoliciesDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSrSteeringPolClient{stream} - return x, nil -} - -type RPCService_DumpSrSteeringPolClient interface { - Recv() (*SrSteeringPolDetails, error) -} - -type serviceClient_DumpSrSteeringPolClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSrSteeringPolClient) Recv() (*SrSteeringPolDetails, error) { - m := new(SrSteeringPolDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) { - out := new(SrLocalsidAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) { - out := new(SrPolicyAddReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { - out := new(SrPolicyDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { - out := new(SrPolicyModReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) { - out := new(SrSetEncapHopLimitReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { - out := new(SrSetEncapSourceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { - out := new(SrSteeringAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/examples/binapi/vpe/vpe.ba.go b/examples/binapi/vpe/vpe.ba.go deleted file mode 100644 index 411a9f4..0000000 --- a/examples/binapi/vpe/vpe.ba.go +++ /dev/null @@ -1,1665 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release -// source: /usr/share/vpp/api/core/vpe.api.json - -/* -Package vpe contains generated code for VPP API file vpe.api (1.6.1). - -It consists of: - 2 aliases - 1 enum - 26 messages - 2 types -*/ -package vpe - -import ( - "bytes" - "context" - "encoding/binary" - "fmt" - "io" - "math" - "net" - "strconv" - "strings" - - api "git.fd.io/govpp.git/api" - codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the GoVPP api package it is being compiled against. -// A compilation error at this line likely means your copy of the -// GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package - -const ( - // ModuleName is the name of this module. - ModuleName = "vpe" - // APIVersion is the API version of this module. - APIVersion = "1.6.1" - // VersionCrc is the CRC of this module. - VersionCrc = 0xbd2c94f4 -) - -// LogLevel represents VPP binary API enum 'log_level'. -type LogLevel uint32 - -const ( - VPE_API_LOG_LEVEL_EMERG LogLevel = 0 - VPE_API_LOG_LEVEL_ALERT LogLevel = 1 - VPE_API_LOG_LEVEL_CRIT LogLevel = 2 - VPE_API_LOG_LEVEL_ERR LogLevel = 3 - VPE_API_LOG_LEVEL_WARNING LogLevel = 4 - VPE_API_LOG_LEVEL_NOTICE LogLevel = 5 - VPE_API_LOG_LEVEL_INFO LogLevel = 6 - VPE_API_LOG_LEVEL_DEBUG LogLevel = 7 - VPE_API_LOG_LEVEL_DISABLED LogLevel = 8 -) - -var ( - LogLevel_name = map[uint32]string{ - 0: "VPE_API_LOG_LEVEL_EMERG", - 1: "VPE_API_LOG_LEVEL_ALERT", - 2: "VPE_API_LOG_LEVEL_CRIT", - 3: "VPE_API_LOG_LEVEL_ERR", - 4: "VPE_API_LOG_LEVEL_WARNING", - 5: "VPE_API_LOG_LEVEL_NOTICE", - 6: "VPE_API_LOG_LEVEL_INFO", - 7: "VPE_API_LOG_LEVEL_DEBUG", - 8: "VPE_API_LOG_LEVEL_DISABLED", - } - LogLevel_value = map[string]uint32{ - "VPE_API_LOG_LEVEL_EMERG": 0, - "VPE_API_LOG_LEVEL_ALERT": 1, - "VPE_API_LOG_LEVEL_CRIT": 2, - "VPE_API_LOG_LEVEL_ERR": 3, - "VPE_API_LOG_LEVEL_WARNING": 4, - "VPE_API_LOG_LEVEL_NOTICE": 5, - "VPE_API_LOG_LEVEL_INFO": 6, - "VPE_API_LOG_LEVEL_DEBUG": 7, - "VPE_API_LOG_LEVEL_DISABLED": 8, - } -) - -func (x LogLevel) String() string { - s, ok := LogLevel_name[uint32(x)] - if ok { - return s - } - return "LogLevel(" + strconv.Itoa(int(x)) + ")" -} - -// Timedelta represents VPP binary API alias 'timedelta'. -type Timedelta float64 - -// Timestamp represents VPP binary API alias 'timestamp'. -type Timestamp float64 - -// ThreadData represents VPP binary API type 'thread_data'. -type ThreadData struct { - ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` - Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` - Type string `binapi:"string[64],name=type" json:"type,omitempty" struc:"[64]byte"` - PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` - CPUID uint32 `binapi:"u32,name=cpu_id" json:"cpu_id,omitempty"` - Core uint32 `binapi:"u32,name=core" json:"core,omitempty"` - CPUSocket uint32 `binapi:"u32,name=cpu_socket" json:"cpu_socket,omitempty"` -} - -func (*ThreadData) GetTypeName() string { return "thread_data" } - -// Version represents VPP binary API type 'version'. -type Version struct { - Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` - Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` - Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` - PreRelease []byte `binapi:"u8[17],name=pre_release" json:"pre_release,omitempty" struc:"[17]byte"` - BuildMetadata []byte `binapi:"u8[17],name=build_metadata" json:"build_metadata,omitempty" struc:"[17]byte"` -} - -func (*Version) GetTypeName() string { return "version" } - -// AddNodeNext represents VPP binary API message 'add_node_next'. -type AddNodeNext struct { - NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` - NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` -} - -func (m *AddNodeNext) Reset() { *m = AddNodeNext{} } -func (*AddNodeNext) GetMessageName() string { return "add_node_next" } -func (*AddNodeNext) GetCrcString() string { return "2457116d" } -func (*AddNodeNext) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *AddNodeNext) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.NodeName - size += 64 - // field[1] m.NextName - size += 64 - return size -} -func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.NodeName - copy(buf[pos:pos+64], m.NodeName) - pos += 64 - // field[1] m.NextName - copy(buf[pos:pos+64], m.NextName) - pos += 64 - return buf, nil -} -func (m *AddNodeNext) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.NodeName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.NodeName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.NextName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.NextName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// AddNodeNextReply represents VPP binary API message 'add_node_next_reply'. -type AddNodeNextReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` -} - -func (m *AddNodeNextReply) Reset() { *m = AddNodeNextReply{} } -func (*AddNodeNextReply) GetMessageName() string { return "add_node_next_reply" } -func (*AddNodeNextReply) GetCrcString() string { return "2ed75f32" } -func (*AddNodeNextReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *AddNodeNextReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.NextIndex - size += 4 - return size -} -func (m *AddNodeNextReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.NextIndex - o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) - pos += 4 - return buf, nil -} -func (m *AddNodeNextReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NextIndex - m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// Cli represents VPP binary API message 'cli'. -type Cli struct { - CmdInShmem uint64 `binapi:"u64,name=cmd_in_shmem" json:"cmd_in_shmem,omitempty"` -} - -func (m *Cli) Reset() { *m = Cli{} } -func (*Cli) GetMessageName() string { return "cli" } -func (*Cli) GetCrcString() string { return "23bfbfff" } -func (*Cli) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *Cli) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.CmdInShmem - size += 8 - return size -} -func (m *Cli) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.CmdInShmem - o.PutUint64(buf[pos:pos+8], uint64(m.CmdInShmem)) - pos += 8 - return buf, nil -} -func (m *Cli) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.CmdInShmem - m.CmdInShmem = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// CliInband represents VPP binary API message 'cli_inband'. -type CliInband struct { - XXX_CmdLen uint32 `struc:"sizeof=Cmd"` - Cmd string `json:"cmd,omitempty"` -} - -func (m *CliInband) Reset() { *m = CliInband{} } -func (*CliInband) GetMessageName() string { return "cli_inband" } -func (*CliInband) GetCrcString() string { return "f8377302" } -func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *CliInband) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Cmd - size += 4 + len(m.Cmd) - return size -} -func (m *CliInband) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Cmd - o.PutUint32(buf[pos:pos+4], uint32(len(m.Cmd))) - pos += 4 - copy(buf[pos:pos+len(m.Cmd)], m.Cmd[:]) - pos += len(m.Cmd) - return buf, nil -} -func (m *CliInband) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Cmd - { - siz := o.Uint32(tmp[pos : pos+4]) - pos += 4 - m.Cmd = codec.DecodeString(tmp[pos : pos+int(siz)]) - pos += len(m.Cmd) - } - return nil -} - -// CliInbandReply represents VPP binary API message 'cli_inband_reply'. -type CliInbandReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - XXX_ReplyLen uint32 `struc:"sizeof=Reply"` - Reply string `json:"reply,omitempty"` -} - -func (m *CliInbandReply) Reset() { *m = CliInbandReply{} } -func (*CliInbandReply) GetMessageName() string { return "cli_inband_reply" } -func (*CliInbandReply) GetCrcString() string { return "05879051" } -func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CliInbandReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.Reply - size += 4 + len(m.Reply) - return size -} -func (m *CliInbandReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.Reply - o.PutUint32(buf[pos:pos+4], uint32(len(m.Reply))) - pos += 4 - copy(buf[pos:pos+len(m.Reply)], m.Reply[:]) - pos += len(m.Reply) - return buf, nil -} -func (m *CliInbandReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Reply - { - siz := o.Uint32(tmp[pos : pos+4]) - pos += 4 - m.Reply = codec.DecodeString(tmp[pos : pos+int(siz)]) - pos += len(m.Reply) - } - return nil -} - -// CliReply represents VPP binary API message 'cli_reply'. -type CliReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` -} - -func (m *CliReply) Reset() { *m = CliReply{} } -func (*CliReply) GetMessageName() string { return "cli_reply" } -func (*CliReply) GetCrcString() string { return "06d68297" } -func (*CliReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *CliReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.ReplyInShmem - size += 8 - return size -} -func (m *CliReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.ReplyInShmem - o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) - pos += 8 - return buf, nil -} -func (m *CliReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ReplyInShmem - m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// ControlPing represents VPP binary API message 'control_ping'. -type ControlPing struct{} - -func (m *ControlPing) Reset() { *m = ControlPing{} } -func (*ControlPing) GetMessageName() string { return "control_ping" } -func (*ControlPing) GetCrcString() string { return "51077d14" } -func (*ControlPing) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ControlPing) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ControlPing) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ControlPing) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ControlPingReply represents VPP binary API message 'control_ping_reply'. -type ControlPingReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` - VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` -} - -func (m *ControlPingReply) Reset() { *m = ControlPingReply{} } -func (*ControlPingReply) GetMessageName() string { return "control_ping_reply" } -func (*ControlPingReply) GetCrcString() string { return "f6b0b8ca" } -func (*ControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ControlPingReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.ClientIndex - size += 4 - // field[1] m.VpePID - size += 4 - return size -} -func (m *ControlPingReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.ClientIndex - o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) - pos += 4 - // field[1] m.VpePID - o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) - pos += 4 - return buf, nil -} -func (m *ControlPingReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ClientIndex - m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VpePID - m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// GetF64EndianValue represents VPP binary API message 'get_f64_endian_value'. -type GetF64EndianValue struct { - F64One float64 `binapi:"f64,name=f64_one,default=1" json:"f64_one,omitempty"` -} - -func (m *GetF64EndianValue) Reset() { *m = GetF64EndianValue{} } -func (*GetF64EndianValue) GetMessageName() string { return "get_f64_endian_value" } -func (*GetF64EndianValue) GetCrcString() string { return "809fcd44" } -func (*GetF64EndianValue) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetF64EndianValue) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.F64One - size += 8 - return size -} -func (m *GetF64EndianValue) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.F64One - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64One))) - pos += 8 - return buf, nil -} -func (m *GetF64EndianValue) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.F64One - m.F64One = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// GetF64EndianValueReply represents VPP binary API message 'get_f64_endian_value_reply'. -type GetF64EndianValueReply struct { - Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` - F64OneResult float64 `binapi:"f64,name=f64_one_result" json:"f64_one_result,omitempty"` -} - -func (m *GetF64EndianValueReply) Reset() { *m = GetF64EndianValueReply{} } -func (*GetF64EndianValueReply) GetMessageName() string { return "get_f64_endian_value_reply" } -func (*GetF64EndianValueReply) GetCrcString() string { return "7e02e404" } -func (*GetF64EndianValueReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetF64EndianValueReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.F64OneResult - size += 8 - return size -} -func (m *GetF64EndianValueReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.F64OneResult - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64OneResult))) - pos += 8 - return buf, nil -} -func (m *GetF64EndianValueReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.F64OneResult - m.F64OneResult = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// GetF64IncrementByOne represents VPP binary API message 'get_f64_increment_by_one'. -type GetF64IncrementByOne struct { - F64Value float64 `binapi:"f64,name=f64_value,default=1" json:"f64_value,omitempty"` -} - -func (m *GetF64IncrementByOne) Reset() { *m = GetF64IncrementByOne{} } -func (*GetF64IncrementByOne) GetMessageName() string { return "get_f64_increment_by_one" } -func (*GetF64IncrementByOne) GetCrcString() string { return "b64f027e" } -func (*GetF64IncrementByOne) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetF64IncrementByOne) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.F64Value - size += 8 - return size -} -func (m *GetF64IncrementByOne) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.F64Value - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) - pos += 8 - return buf, nil -} -func (m *GetF64IncrementByOne) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.F64Value - m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// GetF64IncrementByOneReply represents VPP binary API message 'get_f64_increment_by_one_reply'. -type GetF64IncrementByOneReply struct { - Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` - F64Value float64 `binapi:"f64,name=f64_value" json:"f64_value,omitempty"` -} - -func (m *GetF64IncrementByOneReply) Reset() { *m = GetF64IncrementByOneReply{} } -func (*GetF64IncrementByOneReply) GetMessageName() string { return "get_f64_increment_by_one_reply" } -func (*GetF64IncrementByOneReply) GetCrcString() string { return "d25dbaa3" } -func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetF64IncrementByOneReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.F64Value - size += 8 - return size -} -func (m *GetF64IncrementByOneReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.F64Value - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) - pos += 8 - return buf, nil -} -func (m *GetF64IncrementByOneReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.F64Value - m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// GetNextIndex represents VPP binary API message 'get_next_index'. -type GetNextIndex struct { - NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` - NextName string `binapi:"string[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` -} - -func (m *GetNextIndex) Reset() { *m = GetNextIndex{} } -func (*GetNextIndex) GetMessageName() string { return "get_next_index" } -func (*GetNextIndex) GetCrcString() string { return "2457116d" } -func (*GetNextIndex) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetNextIndex) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.NodeName - size += 64 - // field[1] m.NextName - size += 64 - return size -} -func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.NodeName - copy(buf[pos:pos+64], m.NodeName) - pos += 64 - // field[1] m.NextName - copy(buf[pos:pos+64], m.NextName) - pos += 64 - return buf, nil -} -func (m *GetNextIndex) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.NodeName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.NodeName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[1] m.NextName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.NextName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// GetNextIndexReply represents VPP binary API message 'get_next_index_reply'. -type GetNextIndexReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` -} - -func (m *GetNextIndexReply) Reset() { *m = GetNextIndexReply{} } -func (*GetNextIndexReply) GetMessageName() string { return "get_next_index_reply" } -func (*GetNextIndexReply) GetCrcString() string { return "2ed75f32" } -func (*GetNextIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetNextIndexReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.NextIndex - size += 4 - return size -} -func (m *GetNextIndexReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.NextIndex - o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) - pos += 4 - return buf, nil -} -func (m *GetNextIndexReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NextIndex - m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// GetNodeGraph represents VPP binary API message 'get_node_graph'. -type GetNodeGraph struct{} - -func (m *GetNodeGraph) Reset() { *m = GetNodeGraph{} } -func (*GetNodeGraph) GetMessageName() string { return "get_node_graph" } -func (*GetNodeGraph) GetCrcString() string { return "51077d14" } -func (*GetNodeGraph) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetNodeGraph) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *GetNodeGraph) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *GetNodeGraph) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply'. -type GetNodeGraphReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` -} - -func (m *GetNodeGraphReply) Reset() { *m = GetNodeGraphReply{} } -func (*GetNodeGraphReply) GetMessageName() string { return "get_node_graph_reply" } -func (*GetNodeGraphReply) GetCrcString() string { return "06d68297" } -func (*GetNodeGraphReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetNodeGraphReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.ReplyInShmem - size += 8 - return size -} -func (m *GetNodeGraphReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.ReplyInShmem - o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) - pos += 8 - return buf, nil -} -func (m *GetNodeGraphReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ReplyInShmem - m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) - pos += 8 - return nil -} - -// GetNodeIndex represents VPP binary API message 'get_node_index'. -type GetNodeIndex struct { - NodeName string `binapi:"string[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` -} - -func (m *GetNodeIndex) Reset() { *m = GetNodeIndex{} } -func (*GetNodeIndex) GetMessageName() string { return "get_node_index" } -func (*GetNodeIndex) GetCrcString() string { return "f1984c64" } -func (*GetNodeIndex) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *GetNodeIndex) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.NodeName - size += 64 - return size -} -func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.NodeName - copy(buf[pos:pos+64], m.NodeName) - pos += 64 - return buf, nil -} -func (m *GetNodeIndex) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.NodeName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.NodeName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - return nil -} - -// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply'. -type GetNodeIndexReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - NodeIndex uint32 `binapi:"u32,name=node_index" json:"node_index,omitempty"` -} - -func (m *GetNodeIndexReply) Reset() { *m = GetNodeIndexReply{} } -func (*GetNodeIndexReply) GetMessageName() string { return "get_node_index_reply" } -func (*GetNodeIndexReply) GetCrcString() string { return "a8600b89" } -func (*GetNodeIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *GetNodeIndexReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.NodeIndex - size += 4 - return size -} -func (m *GetNodeIndexReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.NodeIndex - o.PutUint32(buf[pos:pos+4], uint32(m.NodeIndex)) - pos += 4 - return buf, nil -} -func (m *GetNodeIndexReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.NodeIndex - m.NodeIndex = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - return nil -} - -// LogDetails represents VPP binary API message 'log_details'. -type LogDetails struct { - Timestamp Timestamp `binapi:"timestamp,name=timestamp" json:"timestamp,omitempty"` - Level LogLevel `binapi:"log_level,name=level" json:"level,omitempty"` - MsgClass string `binapi:"string[32],name=msg_class" json:"msg_class,omitempty" struc:"[32]byte"` - Message string `binapi:"string[256],name=message" json:"message,omitempty" struc:"[256]byte"` -} - -func (m *LogDetails) Reset() { *m = LogDetails{} } -func (*LogDetails) GetMessageName() string { return "log_details" } -func (*LogDetails) GetCrcString() string { return "255827a1" } -func (*LogDetails) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *LogDetails) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Timestamp - size += 8 - // field[1] m.Level - size += 4 - // field[1] m.MsgClass - size += 32 - // field[1] m.Message - size += 256 - return size -} -func (m *LogDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Timestamp - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.Timestamp))) - pos += 8 - // field[1] m.Level - o.PutUint32(buf[pos:pos+4], uint32(m.Level)) - pos += 4 - // field[1] m.MsgClass - copy(buf[pos:pos+32], m.MsgClass) - pos += 32 - // field[1] m.Message - copy(buf[pos:pos+256], m.Message) - pos += 256 - return buf, nil -} -func (m *LogDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Timestamp - m.Timestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - // field[1] m.Level - m.Level = LogLevel(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.MsgClass - { - nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) - m.MsgClass = codec.DecodeString(tmp[pos : pos+nul]) - pos += 32 - } - // field[1] m.Message - { - nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) - m.Message = codec.DecodeString(tmp[pos : pos+nul]) - pos += 256 - } - return nil -} - -// LogDump represents VPP binary API message 'log_dump'. -type LogDump struct { - StartTimestamp Timestamp `binapi:"timestamp,name=start_timestamp" json:"start_timestamp,omitempty"` -} - -func (m *LogDump) Reset() { *m = LogDump{} } -func (*LogDump) GetMessageName() string { return "log_dump" } -func (*LogDump) GetCrcString() string { return "6ab31753" } -func (*LogDump) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *LogDump) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.StartTimestamp - size += 8 - return size -} -func (m *LogDump) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.StartTimestamp - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.StartTimestamp))) - pos += 8 - return buf, nil -} -func (m *LogDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.StartTimestamp - m.StartTimestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -// ShowThreads represents VPP binary API message 'show_threads'. -type ShowThreads struct{} - -func (m *ShowThreads) Reset() { *m = ShowThreads{} } -func (*ShowThreads) GetMessageName() string { return "show_threads" } -func (*ShowThreads) GetCrcString() string { return "51077d14" } -func (*ShowThreads) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ShowThreads) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ShowThreads) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ShowThreads) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ShowThreadsReply represents VPP binary API message 'show_threads_reply'. -type ShowThreadsReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=ThreadData"` - ThreadData []ThreadData `binapi:"thread_data[count],name=thread_data" json:"thread_data,omitempty"` -} - -func (m *ShowThreadsReply) Reset() { *m = ShowThreadsReply{} } -func (*ShowThreadsReply) GetMessageName() string { return "show_threads_reply" } -func (*ShowThreadsReply) GetCrcString() string { return "efd78e83" } -func (*ShowThreadsReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ShowThreadsReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.Count - size += 4 - // field[1] m.ThreadData - for j1 := 0; j1 < len(m.ThreadData); j1++ { - var s1 ThreadData - _ = s1 - if j1 < len(m.ThreadData) { - s1 = m.ThreadData[j1] - } - // field[2] s1.ID - size += 4 - // field[2] s1.Name - size += 64 - // field[2] s1.Type - size += 64 - // field[2] s1.PID - size += 4 - // field[2] s1.CPUID - size += 4 - // field[2] s1.Core - size += 4 - // field[2] s1.CPUSocket - size += 4 - } - return size -} -func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.Count - o.PutUint32(buf[pos:pos+4], uint32(len(m.ThreadData))) - pos += 4 - // field[1] m.ThreadData - for j1 := 0; j1 < len(m.ThreadData); j1++ { - var v1 ThreadData - if j1 < len(m.ThreadData) { - v1 = m.ThreadData[j1] - } - // field[2] v1.ID - o.PutUint32(buf[pos:pos+4], uint32(v1.ID)) - pos += 4 - // field[2] v1.Name - copy(buf[pos:pos+64], v1.Name) - pos += 64 - // field[2] v1.Type - copy(buf[pos:pos+64], v1.Type) - pos += 64 - // field[2] v1.PID - o.PutUint32(buf[pos:pos+4], uint32(v1.PID)) - pos += 4 - // field[2] v1.CPUID - o.PutUint32(buf[pos:pos+4], uint32(v1.CPUID)) - pos += 4 - // field[2] v1.Core - o.PutUint32(buf[pos:pos+4], uint32(v1.Core)) - pos += 4 - // field[2] v1.CPUSocket - o.PutUint32(buf[pos:pos+4], uint32(v1.CPUSocket)) - pos += 4 - } - return buf, nil -} -func (m *ShowThreadsReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Count - m.Count = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ThreadData - m.ThreadData = make([]ThreadData, int(m.Count)) - for j1 := 0; j1 < int(m.Count); j1++ { - // field[2] m.ThreadData[j1].ID - m.ThreadData[j1].ID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.ThreadData[j1].Name - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.ThreadData[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[2] m.ThreadData[j1].Type - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.ThreadData[j1].Type = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } - // field[2] m.ThreadData[j1].PID - m.ThreadData[j1].PID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.ThreadData[j1].CPUID - m.ThreadData[j1].CPUID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.ThreadData[j1].Core - m.ThreadData[j1].Core = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[2] m.ThreadData[j1].CPUSocket - m.ThreadData[j1].CPUSocket = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - } - return nil -} - -// ShowVersion represents VPP binary API message 'show_version'. -type ShowVersion struct{} - -func (m *ShowVersion) Reset() { *m = ShowVersion{} } -func (*ShowVersion) GetMessageName() string { return "show_version" } -func (*ShowVersion) GetCrcString() string { return "51077d14" } -func (*ShowVersion) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ShowVersion) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ShowVersion) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ShowVersion) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ShowVersionReply represents VPP binary API message 'show_version_reply'. -type ShowVersionReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - Program string `binapi:"string[32],name=program" json:"program,omitempty" struc:"[32]byte"` - Version string `binapi:"string[32],name=version" json:"version,omitempty" struc:"[32]byte"` - BuildDate string `binapi:"string[32],name=build_date" json:"build_date,omitempty" struc:"[32]byte"` - BuildDirectory string `binapi:"string[256],name=build_directory" json:"build_directory,omitempty" struc:"[256]byte"` -} - -func (m *ShowVersionReply) Reset() { *m = ShowVersionReply{} } -func (*ShowVersionReply) GetMessageName() string { return "show_version_reply" } -func (*ShowVersionReply) GetCrcString() string { return "c919bde1" } -func (*ShowVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ShowVersionReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.Program - size += 32 - // field[1] m.Version - size += 32 - // field[1] m.BuildDate - size += 32 - // field[1] m.BuildDirectory - size += 256 - return size -} -func (m *ShowVersionReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.Program - copy(buf[pos:pos+32], m.Program) - pos += 32 - // field[1] m.Version - copy(buf[pos:pos+32], m.Version) - pos += 32 - // field[1] m.BuildDate - copy(buf[pos:pos+32], m.BuildDate) - pos += 32 - // field[1] m.BuildDirectory - copy(buf[pos:pos+256], m.BuildDirectory) - pos += 256 - return buf, nil -} -func (m *ShowVersionReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Program - { - nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) - m.Program = codec.DecodeString(tmp[pos : pos+nul]) - pos += 32 - } - // field[1] m.Version - { - nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) - m.Version = codec.DecodeString(tmp[pos : pos+nul]) - pos += 32 - } - // field[1] m.BuildDate - { - nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) - m.BuildDate = codec.DecodeString(tmp[pos : pos+nul]) - pos += 32 - } - // field[1] m.BuildDirectory - { - nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) - m.BuildDirectory = codec.DecodeString(tmp[pos : pos+nul]) - pos += 256 - } - return nil -} - -// ShowVpeSystemTime represents VPP binary API message 'show_vpe_system_time'. -type ShowVpeSystemTime struct{} - -func (m *ShowVpeSystemTime) Reset() { *m = ShowVpeSystemTime{} } -func (*ShowVpeSystemTime) GetMessageName() string { return "show_vpe_system_time" } -func (*ShowVpeSystemTime) GetCrcString() string { return "51077d14" } -func (*ShowVpeSystemTime) GetMessageType() api.MessageType { return api.RequestMessage } - -func (m *ShowVpeSystemTime) Size() int { - if m == nil { - return 0 - } - var size int - return size -} -func (m *ShowVpeSystemTime) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - return buf, nil -} -func (m *ShowVpeSystemTime) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - return nil -} - -// ShowVpeSystemTimeReply represents VPP binary API message 'show_vpe_system_time_reply'. -type ShowVpeSystemTimeReply struct { - Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` - VpeSystemTime Timestamp `binapi:"timestamp,name=vpe_system_time" json:"vpe_system_time,omitempty"` -} - -func (m *ShowVpeSystemTimeReply) Reset() { *m = ShowVpeSystemTimeReply{} } -func (*ShowVpeSystemTimeReply) GetMessageName() string { return "show_vpe_system_time_reply" } -func (*ShowVpeSystemTimeReply) GetCrcString() string { return "7ffd8193" } -func (*ShowVpeSystemTimeReply) GetMessageType() api.MessageType { return api.ReplyMessage } - -func (m *ShowVpeSystemTimeReply) Size() int { - if m == nil { - return 0 - } - var size int - // field[1] m.Retval - size += 4 - // field[1] m.VpeSystemTime - size += 8 - return size -} -func (m *ShowVpeSystemTimeReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte - if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.VpeSystemTime - o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.VpeSystemTime))) - pos += 8 - return buf, nil -} -func (m *ShowVpeSystemTimeReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.VpeSystemTime - m.VpeSystemTime = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) - pos += 8 - return nil -} - -func init() { file_vpe_binapi_init() } -func file_vpe_binapi_init() { - api.RegisterMessage((*AddNodeNext)(nil), "vpe.AddNodeNext") - api.RegisterMessage((*AddNodeNextReply)(nil), "vpe.AddNodeNextReply") - api.RegisterMessage((*Cli)(nil), "vpe.Cli") - api.RegisterMessage((*CliInband)(nil), "vpe.CliInband") - api.RegisterMessage((*CliInbandReply)(nil), "vpe.CliInbandReply") - api.RegisterMessage((*CliReply)(nil), "vpe.CliReply") - api.RegisterMessage((*ControlPing)(nil), "vpe.ControlPing") - api.RegisterMessage((*ControlPingReply)(nil), "vpe.ControlPingReply") - api.RegisterMessage((*GetF64EndianValue)(nil), "vpe.GetF64EndianValue") - api.RegisterMessage((*GetF64EndianValueReply)(nil), "vpe.GetF64EndianValueReply") - api.RegisterMessage((*GetF64IncrementByOne)(nil), "vpe.GetF64IncrementByOne") - api.RegisterMessage((*GetF64IncrementByOneReply)(nil), "vpe.GetF64IncrementByOneReply") - api.RegisterMessage((*GetNextIndex)(nil), "vpe.GetNextIndex") - api.RegisterMessage((*GetNextIndexReply)(nil), "vpe.GetNextIndexReply") - api.RegisterMessage((*GetNodeGraph)(nil), "vpe.GetNodeGraph") - api.RegisterMessage((*GetNodeGraphReply)(nil), "vpe.GetNodeGraphReply") - api.RegisterMessage((*GetNodeIndex)(nil), "vpe.GetNodeIndex") - api.RegisterMessage((*GetNodeIndexReply)(nil), "vpe.GetNodeIndexReply") - api.RegisterMessage((*LogDetails)(nil), "vpe.LogDetails") - api.RegisterMessage((*LogDump)(nil), "vpe.LogDump") - api.RegisterMessage((*ShowThreads)(nil), "vpe.ShowThreads") - api.RegisterMessage((*ShowThreadsReply)(nil), "vpe.ShowThreadsReply") - api.RegisterMessage((*ShowVersion)(nil), "vpe.ShowVersion") - api.RegisterMessage((*ShowVersionReply)(nil), "vpe.ShowVersionReply") - api.RegisterMessage((*ShowVpeSystemTime)(nil), "vpe.ShowVpeSystemTime") - api.RegisterMessage((*ShowVpeSystemTimeReply)(nil), "vpe.ShowVpeSystemTimeReply") -} - -// Messages returns list of all messages in this module. -func AllMessages() []api.Message { - return []api.Message{ - (*AddNodeNext)(nil), - (*AddNodeNextReply)(nil), - (*Cli)(nil), - (*CliInband)(nil), - (*CliInbandReply)(nil), - (*CliReply)(nil), - (*ControlPing)(nil), - (*ControlPingReply)(nil), - (*GetF64EndianValue)(nil), - (*GetF64EndianValueReply)(nil), - (*GetF64IncrementByOne)(nil), - (*GetF64IncrementByOneReply)(nil), - (*GetNextIndex)(nil), - (*GetNextIndexReply)(nil), - (*GetNodeGraph)(nil), - (*GetNodeGraphReply)(nil), - (*GetNodeIndex)(nil), - (*GetNodeIndexReply)(nil), - (*LogDetails)(nil), - (*LogDump)(nil), - (*ShowThreads)(nil), - (*ShowThreadsReply)(nil), - (*ShowVersion)(nil), - (*ShowVersionReply)(nil), - (*ShowVpeSystemTime)(nil), - (*ShowVpeSystemTimeReply)(nil), - } -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = strings.Contains -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits -var _ = net.ParseIP -var _ = fmt.Errorf diff --git a/examples/binapi/vpe/vpe_rpc.ba.go b/examples/binapi/vpe/vpe_rpc.ba.go deleted file mode 100644 index e81fb91..0000000 --- a/examples/binapi/vpe/vpe_rpc.ba.go +++ /dev/null @@ -1,174 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package vpe - -import ( - "context" - "io" - - api "git.fd.io/govpp.git/api" -) - -// RPCService represents RPC service API for vpe module. -type RPCService interface { - DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) - AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) - Cli(ctx context.Context, in *Cli) (*CliReply, error) - CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) - ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) - GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) - GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) - GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) - GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) - GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) - ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) - ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) - ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpLogClient{stream} - return x, nil -} - -type RPCService_DumpLogClient interface { - Recv() (*LogDetails, error) -} - -type serviceClient_DumpLogClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpLogClient) Recv() (*LogDetails, error) { - m := new(LogDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { - out := new(AddNodeNextReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { - out := new(CliReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { - out := new(CliInbandReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { - out := new(ControlPingReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { - out := new(GetF64EndianValueReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { - out := new(GetF64IncrementByOneReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { - out := new(GetNextIndexReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { - out := new(GetNodeGraphReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { - out := new(GetNodeIndexReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { - out := new(ShowThreadsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { - out := new(ShowVersionReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { - out := new(ShowVpeSystemTimeReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy diff --git a/examples/multi-vpp/multi_vpp.go b/examples/multi-vpp/multi_vpp.go index 244dd03..8714c9a 100644 --- a/examples/multi-vpp/multi_vpp.go +++ b/examples/multi-vpp/multi_vpp.go @@ -18,17 +18,18 @@ package main import ( "flag" "fmt" + "log" + "os" + "git.fd.io/govpp.git" "git.fd.io/govpp.git/adapter/socketclient" "git.fd.io/govpp.git/api" + interfaces "git.fd.io/govpp.git/binapi/interface" + "git.fd.io/govpp.git/binapi/interface_types" + "git.fd.io/govpp.git/binapi/ip" + "git.fd.io/govpp.git/binapi/ip_types" + "git.fd.io/govpp.git/binapi/vpe" "git.fd.io/govpp.git/core" - "git.fd.io/govpp.git/examples/binapi/interface_types" - "git.fd.io/govpp.git/examples/binapi/interfaces" - "git.fd.io/govpp.git/examples/binapi/ip" - "git.fd.io/govpp.git/examples/binapi/ip_types" - "git.fd.io/govpp.git/examples/binapi/vpe" - "log" - "os" ) var ( @@ -175,7 +176,6 @@ func addIPToInterface(ch api.Channel, index interface_types.InterfaceIndex, ip s return } - req := &interfaces.SwInterfaceAddDelAddress{ SwIfIndex: index, IsAdd: true, @@ -212,7 +212,7 @@ func retrieveIPAddresses(ch api.Channel, index interface_types.InterfaceIndex) { break } prefix := ip_types.Prefix(msg.Prefix) - fmt.Printf(" - ip address: %+v\n", prefix.ToString()) + fmt.Printf(" - ip address: %v\n", prefix) } fmt.Println("OK") diff --git a/examples/perf-bench/perf-bench.go b/examples/perf-bench/perf-bench.go index a7ec146..6472068 100644 --- a/examples/perf-bench/perf-bench.go +++ b/examples/perf-bench/perf-bench.go @@ -30,8 +30,8 @@ import ( "git.fd.io/govpp.git/adapter/socketclient" "git.fd.io/govpp.git/adapter/statsclient" "git.fd.io/govpp.git/api" + "git.fd.io/govpp.git/binapi/vpe" "git.fd.io/govpp.git/core" - "git.fd.io/govpp.git/examples/binapi/vpe" ) const ( diff --git a/examples/rpc-service/rpc_service.go b/examples/rpc-service/rpc_service.go index 8ff6c08..e20e5c0 100644 --- a/examples/rpc-service/rpc_service.go +++ b/examples/rpc-service/rpc_service.go @@ -27,8 +27,8 @@ import ( "git.fd.io/govpp.git" "git.fd.io/govpp.git/adapter/socketclient" "git.fd.io/govpp.git/api" - "git.fd.io/govpp.git/examples/binapi/interfaces" - "git.fd.io/govpp.git/examples/binapi/vpe" + interfaces "git.fd.io/govpp.git/binapi/interface" + "git.fd.io/govpp.git/binapi/vpe" ) var ( @@ -47,20 +47,13 @@ func main() { } defer conn.Disconnect() - // create a channel - ch, err := conn.NewAPIChannel() - if err != nil { - log.Fatalln("ERROR: creating channel failed:", err) - } - defer ch.Close() - - showVersion(ch) - interfaceDump(ch) + showVersion(conn) + interfaceDump(conn) } // showVersion shows an example of simple request with services. -func showVersion(ch api.Channel) { - c := vpe.NewServiceClient(ch) +func showVersion(conn api.Connection) { + c := vpe.NewServiceClient(conn) version, err := c.ShowVersion(context.Background(), &vpe.ShowVersion{}) if err != nil { @@ -71,10 +64,10 @@ func showVersion(ch api.Channel) { } // interfaceDump shows an example of multi request with services. -func interfaceDump(ch api.Channel) { - c := interfaces.NewServiceClient(ch) +func interfaceDump(conn api.Connection) { + c := interfaces.NewServiceClient(conn) - stream, err := c.DumpSwInterface(context.Background(), &interfaces.SwInterfaceDump{}) + stream, err := c.SwInterfaceDump(context.Background(), &interfaces.SwInterfaceDump{}) if err != nil { log.Fatalln("ERROR: DumpSwInterface failed:", err) } diff --git a/examples/simple-client/simple_client.go b/examples/simple-client/simple_client.go index 7aeaa0b..e3ba83d 100644 --- a/examples/simple-client/simple_client.go +++ b/examples/simple-client/simple_client.go @@ -18,6 +18,7 @@ package main import ( "context" + "encoding/json" "flag" "fmt" "log" @@ -26,13 +27,13 @@ import ( "git.fd.io/govpp.git" "git.fd.io/govpp.git/adapter/socketclient" "git.fd.io/govpp.git/api" + interfaces "git.fd.io/govpp.git/binapi/interface" + "git.fd.io/govpp.git/binapi/interface_types" + "git.fd.io/govpp.git/binapi/ip" + "git.fd.io/govpp.git/binapi/ip_types" + "git.fd.io/govpp.git/binapi/mactime" + "git.fd.io/govpp.git/binapi/vpe" "git.fd.io/govpp.git/core" - "git.fd.io/govpp.git/examples/binapi/interface_types" - "git.fd.io/govpp.git/examples/binapi/interfaces" - "git.fd.io/govpp.git/examples/binapi/ip" - "git.fd.io/govpp.git/examples/binapi/ip_types" - "git.fd.io/govpp.git/examples/binapi/mactime" - "git.fd.io/govpp.git/examples/binapi/vpe" ) var ( @@ -156,6 +157,7 @@ func interfaceDump(ch api.Channel) { } n++ fmt.Printf(" - interface #%d: %+v\n", n, msg) + marshal(msg) } fmt.Println("OK") @@ -177,6 +179,7 @@ func addIPAddress(ch api.Channel, index interface_types.InterfaceIndex) { Len: 32, }, } + marshal(req) reply := &interfaces.SwInterfaceAddDelAddressReply{} if err := ch.SendRequest(req).ReceiveReply(reply); err != nil { @@ -208,6 +211,7 @@ func ipAddressDump(ch api.Channel, index interface_types.InterfaceIndex) { break } fmt.Printf(" - ip address: %+v\n", msg) + marshal(msg) } fmt.Println("OK") @@ -242,7 +246,9 @@ func interfaceNotifications(ch api.Channel, index interface_types.InterfaceIndex // receive notifications go func() { for notif := range notifChan { - fmt.Printf("incoming event: %+v\n", notif.(*interfaces.SwInterfaceEvent)) + e := notif.(*interfaces.SwInterfaceEvent) + fmt.Printf("incoming event: %+v\n", e) + marshal(e) } }() @@ -326,3 +332,12 @@ Loop: fmt.Println("OK") fmt.Println() } + +func marshal(v interface{}) { + fmt.Printf("GO: %#v\n", v) + b, err := json.MarshalIndent(v, "", " ") + if err != nil { + panic(err) + } + fmt.Printf("JSON: %s\n", b) +} diff --git a/examples/union-example/union_example.go b/examples/union-example/union_example.go deleted file mode 100644 index cdba2fa..0000000 --- a/examples/union-example/union_example.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2018 Cisco and/or its affiliates. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// union-example is an example to show how to use unions in VPP binary API. -package main - -import ( - "fmt" - "git.fd.io/govpp.git/codec" - "git.fd.io/govpp.git/examples/binapi/interfaces" - "git.fd.io/govpp.git/examples/binapi/ip" - "git.fd.io/govpp.git/examples/binapi/ip_types" - "log" - "reflect" -) - -func init() { - log.SetFlags(0) -} - -func main() { - constructExample() - - encodingExampleIP() - - // convert IP from string form into Address type containing union - convertIP("10.10.1.1") - convertIP("ff80::1") - - // convert IP from string form into Prefix type - convertIPPrefix("20.10.1.1/24") - convertIPPrefix("21.10.1.1") - convertIPPrefix("ff90::1/64") - convertIPPrefix("ff91::1") - - // convert MAC address from string into MacAddress - convertToMacAddress("00:10:ab:4f:00:01") -} - -func constructExample() { - var union ip_types.AddressUnion - - // create AddressUnion with AdressUnionXXX constructors - union = ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 1, 10}) - union = ip_types.AddressUnionIP6(ip_types.IP6Address{0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02}) - - // set AddressUnion with SetXXX methods - union.SetIP4(ip_types.IP4Address{192, 168, 1, 10}) - union.SetIP6(ip_types.IP6Address{0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02}) -} - -func encodingExampleIP() { - var c = codec.DefaultCodec - - // encode this message - var msg = ip.IPPuntRedirect{ - Punt: ip.PuntRedirect{ - Nh: ip_types.Address{ - Af: ip_types.ADDRESS_IP4, - Un: ip_types.AddressUnionIP4(ip_types.IP4Address{192, 168, 1, 10}), - }, - }, - IsAdd: true, - } - log.Printf("encoding message: %+v", msg) - - b, err := c.EncodeMsg(&msg, 1) - if err != nil { - log.Fatal(err) - } - - // decode into this message - var msg2 ip.IPPuntRedirect - if err := c.DecodeMsg(b, &msg2); err != nil { - log.Fatal(err) - } - log.Printf("decoded message: %+v", msg2) - - // compare the messages - if !reflect.DeepEqual(msg, msg2) { - log.Fatal("messages are not equal") - } -} - -func convertIP(ip string) { - addr, err := ip_types.ParseAddress(ip) - if err != nil { - log.Printf("error converting IP to Address: %v", err) - return - } - fmt.Printf("converted IP %q to: %+v\n", ip, addr) - - ipStr := addr.ToString() - fmt.Printf("Address converted back to string IP %+v to: %q\n", addr, ipStr) -} - -func convertIPPrefix(ip string) { - prefix, err := ip_types.ParsePrefix(ip) - if err != nil { - log.Printf("error converting prefix to IP4Prefix: %v", err) - return - } - fmt.Printf("converted prefix %q to: %+v\n", ip, prefix) - - ipStr := prefix.ToString() - fmt.Printf("IP4Prefix converted back to string prefix %+v to: %q\n", prefix, ipStr) -} - -func convertToMacAddress(mac string) { - parsedMac, err := interfaces.ParseMAC(mac) - if err != nil { - log.Printf("error converting MAC to MacAddress: %v", err) - return - } - fmt.Printf("converted prefix %q to: %+v\n", mac, parsedMac) - - macStr := parsedMac.ToString() - fmt.Printf("MacAddress converted back to string %+v to: %q\n", parsedMac, macStr) -} \ No newline at end of file diff --git a/gen.go b/gen.go new file mode 100644 index 0000000..6b70a9c --- /dev/null +++ b/gen.go @@ -0,0 +1,21 @@ +// Copyright (c) 2020 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package govpp + +// To generate bindings for VPP API files in the default system directory, run: +// +// go generate gen.go +// +//go:generate binapi-generator -input-dir=/usr/share/vpp/api -output-dir=binapi -gen=rpc,rest diff --git a/internal/testbinapi/binapi2001/acl/acl.ba.go b/internal/testbinapi/binapi2001/acl/acl.ba.go new file mode 100644 index 0000000..7253552 --- /dev/null +++ b/internal/testbinapi/binapi2001/acl/acl.ba.go @@ -0,0 +1,2885 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/plugins/acl.api.json + +/* +Package acl contains generated code for VPP binary API defined by acl.api (version 1.0.1). + +It consists of: + 38 messages + 2 types +*/ +package acl + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "acl" + // APIVersion is the API version of this module. + APIVersion = "1.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0x11c5c1e5 +) + +// ACLRule represents VPP binary API type 'acl_rule'. +type ACLRule struct { + IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` + SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` + DstIPAddr []byte `binapi:"u8[16],name=dst_ip_addr" json:"dst_ip_addr,omitempty" struc:"[16]byte"` + DstIPPrefixLen uint8 `binapi:"u8,name=dst_ip_prefix_len" json:"dst_ip_prefix_len,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` + SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` + SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` + DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` + DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` + TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` + TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` +} + +func (*ACLRule) GetTypeName() string { return "acl_rule" } + +// MacipACLRule represents VPP binary API type 'macip_acl_rule'. +type MacipACLRule struct { + IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + SrcMac []byte `binapi:"u8[6],name=src_mac" json:"src_mac,omitempty" struc:"[6]byte"` + SrcMacMask []byte `binapi:"u8[6],name=src_mac_mask" json:"src_mac_mask,omitempty" struc:"[6]byte"` + SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` + SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` +} + +func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } + +// ACLAddReplace represents VPP binary API message 'acl_add_replace'. +type ACLAddReplace struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } +func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } +func (*ACLAddReplace) GetCrcString() string { return "13bc8539" } +func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + // field[2] s1.DstIPAddr + size += 16 + // field[2] s1.DstIPPrefixLen + size += 1 + // field[2] s1.Proto + size += 1 + // field[2] s1.SrcportOrIcmptypeFirst + size += 2 + // field[2] s1.SrcportOrIcmptypeLast + size += 2 + // field[2] s1.DstportOrIcmpcodeFirst + size += 2 + // field[2] s1.DstportOrIcmpcodeLast + size += 2 + // field[2] s1.TCPFlagsMask + size += 1 + // field[2] s1.TCPFlagsValue + size += 1 + } + return size +} +func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 ACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + // field[2] v1.DstIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.DstIPAddr) { + x = uint8(v1.DstIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.DstIPPrefixLen + buf[pos] = uint8(v1.DstIPPrefixLen) + pos += 1 + // field[2] v1.Proto + buf[pos] = uint8(v1.Proto) + pos += 1 + // field[2] v1.SrcportOrIcmptypeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) + pos += 2 + // field[2] v1.SrcportOrIcmptypeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) + pos += 2 + // field[2] v1.TCPFlagsMask + buf[pos] = uint8(v1.TCPFlagsMask) + pos += 1 + // field[2] v1.TCPFlagsValue + buf[pos] = uint8(v1.TCPFlagsValue) + pos += 1 + } + return buf, nil +} +func (m *ACLAddReplace) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]ACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].DstIPAddr + m.R[j1].DstIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].DstIPAddr); i++ { + m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].DstIPPrefixLen + m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].Proto + m.R[j1].Proto = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcportOrIcmptypeFirst + m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].SrcportOrIcmptypeLast + m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeFirst + m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeLast + m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].TCPFlagsMask + m.R[j1].TCPFlagsMask = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].TCPFlagsValue + m.R[j1].TCPFlagsValue = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply'. +type ACLAddReplaceReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLAddReplaceReply) Reset() { *m = ACLAddReplaceReply{} } +func (*ACLAddReplaceReply) GetMessageName() string { return "acl_add_replace_reply" } +func (*ACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*ACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLAddReplaceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLDel represents VPP binary API message 'acl_del'. +type ACLDel struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLDel) Reset() { *m = ACLDel{} } +func (*ACLDel) GetMessageName() string { return "acl_del" } +func (*ACLDel) GetCrcString() string { return "ef34fea4" } +func (*ACLDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *ACLDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *ACLDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLDelReply represents VPP binary API message 'acl_del_reply'. +type ACLDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLDelReply) Reset() { *m = ACLDelReply{} } +func (*ACLDelReply) GetMessageName() string { return "acl_del_reply" } +func (*ACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLDetails represents VPP binary API message 'acl_details'. +type ACLDetails struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *ACLDetails) Reset() { *m = ACLDetails{} } +func (*ACLDetails) GetMessageName() string { return "acl_details" } +func (*ACLDetails) GetCrcString() string { return "f89d7a88" } +func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + // field[2] s1.DstIPAddr + size += 16 + // field[2] s1.DstIPPrefixLen + size += 1 + // field[2] s1.Proto + size += 1 + // field[2] s1.SrcportOrIcmptypeFirst + size += 2 + // field[2] s1.SrcportOrIcmptypeLast + size += 2 + // field[2] s1.DstportOrIcmpcodeFirst + size += 2 + // field[2] s1.DstportOrIcmpcodeLast + size += 2 + // field[2] s1.TCPFlagsMask + size += 1 + // field[2] s1.TCPFlagsValue + size += 1 + } + return size +} +func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 ACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + // field[2] v1.DstIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.DstIPAddr) { + x = uint8(v1.DstIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.DstIPPrefixLen + buf[pos] = uint8(v1.DstIPPrefixLen) + pos += 1 + // field[2] v1.Proto + buf[pos] = uint8(v1.Proto) + pos += 1 + // field[2] v1.SrcportOrIcmptypeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) + pos += 2 + // field[2] v1.SrcportOrIcmptypeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) + pos += 2 + // field[2] v1.TCPFlagsMask + buf[pos] = uint8(v1.TCPFlagsMask) + pos += 1 + // field[2] v1.TCPFlagsValue + buf[pos] = uint8(v1.TCPFlagsValue) + pos += 1 + } + return buf, nil +} +func (m *ACLDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]ACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].DstIPAddr + m.R[j1].DstIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].DstIPAddr); i++ { + m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].DstIPPrefixLen + m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].Proto + m.R[j1].Proto = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcportOrIcmptypeFirst + m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].SrcportOrIcmptypeLast + m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeFirst + m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeLast + m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].TCPFlagsMask + m.R[j1].TCPFlagsMask = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].TCPFlagsValue + m.R[j1].TCPFlagsValue = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// ACLDump represents VPP binary API message 'acl_dump'. +type ACLDump struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLDump) Reset() { *m = ACLDump{} } +func (*ACLDump) GetMessageName() string { return "acl_dump" } +func (*ACLDump) GetCrcString() string { return "ef34fea4" } +func (*ACLDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *ACLDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *ACLDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. +type ACLInterfaceAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + IsInput uint8 `binapi:"u8,name=is_input" json:"is_input,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } +func (*ACLInterfaceAddDel) GetMessageName() string { return "acl_interface_add_del" } +func (*ACLInterfaceAddDel) GetCrcString() string { return "0b2aedd1" } +func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.IsInput + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + buf[pos] = uint8(m.IsAdd) + pos += 1 + // field[1] m.IsInput + buf[pos] = uint8(m.IsInput) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = uint8(tmp[pos]) + pos += 1 + // field[1] m.IsInput + m.IsInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply'. +type ACLInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceAddDelReply) Reset() { *m = ACLInterfaceAddDelReply{} } +func (*ACLInterfaceAddDelReply) GetMessageName() string { return "acl_interface_add_del_reply" } +func (*ACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. +type ACLInterfaceEtypeWhitelistDetails struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` +} + +func (m *ACLInterfaceEtypeWhitelistDetails) Reset() { *m = ACLInterfaceEtypeWhitelistDetails{} } +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageName() string { + return "acl_interface_etype_whitelist_details" +} +func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { return "6a5d4e81" } +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceEtypeWhitelistDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Whitelist + size += 2 * len(m.Whitelist) + return size +} +func (m *ACLInterfaceEtypeWhitelistDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Whitelist)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Whitelist + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + return buf, nil +} +func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Whitelist + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + return nil +} + +// ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. +type ACLInterfaceEtypeWhitelistDump struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ACLInterfaceEtypeWhitelistDump) Reset() { *m = ACLInterfaceEtypeWhitelistDump{} } +func (*ACLInterfaceEtypeWhitelistDump) GetMessageName() string { + return "acl_interface_etype_whitelist_dump" +} +func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { return "529cb13f" } +func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceEtypeWhitelistDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *ACLInterfaceEtypeWhitelistDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. +type ACLInterfaceListDetails struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } +func (*ACLInterfaceListDetails) GetMessageName() string { return "acl_interface_list_details" } +func (*ACLInterfaceListDetails) GetCrcString() string { return "d5e80809" } +func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *ACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Acls)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. +type ACLInterfaceListDump struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } +func (*ACLInterfaceListDump) GetMessageName() string { return "acl_interface_list_dump" } +func (*ACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*ACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *ACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceListDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. +type ACLInterfaceSetACLList struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } +func (*ACLInterfaceSetACLList) GetMessageName() string { return "acl_interface_set_acl_list" } +func (*ACLInterfaceSetACLList) GetCrcString() string { return "8baece38" } +func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceSetACLList) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *ACLInterfaceSetACLList) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Acls)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *ACLInterfaceSetACLList) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply'. +type ACLInterfaceSetACLListReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceSetACLListReply) Reset() { *m = ACLInterfaceSetACLListReply{} } +func (*ACLInterfaceSetACLListReply) GetMessageName() string { + return "acl_interface_set_acl_list_reply" +} +func (*ACLInterfaceSetACLListReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceSetACLListReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLInterfaceSetACLListReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceSetACLListReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. +type ACLInterfaceSetEtypeWhitelist struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` +} + +func (m *ACLInterfaceSetEtypeWhitelist) Reset() { *m = ACLInterfaceSetEtypeWhitelist{} } +func (*ACLInterfaceSetEtypeWhitelist) GetMessageName() string { + return "acl_interface_set_etype_whitelist" +} +func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { return "f515efc5" } +func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceSetEtypeWhitelist) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Whitelist + size += 2 * len(m.Whitelist) + return size +} +func (m *ACLInterfaceSetEtypeWhitelist) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Whitelist)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Whitelist + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + return buf, nil +} +func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Whitelist + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + return nil +} + +// ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply'. +type ACLInterfaceSetEtypeWhitelistReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLInterfaceSetEtypeWhitelistReply) Reset() { *m = ACLInterfaceSetEtypeWhitelistReply{} } +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageName() string { + return "acl_interface_set_etype_whitelist_reply" +} +func (*ACLInterfaceSetEtypeWhitelistReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceSetEtypeWhitelistReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping'. +type ACLPluginControlPing struct{} + +func (m *ACLPluginControlPing) Reset() { *m = ACLPluginControlPing{} } +func (*ACLPluginControlPing) GetMessageName() string { return "acl_plugin_control_ping" } +func (*ACLPluginControlPing) GetCrcString() string { return "51077d14" } +func (*ACLPluginControlPing) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLPluginControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginControlPing) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ACLPluginControlPing) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply'. +type ACLPluginControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *ACLPluginControlPingReply) Reset() { *m = ACLPluginControlPingReply{} } +func (*ACLPluginControlPingReply) GetMessageName() string { return "acl_plugin_control_ping_reply" } +func (*ACLPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLPluginControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ClientIndex + size += 4 + // field[1] m.VpePID + size += 4 + return size +} +func (m *ACLPluginControlPingReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ClientIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) + pos += 4 + // field[1] m.VpePID + o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) + pos += 4 + return buf, nil +} +func (m *ACLPluginControlPingReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ClientIndex + m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VpePID + m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries'. +type ACLPluginGetConnTableMaxEntries struct{} + +func (m *ACLPluginGetConnTableMaxEntries) Reset() { *m = ACLPluginGetConnTableMaxEntries{} } +func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries" +} +func (*ACLPluginGetConnTableMaxEntries) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLPluginGetConnTableMaxEntries) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetConnTableMaxEntries) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ACLPluginGetConnTableMaxEntries) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply'. +type ACLPluginGetConnTableMaxEntriesReply struct { + ConnTableMaxEntries uint64 `binapi:"u64,name=conn_table_max_entries" json:"conn_table_max_entries,omitempty"` +} + +func (m *ACLPluginGetConnTableMaxEntriesReply) Reset() { *m = ACLPluginGetConnTableMaxEntriesReply{} } +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageName() string { + return "acl_plugin_get_conn_table_max_entries_reply" +} +func (*ACLPluginGetConnTableMaxEntriesReply) GetCrcString() string { return "7a096d3d" } +func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *ACLPluginGetConnTableMaxEntriesReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ConnTableMaxEntries + size += 8 + return size +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ConnTableMaxEntries + o.PutUint64(buf[pos:pos+8], uint64(m.ConnTableMaxEntries)) + pos += 8 + return buf, nil +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ConnTableMaxEntries + m.ConnTableMaxEntries = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version'. +type ACLPluginGetVersion struct{} + +func (m *ACLPluginGetVersion) Reset() { *m = ACLPluginGetVersion{} } +func (*ACLPluginGetVersion) GetMessageName() string { return "acl_plugin_get_version" } +func (*ACLPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetVersion) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ACLPluginGetVersion) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply'. +type ACLPluginGetVersionReply struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` +} + +func (m *ACLPluginGetVersionReply) Reset() { *m = ACLPluginGetVersionReply{} } +func (*ACLPluginGetVersionReply) GetMessageName() string { return "acl_plugin_get_version_reply" } +func (*ACLPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Major + size += 4 + // field[1] m.Minor + size += 4 + return size +} +func (m *ACLPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Major + o.PutUint32(buf[pos:pos+4], uint32(m.Major)) + pos += 4 + // field[1] m.Minor + o.PutUint32(buf[pos:pos+4], uint32(m.Minor)) + pos += 4 + return buf, nil +} +func (m *ACLPluginGetVersionReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Major + m.Major = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Minor + m.Minor = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLStatsIntfCountersEnable represents VPP binary API message 'acl_stats_intf_counters_enable'. +type ACLStatsIntfCountersEnable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *ACLStatsIntfCountersEnable) Reset() { *m = ACLStatsIntfCountersEnable{} } +func (*ACLStatsIntfCountersEnable) GetMessageName() string { return "acl_stats_intf_counters_enable" } +func (*ACLStatsIntfCountersEnable) GetCrcString() string { return "b3e225d2" } +func (*ACLStatsIntfCountersEnable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLStatsIntfCountersEnable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Enable + size += 1 + return size +} +func (m *ACLStatsIntfCountersEnable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Enable + if m.Enable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *ACLStatsIntfCountersEnable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Enable + m.Enable = tmp[pos] != 0 + pos += 1 + return nil +} + +// ACLStatsIntfCountersEnableReply represents VPP binary API message 'acl_stats_intf_counters_enable_reply'. +type ACLStatsIntfCountersEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *ACLStatsIntfCountersEnableReply) Reset() { *m = ACLStatsIntfCountersEnableReply{} } +func (*ACLStatsIntfCountersEnableReply) GetMessageName() string { + return "acl_stats_intf_counters_enable_reply" +} +func (*ACLStatsIntfCountersEnableReply) GetCrcString() string { return "e8d4e804" } +func (*ACLStatsIntfCountersEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLStatsIntfCountersEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLStatsIntfCountersEnableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLStatsIntfCountersEnableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLAdd represents VPP binary API message 'macip_acl_add'. +type MacipACLAdd struct { + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } +func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } +func (*MacipACLAdd) GetCrcString() string { return "0c680ca5" } +func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLAdd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcMac + size += 6 + // field[2] s1.SrcMacMask + size += 6 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + } + return size +} +func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 MacipACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcMac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMac) { + x = uint8(v1.SrcMac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcMacMask + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMacMask) { + x = uint8(v1.SrcMacMask[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + } + return buf, nil +} +func (m *MacipACLAdd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]MacipACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcMac + m.R[j1].SrcMac = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMac); i++ { + m.R[j1].SrcMac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcMacMask + m.R[j1].SrcMacMask = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMacMask); i++ { + m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. +type MacipACLAddReplace struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } +func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } +func (*MacipACLAddReplace) GetCrcString() string { return "d3d313e7" } +func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcMac + size += 6 + // field[2] s1.SrcMacMask + size += 6 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + } + return size +} +func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 MacipACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcMac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMac) { + x = uint8(v1.SrcMac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcMacMask + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMacMask) { + x = uint8(v1.SrcMacMask[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + } + return buf, nil +} +func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]MacipACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcMac + m.R[j1].SrcMac = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMac); i++ { + m.R[j1].SrcMac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcMacMask + m.R[j1].SrcMacMask = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMacMask); i++ { + m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply'. +type MacipACLAddReplaceReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLAddReplaceReply) Reset() { *m = MacipACLAddReplaceReply{} } +func (*MacipACLAddReplaceReply) GetMessageName() string { return "macip_acl_add_replace_reply" } +func (*MacipACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLAddReplaceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply'. +type MacipACLAddReply struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLAddReply) Reset() { *m = MacipACLAddReply{} } +func (*MacipACLAddReply) GetMessageName() string { return "macip_acl_add_reply" } +func (*MacipACLAddReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLAddReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLAddReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLAddReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLDel represents VPP binary API message 'macip_acl_del'. +type MacipACLDel struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLDel) Reset() { *m = MacipACLDel{} } +func (*MacipACLDel) GetMessageName() string { return "macip_acl_del" } +func (*MacipACLDel) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *MacipACLDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply'. +type MacipACLDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLDelReply) Reset() { *m = MacipACLDelReply{} } +func (*MacipACLDelReply) GetMessageName() string { return "macip_acl_del_reply" } +func (*MacipACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLDetails represents VPP binary API message 'macip_acl_details'. +type MacipACLDetails struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` +} + +func (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } +func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } +func (*MacipACLDetails) GetCrcString() string { return "e164e69a" } +func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcMac + size += 6 + // field[2] s1.SrcMacMask + size += 6 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + } + return size +} +func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 MacipACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcMac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMac) { + x = uint8(v1.SrcMac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcMacMask + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMacMask) { + x = uint8(v1.SrcMacMask[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + } + return buf, nil +} +func (m *MacipACLDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]MacipACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcMac + m.R[j1].SrcMac = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMac); i++ { + m.R[j1].SrcMac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcMacMask + m.R[j1].SrcMacMask = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMacMask); i++ { + m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// MacipACLDump represents VPP binary API message 'macip_acl_dump'. +type MacipACLDump struct { + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLDump) Reset() { *m = MacipACLDump{} } +func (*MacipACLDump) GetMessageName() string { return "macip_acl_dump" } +func (*MacipACLDump) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *MacipACLDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. +type MacipACLInterfaceAddDel struct { + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` +} + +func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } +func (*MacipACLInterfaceAddDel) GetMessageName() string { return "macip_acl_interface_add_del" } +func (*MacipACLInterfaceAddDel) GetCrcString() string { return "6a6be97c" } +func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + buf[pos] = uint8(m.IsAdd) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply'. +type MacipACLInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MacipACLInterfaceAddDelReply) Reset() { *m = MacipACLInterfaceAddDelReply{} } +func (*MacipACLInterfaceAddDelReply) GetMessageName() string { + return "macip_acl_interface_add_del_reply" +} +func (*MacipACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get'. +type MacipACLInterfaceGet struct{} + +func (m *MacipACLInterfaceGet) Reset() { *m = MacipACLInterfaceGet{} } +func (*MacipACLInterfaceGet) GetMessageName() string { return "macip_acl_interface_get" } +func (*MacipACLInterfaceGet) GetCrcString() string { return "51077d14" } +func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLInterfaceGet) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MacipACLInterfaceGet) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MacipACLInterfaceGet) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply'. +type MacipACLInterfaceGetReply struct { + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *MacipACLInterfaceGetReply) Reset() { *m = MacipACLInterfaceGetReply{} } +func (*MacipACLInterfaceGetReply) GetMessageName() string { return "macip_acl_interface_get_reply" } +func (*MacipACLInterfaceGetReply) GetCrcString() string { return "accf9b05" } +func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLInterfaceGetReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Count + size += 4 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *MacipACLInterfaceGetReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.Acls))) + pos += 4 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *MacipACLInterfaceGetReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. +type MacipACLInterfaceListDetails struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` +} + +func (m *MacipACLInterfaceListDetails) Reset() { *m = MacipACLInterfaceListDetails{} } +func (*MacipACLInterfaceListDetails) GetMessageName() string { + return "macip_acl_interface_list_details" +} +func (*MacipACLInterfaceListDetails) GetCrcString() string { return "29783fa0" } +func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *MacipACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Acls)) + pos += 1 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. +type MacipACLInterfaceListDump struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } +func (*MacipACLInterfaceListDump) GetMessageName() string { return "macip_acl_interface_list_dump" } +func (*MacipACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *MacipACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLInterfaceListDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_acl_binapi_init() } +func file_acl_binapi_init() { + api.RegisterMessage((*ACLAddReplace)(nil), "acl.ACLAddReplace") + api.RegisterMessage((*ACLAddReplaceReply)(nil), "acl.ACLAddReplaceReply") + api.RegisterMessage((*ACLDel)(nil), "acl.ACLDel") + api.RegisterMessage((*ACLDelReply)(nil), "acl.ACLDelReply") + api.RegisterMessage((*ACLDetails)(nil), "acl.ACLDetails") + api.RegisterMessage((*ACLDump)(nil), "acl.ACLDump") + api.RegisterMessage((*ACLInterfaceAddDel)(nil), "acl.ACLInterfaceAddDel") + api.RegisterMessage((*ACLInterfaceAddDelReply)(nil), "acl.ACLInterfaceAddDelReply") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDetails)(nil), "acl.ACLInterfaceEtypeWhitelistDetails") + api.RegisterMessage((*ACLInterfaceEtypeWhitelistDump)(nil), "acl.ACLInterfaceEtypeWhitelistDump") + api.RegisterMessage((*ACLInterfaceListDetails)(nil), "acl.ACLInterfaceListDetails") + api.RegisterMessage((*ACLInterfaceListDump)(nil), "acl.ACLInterfaceListDump") + api.RegisterMessage((*ACLInterfaceSetACLList)(nil), "acl.ACLInterfaceSetACLList") + api.RegisterMessage((*ACLInterfaceSetACLListReply)(nil), "acl.ACLInterfaceSetACLListReply") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelist)(nil), "acl.ACLInterfaceSetEtypeWhitelist") + api.RegisterMessage((*ACLInterfaceSetEtypeWhitelistReply)(nil), "acl.ACLInterfaceSetEtypeWhitelistReply") + api.RegisterMessage((*ACLPluginControlPing)(nil), "acl.ACLPluginControlPing") + api.RegisterMessage((*ACLPluginControlPingReply)(nil), "acl.ACLPluginControlPingReply") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntries)(nil), "acl.ACLPluginGetConnTableMaxEntries") + api.RegisterMessage((*ACLPluginGetConnTableMaxEntriesReply)(nil), "acl.ACLPluginGetConnTableMaxEntriesReply") + api.RegisterMessage((*ACLPluginGetVersion)(nil), "acl.ACLPluginGetVersion") + api.RegisterMessage((*ACLPluginGetVersionReply)(nil), "acl.ACLPluginGetVersionReply") + api.RegisterMessage((*ACLStatsIntfCountersEnable)(nil), "acl.ACLStatsIntfCountersEnable") + api.RegisterMessage((*ACLStatsIntfCountersEnableReply)(nil), "acl.ACLStatsIntfCountersEnableReply") + api.RegisterMessage((*MacipACLAdd)(nil), "acl.MacipACLAdd") + api.RegisterMessage((*MacipACLAddReplace)(nil), "acl.MacipACLAddReplace") + api.RegisterMessage((*MacipACLAddReplaceReply)(nil), "acl.MacipACLAddReplaceReply") + api.RegisterMessage((*MacipACLAddReply)(nil), "acl.MacipACLAddReply") + api.RegisterMessage((*MacipACLDel)(nil), "acl.MacipACLDel") + api.RegisterMessage((*MacipACLDelReply)(nil), "acl.MacipACLDelReply") + api.RegisterMessage((*MacipACLDetails)(nil), "acl.MacipACLDetails") + api.RegisterMessage((*MacipACLDump)(nil), "acl.MacipACLDump") + api.RegisterMessage((*MacipACLInterfaceAddDel)(nil), "acl.MacipACLInterfaceAddDel") + api.RegisterMessage((*MacipACLInterfaceAddDelReply)(nil), "acl.MacipACLInterfaceAddDelReply") + api.RegisterMessage((*MacipACLInterfaceGet)(nil), "acl.MacipACLInterfaceGet") + api.RegisterMessage((*MacipACLInterfaceGetReply)(nil), "acl.MacipACLInterfaceGetReply") + api.RegisterMessage((*MacipACLInterfaceListDetails)(nil), "acl.MacipACLInterfaceListDetails") + api.RegisterMessage((*MacipACLInterfaceListDump)(nil), "acl.MacipACLInterfaceListDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*ACLAddReplace)(nil), + (*ACLAddReplaceReply)(nil), + (*ACLDel)(nil), + (*ACLDelReply)(nil), + (*ACLDetails)(nil), + (*ACLDump)(nil), + (*ACLInterfaceAddDel)(nil), + (*ACLInterfaceAddDelReply)(nil), + (*ACLInterfaceEtypeWhitelistDetails)(nil), + (*ACLInterfaceEtypeWhitelistDump)(nil), + (*ACLInterfaceListDetails)(nil), + (*ACLInterfaceListDump)(nil), + (*ACLInterfaceSetACLList)(nil), + (*ACLInterfaceSetACLListReply)(nil), + (*ACLInterfaceSetEtypeWhitelist)(nil), + (*ACLInterfaceSetEtypeWhitelistReply)(nil), + (*ACLPluginControlPing)(nil), + (*ACLPluginControlPingReply)(nil), + (*ACLPluginGetConnTableMaxEntries)(nil), + (*ACLPluginGetConnTableMaxEntriesReply)(nil), + (*ACLPluginGetVersion)(nil), + (*ACLPluginGetVersionReply)(nil), + (*ACLStatsIntfCountersEnable)(nil), + (*ACLStatsIntfCountersEnableReply)(nil), + (*MacipACLAdd)(nil), + (*MacipACLAddReplace)(nil), + (*MacipACLAddReplaceReply)(nil), + (*MacipACLAddReply)(nil), + (*MacipACLDel)(nil), + (*MacipACLDelReply)(nil), + (*MacipACLDetails)(nil), + (*MacipACLDump)(nil), + (*MacipACLInterfaceAddDel)(nil), + (*MacipACLInterfaceAddDelReply)(nil), + (*MacipACLInterfaceGet)(nil), + (*MacipACLInterfaceGetReply)(nil), + (*MacipACLInterfaceListDetails)(nil), + (*MacipACLInterfaceListDump)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/internal/testbinapi/binapi2001/acl/acl_rpc.ba.go b/internal/testbinapi/binapi2001/acl/acl_rpc.ba.go new file mode 100644 index 0000000..62b10c3 --- /dev/null +++ b/internal/testbinapi/binapi2001/acl/acl_rpc.ba.go @@ -0,0 +1,302 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package acl + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for acl module. +type RPCService interface { + DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) + DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) + DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) + DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) + DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) + ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) + ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) + ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) + ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) + ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) + ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) + ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) + ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) + ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) + MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) + MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) + MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) + MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) + MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLClient{stream} + return x, nil +} + +type RPCService_DumpACLClient interface { + Recv() (*ACLDetails, error) +} + +type serviceClient_DumpACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLClient) Recv() (*ACLDetails, error) { + m := new(ACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceEtypeWhitelistClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceEtypeWhitelistClient interface { + Recv() (*ACLInterfaceEtypeWhitelistDetails, error) +} + +type serviceClient_DumpACLInterfaceEtypeWhitelistClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceEtypeWhitelistClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { + m := new(ACLInterfaceEtypeWhitelistDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceListClient interface { + Recv() (*ACLInterfaceListDetails, error) +} + +type serviceClient_DumpACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceListClient) Recv() (*ACLInterfaceListDetails, error) { + m := new(ACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLClient interface { + Recv() (*MacipACLDetails, error) +} + +type serviceClient_DumpMacipACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLClient) Recv() (*MacipACLDetails, error) { + m := new(MacipACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLInterfaceListClient interface { + Recv() (*MacipACLInterfaceListDetails, error) +} + +type serviceClient_DumpMacipACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLInterfaceListClient) Recv() (*MacipACLInterfaceListDetails, error) { + m := new(MacipACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { + out := new(ACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { + out := new(ACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { + out := new(ACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { + out := new(ACLInterfaceSetACLListReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { + out := new(ACLInterfaceSetEtypeWhitelistReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { + out := new(ACLPluginControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { + out := new(ACLPluginGetConnTableMaxEntriesReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { + out := new(ACLPluginGetVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) { + out := new(ACLStatsIntfCountersEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { + out := new(MacipACLAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { + out := new(MacipACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { + out := new(MacipACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { + out := new(MacipACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { + out := new(MacipACLInterfaceGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/internal/testbinapi/binapi2001/af_packet/af_packet.ba.go b/internal/testbinapi/binapi2001/af_packet/af_packet.ba.go new file mode 100644 index 0000000..82b89b3 --- /dev/null +++ b/internal/testbinapi/binapi2001/af_packet/af_packet.ba.go @@ -0,0 +1,725 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/af_packet.api.json + +/* +Package af_packet contains generated code for VPP binary API defined by af_packet.api (version 2.0.0). + +It consists of: + 2 aliases + 6 enums + 8 messages +*/ +package af_packet + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "af_packet" + // APIVersion is the API version of this module. + APIVersion = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xba745e20 +) + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// AfPacketCreate represents VPP binary API message 'af_packet_create'. +type AfPacketCreate struct { + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` +} + +func (m *AfPacketCreate) Reset() { *m = AfPacketCreate{} } +func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" } +func (*AfPacketCreate) GetCrcString() string { return "a190415f" } +func (*AfPacketCreate) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AfPacketCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HwAddr + size += 6 + // field[1] m.UseRandomHwAddr + size += 1 + // field[1] m.HostIfName + size += 64 + return size +} +func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HwAddr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.HwAddr) { + x = uint8(m.HwAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.UseRandomHwAddr + if m.UseRandomHwAddr { + buf[pos] = 1 + } + pos += 1 + // field[1] m.HostIfName + copy(buf[pos:pos+64], m.HostIfName) + pos += 64 + return buf, nil +} +func (m *AfPacketCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HwAddr + for i := 0; i < len(m.HwAddr); i++ { + m.HwAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.UseRandomHwAddr + m.UseRandomHwAddr = tmp[pos] != 0 + pos += 1 + // field[1] m.HostIfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'. +type AfPacketCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *AfPacketCreateReply) Reset() { *m = AfPacketCreateReply{} } +func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" } +func (*AfPacketCreateReply) GetCrcString() string { return "5383d31f" } +func (*AfPacketCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AfPacketCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *AfPacketCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// AfPacketDelete represents VPP binary API message 'af_packet_delete'. +type AfPacketDelete struct { + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` +} + +func (m *AfPacketDelete) Reset() { *m = AfPacketDelete{} } +func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" } +func (*AfPacketDelete) GetCrcString() string { return "863fa648" } +func (*AfPacketDelete) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AfPacketDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HostIfName + size += 64 + return size +} +func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HostIfName + copy(buf[pos:pos+64], m.HostIfName) + pos += 64 + return buf, nil +} +func (m *AfPacketDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HostIfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply'. +type AfPacketDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AfPacketDeleteReply) Reset() { *m = AfPacketDeleteReply{} } +func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" } +func (*AfPacketDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*AfPacketDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AfPacketDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *AfPacketDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// AfPacketDetails represents VPP binary API message 'af_packet_details'. +type AfPacketDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` +} + +func (m *AfPacketDetails) Reset() { *m = AfPacketDetails{} } +func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" } +func (*AfPacketDetails) GetCrcString() string { return "58c7c042" } +func (*AfPacketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AfPacketDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.HostIfName + size += 64 + return size +} +func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.HostIfName + copy(buf[pos:pos+64], m.HostIfName) + pos += 64 + return buf, nil +} +func (m *AfPacketDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.HostIfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// AfPacketDump represents VPP binary API message 'af_packet_dump'. +type AfPacketDump struct{} + +func (m *AfPacketDump) Reset() { *m = AfPacketDump{} } +func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" } +func (*AfPacketDump) GetCrcString() string { return "51077d14" } +func (*AfPacketDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AfPacketDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *AfPacketDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'. +type AfPacketSetL4CksumOffload struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Set bool `binapi:"bool,name=set" json:"set,omitempty"` +} + +func (m *AfPacketSetL4CksumOffload) Reset() { *m = AfPacketSetL4CksumOffload{} } +func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" } +func (*AfPacketSetL4CksumOffload) GetCrcString() string { return "319cd5c8" } +func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AfPacketSetL4CksumOffload) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Set + size += 1 + return size +} +func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Set + if m.Set { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *AfPacketSetL4CksumOffload) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Set + m.Set = tmp[pos] != 0 + pos += 1 + return nil +} + +// AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply'. +type AfPacketSetL4CksumOffloadReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} } +func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string { + return "af_packet_set_l4_cksum_offload_reply" +} +func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" } +func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AfPacketSetL4CksumOffloadReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_af_packet_binapi_init() } +func file_af_packet_binapi_init() { + api.RegisterMessage((*AfPacketCreate)(nil), "af_packet.AfPacketCreate") + api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet.AfPacketCreateReply") + api.RegisterMessage((*AfPacketDelete)(nil), "af_packet.AfPacketDelete") + api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet.AfPacketDeleteReply") + api.RegisterMessage((*AfPacketDetails)(nil), "af_packet.AfPacketDetails") + api.RegisterMessage((*AfPacketDump)(nil), "af_packet.AfPacketDump") + api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet.AfPacketSetL4CksumOffload") + api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AfPacketCreate)(nil), + (*AfPacketCreateReply)(nil), + (*AfPacketDelete)(nil), + (*AfPacketDeleteReply)(nil), + (*AfPacketDetails)(nil), + (*AfPacketDump)(nil), + (*AfPacketSetL4CksumOffload)(nil), + (*AfPacketSetL4CksumOffloadReply)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/internal/testbinapi/binapi2001/af_packet/af_packet_rpc.ba.go b/internal/testbinapi/binapi2001/af_packet/af_packet_rpc.ba.go new file mode 100644 index 0000000..d2df47a --- /dev/null +++ b/internal/testbinapi/binapi2001/af_packet/af_packet_rpc.ba.go @@ -0,0 +1,84 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package af_packet + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for af_packet module. +type RPCService interface { + DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) + AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) + AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAfPacketClient{stream} + return x, nil +} + +type RPCService_DumpAfPacketClient interface { + Recv() (*AfPacketDetails, error) +} + +type serviceClient_DumpAfPacketClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAfPacketClient) Recv() (*AfPacketDetails, error) { + m := new(AfPacketDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { + out := new(AfPacketCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { + out := new(AfPacketDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { + out := new(AfPacketSetL4CksumOffloadReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/internal/testbinapi/binapi2001/interfaces/interfaces.ba.go b/internal/testbinapi/binapi2001/interfaces/interfaces.ba.go new file mode 100644 index 0000000..0c6ff3e --- /dev/null +++ b/internal/testbinapi/binapi2001/interfaces/interfaces.ba.go @@ -0,0 +1,3961 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/interface.api.json + +/* +Package interfaces contains generated code for VPP binary API defined by interface.api (version 3.2.2). + +It consists of: + 7 aliases + 10 enums + 53 messages + 6 types + 1 union +*/ +package interfaces + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "interface" + // APIVersion is the API version of this module. + APIVersion = "3.2.2" + // VersionCrc is the CRC of this module. + VersionCrc = 0xfebc3ffa +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var ( + AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", + } + AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, + } +) + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return "AddressFamily(" + strconv.Itoa(int(x)) + ")" +} + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var ( + IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", + } + IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, + } +) + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return "IPDscp(" + strconv.Itoa(int(x)) + ")" +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var ( + IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", + } + IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, + } +) + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return "IPEcn(" + strconv.Itoa(int(x)) + ")" +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var ( + IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", + } + IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, + } +) + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return "IPProto(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. +type AddressWithPrefix Prefix + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. +type IP4AddressWithPrefix IP4Prefix + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. +type IP6AddressWithPrefix IP6Prefix + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` +} + +func (*Address) GetTypeName() string { return "address" } + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` +} + +func (*Mprefix) GetTypeName() string { return "mprefix" } + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*Prefix) GetTypeName() string { return "prefix" } + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` +} + +func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { return "address_union" } + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. +type CollectDetailedInterfaceStats struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` +} + +func (m *CollectDetailedInterfaceStats) Reset() { *m = CollectDetailedInterfaceStats{} } +func (*CollectDetailedInterfaceStats) GetMessageName() string { + return "collect_detailed_interface_stats" +} +func (*CollectDetailedInterfaceStats) GetCrcString() string { return "5501adee" } +func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CollectDetailedInterfaceStats) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.EnableDisable + size += 1 + return size +} +func (m *CollectDetailedInterfaceStats) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.EnableDisable + if m.EnableDisable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *CollectDetailedInterfaceStats) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.EnableDisable + m.EnableDisable = tmp[pos] != 0 + pos += 1 + return nil +} + +// CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply'. +type CollectDetailedInterfaceStatsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *CollectDetailedInterfaceStatsReply) Reset() { *m = CollectDetailedInterfaceStatsReply{} } +func (*CollectDetailedInterfaceStatsReply) GetMessageName() string { + return "collect_detailed_interface_stats_reply" +} +func (*CollectDetailedInterfaceStatsReply) GetCrcString() string { return "e8d4e804" } +func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CollectDetailedInterfaceStatsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *CollectDetailedInterfaceStatsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *CollectDetailedInterfaceStatsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateLoopback represents VPP binary API message 'create_loopback'. +type CreateLoopback struct { + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *CreateLoopback) Reset() { *m = CreateLoopback{} } +func (*CreateLoopback) GetMessageName() string { return "create_loopback" } +func (*CreateLoopback) GetCrcString() string { return "42bb5d22" } +func (*CreateLoopback) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CreateLoopback) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.MacAddress + size += 6 + return size +} +func (m *CreateLoopback) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *CreateLoopback) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance'. +type CreateLoopbackInstance struct { + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + IsSpecified bool `binapi:"bool,name=is_specified" json:"is_specified,omitempty"` + UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"` +} + +func (m *CreateLoopbackInstance) Reset() { *m = CreateLoopbackInstance{} } +func (*CreateLoopbackInstance) GetMessageName() string { return "create_loopback_instance" } +func (*CreateLoopbackInstance) GetCrcString() string { return "d36a3ee2" } +func (*CreateLoopbackInstance) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CreateLoopbackInstance) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.MacAddress + size += 6 + // field[1] m.IsSpecified + size += 1 + // field[1] m.UserInstance + size += 4 + return size +} +func (m *CreateLoopbackInstance) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.IsSpecified + if m.IsSpecified { + buf[pos] = 1 + } + pos += 1 + // field[1] m.UserInstance + o.PutUint32(buf[pos:pos+4], uint32(m.UserInstance)) + pos += 4 + return buf, nil +} +func (m *CreateLoopbackInstance) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.IsSpecified + m.IsSpecified = tmp[pos] != 0 + pos += 1 + // field[1] m.UserInstance + m.UserInstance = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply'. +type CreateLoopbackInstanceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateLoopbackInstanceReply) Reset() { *m = CreateLoopbackInstanceReply{} } +func (*CreateLoopbackInstanceReply) GetMessageName() string { return "create_loopback_instance_reply" } +func (*CreateLoopbackInstanceReply) GetCrcString() string { return "5383d31f" } +func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CreateLoopbackInstanceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateLoopbackInstanceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateLoopbackInstanceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateLoopbackReply represents VPP binary API message 'create_loopback_reply'. +type CreateLoopbackReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateLoopbackReply) Reset() { *m = CreateLoopbackReply{} } +func (*CreateLoopbackReply) GetMessageName() string { return "create_loopback_reply" } +func (*CreateLoopbackReply) GetCrcString() string { return "5383d31f" } +func (*CreateLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CreateLoopbackReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateLoopbackReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateLoopbackReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateSubif represents VPP binary API message 'create_subif'. +type CreateSubif struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + OuterVlanID uint16 `binapi:"u16,name=outer_vlan_id" json:"outer_vlan_id,omitempty"` + InnerVlanID uint16 `binapi:"u16,name=inner_vlan_id" json:"inner_vlan_id,omitempty"` +} + +func (m *CreateSubif) Reset() { *m = CreateSubif{} } +func (*CreateSubif) GetMessageName() string { return "create_subif" } +func (*CreateSubif) GetCrcString() string { return "cb371063" } +func (*CreateSubif) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CreateSubif) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.SubID + size += 4 + // field[1] m.SubIfFlags + size += 4 + // field[1] m.OuterVlanID + size += 2 + // field[1] m.InnerVlanID + size += 2 + return size +} +func (m *CreateSubif) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.SubID + o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) + pos += 4 + // field[1] m.SubIfFlags + o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) + pos += 4 + // field[1] m.OuterVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.OuterVlanID)) + pos += 2 + // field[1] m.InnerVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.InnerVlanID)) + pos += 2 + return buf, nil +} +func (m *CreateSubif) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SubID + m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SubIfFlags + m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.OuterVlanID + m.OuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.InnerVlanID + m.InnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +// CreateSubifReply represents VPP binary API message 'create_subif_reply'. +type CreateSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateSubifReply) Reset() { *m = CreateSubifReply{} } +func (*CreateSubifReply) GetMessageName() string { return "create_subif_reply" } +func (*CreateSubifReply) GetCrcString() string { return "5383d31f" } +func (*CreateSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CreateSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateSubifReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateSubifReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateVlanSubif represents VPP binary API message 'create_vlan_subif'. +type CreateVlanSubif struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanID uint32 `binapi:"u32,name=vlan_id" json:"vlan_id,omitempty"` +} + +func (m *CreateVlanSubif) Reset() { *m = CreateVlanSubif{} } +func (*CreateVlanSubif) GetMessageName() string { return "create_vlan_subif" } +func (*CreateVlanSubif) GetCrcString() string { return "af34ac8b" } +func (*CreateVlanSubif) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CreateVlanSubif) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.VlanID + size += 4 + return size +} +func (m *CreateVlanSubif) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.VlanID + o.PutUint32(buf[pos:pos+4], uint32(m.VlanID)) + pos += 4 + return buf, nil +} +func (m *CreateVlanSubif) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanID + m.VlanID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply'. +type CreateVlanSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *CreateVlanSubifReply) Reset() { *m = CreateVlanSubifReply{} } +func (*CreateVlanSubifReply) GetMessageName() string { return "create_vlan_subif_reply" } +func (*CreateVlanSubifReply) GetCrcString() string { return "5383d31f" } +func (*CreateVlanSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CreateVlanSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateVlanSubifReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateVlanSubifReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// DeleteLoopback represents VPP binary API message 'delete_loopback'. +type DeleteLoopback struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *DeleteLoopback) Reset() { *m = DeleteLoopback{} } +func (*DeleteLoopback) GetMessageName() string { return "delete_loopback" } +func (*DeleteLoopback) GetCrcString() string { return "f9e6675e" } +func (*DeleteLoopback) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *DeleteLoopback) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *DeleteLoopback) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *DeleteLoopback) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply'. +type DeleteLoopbackReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DeleteLoopbackReply) Reset() { *m = DeleteLoopbackReply{} } +func (*DeleteLoopbackReply) GetMessageName() string { return "delete_loopback_reply" } +func (*DeleteLoopbackReply) GetCrcString() string { return "e8d4e804" } +func (*DeleteLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *DeleteLoopbackReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *DeleteLoopbackReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *DeleteLoopbackReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// DeleteSubif represents VPP binary API message 'delete_subif'. +type DeleteSubif struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *DeleteSubif) Reset() { *m = DeleteSubif{} } +func (*DeleteSubif) GetMessageName() string { return "delete_subif" } +func (*DeleteSubif) GetCrcString() string { return "f9e6675e" } +func (*DeleteSubif) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *DeleteSubif) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *DeleteSubif) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *DeleteSubif) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// DeleteSubifReply represents VPP binary API message 'delete_subif_reply'. +type DeleteSubifReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *DeleteSubifReply) Reset() { *m = DeleteSubifReply{} } +func (*DeleteSubifReply) GetMessageName() string { return "delete_subif_reply" } +func (*DeleteSubifReply) GetCrcString() string { return "e8d4e804" } +func (*DeleteSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *DeleteSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *DeleteSubifReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *DeleteSubifReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu'. +type HwInterfaceSetMtu struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` +} + +func (m *HwInterfaceSetMtu) Reset() { *m = HwInterfaceSetMtu{} } +func (*HwInterfaceSetMtu) GetMessageName() string { return "hw_interface_set_mtu" } +func (*HwInterfaceSetMtu) GetCrcString() string { return "e6746899" } +func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *HwInterfaceSetMtu) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Mtu + size += 2 + return size +} +func (m *HwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Mtu + o.PutUint16(buf[pos:pos+2], uint16(m.Mtu)) + pos += 2 + return buf, nil +} +func (m *HwInterfaceSetMtu) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mtu + m.Mtu = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +// HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply'. +type HwInterfaceSetMtuReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *HwInterfaceSetMtuReply) Reset() { *m = HwInterfaceSetMtuReply{} } +func (*HwInterfaceSetMtuReply) GetMessageName() string { return "hw_interface_set_mtu_reply" } +func (*HwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } +func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *HwInterfaceSetMtuReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *HwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *HwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber'. +type InterfaceNameRenumber struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + NewShowDevInstance uint32 `binapi:"u32,name=new_show_dev_instance" json:"new_show_dev_instance,omitempty"` +} + +func (m *InterfaceNameRenumber) Reset() { *m = InterfaceNameRenumber{} } +func (*InterfaceNameRenumber) GetMessageName() string { return "interface_name_renumber" } +func (*InterfaceNameRenumber) GetCrcString() string { return "2b8858b8" } +func (*InterfaceNameRenumber) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *InterfaceNameRenumber) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.NewShowDevInstance + size += 4 + return size +} +func (m *InterfaceNameRenumber) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.NewShowDevInstance + o.PutUint32(buf[pos:pos+4], uint32(m.NewShowDevInstance)) + pos += 4 + return buf, nil +} +func (m *InterfaceNameRenumber) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NewShowDevInstance + m.NewShowDevInstance = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply'. +type InterfaceNameRenumberReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *InterfaceNameRenumberReply) Reset() { *m = InterfaceNameRenumberReply{} } +func (*InterfaceNameRenumberReply) GetMessageName() string { return "interface_name_renumber_reply" } +func (*InterfaceNameRenumberReply) GetCrcString() string { return "e8d4e804" } +func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *InterfaceNameRenumberReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *InterfaceNameRenumberReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *InterfaceNameRenumberReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address'. +type SwInterfaceAddDelAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` + Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *SwInterfaceAddDelAddress) Reset() { *m = SwInterfaceAddDelAddress{} } +func (*SwInterfaceAddDelAddress) GetMessageName() string { return "sw_interface_add_del_address" } +func (*SwInterfaceAddDelAddress) GetCrcString() string { return "5803d5c4" } +func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceAddDelAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsAdd + size += 1 + // field[1] m.DelAll + size += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *SwInterfaceAddDelAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.DelAll + if m.DelAll { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *SwInterfaceAddDelAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.DelAll + m.DelAll = tmp[pos] != 0 + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply'. +type SwInterfaceAddDelAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddDelAddressReply) Reset() { *m = SwInterfaceAddDelAddressReply{} } +func (*SwInterfaceAddDelAddressReply) GetMessageName() string { + return "sw_interface_add_del_address_reply" +} +func (*SwInterfaceAddDelAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceAddDelAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceAddDelAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceAddDelAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceAddDelMacAddress represents VPP binary API message 'sw_interface_add_del_mac_address'. +type SwInterfaceAddDelMacAddress struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Addr MacAddress `binapi:"mac_address,name=addr" json:"addr,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` +} + +func (m *SwInterfaceAddDelMacAddress) Reset() { *m = SwInterfaceAddDelMacAddress{} } +func (*SwInterfaceAddDelMacAddress) GetMessageName() string { + return "sw_interface_add_del_mac_address" +} +func (*SwInterfaceAddDelMacAddress) GetCrcString() string { return "638bb9f4" } +func (*SwInterfaceAddDelMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceAddDelMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Addr + size += 6 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *SwInterfaceAddDelMacAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Addr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.Addr) { + x = uint8(m.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.IsAdd + buf[pos] = uint8(m.IsAdd) + pos += 1 + return buf, nil +} +func (m *SwInterfaceAddDelMacAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Addr + for i := 0; i < len(m.Addr); i++ { + m.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.IsAdd + m.IsAdd = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SwInterfaceAddDelMacAddressReply represents VPP binary API message 'sw_interface_add_del_mac_address_reply'. +type SwInterfaceAddDelMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceAddDelMacAddressReply) Reset() { *m = SwInterfaceAddDelMacAddressReply{} } +func (*SwInterfaceAddDelMacAddressReply) GetMessageName() string { + return "sw_interface_add_del_mac_address_reply" +} +func (*SwInterfaceAddDelMacAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceAddDelMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceAddDelMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceAddDelMacAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceAddDelMacAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. +type SwInterfaceClearStats struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceClearStats) Reset() { *m = SwInterfaceClearStats{} } +func (*SwInterfaceClearStats) GetMessageName() string { return "sw_interface_clear_stats" } +func (*SwInterfaceClearStats) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceClearStats) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceClearStats) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *SwInterfaceClearStats) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceClearStats) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply'. +type SwInterfaceClearStatsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceClearStatsReply) Reset() { *m = SwInterfaceClearStatsReply{} } +func (*SwInterfaceClearStatsReply) GetMessageName() string { return "sw_interface_clear_stats_reply" } +func (*SwInterfaceClearStatsReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceClearStatsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceClearStatsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceClearStatsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. +type SwInterfaceDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SupSwIfIndex uint32 `binapi:"u32,name=sup_sw_if_index" json:"sup_sw_if_index,omitempty"` + L2Address MacAddress `binapi:"mac_address,name=l2_address" json:"l2_address,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Type IfType `binapi:"if_type,name=type" json:"type,omitempty"` + LinkDuplex LinkDuplex `binapi:"link_duplex,name=link_duplex" json:"link_duplex,omitempty"` + LinkSpeed uint32 `binapi:"u32,name=link_speed" json:"link_speed,omitempty"` + LinkMtu uint16 `binapi:"u16,name=link_mtu" json:"link_mtu,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubNumberOfTags uint8 `binapi:"u8,name=sub_number_of_tags" json:"sub_number_of_tags,omitempty"` + SubOuterVlanID uint16 `binapi:"u16,name=sub_outer_vlan_id" json:"sub_outer_vlan_id,omitempty"` + SubInnerVlanID uint16 `binapi:"u16,name=sub_inner_vlan_id" json:"sub_inner_vlan_id,omitempty"` + SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` + VtrPushDot1q uint32 `binapi:"u32,name=vtr_push_dot1q" json:"vtr_push_dot1q,omitempty"` + VtrTag1 uint32 `binapi:"u32,name=vtr_tag1" json:"vtr_tag1,omitempty"` + VtrTag2 uint32 `binapi:"u32,name=vtr_tag2" json:"vtr_tag2,omitempty"` + OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` + BDmac MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` + BSmac MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` + BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` + ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty" struc:"[64]byte"` + InterfaceDevType string `binapi:"string[64],name=interface_dev_type" json:"interface_dev_type,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` +} + +func (m *SwInterfaceDetails) Reset() { *m = SwInterfaceDetails{} } +func (*SwInterfaceDetails) GetMessageName() string { return "sw_interface_details" } +func (*SwInterfaceDetails) GetCrcString() string { return "17b69fa2" } +func (*SwInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.SupSwIfIndex + size += 4 + // field[1] m.L2Address + size += 6 + // field[1] m.Flags + size += 4 + // field[1] m.Type + size += 4 + // field[1] m.LinkDuplex + size += 4 + // field[1] m.LinkSpeed + size += 4 + // field[1] m.LinkMtu + size += 2 + // field[1] m.Mtu + size += 16 + // field[1] m.SubID + size += 4 + // field[1] m.SubNumberOfTags + size += 1 + // field[1] m.SubOuterVlanID + size += 2 + // field[1] m.SubInnerVlanID + size += 2 + // field[1] m.SubIfFlags + size += 4 + // field[1] m.VtrOp + size += 4 + // field[1] m.VtrPushDot1q + size += 4 + // field[1] m.VtrTag1 + size += 4 + // field[1] m.VtrTag2 + size += 4 + // field[1] m.OuterTag + size += 2 + // field[1] m.BDmac + size += 6 + // field[1] m.BSmac + size += 6 + // field[1] m.BVlanid + size += 2 + // field[1] m.ISid + size += 4 + // field[1] m.InterfaceName + size += 64 + // field[1] m.InterfaceDevType + size += 64 + // field[1] m.Tag + size += 64 + return size +} +func (m *SwInterfaceDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.SupSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SupSwIfIndex)) + pos += 4 + // field[1] m.L2Address + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.L2Address) { + x = uint8(m.L2Address[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + // field[1] m.LinkDuplex + o.PutUint32(buf[pos:pos+4], uint32(m.LinkDuplex)) + pos += 4 + // field[1] m.LinkSpeed + o.PutUint32(buf[pos:pos+4], uint32(m.LinkSpeed)) + pos += 4 + // field[1] m.LinkMtu + o.PutUint16(buf[pos:pos+2], uint16(m.LinkMtu)) + pos += 2 + // field[1] m.Mtu + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + // field[1] m.SubID + o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) + pos += 4 + // field[1] m.SubNumberOfTags + buf[pos] = uint8(m.SubNumberOfTags) + pos += 1 + // field[1] m.SubOuterVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.SubOuterVlanID)) + pos += 2 + // field[1] m.SubInnerVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.SubInnerVlanID)) + pos += 2 + // field[1] m.SubIfFlags + o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) + pos += 4 + // field[1] m.VtrOp + o.PutUint32(buf[pos:pos+4], uint32(m.VtrOp)) + pos += 4 + // field[1] m.VtrPushDot1q + o.PutUint32(buf[pos:pos+4], uint32(m.VtrPushDot1q)) + pos += 4 + // field[1] m.VtrTag1 + o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag1)) + pos += 4 + // field[1] m.VtrTag2 + o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag2)) + pos += 4 + // field[1] m.OuterTag + o.PutUint16(buf[pos:pos+2], uint16(m.OuterTag)) + pos += 2 + // field[1] m.BDmac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.BDmac) { + x = uint8(m.BDmac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.BSmac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.BSmac) { + x = uint8(m.BSmac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.BVlanid + o.PutUint16(buf[pos:pos+2], uint16(m.BVlanid)) + pos += 2 + // field[1] m.ISid + o.PutUint32(buf[pos:pos+4], uint32(m.ISid)) + pos += 4 + // field[1] m.InterfaceName + copy(buf[pos:pos+64], m.InterfaceName) + pos += 64 + // field[1] m.InterfaceDevType + copy(buf[pos:pos+64], m.InterfaceDevType) + pos += 64 + // field[1] m.Tag + copy(buf[pos:pos+64], m.Tag) + pos += 64 + return buf, nil +} +func (m *SwInterfaceDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SupSwIfIndex + m.SupSwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.L2Address + for i := 0; i < len(m.L2Address); i++ { + m.L2Address[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Type + m.Type = IfType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.LinkDuplex + m.LinkDuplex = LinkDuplex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.LinkSpeed + m.LinkSpeed = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.LinkMtu + m.LinkMtu = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.Mtu + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + // field[1] m.SubID + m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SubNumberOfTags + m.SubNumberOfTags = uint8(tmp[pos]) + pos += 1 + // field[1] m.SubOuterVlanID + m.SubOuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.SubInnerVlanID + m.SubInnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.SubIfFlags + m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrOp + m.VtrOp = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrPushDot1q + m.VtrPushDot1q = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrTag1 + m.VtrTag1 = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrTag2 + m.VtrTag2 = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.OuterTag + m.OuterTag = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.BDmac + for i := 0; i < len(m.BDmac); i++ { + m.BDmac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.BSmac + for i := 0; i < len(m.BSmac); i++ { + m.BSmac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.BVlanid + m.BVlanid = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.ISid + m.ISid = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.InterfaceName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.InterfaceName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + // field[1] m.InterfaceDevType + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.InterfaceDevType = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + // field[1] m.Tag + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. +type SwInterfaceDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"` + XXX_NameFilterLen uint32 `struc:"sizeof=NameFilter"` + NameFilter string `json:"name_filter,omitempty"` +} + +func (m *SwInterfaceDump) Reset() { *m = SwInterfaceDump{} } +func (*SwInterfaceDump) GetMessageName() string { return "sw_interface_dump" } +func (*SwInterfaceDump) GetCrcString() string { return "aa610c27" } +func (*SwInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.NameFilterValid + size += 1 + // field[1] m.NameFilter + size += 4 + len(m.NameFilter) + return size +} +func (m *SwInterfaceDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.NameFilterValid + if m.NameFilterValid { + buf[pos] = 1 + } + pos += 1 + // field[1] m.NameFilter + o.PutUint32(buf[pos:pos+4], uint32(len(m.NameFilter))) + pos += 4 + copy(buf[pos:pos+len(m.NameFilter)], m.NameFilter[:]) + pos += len(m.NameFilter) + return buf, nil +} +func (m *SwInterfaceDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NameFilterValid + m.NameFilterValid = tmp[pos] != 0 + pos += 1 + // field[1] m.NameFilter + { + siz := o.Uint32(tmp[pos : pos+4]) + pos += 4 + m.NameFilter = codec.DecodeString(tmp[pos : pos+int(siz)]) + pos += len(m.NameFilter) + } + return nil +} + +// SwInterfaceEvent represents VPP binary API message 'sw_interface_event'. +type SwInterfaceEvent struct { + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Deleted bool `binapi:"bool,name=deleted" json:"deleted,omitempty"` +} + +func (m *SwInterfaceEvent) Reset() { *m = SwInterfaceEvent{} } +func (*SwInterfaceEvent) GetMessageName() string { return "sw_interface_event" } +func (*SwInterfaceEvent) GetCrcString() string { return "f709f78d" } +func (*SwInterfaceEvent) GetMessageType() api.MessageType { return api.EventMessage } + +func (m *SwInterfaceEvent) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.PID + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Flags + size += 4 + // field[1] m.Deleted + size += 1 + return size +} +func (m *SwInterfaceEvent) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.PID + o.PutUint32(buf[pos:pos+4], uint32(m.PID)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + // field[1] m.Deleted + if m.Deleted { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceEvent) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.PID + m.PID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Deleted + m.Deleted = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address'. +type SwInterfaceGetMacAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceGetMacAddress) Reset() { *m = SwInterfaceGetMacAddress{} } +func (*SwInterfaceGetMacAddress) GetMessageName() string { return "sw_interface_get_mac_address" } +func (*SwInterfaceGetMacAddress) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceGetMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *SwInterfaceGetMacAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceGetMacAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply'. +type SwInterfaceGetMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *SwInterfaceGetMacAddressReply) Reset() { *m = SwInterfaceGetMacAddressReply{} } +func (*SwInterfaceGetMacAddressReply) GetMessageName() string { + return "sw_interface_get_mac_address_reply" +} +func (*SwInterfaceGetMacAddressReply) GetCrcString() string { return "40ef2c08" } +func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceGetMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.MacAddress + size += 6 + return size +} +func (m *SwInterfaceGetMacAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SwInterfaceGetMacAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table'. +type SwInterfaceGetTable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *SwInterfaceGetTable) Reset() { *m = SwInterfaceGetTable{} } +func (*SwInterfaceGetTable) GetMessageName() string { return "sw_interface_get_table" } +func (*SwInterfaceGetTable) GetCrcString() string { return "2d033de4" } +func (*SwInterfaceGetTable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceGetTable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *SwInterfaceGetTable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceGetTable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply'. +type SwInterfaceGetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *SwInterfaceGetTableReply) Reset() { *m = SwInterfaceGetTableReply{} } +func (*SwInterfaceGetTableReply) GetMessageName() string { return "sw_interface_get_table_reply" } +func (*SwInterfaceGetTableReply) GetCrcString() string { return "a6eb0109" } +func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceGetTableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.VrfID + size += 4 + return size +} +func (m *SwInterfaceGetTableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceGetTableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details'. +type SwInterfaceRxPlacementDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` +} + +func (m *SwInterfaceRxPlacementDetails) Reset() { *m = SwInterfaceRxPlacementDetails{} } +func (*SwInterfaceRxPlacementDetails) GetMessageName() string { + return "sw_interface_rx_placement_details" +} +func (*SwInterfaceRxPlacementDetails) GetCrcString() string { return "f6d7d024" } +func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceRxPlacementDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.QueueID + size += 4 + // field[1] m.WorkerID + size += 4 + // field[1] m.Mode + size += 4 + return size +} +func (m *SwInterfaceRxPlacementDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.QueueID + o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) + pos += 4 + // field[1] m.WorkerID + o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceRxPlacementDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.QueueID + m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.WorkerID + m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump'. +type SwInterfaceRxPlacementDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *SwInterfaceRxPlacementDump) Reset() { *m = SwInterfaceRxPlacementDump{} } +func (*SwInterfaceRxPlacementDump) GetMessageName() string { return "sw_interface_rx_placement_dump" } +func (*SwInterfaceRxPlacementDump) GetCrcString() string { return "f9e6675e" } +func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceRxPlacementDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *SwInterfaceRxPlacementDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceRxPlacementDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags'. +type SwInterfaceSetFlags struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` +} + +func (m *SwInterfaceSetFlags) Reset() { *m = SwInterfaceSetFlags{} } +func (*SwInterfaceSetFlags) GetMessageName() string { return "sw_interface_set_flags" } +func (*SwInterfaceSetFlags) GetCrcString() string { return "6a2b491a" } +func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetFlags) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Flags + size += 4 + return size +} +func (m *SwInterfaceSetFlags) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetFlags) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply'. +type SwInterfaceSetFlagsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetFlagsReply) Reset() { *m = SwInterfaceSetFlagsReply{} } +func (*SwInterfaceSetFlagsReply) GetMessageName() string { return "sw_interface_set_flags_reply" } +func (*SwInterfaceSetFlagsReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetFlagsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetFlagsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetFlagsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast'. +type SwInterfaceSetIPDirectedBroadcast struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *SwInterfaceSetIPDirectedBroadcast) Reset() { *m = SwInterfaceSetIPDirectedBroadcast{} } +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast" +} +func (*SwInterfaceSetIPDirectedBroadcast) GetCrcString() string { return "ae6cfcfb" } +func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetIPDirectedBroadcast) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Enable + size += 1 + return size +} +func (m *SwInterfaceSetIPDirectedBroadcast) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Enable + if m.Enable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceSetIPDirectedBroadcast) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Enable + m.Enable = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply'. +type SwInterfaceSetIPDirectedBroadcastReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetIPDirectedBroadcastReply) Reset() { + *m = SwInterfaceSetIPDirectedBroadcastReply{} +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageName() string { + return "sw_interface_set_ip_directed_broadcast_reply" +} +func (*SwInterfaceSetIPDirectedBroadcastReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceSetIPDirectedBroadcastReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetIPDirectedBroadcastReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetIPDirectedBroadcastReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address'. +type SwInterfaceSetMacAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` +} + +func (m *SwInterfaceSetMacAddress) Reset() { *m = SwInterfaceSetMacAddress{} } +func (*SwInterfaceSetMacAddress) GetMessageName() string { return "sw_interface_set_mac_address" } +func (*SwInterfaceSetMacAddress) GetCrcString() string { return "6aca746a" } +func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.MacAddress + size += 6 + return size +} +func (m *SwInterfaceSetMacAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SwInterfaceSetMacAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply'. +type SwInterfaceSetMacAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetMacAddressReply) Reset() { *m = SwInterfaceSetMacAddressReply{} } +func (*SwInterfaceSetMacAddressReply) GetMessageName() string { + return "sw_interface_set_mac_address_reply" +} +func (*SwInterfaceSetMacAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetMacAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetMacAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu'. +type SwInterfaceSetMtu struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` +} + +func (m *SwInterfaceSetMtu) Reset() { *m = SwInterfaceSetMtu{} } +func (*SwInterfaceSetMtu) GetMessageName() string { return "sw_interface_set_mtu" } +func (*SwInterfaceSetMtu) GetCrcString() string { return "5cbe85e5" } +func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetMtu) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Mtu + size += 16 + return size +} +func (m *SwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Mtu + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *SwInterfaceSetMtu) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mtu + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply'. +type SwInterfaceSetMtuReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetMtuReply) Reset() { *m = SwInterfaceSetMtuReply{} } +func (*SwInterfaceSetMtuReply) GetMessageName() string { return "sw_interface_set_mtu_reply" } +func (*SwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetMtuReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode'. +type SwInterfaceSetRxMode struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueIDValid bool `binapi:"bool,name=queue_id_valid" json:"queue_id_valid,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` +} + +func (m *SwInterfaceSetRxMode) Reset() { *m = SwInterfaceSetRxMode{} } +func (*SwInterfaceSetRxMode) GetMessageName() string { return "sw_interface_set_rx_mode" } +func (*SwInterfaceSetRxMode) GetCrcString() string { return "780f5cee" } +func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetRxMode) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.QueueIDValid + size += 1 + // field[1] m.QueueID + size += 4 + // field[1] m.Mode + size += 4 + return size +} +func (m *SwInterfaceSetRxMode) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.QueueIDValid + if m.QueueIDValid { + buf[pos] = 1 + } + pos += 1 + // field[1] m.QueueID + o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetRxMode) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.QueueIDValid + m.QueueIDValid = tmp[pos] != 0 + pos += 1 + // field[1] m.QueueID + m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply'. +type SwInterfaceSetRxModeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetRxModeReply) Reset() { *m = SwInterfaceSetRxModeReply{} } +func (*SwInterfaceSetRxModeReply) GetMessageName() string { return "sw_interface_set_rx_mode_reply" } +func (*SwInterfaceSetRxModeReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetRxModeReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetRxModeReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetRxModeReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement'. +type SwInterfaceSetRxPlacement struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + IsMain bool `binapi:"bool,name=is_main" json:"is_main,omitempty"` +} + +func (m *SwInterfaceSetRxPlacement) Reset() { *m = SwInterfaceSetRxPlacement{} } +func (*SwInterfaceSetRxPlacement) GetMessageName() string { return "sw_interface_set_rx_placement" } +func (*SwInterfaceSetRxPlacement) GetCrcString() string { return "db65f3c9" } +func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetRxPlacement) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.QueueID + size += 4 + // field[1] m.WorkerID + size += 4 + // field[1] m.IsMain + size += 1 + return size +} +func (m *SwInterfaceSetRxPlacement) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.QueueID + o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) + pos += 4 + // field[1] m.WorkerID + o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) + pos += 4 + // field[1] m.IsMain + if m.IsMain { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceSetRxPlacement) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.QueueID + m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.WorkerID + m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsMain + m.IsMain = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply'. +type SwInterfaceSetRxPlacementReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetRxPlacementReply) Reset() { *m = SwInterfaceSetRxPlacementReply{} } +func (*SwInterfaceSetRxPlacementReply) GetMessageName() string { + return "sw_interface_set_rx_placement_reply" +} +func (*SwInterfaceSetRxPlacementReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetRxPlacementReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetRxPlacementReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetRxPlacementReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table'. +type SwInterfaceSetTable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *SwInterfaceSetTable) Reset() { *m = SwInterfaceSetTable{} } +func (*SwInterfaceSetTable) GetMessageName() string { return "sw_interface_set_table" } +func (*SwInterfaceSetTable) GetCrcString() string { return "df42a577" } +func (*SwInterfaceSetTable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetTable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + // field[1] m.VrfID + size += 4 + return size +} +func (m *SwInterfaceSetTable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetTable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply'. +type SwInterfaceSetTableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetTableReply) Reset() { *m = SwInterfaceSetTableReply{} } +func (*SwInterfaceSetTableReply) GetMessageName() string { return "sw_interface_set_table_reply" } +func (*SwInterfaceSetTableReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetTableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetTableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetTableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered'. +type SwInterfaceSetUnnumbered struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + UnnumberedSwIfIndex InterfaceIndex `binapi:"interface_index,name=unnumbered_sw_if_index" json:"unnumbered_sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` +} + +func (m *SwInterfaceSetUnnumbered) Reset() { *m = SwInterfaceSetUnnumbered{} } +func (*SwInterfaceSetUnnumbered) GetMessageName() string { return "sw_interface_set_unnumbered" } +func (*SwInterfaceSetUnnumbered) GetCrcString() string { return "938ef33b" } +func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceSetUnnumbered) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.UnnumberedSwIfIndex + size += 4 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *SwInterfaceSetUnnumbered) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.UnnumberedSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.UnnumberedSwIfIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceSetUnnumbered) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.UnnumberedSwIfIndex + m.UnnumberedSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply'. +type SwInterfaceSetUnnumberedReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceSetUnnumberedReply) Reset() { *m = SwInterfaceSetUnnumberedReply{} } +func (*SwInterfaceSetUnnumberedReply) GetMessageName() string { + return "sw_interface_set_unnumbered_reply" +} +func (*SwInterfaceSetUnnumberedReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceSetUnnumberedReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetUnnumberedReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetUnnumberedReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. +type SwInterfaceTagAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` +} + +func (m *SwInterfaceTagAddDel) Reset() { *m = SwInterfaceTagAddDel{} } +func (*SwInterfaceTagAddDel) GetMessageName() string { return "sw_interface_tag_add_del" } +func (*SwInterfaceTagAddDel) GetCrcString() string { return "426f8bc1" } +func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceTagAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Tag + size += 64 + return size +} +func (m *SwInterfaceTagAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Tag + copy(buf[pos:pos+64], m.Tag) + pos += 64 + return buf, nil +} +func (m *SwInterfaceTagAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply'. +type SwInterfaceTagAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceTagAddDelReply) Reset() { *m = SwInterfaceTagAddDelReply{} } +func (*SwInterfaceTagAddDelReply) GetMessageName() string { return "sw_interface_tag_add_del_reply" } +func (*SwInterfaceTagAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceTagAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceTagAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceTagAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// WantInterfaceEvents represents VPP binary API message 'want_interface_events'. +type WantInterfaceEvents struct { + EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` +} + +func (m *WantInterfaceEvents) Reset() { *m = WantInterfaceEvents{} } +func (*WantInterfaceEvents) GetMessageName() string { return "want_interface_events" } +func (*WantInterfaceEvents) GetCrcString() string { return "476f5a08" } +func (*WantInterfaceEvents) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *WantInterfaceEvents) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.EnableDisable + size += 4 + // field[1] m.PID + size += 4 + return size +} +func (m *WantInterfaceEvents) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.EnableDisable + o.PutUint32(buf[pos:pos+4], uint32(m.EnableDisable)) + pos += 4 + // field[1] m.PID + o.PutUint32(buf[pos:pos+4], uint32(m.PID)) + pos += 4 + return buf, nil +} +func (m *WantInterfaceEvents) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.EnableDisable + m.EnableDisable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PID + m.PID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply'. +type WantInterfaceEventsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *WantInterfaceEventsReply) Reset() { *m = WantInterfaceEventsReply{} } +func (*WantInterfaceEventsReply) GetMessageName() string { return "want_interface_events_reply" } +func (*WantInterfaceEventsReply) GetCrcString() string { return "e8d4e804" } +func (*WantInterfaceEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *WantInterfaceEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *WantInterfaceEventsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *WantInterfaceEventsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_interfaces_binapi_init() } +func file_interfaces_binapi_init() { + api.RegisterMessage((*CollectDetailedInterfaceStats)(nil), "interface.CollectDetailedInterfaceStats") + api.RegisterMessage((*CollectDetailedInterfaceStatsReply)(nil), "interface.CollectDetailedInterfaceStatsReply") + api.RegisterMessage((*CreateLoopback)(nil), "interface.CreateLoopback") + api.RegisterMessage((*CreateLoopbackInstance)(nil), "interface.CreateLoopbackInstance") + api.RegisterMessage((*CreateLoopbackInstanceReply)(nil), "interface.CreateLoopbackInstanceReply") + api.RegisterMessage((*CreateLoopbackReply)(nil), "interface.CreateLoopbackReply") + api.RegisterMessage((*CreateSubif)(nil), "interface.CreateSubif") + api.RegisterMessage((*CreateSubifReply)(nil), "interface.CreateSubifReply") + api.RegisterMessage((*CreateVlanSubif)(nil), "interface.CreateVlanSubif") + api.RegisterMessage((*CreateVlanSubifReply)(nil), "interface.CreateVlanSubifReply") + api.RegisterMessage((*DeleteLoopback)(nil), "interface.DeleteLoopback") + api.RegisterMessage((*DeleteLoopbackReply)(nil), "interface.DeleteLoopbackReply") + api.RegisterMessage((*DeleteSubif)(nil), "interface.DeleteSubif") + api.RegisterMessage((*DeleteSubifReply)(nil), "interface.DeleteSubifReply") + api.RegisterMessage((*HwInterfaceSetMtu)(nil), "interface.HwInterfaceSetMtu") + api.RegisterMessage((*HwInterfaceSetMtuReply)(nil), "interface.HwInterfaceSetMtuReply") + api.RegisterMessage((*InterfaceNameRenumber)(nil), "interface.InterfaceNameRenumber") + api.RegisterMessage((*InterfaceNameRenumberReply)(nil), "interface.InterfaceNameRenumberReply") + api.RegisterMessage((*SwInterfaceAddDelAddress)(nil), "interface.SwInterfaceAddDelAddress") + api.RegisterMessage((*SwInterfaceAddDelAddressReply)(nil), "interface.SwInterfaceAddDelAddressReply") + api.RegisterMessage((*SwInterfaceAddDelMacAddress)(nil), "interface.SwInterfaceAddDelMacAddress") + api.RegisterMessage((*SwInterfaceAddDelMacAddressReply)(nil), "interface.SwInterfaceAddDelMacAddressReply") + api.RegisterMessage((*SwInterfaceClearStats)(nil), "interface.SwInterfaceClearStats") + api.RegisterMessage((*SwInterfaceClearStatsReply)(nil), "interface.SwInterfaceClearStatsReply") + api.RegisterMessage((*SwInterfaceDetails)(nil), "interface.SwInterfaceDetails") + api.RegisterMessage((*SwInterfaceDump)(nil), "interface.SwInterfaceDump") + api.RegisterMessage((*SwInterfaceEvent)(nil), "interface.SwInterfaceEvent") + api.RegisterMessage((*SwInterfaceGetMacAddress)(nil), "interface.SwInterfaceGetMacAddress") + api.RegisterMessage((*SwInterfaceGetMacAddressReply)(nil), "interface.SwInterfaceGetMacAddressReply") + api.RegisterMessage((*SwInterfaceGetTable)(nil), "interface.SwInterfaceGetTable") + api.RegisterMessage((*SwInterfaceGetTableReply)(nil), "interface.SwInterfaceGetTableReply") + api.RegisterMessage((*SwInterfaceRxPlacementDetails)(nil), "interface.SwInterfaceRxPlacementDetails") + api.RegisterMessage((*SwInterfaceRxPlacementDump)(nil), "interface.SwInterfaceRxPlacementDump") + api.RegisterMessage((*SwInterfaceSetFlags)(nil), "interface.SwInterfaceSetFlags") + api.RegisterMessage((*SwInterfaceSetFlagsReply)(nil), "interface.SwInterfaceSetFlagsReply") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcast)(nil), "interface.SwInterfaceSetIPDirectedBroadcast") + api.RegisterMessage((*SwInterfaceSetIPDirectedBroadcastReply)(nil), "interface.SwInterfaceSetIPDirectedBroadcastReply") + api.RegisterMessage((*SwInterfaceSetMacAddress)(nil), "interface.SwInterfaceSetMacAddress") + api.RegisterMessage((*SwInterfaceSetMacAddressReply)(nil), "interface.SwInterfaceSetMacAddressReply") + api.RegisterMessage((*SwInterfaceSetMtu)(nil), "interface.SwInterfaceSetMtu") + api.RegisterMessage((*SwInterfaceSetMtuReply)(nil), "interface.SwInterfaceSetMtuReply") + api.RegisterMessage((*SwInterfaceSetRxMode)(nil), "interface.SwInterfaceSetRxMode") + api.RegisterMessage((*SwInterfaceSetRxModeReply)(nil), "interface.SwInterfaceSetRxModeReply") + api.RegisterMessage((*SwInterfaceSetRxPlacement)(nil), "interface.SwInterfaceSetRxPlacement") + api.RegisterMessage((*SwInterfaceSetRxPlacementReply)(nil), "interface.SwInterfaceSetRxPlacementReply") + api.RegisterMessage((*SwInterfaceSetTable)(nil), "interface.SwInterfaceSetTable") + api.RegisterMessage((*SwInterfaceSetTableReply)(nil), "interface.SwInterfaceSetTableReply") + api.RegisterMessage((*SwInterfaceSetUnnumbered)(nil), "interface.SwInterfaceSetUnnumbered") + api.RegisterMessage((*SwInterfaceSetUnnumberedReply)(nil), "interface.SwInterfaceSetUnnumberedReply") + api.RegisterMessage((*SwInterfaceTagAddDel)(nil), "interface.SwInterfaceTagAddDel") + api.RegisterMessage((*SwInterfaceTagAddDelReply)(nil), "interface.SwInterfaceTagAddDelReply") + api.RegisterMessage((*WantInterfaceEvents)(nil), "interface.WantInterfaceEvents") + api.RegisterMessage((*WantInterfaceEventsReply)(nil), "interface.WantInterfaceEventsReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*CollectDetailedInterfaceStats)(nil), + (*CollectDetailedInterfaceStatsReply)(nil), + (*CreateLoopback)(nil), + (*CreateLoopbackInstance)(nil), + (*CreateLoopbackInstanceReply)(nil), + (*CreateLoopbackReply)(nil), + (*CreateSubif)(nil), + (*CreateSubifReply)(nil), + (*CreateVlanSubif)(nil), + (*CreateVlanSubifReply)(nil), + (*DeleteLoopback)(nil), + (*DeleteLoopbackReply)(nil), + (*DeleteSubif)(nil), + (*DeleteSubifReply)(nil), + (*HwInterfaceSetMtu)(nil), + (*HwInterfaceSetMtuReply)(nil), + (*InterfaceNameRenumber)(nil), + (*InterfaceNameRenumberReply)(nil), + (*SwInterfaceAddDelAddress)(nil), + (*SwInterfaceAddDelAddressReply)(nil), + (*SwInterfaceAddDelMacAddress)(nil), + (*SwInterfaceAddDelMacAddressReply)(nil), + (*SwInterfaceClearStats)(nil), + (*SwInterfaceClearStatsReply)(nil), + (*SwInterfaceDetails)(nil), + (*SwInterfaceDump)(nil), + (*SwInterfaceEvent)(nil), + (*SwInterfaceGetMacAddress)(nil), + (*SwInterfaceGetMacAddressReply)(nil), + (*SwInterfaceGetTable)(nil), + (*SwInterfaceGetTableReply)(nil), + (*SwInterfaceRxPlacementDetails)(nil), + (*SwInterfaceRxPlacementDump)(nil), + (*SwInterfaceSetFlags)(nil), + (*SwInterfaceSetFlagsReply)(nil), + (*SwInterfaceSetIPDirectedBroadcast)(nil), + (*SwInterfaceSetIPDirectedBroadcastReply)(nil), + (*SwInterfaceSetMacAddress)(nil), + (*SwInterfaceSetMacAddressReply)(nil), + (*SwInterfaceSetMtu)(nil), + (*SwInterfaceSetMtuReply)(nil), + (*SwInterfaceSetRxMode)(nil), + (*SwInterfaceSetRxModeReply)(nil), + (*SwInterfaceSetRxPlacement)(nil), + (*SwInterfaceSetRxPlacementReply)(nil), + (*SwInterfaceSetTable)(nil), + (*SwInterfaceSetTableReply)(nil), + (*SwInterfaceSetUnnumbered)(nil), + (*SwInterfaceSetUnnumberedReply)(nil), + (*SwInterfaceTagAddDel)(nil), + (*SwInterfaceTagAddDelReply)(nil), + (*WantInterfaceEvents)(nil), + (*WantInterfaceEventsReply)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/internal/testbinapi/binapi2001/interfaces/interfaces_rpc.ba.go b/internal/testbinapi/binapi2001/interfaces/interfaces_rpc.ba.go new file mode 100644 index 0000000..e30aed9 --- /dev/null +++ b/internal/testbinapi/binapi2001/interfaces/interfaces_rpc.ba.go @@ -0,0 +1,321 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package interfaces + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for interface module. +type RPCService interface { + DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) + DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) + CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) + CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) + CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) + CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) + CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) + DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) + DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) + HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) + InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) + SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) + SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) + SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) + SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) + SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) + SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) + SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) + SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) + SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) + SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) + SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) + SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) + SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) + SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) + WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceClient interface { + Recv() (*SwInterfaceDetails, error) +} + +type serviceClient_DumpSwInterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceClient) Recv() (*SwInterfaceDetails, error) { + m := new(SwInterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceRxPlacementClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceRxPlacementClient interface { + Recv() (*SwInterfaceRxPlacementDetails, error) +} + +type serviceClient_DumpSwInterfaceRxPlacementClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceRxPlacementClient) Recv() (*SwInterfaceRxPlacementDetails, error) { + m := new(SwInterfaceRxPlacementDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { + out := new(CollectDetailedInterfaceStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { + out := new(CreateLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { + out := new(CreateLoopbackInstanceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { + out := new(CreateSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { + out := new(CreateVlanSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { + out := new(DeleteLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { + out := new(DeleteSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { + out := new(HwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { + out := new(InterfaceNameRenumberReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { + out := new(SwInterfaceAddDelAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { + out := new(SwInterfaceAddDelMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { + out := new(SwInterfaceClearStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { + out := new(SwInterfaceGetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { + out := new(SwInterfaceGetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { + out := new(SwInterfaceSetFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { + out := new(SwInterfaceSetIPDirectedBroadcastReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { + out := new(SwInterfaceSetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { + out := new(SwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { + out := new(SwInterfaceSetRxModeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { + out := new(SwInterfaceSetRxPlacementReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { + out := new(SwInterfaceSetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { + out := new(SwInterfaceSetUnnumberedReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { + out := new(SwInterfaceTagAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { + out := new(WantInterfaceEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/internal/testbinapi/binapi2001/ip/ip.ba.go b/internal/testbinapi/binapi2001/ip/ip.ba.go new file mode 100644 index 0000000..ca717ca --- /dev/null +++ b/internal/testbinapi/binapi2001/ip/ip.ba.go @@ -0,0 +1,5730 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/ip.api.json + +/* +Package ip contains generated code for VPP binary API defined by ip.api (version 3.0.1). + +It consists of: + 7 aliases + 15 enums + 60 messages + 14 types + 1 union +*/ +package ip + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "ip" + // APIVersion is the API version of this module. + APIVersion = "3.0.1" + // VersionCrc is the CRC of this module. + VersionCrc = 0xfc3fea46 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var ( + AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", + } + AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, + } +) + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return "AddressFamily(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathFlags represents VPP binary API enum 'fib_path_flags'. +type FibPathFlags uint32 + +const ( + FIB_API_PATH_FLAG_NONE FibPathFlags = 0 + FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 + FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 + FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 +) + +var ( + FibPathFlags_name = map[uint32]string{ + 0: "FIB_API_PATH_FLAG_NONE", + 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", + 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", + 4: "FIB_API_PATH_FLAG_POP_PW_CW", + } + FibPathFlags_value = map[string]uint32{ + "FIB_API_PATH_FLAG_NONE": 0, + "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, + "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, + "FIB_API_PATH_FLAG_POP_PW_CW": 4, + } +) + +func (x FibPathFlags) String() string { + s, ok := FibPathFlags_name[uint32(x)] + if ok { + return s + } + return "FibPathFlags(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. +type FibPathNhProto uint32 + +const ( + FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 + FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 + FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 + FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 + FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 +) + +var ( + FibPathNhProto_name = map[uint32]string{ + 0: "FIB_API_PATH_NH_PROTO_IP4", + 1: "FIB_API_PATH_NH_PROTO_IP6", + 2: "FIB_API_PATH_NH_PROTO_MPLS", + 3: "FIB_API_PATH_NH_PROTO_ETHERNET", + 4: "FIB_API_PATH_NH_PROTO_BIER", + } + FibPathNhProto_value = map[string]uint32{ + "FIB_API_PATH_NH_PROTO_IP4": 0, + "FIB_API_PATH_NH_PROTO_IP6": 1, + "FIB_API_PATH_NH_PROTO_MPLS": 2, + "FIB_API_PATH_NH_PROTO_ETHERNET": 3, + "FIB_API_PATH_NH_PROTO_BIER": 4, + } +) + +func (x FibPathNhProto) String() string { + s, ok := FibPathNhProto_name[uint32(x)] + if ok { + return s + } + return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathType represents VPP binary API enum 'fib_path_type'. +type FibPathType uint32 + +const ( + FIB_API_PATH_TYPE_NORMAL FibPathType = 0 + FIB_API_PATH_TYPE_LOCAL FibPathType = 1 + FIB_API_PATH_TYPE_DROP FibPathType = 2 + FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 + FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 + FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 + FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 + FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 + FIB_API_PATH_TYPE_DVR FibPathType = 8 + FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 + FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 +) + +var ( + FibPathType_name = map[uint32]string{ + 0: "FIB_API_PATH_TYPE_NORMAL", + 1: "FIB_API_PATH_TYPE_LOCAL", + 2: "FIB_API_PATH_TYPE_DROP", + 3: "FIB_API_PATH_TYPE_UDP_ENCAP", + 4: "FIB_API_PATH_TYPE_BIER_IMP", + 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", + 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", + 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", + 8: "FIB_API_PATH_TYPE_DVR", + 9: "FIB_API_PATH_TYPE_INTERFACE_RX", + 10: "FIB_API_PATH_TYPE_CLASSIFY", + } + FibPathType_value = map[string]uint32{ + "FIB_API_PATH_TYPE_NORMAL": 0, + "FIB_API_PATH_TYPE_LOCAL": 1, + "FIB_API_PATH_TYPE_DROP": 2, + "FIB_API_PATH_TYPE_UDP_ENCAP": 3, + "FIB_API_PATH_TYPE_BIER_IMP": 4, + "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, + "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, + "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, + "FIB_API_PATH_TYPE_DVR": 8, + "FIB_API_PATH_TYPE_INTERFACE_RX": 9, + "FIB_API_PATH_TYPE_CLASSIFY": 10, + } +) + +func (x FibPathType) String() string { + s, ok := FibPathType_name[uint32(x)] + if ok { + return s + } + return "FibPathType(" + strconv.Itoa(int(x)) + ")" +} + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var ( + IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", + } + IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, + } +) + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return "IPDscp(" + strconv.Itoa(int(x)) + ")" +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var ( + IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", + } + IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, + } +) + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return "IPEcn(" + strconv.Itoa(int(x)) + ")" +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var ( + IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", + } + IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, + } +) + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return "IPProto(" + strconv.Itoa(int(x)) + ")" +} + +// IPReassType represents VPP binary API enum 'ip_reass_type'. +type IPReassType uint32 + +const ( + IP_REASS_TYPE_FULL IPReassType = 0 + IP_REASS_TYPE_SHALLOW_VIRTUAL IPReassType = 1 +) + +var ( + IPReassType_name = map[uint32]string{ + 0: "IP_REASS_TYPE_FULL", + 1: "IP_REASS_TYPE_SHALLOW_VIRTUAL", + } + IPReassType_value = map[string]uint32{ + "IP_REASS_TYPE_FULL": 0, + "IP_REASS_TYPE_SHALLOW_VIRTUAL": 1, + } +) + +func (x IPReassType) String() string { + s, ok := IPReassType_name[uint32(x)] + if ok { + return s + } + return "IPReassType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MfibItfFlags represents VPP binary API enum 'mfib_itf_flags'. +type MfibItfFlags uint32 + +const ( + MFIB_API_ITF_FLAG_NONE MfibItfFlags = 0 + MFIB_API_ITF_FLAG_NEGATE_SIGNAL MfibItfFlags = 1 + MFIB_API_ITF_FLAG_ACCEPT MfibItfFlags = 2 + MFIB_API_ITF_FLAG_FORWARD MfibItfFlags = 4 + MFIB_API_ITF_FLAG_SIGNAL_PRESENT MfibItfFlags = 8 + MFIB_API_ITF_FLAG_DONT_PRESERVE MfibItfFlags = 16 +) + +var ( + MfibItfFlags_name = map[uint32]string{ + 0: "MFIB_API_ITF_FLAG_NONE", + 1: "MFIB_API_ITF_FLAG_NEGATE_SIGNAL", + 2: "MFIB_API_ITF_FLAG_ACCEPT", + 4: "MFIB_API_ITF_FLAG_FORWARD", + 8: "MFIB_API_ITF_FLAG_SIGNAL_PRESENT", + 16: "MFIB_API_ITF_FLAG_DONT_PRESERVE", + } + MfibItfFlags_value = map[string]uint32{ + "MFIB_API_ITF_FLAG_NONE": 0, + "MFIB_API_ITF_FLAG_NEGATE_SIGNAL": 1, + "MFIB_API_ITF_FLAG_ACCEPT": 2, + "MFIB_API_ITF_FLAG_FORWARD": 4, + "MFIB_API_ITF_FLAG_SIGNAL_PRESENT": 8, + "MFIB_API_ITF_FLAG_DONT_PRESERVE": 16, + } +) + +func (x MfibItfFlags) String() string { + s, ok := MfibItfFlags_name[uint32(x)] + if ok { + return s + } + return "MfibItfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. +type AddressWithPrefix Prefix + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. +type IP4AddressWithPrefix IP4Prefix + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. +type IP6AddressWithPrefix IP6Prefix + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` +} + +func (*Address) GetTypeName() string { return "address" } + +// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. +type FibMplsLabel struct { + IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"` + Label uint32 `binapi:"u32,name=label" json:"label,omitempty"` + TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` + Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"` +} + +func (*FibMplsLabel) GetTypeName() string { return "fib_mpls_label" } + +// FibPath represents VPP binary API type 'fib_path'. +type FibPath struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` + Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` + Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"` + Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"` + Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"` + Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"` + NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"` + LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty" struc:"[16]FibMplsLabel"` +} + +func (*FibPath) GetTypeName() string { return "fib_path" } + +// FibPathNh represents VPP binary API type 'fib_path_nh'. +type FibPathNh struct { + Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` + ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` + ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` + ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` +} + +func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } + +// IPMroute represents VPP binary API type 'ip_mroute'. +type IPMroute struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + EntryFlags uint32 `binapi:"u32,name=entry_flags" json:"entry_flags,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` + Paths []MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +func (*IPMroute) GetTypeName() string { return "ip_mroute" } + +// IPRoute represents VPP binary API type 'ip_route'. +type IPRoute struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` + Paths []FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` +} + +func (*IPRoute) GetTypeName() string { return "ip_route" } + +// IPTable represents VPP binary API type 'ip_table'. +type IPTable struct { + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (*IPTable) GetTypeName() string { return "ip_table" } + +// MfibPath represents VPP binary API type 'mfib_path'. +type MfibPath struct { + ItfFlags MfibItfFlags `binapi:"mfib_itf_flags,name=itf_flags" json:"itf_flags,omitempty"` + Path FibPath `binapi:"fib_path,name=path" json:"path,omitempty"` +} + +func (*MfibPath) GetTypeName() string { return "mfib_path" } + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` +} + +func (*Mprefix) GetTypeName() string { return "mprefix" } + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*Prefix) GetTypeName() string { return "prefix" } + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` +} + +func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } + +// PuntRedirect represents VPP binary API type 'punt_redirect'. +type PuntRedirect struct { + RxSwIfIndex InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + TxSwIfIndex InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` + Nh Address `binapi:"address,name=nh" json:"nh,omitempty"` +} + +func (*PuntRedirect) GetTypeName() string { return "punt_redirect" } + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { return "address_union" } + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// IoamDisable represents VPP binary API message 'ioam_disable'. +type IoamDisable struct { + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` +} + +func (m *IoamDisable) Reset() { *m = IoamDisable{} } +func (*IoamDisable) GetMessageName() string { return "ioam_disable" } +func (*IoamDisable) GetCrcString() string { return "6b16a45e" } +func (*IoamDisable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IoamDisable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ID + size += 2 + return size +} +func (m *IoamDisable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ID + o.PutUint16(buf[pos:pos+2], uint16(m.ID)) + pos += 2 + return buf, nil +} +func (m *IoamDisable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ID + m.ID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +// IoamDisableReply represents VPP binary API message 'ioam_disable_reply'. +type IoamDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IoamDisableReply) Reset() { *m = IoamDisableReply{} } +func (*IoamDisableReply) GetMessageName() string { return "ioam_disable_reply" } +func (*IoamDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IoamDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IoamDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IoamDisableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IoamDisableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IoamEnable represents VPP binary API message 'ioam_enable'. +type IoamEnable struct { + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` + Seqno bool `binapi:"bool,name=seqno" json:"seqno,omitempty"` + Analyse bool `binapi:"bool,name=analyse" json:"analyse,omitempty"` + PotEnable bool `binapi:"bool,name=pot_enable" json:"pot_enable,omitempty"` + TraceEnable bool `binapi:"bool,name=trace_enable" json:"trace_enable,omitempty"` + NodeID uint32 `binapi:"u32,name=node_id" json:"node_id,omitempty"` +} + +func (m *IoamEnable) Reset() { *m = IoamEnable{} } +func (*IoamEnable) GetMessageName() string { return "ioam_enable" } +func (*IoamEnable) GetCrcString() string { return "51ccd868" } +func (*IoamEnable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IoamEnable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ID + size += 2 + // field[1] m.Seqno + size += 1 + // field[1] m.Analyse + size += 1 + // field[1] m.PotEnable + size += 1 + // field[1] m.TraceEnable + size += 1 + // field[1] m.NodeID + size += 4 + return size +} +func (m *IoamEnable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ID + o.PutUint16(buf[pos:pos+2], uint16(m.ID)) + pos += 2 + // field[1] m.Seqno + if m.Seqno { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Analyse + if m.Analyse { + buf[pos] = 1 + } + pos += 1 + // field[1] m.PotEnable + if m.PotEnable { + buf[pos] = 1 + } + pos += 1 + // field[1] m.TraceEnable + if m.TraceEnable { + buf[pos] = 1 + } + pos += 1 + // field[1] m.NodeID + o.PutUint32(buf[pos:pos+4], uint32(m.NodeID)) + pos += 4 + return buf, nil +} +func (m *IoamEnable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ID + m.ID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.Seqno + m.Seqno = tmp[pos] != 0 + pos += 1 + // field[1] m.Analyse + m.Analyse = tmp[pos] != 0 + pos += 1 + // field[1] m.PotEnable + m.PotEnable = tmp[pos] != 0 + pos += 1 + // field[1] m.TraceEnable + m.TraceEnable = tmp[pos] != 0 + pos += 1 + // field[1] m.NodeID + m.NodeID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IoamEnableReply represents VPP binary API message 'ioam_enable_reply'. +type IoamEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IoamEnableReply) Reset() { *m = IoamEnableReply{} } +func (*IoamEnableReply) GetMessageName() string { return "ioam_enable_reply" } +func (*IoamEnableReply) GetCrcString() string { return "e8d4e804" } +func (*IoamEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IoamEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IoamEnableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IoamEnableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPAddressDetails represents VPP binary API message 'ip_address_details'. +type IPAddressDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *IPAddressDetails) Reset() { *m = IPAddressDetails{} } +func (*IPAddressDetails) GetMessageName() string { return "ip_address_details" } +func (*IPAddressDetails) GetCrcString() string { return "b1199745" } +func (*IPAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPAddressDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *IPAddressDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *IPAddressDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + +// IPAddressDump represents VPP binary API message 'ip_address_dump'. +type IPAddressDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPAddressDump) Reset() { *m = IPAddressDump{} } +func (*IPAddressDump) GetMessageName() string { return "ip_address_dump" } +func (*IPAddressDump) GetCrcString() string { return "2d033de4" } +func (*IPAddressDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPAddressDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPAddressDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPAddressDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del'. +type IPContainerProxyAddDel struct { + Pfx Prefix `binapi:"prefix,name=pfx" json:"pfx,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *IPContainerProxyAddDel) Reset() { *m = IPContainerProxyAddDel{} } +func (*IPContainerProxyAddDel) GetMessageName() string { return "ip_container_proxy_add_del" } +func (*IPContainerProxyAddDel) GetCrcString() string { return "91189f40" } +func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPContainerProxyAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Pfx + // field[2] m.Pfx.Address + // field[3] m.Pfx.Address.Af + size += 4 + // field[3] m.Pfx.Address.Un + size += 16 + // field[2] m.Pfx.Len + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *IPContainerProxyAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Pfx + // field[2] m.Pfx.Address + // field[3] m.Pfx.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Pfx.Address.Af)) + pos += 4 + // field[3] m.Pfx.Address.Un + copy(buf[pos:pos+16], m.Pfx.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Pfx.Len + buf[pos] = uint8(m.Pfx.Len) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPContainerProxyAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Pfx + // field[2] m.Pfx.Address + // field[3] m.Pfx.Address.Af + m.Pfx.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Pfx.Address.Un + copy(m.Pfx.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Pfx.Len + m.Pfx.Len = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply'. +type IPContainerProxyAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPContainerProxyAddDelReply) Reset() { *m = IPContainerProxyAddDelReply{} } +func (*IPContainerProxyAddDelReply) GetMessageName() string { + return "ip_container_proxy_add_del_reply" +} +func (*IPContainerProxyAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPContainerProxyAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPContainerProxyAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPContainerProxyAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details'. +type IPContainerProxyDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` +} + +func (m *IPContainerProxyDetails) Reset() { *m = IPContainerProxyDetails{} } +func (*IPContainerProxyDetails) GetMessageName() string { return "ip_container_proxy_details" } +func (*IPContainerProxyDetails) GetCrcString() string { return "0ee460e8" } +func (*IPContainerProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPContainerProxyDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *IPContainerProxyDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *IPContainerProxyDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + +// IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump'. +type IPContainerProxyDump struct{} + +func (m *IPContainerProxyDump) Reset() { *m = IPContainerProxyDump{} } +func (*IPContainerProxyDump) GetMessageName() string { return "ip_container_proxy_dump" } +func (*IPContainerProxyDump) GetCrcString() string { return "51077d14" } +func (*IPContainerProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPContainerProxyDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPContainerProxyDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *IPContainerProxyDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// IPDetails represents VPP binary API message 'ip_details'. +type IPDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPDetails) Reset() { *m = IPDetails{} } +func (*IPDetails) GetMessageName() string { return "ip_details" } +func (*IPDetails) GetCrcString() string { return "eb152d07" } +func (*IPDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPDump represents VPP binary API message 'ip_dump'. +type IPDump struct { + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPDump) Reset() { *m = IPDump{} } +func (*IPDump) GetMessageName() string { return "ip_dump" } +func (*IPDump) GetCrcString() string { return "98d231ca" } +func (*IPDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del'. +type IPMrouteAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` + Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` +} + +func (m *IPMrouteAddDel) Reset() { *m = IPMrouteAddDel{} } +func (*IPMrouteAddDel) GetMessageName() string { return "ip_mroute_add_del" } +func (*IPMrouteAddDel) GetCrcString() string { return "f6627d17" } +func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPMrouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.IsMultipath + size += 1 + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.EntryFlags + size += 4 + // field[2] m.Route.RpfID + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + size += 4 + // field[3] m.Route.Prefix.GrpAddressLength + size += 2 + // field[3] m.Route.Prefix.GrpAddress + size += 16 + // field[3] m.Route.Prefix.SrcAddress + size += 16 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 MfibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.ItfFlags + size += 4 + // field[3] s2.Path + // field[4] s2.Path.SwIfIndex + size += 4 + // field[4] s2.Path.TableID + size += 4 + // field[4] s2.Path.RpfID + size += 4 + // field[4] s2.Path.Weight + size += 1 + // field[4] s2.Path.Preference + size += 1 + // field[4] s2.Path.Type + size += 4 + // field[4] s2.Path.Flags + size += 4 + // field[4] s2.Path.Proto + size += 4 + // field[4] s2.Path.Nh + // field[5] s2.Path.Nh.Address + size += 16 + // field[5] s2.Path.Nh.ViaLabel + size += 4 + // field[5] s2.Path.Nh.ObjID + size += 4 + // field[5] s2.Path.Nh.ClassifyTableIndex + size += 4 + // field[4] s2.Path.NLabels + size += 1 + // field[4] s2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var s4 FibMplsLabel + _ = s4 + if j4 < len(s2.Path.LabelStack) { + s4 = s2.Path.LabelStack[j4] + } + // field[5] s4.IsUniform + size += 1 + // field[5] s4.Label + size += 4 + // field[5] s4.TTL + size += 1 + // field[5] s4.Exp + size += 1 + } + } + return size +} +func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.IsMultipath + if m.IsMultipath { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.EntryFlags + o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) + pos += 4 + // field[2] m.Route.RpfID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) + pos += 16 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 MfibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.ItfFlags + o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) + pos += 4 + // field[3] v2.Path + // field[4] v2.Path.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) + pos += 4 + // field[4] v2.Path.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) + pos += 4 + // field[4] v2.Path.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) + pos += 4 + // field[4] v2.Path.Weight + buf[pos] = uint8(v2.Path.Weight) + pos += 1 + // field[4] v2.Path.Preference + buf[pos] = uint8(v2.Path.Preference) + pos += 1 + // field[4] v2.Path.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) + pos += 4 + // field[4] v2.Path.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) + pos += 4 + // field[4] v2.Path.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) + pos += 4 + // field[4] v2.Path.Nh + // field[5] v2.Path.Nh.Address + copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[5] v2.Path.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) + pos += 4 + // field[5] v2.Path.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) + pos += 4 + // field[5] v2.Path.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) + pos += 4 + // field[4] v2.Path.NLabels + buf[pos] = uint8(v2.Path.NLabels) + pos += 1 + // field[4] v2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var v4 FibMplsLabel + if j4 < len(v2.Path.LabelStack) { + v4 = v2.Path.LabelStack[j4] + } + // field[5] v4.IsUniform + buf[pos] = uint8(v4.IsUniform) + pos += 1 + // field[5] v4.Label + o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) + pos += 4 + // field[5] v4.TTL + buf[pos] = uint8(v4.TTL) + pos += 1 + // field[5] v4.Exp + buf[pos] = uint8(v4.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPMrouteAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.IsMultipath + m.IsMultipath = tmp[pos] != 0 + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.EntryFlags + m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.RpfID + m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].ItfFlags + m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Path + // field[4] m.Route.Paths[j2].Path.SwIfIndex + m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.TableID + m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.RpfID + m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Weight + m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Preference + m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Type + m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Flags + m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Proto + m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Nh + // field[5] m.Route.Paths[j2].Path.Nh.Address + copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel + m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ObjID + m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex + m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.NLabels + m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform + m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label + m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL + m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp + m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply'. +type IPMrouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *IPMrouteAddDelReply) Reset() { *m = IPMrouteAddDelReply{} } +func (*IPMrouteAddDelReply) GetMessageName() string { return "ip_mroute_add_del_reply" } +func (*IPMrouteAddDelReply) GetCrcString() string { return "1992deab" } +func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPMrouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.StatsIndex + size += 4 + return size +} +func (m *IPMrouteAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) + pos += 4 + return buf, nil +} +func (m *IPMrouteAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.StatsIndex + m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPMrouteDetails represents VPP binary API message 'ip_mroute_details'. +type IPMrouteDetails struct { + Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` +} + +func (m *IPMrouteDetails) Reset() { *m = IPMrouteDetails{} } +func (*IPMrouteDetails) GetMessageName() string { return "ip_mroute_details" } +func (*IPMrouteDetails) GetCrcString() string { return "c1cb4b44" } +func (*IPMrouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPMrouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.EntryFlags + size += 4 + // field[2] m.Route.RpfID + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + size += 4 + // field[3] m.Route.Prefix.GrpAddressLength + size += 2 + // field[3] m.Route.Prefix.GrpAddress + size += 16 + // field[3] m.Route.Prefix.SrcAddress + size += 16 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 MfibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.ItfFlags + size += 4 + // field[3] s2.Path + // field[4] s2.Path.SwIfIndex + size += 4 + // field[4] s2.Path.TableID + size += 4 + // field[4] s2.Path.RpfID + size += 4 + // field[4] s2.Path.Weight + size += 1 + // field[4] s2.Path.Preference + size += 1 + // field[4] s2.Path.Type + size += 4 + // field[4] s2.Path.Flags + size += 4 + // field[4] s2.Path.Proto + size += 4 + // field[4] s2.Path.Nh + // field[5] s2.Path.Nh.Address + size += 16 + // field[5] s2.Path.Nh.ViaLabel + size += 4 + // field[5] s2.Path.Nh.ObjID + size += 4 + // field[5] s2.Path.Nh.ClassifyTableIndex + size += 4 + // field[4] s2.Path.NLabels + size += 1 + // field[4] s2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var s4 FibMplsLabel + _ = s4 + if j4 < len(s2.Path.LabelStack) { + s4 = s2.Path.LabelStack[j4] + } + // field[5] s4.IsUniform + size += 1 + // field[5] s4.Label + size += 4 + // field[5] s4.TTL + size += 1 + // field[5] s4.Exp + size += 1 + } + } + return size +} +func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.EntryFlags + o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) + pos += 4 + // field[2] m.Route.RpfID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) + pos += 16 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 MfibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.ItfFlags + o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) + pos += 4 + // field[3] v2.Path + // field[4] v2.Path.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) + pos += 4 + // field[4] v2.Path.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) + pos += 4 + // field[4] v2.Path.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) + pos += 4 + // field[4] v2.Path.Weight + buf[pos] = uint8(v2.Path.Weight) + pos += 1 + // field[4] v2.Path.Preference + buf[pos] = uint8(v2.Path.Preference) + pos += 1 + // field[4] v2.Path.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) + pos += 4 + // field[4] v2.Path.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) + pos += 4 + // field[4] v2.Path.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) + pos += 4 + // field[4] v2.Path.Nh + // field[5] v2.Path.Nh.Address + copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[5] v2.Path.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) + pos += 4 + // field[5] v2.Path.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) + pos += 4 + // field[5] v2.Path.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) + pos += 4 + // field[4] v2.Path.NLabels + buf[pos] = uint8(v2.Path.NLabels) + pos += 1 + // field[4] v2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var v4 FibMplsLabel + if j4 < len(v2.Path.LabelStack) { + v4 = v2.Path.LabelStack[j4] + } + // field[5] v4.IsUniform + buf[pos] = uint8(v4.IsUniform) + pos += 1 + // field[5] v4.Label + o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) + pos += 4 + // field[5] v4.TTL + buf[pos] = uint8(v4.TTL) + pos += 1 + // field[5] v4.Exp + buf[pos] = uint8(v4.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPMrouteDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.EntryFlags + m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.RpfID + m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].ItfFlags + m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Path + // field[4] m.Route.Paths[j2].Path.SwIfIndex + m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.TableID + m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.RpfID + m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Weight + m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Preference + m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Type + m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Flags + m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Proto + m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Nh + // field[5] m.Route.Paths[j2].Path.Nh.Address + copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel + m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ObjID + m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex + m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.NLabels + m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform + m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label + m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL + m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp + m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// IPMrouteDump represents VPP binary API message 'ip_mroute_dump'. +type IPMrouteDump struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPMrouteDump) Reset() { *m = IPMrouteDump{} } +func (*IPMrouteDump) GetMessageName() string { return "ip_mroute_dump" } +func (*IPMrouteDump) GetCrcString() string { return "b9d2e09e" } +func (*IPMrouteDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPMrouteDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPMrouteDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPMrouteDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPMtableDetails represents VPP binary API message 'ip_mtable_details'. +type IPMtableDetails struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPMtableDetails) Reset() { *m = IPMtableDetails{} } +func (*IPMtableDetails) GetMessageName() string { return "ip_mtable_details" } +func (*IPMtableDetails) GetCrcString() string { return "b9d2e09e" } +func (*IPMtableDetails) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPMtableDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPMtableDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPMtableDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPMtableDump represents VPP binary API message 'ip_mtable_dump'. +type IPMtableDump struct{} + +func (m *IPMtableDump) Reset() { *m = IPMtableDump{} } +func (*IPMtableDump) GetMessageName() string { return "ip_mtable_dump" } +func (*IPMtableDump) GetCrcString() string { return "51077d14" } +func (*IPMtableDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPMtableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPMtableDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *IPMtableDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// IPPuntPolice represents VPP binary API message 'ip_punt_police'. +type IPPuntPolice struct { + PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` +} + +func (m *IPPuntPolice) Reset() { *m = IPPuntPolice{} } +func (*IPPuntPolice) GetMessageName() string { return "ip_punt_police" } +func (*IPPuntPolice) GetCrcString() string { return "db867cea" } +func (*IPPuntPolice) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPPuntPolice) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.PolicerIndex + size += 4 + // field[1] m.IsAdd + size += 1 + // field[1] m.IsIP6 + size += 1 + return size +} +func (m *IPPuntPolice) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.PolicerIndex + o.PutUint32(buf[pos:pos+4], uint32(m.PolicerIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPPuntPolice) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.PolicerIndex + m.PolicerIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply'. +type IPPuntPoliceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPPuntPoliceReply) Reset() { *m = IPPuntPoliceReply{} } +func (*IPPuntPoliceReply) GetMessageName() string { return "ip_punt_police_reply" } +func (*IPPuntPoliceReply) GetCrcString() string { return "e8d4e804" } +func (*IPPuntPoliceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPPuntPoliceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPPuntPoliceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPPuntPoliceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPPuntRedirect represents VPP binary API message 'ip_punt_redirect'. +type IPPuntRedirect struct { + Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` +} + +func (m *IPPuntRedirect) Reset() { *m = IPPuntRedirect{} } +func (*IPPuntRedirect) GetMessageName() string { return "ip_punt_redirect" } +func (*IPPuntRedirect) GetCrcString() string { return "a9a5592c" } +func (*IPPuntRedirect) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPPuntRedirect) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + size += 4 + // field[2] m.Punt.TxSwIfIndex + size += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + size += 4 + // field[3] m.Punt.Nh.Un + size += 16 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *IPPuntRedirect) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) + pos += 16 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPPuntRedirect) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details'. +type IPPuntRedirectDetails struct { + Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` +} + +func (m *IPPuntRedirectDetails) Reset() { *m = IPPuntRedirectDetails{} } +func (*IPPuntRedirectDetails) GetMessageName() string { return "ip_punt_redirect_details" } +func (*IPPuntRedirectDetails) GetCrcString() string { return "3924f5d3" } +func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPPuntRedirectDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + size += 4 + // field[2] m.Punt.TxSwIfIndex + size += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + size += 4 + // field[3] m.Punt.Nh.Un + size += 16 + return size +} +func (m *IPPuntRedirectDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) + pos += 16 + return buf, nil +} +func (m *IPPuntRedirectDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + return nil +} + +// IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump'. +type IPPuntRedirectDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` +} + +func (m *IPPuntRedirectDump) Reset() { *m = IPPuntRedirectDump{} } +func (*IPPuntRedirectDump) GetMessageName() string { return "ip_punt_redirect_dump" } +func (*IPPuntRedirectDump) GetCrcString() string { return "2d033de4" } +func (*IPPuntRedirectDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPPuntRedirectDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPPuntRedirectDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPPuntRedirectDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply'. +type IPPuntRedirectReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPPuntRedirectReply) Reset() { *m = IPPuntRedirectReply{} } +func (*IPPuntRedirectReply) GetMessageName() string { return "ip_punt_redirect_reply" } +func (*IPPuntRedirectReply) GetCrcString() string { return "e8d4e804" } +func (*IPPuntRedirectReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPPuntRedirectReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPPuntRedirectReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPPuntRedirectReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable'. +type IPReassemblyEnableDisable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableIP4 bool `binapi:"bool,name=enable_ip4" json:"enable_ip4,omitempty"` + EnableIP6 bool `binapi:"bool,name=enable_ip6" json:"enable_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` +} + +func (m *IPReassemblyEnableDisable) Reset() { *m = IPReassemblyEnableDisable{} } +func (*IPReassemblyEnableDisable) GetMessageName() string { return "ip_reassembly_enable_disable" } +func (*IPReassemblyEnableDisable) GetCrcString() string { return "885c85a6" } +func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPReassemblyEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.EnableIP4 + size += 1 + // field[1] m.EnableIP6 + size += 1 + // field[1] m.Type + size += 4 + return size +} +func (m *IPReassemblyEnableDisable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.EnableIP4 + if m.EnableIP4 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.EnableIP6 + if m.EnableIP6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + return buf, nil +} +func (m *IPReassemblyEnableDisable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.EnableIP4 + m.EnableIP4 = tmp[pos] != 0 + pos += 1 + // field[1] m.EnableIP6 + m.EnableIP6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Type + m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply'. +type IPReassemblyEnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPReassemblyEnableDisableReply) Reset() { *m = IPReassemblyEnableDisableReply{} } +func (*IPReassemblyEnableDisableReply) GetMessageName() string { + return "ip_reassembly_enable_disable_reply" +} +func (*IPReassemblyEnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPReassemblyEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPReassemblyEnableDisableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPReassemblyEnableDisableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblyGet represents VPP binary API message 'ip_reassembly_get'. +type IPReassemblyGet struct { + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` +} + +func (m *IPReassemblyGet) Reset() { *m = IPReassemblyGet{} } +func (*IPReassemblyGet) GetMessageName() string { return "ip_reassembly_get" } +func (*IPReassemblyGet) GetCrcString() string { return "ea13ff63" } +func (*IPReassemblyGet) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPReassemblyGet) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsIP6 + size += 1 + // field[1] m.Type + size += 4 + return size +} +func (m *IPReassemblyGet) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + return buf, nil +} +func (m *IPReassemblyGet) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Type + m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply'. +type IPReassemblyGetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` + MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` + MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` + ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` +} + +func (m *IPReassemblyGetReply) Reset() { *m = IPReassemblyGetReply{} } +func (*IPReassemblyGetReply) GetMessageName() string { return "ip_reassembly_get_reply" } +func (*IPReassemblyGetReply) GetCrcString() string { return "d5eb8d34" } +func (*IPReassemblyGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPReassemblyGetReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.TimeoutMs + size += 4 + // field[1] m.MaxReassemblies + size += 4 + // field[1] m.MaxReassemblyLength + size += 4 + // field[1] m.ExpireWalkIntervalMs + size += 4 + // field[1] m.IsIP6 + size += 1 + return size +} +func (m *IPReassemblyGetReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.TimeoutMs + o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) + pos += 4 + // field[1] m.MaxReassemblies + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) + pos += 4 + // field[1] m.MaxReassemblyLength + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) + pos += 4 + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPReassemblyGetReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TimeoutMs + m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblies + m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblyLength + m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + return nil +} + +// IPReassemblySet represents VPP binary API message 'ip_reassembly_set'. +type IPReassemblySet struct { + TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` + MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` + MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` + ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` +} + +func (m *IPReassemblySet) Reset() { *m = IPReassemblySet{} } +func (*IPReassemblySet) GetMessageName() string { return "ip_reassembly_set" } +func (*IPReassemblySet) GetCrcString() string { return "16467d25" } +func (*IPReassemblySet) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPReassemblySet) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.TimeoutMs + size += 4 + // field[1] m.MaxReassemblies + size += 4 + // field[1] m.MaxReassemblyLength + size += 4 + // field[1] m.ExpireWalkIntervalMs + size += 4 + // field[1] m.IsIP6 + size += 1 + // field[1] m.Type + size += 4 + return size +} +func (m *IPReassemblySet) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.TimeoutMs + o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) + pos += 4 + // field[1] m.MaxReassemblies + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) + pos += 4 + // field[1] m.MaxReassemblyLength + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) + pos += 4 + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + return buf, nil +} +func (m *IPReassemblySet) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.TimeoutMs + m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblies + m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblyLength + m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Type + m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply'. +type IPReassemblySetReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPReassemblySetReply) Reset() { *m = IPReassemblySetReply{} } +func (*IPReassemblySetReply) GetMessageName() string { return "ip_reassembly_set_reply" } +func (*IPReassemblySetReply) GetCrcString() string { return "e8d4e804" } +func (*IPReassemblySetReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPReassemblySetReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPReassemblySetReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPReassemblySetReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPRouteAddDel represents VPP binary API message 'ip_route_add_del'. +type IPRouteAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` +} + +func (m *IPRouteAddDel) Reset() { *m = IPRouteAddDel{} } +func (*IPRouteAddDel) GetMessageName() string { return "ip_route_add_del" } +func (*IPRouteAddDel) GetCrcString() string { return "c1ff832d" } +func (*IPRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPRouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.IsMultipath + size += 1 + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.StatsIndex + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + size += 4 + // field[4] m.Route.Prefix.Address.Un + size += 16 + // field[3] m.Route.Prefix.Len + size += 1 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.SwIfIndex + size += 4 + // field[3] s2.TableID + size += 4 + // field[3] s2.RpfID + size += 4 + // field[3] s2.Weight + size += 1 + // field[3] s2.Preference + size += 1 + // field[3] s2.Type + size += 4 + // field[3] s2.Flags + size += 4 + // field[3] s2.Proto + size += 4 + // field[3] s2.Nh + // field[4] s2.Nh.Address + size += 16 + // field[4] s2.Nh.ViaLabel + size += 4 + // field[4] s2.Nh.ObjID + size += 4 + // field[4] s2.Nh.ClassifyTableIndex + size += 4 + // field[3] s2.NLabels + size += 1 + // field[3] s2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var s3 FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + // field[4] s3.IsUniform + size += 1 + // field[4] s3.Label + size += 4 + // field[4] s3.TTL + size += 1 + // field[4] s3.Exp + size += 1 + } + } + return size +} +func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.IsMultipath + if m.IsMultipath { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.Len + buf[pos] = uint8(m.Route.Prefix.Len) + pos += 1 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 FibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) + pos += 4 + // field[3] v2.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) + pos += 4 + // field[3] v2.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) + pos += 4 + // field[3] v2.Weight + buf[pos] = uint8(v2.Weight) + pos += 1 + // field[3] v2.Preference + buf[pos] = uint8(v2.Preference) + pos += 1 + // field[3] v2.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) + pos += 4 + // field[3] v2.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) + pos += 4 + // field[3] v2.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) + pos += 4 + // field[3] v2.Nh + // field[4] v2.Nh.Address + copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[4] v2.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) + pos += 4 + // field[4] v2.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) + pos += 4 + // field[4] v2.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) + pos += 4 + // field[3] v2.NLabels + buf[pos] = uint8(v2.NLabels) + pos += 1 + // field[3] v2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var v3 FibMplsLabel + if j3 < len(v2.LabelStack) { + v3 = v2.LabelStack[j3] + } + // field[4] v3.IsUniform + buf[pos] = uint8(v3.IsUniform) + pos += 1 + // field[4] v3.Label + o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) + pos += 4 + // field[4] v3.TTL + buf[pos] = uint8(v3.TTL) + pos += 1 + // field[4] v3.Exp + buf[pos] = uint8(v3.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPRouteAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.IsMultipath + m.IsMultipath = tmp[pos] != 0 + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.StatsIndex + m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.Len + m.Route.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].SwIfIndex + m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].TableID + m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].RpfID + m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Weight + m.Route.Paths[j2].Weight = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Preference + m.Route.Paths[j2].Preference = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Type + m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Flags + m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Proto + m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Nh + // field[4] m.Route.Paths[j2].Nh.Address + copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[4] m.Route.Paths[j2].Nh.ViaLabel + m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ObjID + m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex + m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].NLabels + m.Route.Paths[j2].NLabels = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].LabelStack + for j3 := 0; j3 < 16; j3++ { + // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform + m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Label + m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].LabelStack[j3].TTL + m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Exp + m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// IPRouteAddDelReply represents VPP binary API message 'ip_route_add_del_reply'. +type IPRouteAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` +} + +func (m *IPRouteAddDelReply) Reset() { *m = IPRouteAddDelReply{} } +func (*IPRouteAddDelReply) GetMessageName() string { return "ip_route_add_del_reply" } +func (*IPRouteAddDelReply) GetCrcString() string { return "1992deab" } +func (*IPRouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPRouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.StatsIndex + size += 4 + return size +} +func (m *IPRouteAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) + pos += 4 + return buf, nil +} +func (m *IPRouteAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.StatsIndex + m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPRouteDetails represents VPP binary API message 'ip_route_details'. +type IPRouteDetails struct { + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` +} + +func (m *IPRouteDetails) Reset() { *m = IPRouteDetails{} } +func (*IPRouteDetails) GetMessageName() string { return "ip_route_details" } +func (*IPRouteDetails) GetCrcString() string { return "d1ffaae1" } +func (*IPRouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPRouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.StatsIndex + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + size += 4 + // field[4] m.Route.Prefix.Address.Un + size += 16 + // field[3] m.Route.Prefix.Len + size += 1 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.SwIfIndex + size += 4 + // field[3] s2.TableID + size += 4 + // field[3] s2.RpfID + size += 4 + // field[3] s2.Weight + size += 1 + // field[3] s2.Preference + size += 1 + // field[3] s2.Type + size += 4 + // field[3] s2.Flags + size += 4 + // field[3] s2.Proto + size += 4 + // field[3] s2.Nh + // field[4] s2.Nh.Address + size += 16 + // field[4] s2.Nh.ViaLabel + size += 4 + // field[4] s2.Nh.ObjID + size += 4 + // field[4] s2.Nh.ClassifyTableIndex + size += 4 + // field[3] s2.NLabels + size += 1 + // field[3] s2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var s3 FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + // field[4] s3.IsUniform + size += 1 + // field[4] s3.Label + size += 4 + // field[4] s3.TTL + size += 1 + // field[4] s3.Exp + size += 1 + } + } + return size +} +func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.Len + buf[pos] = uint8(m.Route.Prefix.Len) + pos += 1 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 FibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) + pos += 4 + // field[3] v2.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) + pos += 4 + // field[3] v2.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) + pos += 4 + // field[3] v2.Weight + buf[pos] = uint8(v2.Weight) + pos += 1 + // field[3] v2.Preference + buf[pos] = uint8(v2.Preference) + pos += 1 + // field[3] v2.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) + pos += 4 + // field[3] v2.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) + pos += 4 + // field[3] v2.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) + pos += 4 + // field[3] v2.Nh + // field[4] v2.Nh.Address + copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[4] v2.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) + pos += 4 + // field[4] v2.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) + pos += 4 + // field[4] v2.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) + pos += 4 + // field[3] v2.NLabels + buf[pos] = uint8(v2.NLabels) + pos += 1 + // field[3] v2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var v3 FibMplsLabel + if j3 < len(v2.LabelStack) { + v3 = v2.LabelStack[j3] + } + // field[4] v3.IsUniform + buf[pos] = uint8(v3.IsUniform) + pos += 1 + // field[4] v3.Label + o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) + pos += 4 + // field[4] v3.TTL + buf[pos] = uint8(v3.TTL) + pos += 1 + // field[4] v3.Exp + buf[pos] = uint8(v3.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPRouteDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.StatsIndex + m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.Len + m.Route.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].SwIfIndex + m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].TableID + m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].RpfID + m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Weight + m.Route.Paths[j2].Weight = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Preference + m.Route.Paths[j2].Preference = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Type + m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Flags + m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Proto + m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Nh + // field[4] m.Route.Paths[j2].Nh.Address + copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[4] m.Route.Paths[j2].Nh.ViaLabel + m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ObjID + m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex + m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].NLabels + m.Route.Paths[j2].NLabels = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].LabelStack + for j3 := 0; j3 < 16; j3++ { + // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform + m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Label + m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].LabelStack[j3].TTL + m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Exp + m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// IPRouteDump represents VPP binary API message 'ip_route_dump'. +type IPRouteDump struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPRouteDump) Reset() { *m = IPRouteDump{} } +func (*IPRouteDump) GetMessageName() string { return "ip_route_dump" } +func (*IPRouteDump) GetCrcString() string { return "b9d2e09e" } +func (*IPRouteDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPRouteDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPRouteDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPRouteDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. +type IPSourceAndPortRangeCheckAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` + LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty" struc:"[32]uint16"` + HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty" struc:"[32]uint16"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeCheckAddDel{} } +func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { + return "ip_source_and_port_range_check_add_del" +} +func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { return "8bfc76f2" } +func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPSourceAndPortRangeCheckAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + // field[1] m.NumberOfRanges + size += 1 + // field[1] m.LowPorts + size += 64 + // field[1] m.HighPorts + size += 64 + // field[1] m.VrfID + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + // field[1] m.NumberOfRanges + buf[pos] = uint8(m.NumberOfRanges) + pos += 1 + // field[1] m.LowPorts + for i := 0; i < 32; i++ { + var x uint16 + if i < len(m.LowPorts) { + x = uint16(m.LowPorts[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + // field[1] m.HighPorts + for i := 0; i < 32; i++ { + var x uint16 + if i < len(m.HighPorts) { + x = uint16(m.HighPorts[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[1] m.NumberOfRanges + m.NumberOfRanges = uint8(tmp[pos]) + pos += 1 + // field[1] m.LowPorts + m.LowPorts = make([]uint16, 32) + for i := 0; i < len(m.LowPorts); i++ { + m.LowPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + // field[1] m.HighPorts + m.HighPorts = make([]uint16, 32) + for i := 0; i < len(m.HighPorts); i++ { + m.HighPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply'. +type IPSourceAndPortRangeCheckAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckAddDelReply) Reset() { *m = IPSourceAndPortRangeCheckAddDelReply{} } +func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageName() string { + return "ip_source_and_port_range_check_add_del_reply" +} +func (*IPSourceAndPortRangeCheckAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPSourceAndPortRangeCheckAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del'. +type IPSourceAndPortRangeCheckInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TCPInVrfID uint32 `binapi:"u32,name=tcp_in_vrf_id" json:"tcp_in_vrf_id,omitempty"` + TCPOutVrfID uint32 `binapi:"u32,name=tcp_out_vrf_id" json:"tcp_out_vrf_id,omitempty"` + UDPInVrfID uint32 `binapi:"u32,name=udp_in_vrf_id" json:"udp_in_vrf_id,omitempty"` + UDPOutVrfID uint32 `binapi:"u32,name=udp_out_vrf_id" json:"udp_out_vrf_id,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Reset() { + *m = IPSourceAndPortRangeCheckInterfaceAddDel{} +} +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageName() string { + return "ip_source_and_port_range_check_interface_add_del" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetCrcString() string { return "e1ba8987" } +func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TCPInVrfID + size += 4 + // field[1] m.TCPOutVrfID + size += 4 + // field[1] m.UDPInVrfID + size += 4 + // field[1] m.UDPOutVrfID + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TCPInVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.TCPInVrfID)) + pos += 4 + // field[1] m.TCPOutVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.TCPOutVrfID)) + pos += 4 + // field[1] m.UDPInVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.UDPInVrfID)) + pos += 4 + // field[1] m.UDPOutVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.UDPOutVrfID)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TCPInVrfID + m.TCPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TCPOutVrfID + m.TCPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.UDPInVrfID + m.UDPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.UDPOutVrfID + m.UDPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply'. +type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Reset() { + *m = IPSourceAndPortRangeCheckInterfaceAddDelReply{} +} +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageName() string { + return "ip_source_and_port_range_check_interface_add_del_reply" +} +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del'. +type IPSourceCheckInterfaceAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Loose bool `binapi:"bool,name=loose" json:"loose,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IPSourceCheckInterfaceAddDel) Reset() { *m = IPSourceCheckInterfaceAddDel{} } +func (*IPSourceCheckInterfaceAddDel) GetMessageName() string { + return "ip_source_check_interface_add_del" +} +func (*IPSourceCheckInterfaceAddDel) GetCrcString() string { return "6612356b" } +func (*IPSourceCheckInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPSourceCheckInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.Loose + size += 1 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *IPSourceCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Loose + if m.Loose { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *IPSourceCheckInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.Loose + m.Loose = tmp[pos] != 0 + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply'. +type IPSourceCheckInterfaceAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPSourceCheckInterfaceAddDelReply) Reset() { *m = IPSourceCheckInterfaceAddDelReply{} } +func (*IPSourceCheckInterfaceAddDelReply) GetMessageName() string { + return "ip_source_check_interface_add_del_reply" +} +func (*IPSourceCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPSourceCheckInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPSourceCheckInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPSourceCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPSourceCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPTableAddDel represents VPP binary API message 'ip_table_add_del'. +type IPTableAddDel struct { + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableAddDel) Reset() { *m = IPTableAddDel{} } +func (*IPTableAddDel) GetMessageName() string { return "ip_table_add_del" } +func (*IPTableAddDel) GetCrcString() string { return "0ffdaec0" } +func (*IPTableAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply'. +type IPTableAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableAddDelReply) Reset() { *m = IPTableAddDelReply{} } +func (*IPTableAddDelReply) GetMessageName() string { return "ip_table_add_del_reply" } +func (*IPTableAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPTableDetails represents VPP binary API message 'ip_table_details'. +type IPTableDetails struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableDetails) Reset() { *m = IPTableDetails{} } +func (*IPTableDetails) GetMessageName() string { return "ip_table_details" } +func (*IPTableDetails) GetCrcString() string { return "c79fca0f" } +func (*IPTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableDump represents VPP binary API message 'ip_table_dump'. +type IPTableDump struct{} + +func (m *IPTableDump) Reset() { *m = IPTableDump{} } +func (*IPTableDump) GetMessageName() string { return "ip_table_dump" } +func (*IPTableDump) GetCrcString() string { return "51077d14" } +func (*IPTableDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPTableDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *IPTableDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// IPTableFlush represents VPP binary API message 'ip_table_flush'. +type IPTableFlush struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableFlush) Reset() { *m = IPTableFlush{} } +func (*IPTableFlush) GetMessageName() string { return "ip_table_flush" } +func (*IPTableFlush) GetCrcString() string { return "b9d2e09e" } +func (*IPTableFlush) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableFlush) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableFlush) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableFlush) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableFlushReply represents VPP binary API message 'ip_table_flush_reply'. +type IPTableFlushReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableFlushReply) Reset() { *m = IPTableFlushReply{} } +func (*IPTableFlushReply) GetMessageName() string { return "ip_table_flush_reply" } +func (*IPTableFlushReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableFlushReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableFlushReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableFlushReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableFlushReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPTableReplaceBegin represents VPP binary API message 'ip_table_replace_begin'. +type IPTableReplaceBegin struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableReplaceBegin) Reset() { *m = IPTableReplaceBegin{} } +func (*IPTableReplaceBegin) GetMessageName() string { return "ip_table_replace_begin" } +func (*IPTableReplaceBegin) GetCrcString() string { return "b9d2e09e" } +func (*IPTableReplaceBegin) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableReplaceBegin) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableReplaceBegin) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableReplaceBegin) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableReplaceBeginReply represents VPP binary API message 'ip_table_replace_begin_reply'. +type IPTableReplaceBeginReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableReplaceBeginReply) Reset() { *m = IPTableReplaceBeginReply{} } +func (*IPTableReplaceBeginReply) GetMessageName() string { return "ip_table_replace_begin_reply" } +func (*IPTableReplaceBeginReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableReplaceBeginReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableReplaceBeginReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableReplaceBeginReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableReplaceBeginReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPTableReplaceEnd represents VPP binary API message 'ip_table_replace_end'. +type IPTableReplaceEnd struct { + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` +} + +func (m *IPTableReplaceEnd) Reset() { *m = IPTableReplaceEnd{} } +func (*IPTableReplaceEnd) GetMessageName() string { return "ip_table_replace_end" } +func (*IPTableReplaceEnd) GetCrcString() string { return "b9d2e09e" } +func (*IPTableReplaceEnd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPTableReplaceEnd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableReplaceEnd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableReplaceEnd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// IPTableReplaceEndReply represents VPP binary API message 'ip_table_replace_end_reply'. +type IPTableReplaceEndReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *IPTableReplaceEndReply) Reset() { *m = IPTableReplaceEndReply{} } +func (*IPTableReplaceEndReply) GetMessageName() string { return "ip_table_replace_end_reply" } +func (*IPTableReplaceEndReply) GetCrcString() string { return "e8d4e804" } +func (*IPTableReplaceEndReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPTableReplaceEndReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableReplaceEndReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableReplaceEndReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details'. +type IPUnnumberedDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IPSwIfIndex InterfaceIndex `binapi:"interface_index,name=ip_sw_if_index" json:"ip_sw_if_index,omitempty"` +} + +func (m *IPUnnumberedDetails) Reset() { *m = IPUnnumberedDetails{} } +func (*IPUnnumberedDetails) GetMessageName() string { return "ip_unnumbered_details" } +func (*IPUnnumberedDetails) GetCrcString() string { return "aa12a483" } +func (*IPUnnumberedDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *IPUnnumberedDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IPSwIfIndex + size += 4 + return size +} +func (m *IPUnnumberedDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IPSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.IPSwIfIndex)) + pos += 4 + return buf, nil +} +func (m *IPUnnumberedDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IPSwIfIndex + m.IPSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. +type IPUnnumberedDump struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *IPUnnumberedDump) Reset() { *m = IPUnnumberedDump{} } +func (*IPUnnumberedDump) GetMessageName() string { return "ip_unnumbered_dump" } +func (*IPUnnumberedDump) GetCrcString() string { return "f9e6675e" } +func (*IPUnnumberedDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *IPUnnumberedDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *IPUnnumberedDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *IPUnnumberedDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MfibSignalDetails represents VPP binary API message 'mfib_signal_details'. +type MfibSignalDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + IPPacketLen uint16 `binapi:"u16,name=ip_packet_len" json:"ip_packet_len,omitempty"` + IPPacketData []byte `binapi:"u8[256],name=ip_packet_data" json:"ip_packet_data,omitempty" struc:"[256]byte"` +} + +func (m *MfibSignalDetails) Reset() { *m = MfibSignalDetails{} } +func (*MfibSignalDetails) GetMessageName() string { return "mfib_signal_details" } +func (*MfibSignalDetails) GetCrcString() string { return "64398a9a" } +func (*MfibSignalDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MfibSignalDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TableID + size += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Af + size += 4 + // field[2] m.Prefix.GrpAddressLength + size += 2 + // field[2] m.Prefix.GrpAddress + size += 16 + // field[2] m.Prefix.SrcAddress + size += 16 + // field[1] m.IPPacketLen + size += 2 + // field[1] m.IPPacketData + size += 256 + return size +} +func (m *MfibSignalDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Af)) + pos += 4 + // field[2] m.Prefix.GrpAddressLength + o.PutUint16(buf[pos:pos+2], uint16(m.Prefix.GrpAddressLength)) + pos += 2 + // field[2] m.Prefix.GrpAddress + copy(buf[pos:pos+16], m.Prefix.GrpAddress.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.SrcAddress + copy(buf[pos:pos+16], m.Prefix.SrcAddress.XXX_UnionData[:]) + pos += 16 + // field[1] m.IPPacketLen + o.PutUint16(buf[pos:pos+2], uint16(m.IPPacketLen)) + pos += 2 + // field[1] m.IPPacketData + for i := 0; i < 256; i++ { + var x uint8 + if i < len(m.IPPacketData) { + x = uint8(m.IPPacketData[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *MfibSignalDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TableID + m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Af + m.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Prefix.GrpAddressLength + m.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.Prefix.GrpAddress + copy(m.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.SrcAddress + copy(m.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[1] m.IPPacketLen + m.IPPacketLen = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.IPPacketData + m.IPPacketData = make([]uint8, 256) + for i := 0; i < len(m.IPPacketData); i++ { + m.IPPacketData[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// MfibSignalDump represents VPP binary API message 'mfib_signal_dump'. +type MfibSignalDump struct{} + +func (m *MfibSignalDump) Reset() { *m = MfibSignalDump{} } +func (*MfibSignalDump) GetMessageName() string { return "mfib_signal_dump" } +func (*MfibSignalDump) GetCrcString() string { return "51077d14" } +func (*MfibSignalDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MfibSignalDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MfibSignalDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MfibSignalDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash'. +type SetIPFlowHash struct { + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Src bool `binapi:"bool,name=src" json:"src,omitempty"` + Dst bool `binapi:"bool,name=dst" json:"dst,omitempty"` + Sport bool `binapi:"bool,name=sport" json:"sport,omitempty"` + Dport bool `binapi:"bool,name=dport" json:"dport,omitempty"` + Proto bool `binapi:"bool,name=proto" json:"proto,omitempty"` + Reverse bool `binapi:"bool,name=reverse" json:"reverse,omitempty"` + Symmetric bool `binapi:"bool,name=symmetric" json:"symmetric,omitempty"` +} + +func (m *SetIPFlowHash) Reset() { *m = SetIPFlowHash{} } +func (*SetIPFlowHash) GetMessageName() string { return "set_ip_flow_hash" } +func (*SetIPFlowHash) GetCrcString() string { return "084ee09e" } +func (*SetIPFlowHash) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SetIPFlowHash) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.VrfID + size += 4 + // field[1] m.IsIPv6 + size += 1 + // field[1] m.Src + size += 1 + // field[1] m.Dst + size += 1 + // field[1] m.Sport + size += 1 + // field[1] m.Dport + size += 1 + // field[1] m.Proto + size += 1 + // field[1] m.Reverse + size += 1 + // field[1] m.Symmetric + size += 1 + return size +} +func (m *SetIPFlowHash) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Src + if m.Src { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Dst + if m.Dst { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Sport + if m.Sport { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Dport + if m.Dport { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Proto + if m.Proto { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Reverse + if m.Reverse { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Symmetric + if m.Symmetric { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SetIPFlowHash) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Src + m.Src = tmp[pos] != 0 + pos += 1 + // field[1] m.Dst + m.Dst = tmp[pos] != 0 + pos += 1 + // field[1] m.Sport + m.Sport = tmp[pos] != 0 + pos += 1 + // field[1] m.Dport + m.Dport = tmp[pos] != 0 + pos += 1 + // field[1] m.Proto + m.Proto = tmp[pos] != 0 + pos += 1 + // field[1] m.Reverse + m.Reverse = tmp[pos] != 0 + pos += 1 + // field[1] m.Symmetric + m.Symmetric = tmp[pos] != 0 + pos += 1 + return nil +} + +// SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply'. +type SetIPFlowHashReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SetIPFlowHashReply) Reset() { *m = SetIPFlowHashReply{} } +func (*SetIPFlowHashReply) GetMessageName() string { return "set_ip_flow_hash_reply" } +func (*SetIPFlowHashReply) GetCrcString() string { return "e8d4e804" } +func (*SetIPFlowHashReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SetIPFlowHashReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SetIPFlowHashReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SetIPFlowHashReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable'. +type SwInterfaceIP6EnableDisable struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *SwInterfaceIP6EnableDisable) Reset() { *m = SwInterfaceIP6EnableDisable{} } +func (*SwInterfaceIP6EnableDisable) GetMessageName() string { return "sw_interface_ip6_enable_disable" } +func (*SwInterfaceIP6EnableDisable) GetCrcString() string { return "ae6cfcfb" } +func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceIP6EnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Enable + size += 1 + return size +} +func (m *SwInterfaceIP6EnableDisable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Enable + if m.Enable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceIP6EnableDisable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Enable + m.Enable = tmp[pos] != 0 + pos += 1 + return nil +} + +// SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply'. +type SwInterfaceIP6EnableDisableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceIP6EnableDisableReply) Reset() { *m = SwInterfaceIP6EnableDisableReply{} } +func (*SwInterfaceIP6EnableDisableReply) GetMessageName() string { + return "sw_interface_ip6_enable_disable_reply" +} +func (*SwInterfaceIP6EnableDisableReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SwInterfaceIP6EnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceIP6EnableDisableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SwInterfaceIP6SetLinkLocalAddress represents VPP binary API message 'sw_interface_ip6_set_link_local_address'. +type SwInterfaceIP6SetLinkLocalAddress struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` +} + +func (m *SwInterfaceIP6SetLinkLocalAddress) Reset() { *m = SwInterfaceIP6SetLinkLocalAddress{} } +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address" +} +func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { return "2931d9fa" } +func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SwInterfaceIP6SetLinkLocalAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IP + size += 16 + return size +} +func (m *SwInterfaceIP6SetLinkLocalAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IP + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.IP) { + x = uint8(m.IP[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SwInterfaceIP6SetLinkLocalAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IP + for i := 0; i < len(m.IP); i++ { + m.IP[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SwInterfaceIP6SetLinkLocalAddressReply represents VPP binary API message 'sw_interface_ip6_set_link_local_address_reply'. +type SwInterfaceIP6SetLinkLocalAddressReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Reset() { + *m = SwInterfaceIP6SetLinkLocalAddressReply{} +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageName() string { + return "sw_interface_ip6_set_link_local_address_reply" +} +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetCrcString() string { return "e8d4e804" } +func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_ip_binapi_init() } +func file_ip_binapi_init() { + api.RegisterMessage((*IoamDisable)(nil), "ip.IoamDisable") + api.RegisterMessage((*IoamDisableReply)(nil), "ip.IoamDisableReply") + api.RegisterMessage((*IoamEnable)(nil), "ip.IoamEnable") + api.RegisterMessage((*IoamEnableReply)(nil), "ip.IoamEnableReply") + api.RegisterMessage((*IPAddressDetails)(nil), "ip.IPAddressDetails") + api.RegisterMessage((*IPAddressDump)(nil), "ip.IPAddressDump") + api.RegisterMessage((*IPContainerProxyAddDel)(nil), "ip.IPContainerProxyAddDel") + api.RegisterMessage((*IPContainerProxyAddDelReply)(nil), "ip.IPContainerProxyAddDelReply") + api.RegisterMessage((*IPContainerProxyDetails)(nil), "ip.IPContainerProxyDetails") + api.RegisterMessage((*IPContainerProxyDump)(nil), "ip.IPContainerProxyDump") + api.RegisterMessage((*IPDetails)(nil), "ip.IPDetails") + api.RegisterMessage((*IPDump)(nil), "ip.IPDump") + api.RegisterMessage((*IPMrouteAddDel)(nil), "ip.IPMrouteAddDel") + api.RegisterMessage((*IPMrouteAddDelReply)(nil), "ip.IPMrouteAddDelReply") + api.RegisterMessage((*IPMrouteDetails)(nil), "ip.IPMrouteDetails") + api.RegisterMessage((*IPMrouteDump)(nil), "ip.IPMrouteDump") + api.RegisterMessage((*IPMtableDetails)(nil), "ip.IPMtableDetails") + api.RegisterMessage((*IPMtableDump)(nil), "ip.IPMtableDump") + api.RegisterMessage((*IPPuntPolice)(nil), "ip.IPPuntPolice") + api.RegisterMessage((*IPPuntPoliceReply)(nil), "ip.IPPuntPoliceReply") + api.RegisterMessage((*IPPuntRedirect)(nil), "ip.IPPuntRedirect") + api.RegisterMessage((*IPPuntRedirectDetails)(nil), "ip.IPPuntRedirectDetails") + api.RegisterMessage((*IPPuntRedirectDump)(nil), "ip.IPPuntRedirectDump") + api.RegisterMessage((*IPPuntRedirectReply)(nil), "ip.IPPuntRedirectReply") + api.RegisterMessage((*IPReassemblyEnableDisable)(nil), "ip.IPReassemblyEnableDisable") + api.RegisterMessage((*IPReassemblyEnableDisableReply)(nil), "ip.IPReassemblyEnableDisableReply") + api.RegisterMessage((*IPReassemblyGet)(nil), "ip.IPReassemblyGet") + api.RegisterMessage((*IPReassemblyGetReply)(nil), "ip.IPReassemblyGetReply") + api.RegisterMessage((*IPReassemblySet)(nil), "ip.IPReassemblySet") + api.RegisterMessage((*IPReassemblySetReply)(nil), "ip.IPReassemblySetReply") + api.RegisterMessage((*IPRouteAddDel)(nil), "ip.IPRouteAddDel") + api.RegisterMessage((*IPRouteAddDelReply)(nil), "ip.IPRouteAddDelReply") + api.RegisterMessage((*IPRouteDetails)(nil), "ip.IPRouteDetails") + api.RegisterMessage((*IPRouteDump)(nil), "ip.IPRouteDump") + api.RegisterMessage((*IPSourceAndPortRangeCheckAddDel)(nil), "ip.IPSourceAndPortRangeCheckAddDel") + api.RegisterMessage((*IPSourceAndPortRangeCheckAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckAddDelReply") + api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDel") + api.RegisterMessage((*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), "ip.IPSourceAndPortRangeCheckInterfaceAddDelReply") + api.RegisterMessage((*IPSourceCheckInterfaceAddDel)(nil), "ip.IPSourceCheckInterfaceAddDel") + api.RegisterMessage((*IPSourceCheckInterfaceAddDelReply)(nil), "ip.IPSourceCheckInterfaceAddDelReply") + api.RegisterMessage((*IPTableAddDel)(nil), "ip.IPTableAddDel") + api.RegisterMessage((*IPTableAddDelReply)(nil), "ip.IPTableAddDelReply") + api.RegisterMessage((*IPTableDetails)(nil), "ip.IPTableDetails") + api.RegisterMessage((*IPTableDump)(nil), "ip.IPTableDump") + api.RegisterMessage((*IPTableFlush)(nil), "ip.IPTableFlush") + api.RegisterMessage((*IPTableFlushReply)(nil), "ip.IPTableFlushReply") + api.RegisterMessage((*IPTableReplaceBegin)(nil), "ip.IPTableReplaceBegin") + api.RegisterMessage((*IPTableReplaceBeginReply)(nil), "ip.IPTableReplaceBeginReply") + api.RegisterMessage((*IPTableReplaceEnd)(nil), "ip.IPTableReplaceEnd") + api.RegisterMessage((*IPTableReplaceEndReply)(nil), "ip.IPTableReplaceEndReply") + api.RegisterMessage((*IPUnnumberedDetails)(nil), "ip.IPUnnumberedDetails") + api.RegisterMessage((*IPUnnumberedDump)(nil), "ip.IPUnnumberedDump") + api.RegisterMessage((*MfibSignalDetails)(nil), "ip.MfibSignalDetails") + api.RegisterMessage((*MfibSignalDump)(nil), "ip.MfibSignalDump") + api.RegisterMessage((*SetIPFlowHash)(nil), "ip.SetIPFlowHash") + api.RegisterMessage((*SetIPFlowHashReply)(nil), "ip.SetIPFlowHashReply") + api.RegisterMessage((*SwInterfaceIP6EnableDisable)(nil), "ip.SwInterfaceIP6EnableDisable") + api.RegisterMessage((*SwInterfaceIP6EnableDisableReply)(nil), "ip.SwInterfaceIP6EnableDisableReply") + api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddress)(nil), "ip.SwInterfaceIP6SetLinkLocalAddress") + api.RegisterMessage((*SwInterfaceIP6SetLinkLocalAddressReply)(nil), "ip.SwInterfaceIP6SetLinkLocalAddressReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*IoamDisable)(nil), + (*IoamDisableReply)(nil), + (*IoamEnable)(nil), + (*IoamEnableReply)(nil), + (*IPAddressDetails)(nil), + (*IPAddressDump)(nil), + (*IPContainerProxyAddDel)(nil), + (*IPContainerProxyAddDelReply)(nil), + (*IPContainerProxyDetails)(nil), + (*IPContainerProxyDump)(nil), + (*IPDetails)(nil), + (*IPDump)(nil), + (*IPMrouteAddDel)(nil), + (*IPMrouteAddDelReply)(nil), + (*IPMrouteDetails)(nil), + (*IPMrouteDump)(nil), + (*IPMtableDetails)(nil), + (*IPMtableDump)(nil), + (*IPPuntPolice)(nil), + (*IPPuntPoliceReply)(nil), + (*IPPuntRedirect)(nil), + (*IPPuntRedirectDetails)(nil), + (*IPPuntRedirectDump)(nil), + (*IPPuntRedirectReply)(nil), + (*IPReassemblyEnableDisable)(nil), + (*IPReassemblyEnableDisableReply)(nil), + (*IPReassemblyGet)(nil), + (*IPReassemblyGetReply)(nil), + (*IPReassemblySet)(nil), + (*IPReassemblySetReply)(nil), + (*IPRouteAddDel)(nil), + (*IPRouteAddDelReply)(nil), + (*IPRouteDetails)(nil), + (*IPRouteDump)(nil), + (*IPSourceAndPortRangeCheckAddDel)(nil), + (*IPSourceAndPortRangeCheckAddDelReply)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDel)(nil), + (*IPSourceAndPortRangeCheckInterfaceAddDelReply)(nil), + (*IPSourceCheckInterfaceAddDel)(nil), + (*IPSourceCheckInterfaceAddDelReply)(nil), + (*IPTableAddDel)(nil), + (*IPTableAddDelReply)(nil), + (*IPTableDetails)(nil), + (*IPTableDump)(nil), + (*IPTableFlush)(nil), + (*IPTableFlushReply)(nil), + (*IPTableReplaceBegin)(nil), + (*IPTableReplaceBeginReply)(nil), + (*IPTableReplaceEnd)(nil), + (*IPTableReplaceEndReply)(nil), + (*IPUnnumberedDetails)(nil), + (*IPUnnumberedDump)(nil), + (*MfibSignalDetails)(nil), + (*MfibSignalDump)(nil), + (*SetIPFlowHash)(nil), + (*SetIPFlowHashReply)(nil), + (*SwInterfaceIP6EnableDisable)(nil), + (*SwInterfaceIP6EnableDisableReply)(nil), + (*SwInterfaceIP6SetLinkLocalAddress)(nil), + (*SwInterfaceIP6SetLinkLocalAddressReply)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/internal/testbinapi/binapi2001/ip/ip_rpc.ba.go b/internal/testbinapi/binapi2001/ip/ip_rpc.ba.go new file mode 100644 index 0000000..e0580d5 --- /dev/null +++ b/internal/testbinapi/binapi2001/ip/ip_rpc.ba.go @@ -0,0 +1,497 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ip + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for ip module. +type RPCService interface { + DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) + DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) + DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) + DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) + DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) + DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) + DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) + DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) + DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) + DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) + IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) + IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) + IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) + IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) + IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) + IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) + IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) + IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) + IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) + IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) + IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) + IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) + IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) + IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) + IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) + IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) + IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) + SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) + SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) + SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPAddressClient{stream} + return x, nil +} + +type RPCService_DumpIPAddressClient interface { + Recv() (*IPAddressDetails, error) +} + +type serviceClient_DumpIPAddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPAddressClient) Recv() (*IPAddressDetails, error) { + m := new(IPAddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPContainerProxyClient{stream} + return x, nil +} + +type RPCService_DumpIPContainerProxyClient interface { + Recv() (*IPContainerProxyDetails, error) +} + +type serviceClient_DumpIPContainerProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPContainerProxyClient) Recv() (*IPContainerProxyDetails, error) { + m := new(IPContainerProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPClient{stream} + return x, nil +} + +type RPCService_DumpIPClient interface { + Recv() (*IPDetails, error) +} + +type serviceClient_DumpIPClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPClient) Recv() (*IPDetails, error) { + m := new(IPDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMrouteClient{stream} + return x, nil +} + +type RPCService_DumpIPMrouteClient interface { + Recv() (*IPMrouteDetails, error) +} + +type serviceClient_DumpIPMrouteClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMrouteClient) Recv() (*IPMrouteDetails, error) { + m := new(IPMrouteDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMtableClient{stream} + return x, nil +} + +type RPCService_DumpIPMtableClient interface { + Recv() (*IPMtableDetails, error) +} + +type serviceClient_DumpIPMtableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMtableClient) Recv() (*IPMtableDetails, error) { + m := new(IPMtableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPPuntRedirectClient{stream} + return x, nil +} + +type RPCService_DumpIPPuntRedirectClient interface { + Recv() (*IPPuntRedirectDetails, error) +} + +type serviceClient_DumpIPPuntRedirectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPPuntRedirectClient) Recv() (*IPPuntRedirectDetails, error) { + m := new(IPPuntRedirectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPRouteClient{stream} + return x, nil +} + +type RPCService_DumpIPRouteClient interface { + Recv() (*IPRouteDetails, error) +} + +type serviceClient_DumpIPRouteClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPRouteClient) Recv() (*IPRouteDetails, error) { + m := new(IPRouteDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPTableClient{stream} + return x, nil +} + +type RPCService_DumpIPTableClient interface { + Recv() (*IPTableDetails, error) +} + +type serviceClient_DumpIPTableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPTableClient) Recv() (*IPTableDetails, error) { + m := new(IPTableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPUnnumberedClient{stream} + return x, nil +} + +type RPCService_DumpIPUnnumberedClient interface { + Recv() (*IPUnnumberedDetails, error) +} + +type serviceClient_DumpIPUnnumberedClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPUnnumberedClient) Recv() (*IPUnnumberedDetails, error) { + m := new(IPUnnumberedDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMfibSignalClient{stream} + return x, nil +} + +type RPCService_DumpMfibSignalClient interface { + Recv() (*MfibSignalDetails, error) +} + +type serviceClient_DumpMfibSignalClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMfibSignalClient) Recv() (*MfibSignalDetails, error) { + m := new(MfibSignalDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { + out := new(IoamDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { + out := new(IoamEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { + out := new(IPContainerProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { + out := new(IPMrouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { + out := new(IPPuntPoliceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { + out := new(IPPuntRedirectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { + out := new(IPReassemblyEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { + out := new(IPReassemblyGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { + out := new(IPReassemblySetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { + out := new(IPRouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) { + out := new(IPSourceCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { + out := new(IPTableAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) { + out := new(IPTableFlushReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) { + out := new(IPTableReplaceBeginReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) { + out := new(IPTableReplaceEndReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { + out := new(SetIPFlowHashReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { + out := new(SwInterfaceIP6EnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { + out := new(SwInterfaceIP6SetLinkLocalAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/internal/testbinapi/binapi2001/memclnt/memclnt.ba.go b/internal/testbinapi/binapi2001/memclnt/memclnt.ba.go new file mode 100644 index 0000000..0b251ce --- /dev/null +++ b/internal/testbinapi/binapi2001/memclnt/memclnt.ba.go @@ -0,0 +1,1450 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/memclnt.api.json + +/* +Package memclnt contains generated code for VPP binary API defined by memclnt.api (version 2.1.0). + +It consists of: + 22 messages + 2 types +*/ +package memclnt + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "memclnt" + // APIVersion is the API version of this module. + APIVersion = "2.1.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x8d3dd881 +) + +// MessageTableEntry represents VPP binary API type 'message_table_entry'. +type MessageTableEntry struct { + Index uint16 `binapi:"u16,name=index" json:"index,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (*MessageTableEntry) GetTypeName() string { return "message_table_entry" } + +// ModuleVersion represents VPP binary API type 'module_version'. +type ModuleVersion struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` + Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (*ModuleVersion) GetTypeName() string { return "module_version" } + +// APIVersions represents VPP binary API message 'api_versions'. +type APIVersions struct{} + +func (m *APIVersions) Reset() { *m = APIVersions{} } +func (*APIVersions) GetMessageName() string { return "api_versions" } +func (*APIVersions) GetCrcString() string { return "51077d14" } +func (*APIVersions) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *APIVersions) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *APIVersions) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *APIVersions) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// APIVersionsReply represents VPP binary API message 'api_versions_reply'. +type APIVersionsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=APIVersions"` + APIVersions []ModuleVersion `binapi:"module_version[count],name=api_versions" json:"api_versions,omitempty"` +} + +func (m *APIVersionsReply) Reset() { *m = APIVersionsReply{} } +func (*APIVersionsReply) GetMessageName() string { return "api_versions_reply" } +func (*APIVersionsReply) GetCrcString() string { return "5f0d99d6" } +func (*APIVersionsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *APIVersionsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Count + size += 4 + // field[1] m.APIVersions + for j1 := 0; j1 < len(m.APIVersions); j1++ { + var s1 ModuleVersion + _ = s1 + if j1 < len(m.APIVersions) { + s1 = m.APIVersions[j1] + } + // field[2] s1.Major + size += 4 + // field[2] s1.Minor + size += 4 + // field[2] s1.Patch + size += 4 + // field[2] s1.Name + size += 64 + } + return size +} +func (m *APIVersionsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.APIVersions))) + pos += 4 + // field[1] m.APIVersions + for j1 := 0; j1 < len(m.APIVersions); j1++ { + var v1 ModuleVersion + if j1 < len(m.APIVersions) { + v1 = m.APIVersions[j1] + } + // field[2] v1.Major + o.PutUint32(buf[pos:pos+4], uint32(v1.Major)) + pos += 4 + // field[2] v1.Minor + o.PutUint32(buf[pos:pos+4], uint32(v1.Minor)) + pos += 4 + // field[2] v1.Patch + o.PutUint32(buf[pos:pos+4], uint32(v1.Patch)) + pos += 4 + // field[2] v1.Name + copy(buf[pos:pos+64], v1.Name) + pos += 64 + } + return buf, nil +} +func (m *APIVersionsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.APIVersions + m.APIVersions = make([]ModuleVersion, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.APIVersions[j1].Major + m.APIVersions[j1].Major = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.APIVersions[j1].Minor + m.APIVersions[j1].Minor = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.APIVersions[j1].Patch + m.APIVersions[j1].Patch = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.APIVersions[j1].Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.APIVersions[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + } + return nil +} + +// GetFirstMsgID represents VPP binary API message 'get_first_msg_id'. +type GetFirstMsgID struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (m *GetFirstMsgID) Reset() { *m = GetFirstMsgID{} } +func (*GetFirstMsgID) GetMessageName() string { return "get_first_msg_id" } +func (*GetFirstMsgID) GetCrcString() string { return "ebf79a66" } +func (*GetFirstMsgID) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetFirstMsgID) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Name + size += 64 + return size +} +func (m *GetFirstMsgID) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Name + copy(buf[pos:pos+64], m.Name) + pos += 64 + return buf, nil +} +func (m *GetFirstMsgID) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply'. +type GetFirstMsgIDReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` +} + +func (m *GetFirstMsgIDReply) Reset() { *m = GetFirstMsgIDReply{} } +func (*GetFirstMsgIDReply) GetMessageName() string { return "get_first_msg_id_reply" } +func (*GetFirstMsgIDReply) GetCrcString() string { return "7d337472" } +func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetFirstMsgIDReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.FirstMsgID + size += 2 + return size +} +func (m *GetFirstMsgIDReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.FirstMsgID + o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) + pos += 2 + return buf, nil +} +func (m *GetFirstMsgIDReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FirstMsgID + m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +// MemclntCreate represents VPP binary API message 'memclnt_create'. +type MemclntCreate struct { + CtxQuota int32 `binapi:"i32,name=ctx_quota" json:"ctx_quota,omitempty"` + InputQueue uint64 `binapi:"u64,name=input_queue" json:"input_queue,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` + APIVersions []uint32 `binapi:"u32[8],name=api_versions" json:"api_versions,omitempty" struc:"[8]uint32"` +} + +func (m *MemclntCreate) Reset() { *m = MemclntCreate{} } +func (*MemclntCreate) GetMessageName() string { return "memclnt_create" } +func (*MemclntCreate) GetCrcString() string { return "9c5e1c2f" } +func (*MemclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemclntCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.CtxQuota + size += 4 + // field[1] m.InputQueue + size += 8 + // field[1] m.Name + size += 64 + // field[1] m.APIVersions + size += 32 + return size +} +func (m *MemclntCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.CtxQuota + o.PutUint32(buf[pos:pos+4], uint32(m.CtxQuota)) + pos += 4 + // field[1] m.InputQueue + o.PutUint64(buf[pos:pos+8], uint64(m.InputQueue)) + pos += 8 + // field[1] m.Name + copy(buf[pos:pos+64], m.Name) + pos += 64 + // field[1] m.APIVersions + for i := 0; i < 8; i++ { + var x uint32 + if i < len(m.APIVersions) { + x = uint32(m.APIVersions[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *MemclntCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.CtxQuota + m.CtxQuota = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.InputQueue + m.InputQueue = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + // field[1] m.APIVersions + m.APIVersions = make([]uint32, 8) + for i := 0; i < len(m.APIVersions); i++ { + m.APIVersions[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// MemclntCreateReply represents VPP binary API message 'memclnt_create_reply'. +type MemclntCreateReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + MessageTable uint64 `binapi:"u64,name=message_table" json:"message_table,omitempty"` +} + +func (m *MemclntCreateReply) Reset() { *m = MemclntCreateReply{} } +func (*MemclntCreateReply) GetMessageName() string { return "memclnt_create_reply" } +func (*MemclntCreateReply) GetCrcString() string { return "42ec4560" } +func (*MemclntCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemclntCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + // field[1] m.Handle + size += 8 + // field[1] m.Index + size += 4 + // field[1] m.MessageTable + size += 8 + return size +} +func (m *MemclntCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + // field[1] m.Handle + o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) + pos += 8 + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + // field[1] m.MessageTable + o.PutUint64(buf[pos:pos+8], uint64(m.MessageTable)) + pos += 8 + return buf, nil +} +func (m *MemclntCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Handle + m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MessageTable + m.MessageTable = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// MemclntDelete represents VPP binary API message 'memclnt_delete'. +type MemclntDelete struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` + DoCleanup bool `binapi:"bool,name=do_cleanup" json:"do_cleanup,omitempty"` +} + +func (m *MemclntDelete) Reset() { *m = MemclntDelete{} } +func (*MemclntDelete) GetMessageName() string { return "memclnt_delete" } +func (*MemclntDelete) GetCrcString() string { return "7e1c04e3" } +func (*MemclntDelete) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *MemclntDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Index + size += 4 + // field[1] m.Handle + size += 8 + // field[1] m.DoCleanup + size += 1 + return size +} +func (m *MemclntDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + // field[1] m.Handle + o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) + pos += 8 + // field[1] m.DoCleanup + if m.DoCleanup { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *MemclntDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Handle + m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.DoCleanup + m.DoCleanup = tmp[pos] != 0 + pos += 1 + return nil +} + +// MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply'. +type MemclntDeleteReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` +} + +func (m *MemclntDeleteReply) Reset() { *m = MemclntDeleteReply{} } +func (*MemclntDeleteReply) GetMessageName() string { return "memclnt_delete_reply" } +func (*MemclntDeleteReply) GetCrcString() string { return "3d3b6312" } +func (*MemclntDeleteReply) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *MemclntDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + // field[1] m.Handle + size += 8 + return size +} +func (m *MemclntDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + // field[1] m.Handle + o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) + pos += 8 + return buf, nil +} +func (m *MemclntDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Handle + m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// MemclntKeepalive represents VPP binary API message 'memclnt_keepalive'. +type MemclntKeepalive struct{} + +func (m *MemclntKeepalive) Reset() { *m = MemclntKeepalive{} } +func (*MemclntKeepalive) GetMessageName() string { return "memclnt_keepalive" } +func (*MemclntKeepalive) GetCrcString() string { return "51077d14" } +func (*MemclntKeepalive) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemclntKeepalive) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemclntKeepalive) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MemclntKeepalive) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply'. +type MemclntKeepaliveReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MemclntKeepaliveReply) Reset() { *m = MemclntKeepaliveReply{} } +func (*MemclntKeepaliveReply) GetMessageName() string { return "memclnt_keepalive_reply" } +func (*MemclntKeepaliveReply) GetCrcString() string { return "e8d4e804" } +func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemclntKeepaliveReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MemclntKeepaliveReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MemclntKeepaliveReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout'. +type MemclntReadTimeout struct { + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` +} + +func (m *MemclntReadTimeout) Reset() { *m = MemclntReadTimeout{} } +func (*MemclntReadTimeout) GetMessageName() string { return "memclnt_read_timeout" } +func (*MemclntReadTimeout) GetCrcString() string { return "c3a3a452" } +func (*MemclntReadTimeout) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *MemclntReadTimeout) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Dummy + size += 1 + return size +} +func (m *MemclntReadTimeout) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Dummy + buf[pos] = uint8(m.Dummy) + pos += 1 + return buf, nil +} +func (m *MemclntReadTimeout) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Dummy + m.Dummy = uint8(tmp[pos]) + pos += 1 + return nil +} + +// MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend'. +type MemclntRxThreadSuspend struct { + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` +} + +func (m *MemclntRxThreadSuspend) Reset() { *m = MemclntRxThreadSuspend{} } +func (*MemclntRxThreadSuspend) GetMessageName() string { return "memclnt_rx_thread_suspend" } +func (*MemclntRxThreadSuspend) GetCrcString() string { return "c3a3a452" } +func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *MemclntRxThreadSuspend) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Dummy + size += 1 + return size +} +func (m *MemclntRxThreadSuspend) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Dummy + buf[pos] = uint8(m.Dummy) + pos += 1 + return buf, nil +} +func (m *MemclntRxThreadSuspend) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Dummy + m.Dummy = uint8(tmp[pos]) + pos += 1 + return nil +} + +// RPCCall represents VPP binary API message 'rpc_call'. +type RPCCall struct { + Function uint64 `binapi:"u64,name=function" json:"function,omitempty"` + Multicast uint8 `binapi:"u8,name=multicast" json:"multicast,omitempty"` + NeedBarrierSync uint8 `binapi:"u8,name=need_barrier_sync" json:"need_barrier_sync,omitempty"` + SendReply uint8 `binapi:"u8,name=send_reply" json:"send_reply,omitempty"` + DataLen uint32 `binapi:"u32,name=data_len" json:"data_len,omitempty" struc:"sizeof=Data"` + Data []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"` +} + +func (m *RPCCall) Reset() { *m = RPCCall{} } +func (*RPCCall) GetMessageName() string { return "rpc_call" } +func (*RPCCall) GetCrcString() string { return "7e8a2c95" } +func (*RPCCall) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *RPCCall) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Function + size += 8 + // field[1] m.Multicast + size += 1 + // field[1] m.NeedBarrierSync + size += 1 + // field[1] m.SendReply + size += 1 + // field[1] m.DataLen + size += 4 + // field[1] m.Data + size += 1 * len(m.Data) + return size +} +func (m *RPCCall) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Function + o.PutUint64(buf[pos:pos+8], uint64(m.Function)) + pos += 8 + // field[1] m.Multicast + buf[pos] = uint8(m.Multicast) + pos += 1 + // field[1] m.NeedBarrierSync + buf[pos] = uint8(m.NeedBarrierSync) + pos += 1 + // field[1] m.SendReply + buf[pos] = uint8(m.SendReply) + pos += 1 + // field[1] m.DataLen + o.PutUint32(buf[pos:pos+4], uint32(len(m.Data))) + pos += 4 + // field[1] m.Data + for i := 0; i < len(m.Data); i++ { + var x uint8 + if i < len(m.Data) { + x = uint8(m.Data[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *RPCCall) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Function + m.Function = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.Multicast + m.Multicast = uint8(tmp[pos]) + pos += 1 + // field[1] m.NeedBarrierSync + m.NeedBarrierSync = uint8(tmp[pos]) + pos += 1 + // field[1] m.SendReply + m.SendReply = uint8(tmp[pos]) + pos += 1 + // field[1] m.DataLen + m.DataLen = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Data + m.Data = make([]uint8, m.DataLen) + for i := 0; i < len(m.Data); i++ { + m.Data[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// RPCCallReply represents VPP binary API message 'rpc_call_reply'. +type RPCCallReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *RPCCallReply) Reset() { *m = RPCCallReply{} } +func (*RPCCallReply) GetMessageName() string { return "rpc_call_reply" } +func (*RPCCallReply) GetCrcString() string { return "e8d4e804" } +func (*RPCCallReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *RPCCallReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *RPCCallReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *RPCCallReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// RxThreadExit represents VPP binary API message 'rx_thread_exit'. +type RxThreadExit struct { + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` +} + +func (m *RxThreadExit) Reset() { *m = RxThreadExit{} } +func (*RxThreadExit) GetMessageName() string { return "rx_thread_exit" } +func (*RxThreadExit) GetCrcString() string { return "c3a3a452" } +func (*RxThreadExit) GetMessageType() api.MessageType { return api.OtherMessage } + +func (m *RxThreadExit) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Dummy + size += 1 + return size +} +func (m *RxThreadExit) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Dummy + buf[pos] = uint8(m.Dummy) + pos += 1 + return buf, nil +} +func (m *RxThreadExit) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Dummy + m.Dummy = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SockInitShm represents VPP binary API message 'sock_init_shm'. +type SockInitShm struct { + RequestedSize uint32 `binapi:"u32,name=requested_size" json:"requested_size,omitempty"` + Nitems uint8 `binapi:"u8,name=nitems" json:"nitems,omitempty" struc:"sizeof=Configs"` + Configs []uint64 `binapi:"u64[nitems],name=configs" json:"configs,omitempty"` +} + +func (m *SockInitShm) Reset() { *m = SockInitShm{} } +func (*SockInitShm) GetMessageName() string { return "sock_init_shm" } +func (*SockInitShm) GetCrcString() string { return "51646d92" } +func (*SockInitShm) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SockInitShm) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.RequestedSize + size += 4 + // field[1] m.Nitems + size += 1 + // field[1] m.Configs + size += 8 * len(m.Configs) + return size +} +func (m *SockInitShm) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.RequestedSize + o.PutUint32(buf[pos:pos+4], uint32(m.RequestedSize)) + pos += 4 + // field[1] m.Nitems + buf[pos] = uint8(len(m.Configs)) + pos += 1 + // field[1] m.Configs + for i := 0; i < len(m.Configs); i++ { + var x uint64 + if i < len(m.Configs) { + x = uint64(m.Configs[i]) + } + o.PutUint64(buf[pos:pos+8], uint64(x)) + pos += 8 + } + return buf, nil +} +func (m *SockInitShm) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.RequestedSize + m.RequestedSize = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Nitems + m.Nitems = uint8(tmp[pos]) + pos += 1 + // field[1] m.Configs + m.Configs = make([]uint64, m.Nitems) + for i := 0; i < len(m.Configs); i++ { + m.Configs[i] = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + } + return nil +} + +// SockInitShmReply represents VPP binary API message 'sock_init_shm_reply'. +type SockInitShmReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SockInitShmReply) Reset() { *m = SockInitShmReply{} } +func (*SockInitShmReply) GetMessageName() string { return "sock_init_shm_reply" } +func (*SockInitShmReply) GetCrcString() string { return "e8d4e804" } +func (*SockInitShmReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SockInitShmReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SockInitShmReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SockInitShmReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SockclntCreate represents VPP binary API message 'sockclnt_create'. +type SockclntCreate struct { + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` +} + +func (m *SockclntCreate) Reset() { *m = SockclntCreate{} } +func (*SockclntCreate) GetMessageName() string { return "sockclnt_create" } +func (*SockclntCreate) GetCrcString() string { return "455fb9c4" } +func (*SockclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SockclntCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Name + size += 64 + return size +} +func (m *SockclntCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Name + copy(buf[pos:pos+64], m.Name) + pos += 64 + return buf, nil +} +func (m *SockclntCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'. +type SockclntCreateReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Count uint16 `binapi:"u16,name=count" json:"count,omitempty" struc:"sizeof=MessageTable"` + MessageTable []MessageTableEntry `binapi:"message_table_entry[count],name=message_table" json:"message_table,omitempty"` +} + +func (m *SockclntCreateReply) Reset() { *m = SockclntCreateReply{} } +func (*SockclntCreateReply) GetMessageName() string { return "sockclnt_create_reply" } +func (*SockclntCreateReply) GetCrcString() string { return "35166268" } +func (*SockclntCreateReply) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SockclntCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + // field[1] m.Index + size += 4 + // field[1] m.Count + size += 2 + // field[1] m.MessageTable + for j1 := 0; j1 < len(m.MessageTable); j1++ { + var s1 MessageTableEntry + _ = s1 + if j1 < len(m.MessageTable) { + s1 = m.MessageTable[j1] + } + // field[2] s1.Index + size += 2 + // field[2] s1.Name + size += 64 + } + return size +} +func (m *SockclntCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + // field[1] m.Count + o.PutUint16(buf[pos:pos+2], uint16(len(m.MessageTable))) + pos += 2 + // field[1] m.MessageTable + for j1 := 0; j1 < len(m.MessageTable); j1++ { + var v1 MessageTableEntry + if j1 < len(m.MessageTable) { + v1 = m.MessageTable[j1] + } + // field[2] v1.Index + o.PutUint16(buf[pos:pos+2], uint16(v1.Index)) + pos += 2 + // field[2] v1.Name + copy(buf[pos:pos+64], v1.Name) + pos += 64 + } + return buf, nil +} +func (m *SockclntCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.MessageTable + m.MessageTable = make([]MessageTableEntry, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.MessageTable[j1].Index + m.MessageTable[j1].Index = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.MessageTable[j1].Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.MessageTable[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + } + return nil +} + +// SockclntDelete represents VPP binary API message 'sockclnt_delete'. +type SockclntDelete struct { + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` +} + +func (m *SockclntDelete) Reset() { *m = SockclntDelete{} } +func (*SockclntDelete) GetMessageName() string { return "sockclnt_delete" } +func (*SockclntDelete) GetCrcString() string { return "8ac76db6" } +func (*SockclntDelete) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SockclntDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Index + size += 4 + return size +} +func (m *SockclntDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + return buf, nil +} +func (m *SockclntDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'. +type SockclntDeleteReply struct { + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` +} + +func (m *SockclntDeleteReply) Reset() { *m = SockclntDeleteReply{} } +func (*SockclntDeleteReply) GetMessageName() string { return "sockclnt_delete_reply" } +func (*SockclntDeleteReply) GetCrcString() string { return "8f38b1ee" } +func (*SockclntDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SockclntDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + return size +} +func (m *SockclntDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + return buf, nil +} +func (m *SockclntDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids'. +type TracePluginMsgIds struct { + PluginName string `binapi:"string[128],name=plugin_name" json:"plugin_name,omitempty" struc:"[128]byte"` + FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` + LastMsgID uint16 `binapi:"u16,name=last_msg_id" json:"last_msg_id,omitempty"` +} + +func (m *TracePluginMsgIds) Reset() { *m = TracePluginMsgIds{} } +func (*TracePluginMsgIds) GetMessageName() string { return "trace_plugin_msg_ids" } +func (*TracePluginMsgIds) GetCrcString() string { return "f476d3ce" } +func (*TracePluginMsgIds) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *TracePluginMsgIds) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.PluginName + size += 128 + // field[1] m.FirstMsgID + size += 2 + // field[1] m.LastMsgID + size += 2 + return size +} +func (m *TracePluginMsgIds) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.PluginName + copy(buf[pos:pos+128], m.PluginName) + pos += 128 + // field[1] m.FirstMsgID + o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) + pos += 2 + // field[1] m.LastMsgID + o.PutUint16(buf[pos:pos+2], uint16(m.LastMsgID)) + pos += 2 + return buf, nil +} +func (m *TracePluginMsgIds) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.PluginName + { + nul := bytes.Index(tmp[pos:pos+128], []byte{0x00}) + m.PluginName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 128 + } + // field[1] m.FirstMsgID + m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.LastMsgID + m.LastMsgID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +func init() { file_memclnt_binapi_init() } +func file_memclnt_binapi_init() { + api.RegisterMessage((*APIVersions)(nil), "memclnt.APIVersions") + api.RegisterMessage((*APIVersionsReply)(nil), "memclnt.APIVersionsReply") + api.RegisterMessage((*GetFirstMsgID)(nil), "memclnt.GetFirstMsgID") + api.RegisterMessage((*GetFirstMsgIDReply)(nil), "memclnt.GetFirstMsgIDReply") + api.RegisterMessage((*MemclntCreate)(nil), "memclnt.MemclntCreate") + api.RegisterMessage((*MemclntCreateReply)(nil), "memclnt.MemclntCreateReply") + api.RegisterMessage((*MemclntDelete)(nil), "memclnt.MemclntDelete") + api.RegisterMessage((*MemclntDeleteReply)(nil), "memclnt.MemclntDeleteReply") + api.RegisterMessage((*MemclntKeepalive)(nil), "memclnt.MemclntKeepalive") + api.RegisterMessage((*MemclntKeepaliveReply)(nil), "memclnt.MemclntKeepaliveReply") + api.RegisterMessage((*MemclntReadTimeout)(nil), "memclnt.MemclntReadTimeout") + api.RegisterMessage((*MemclntRxThreadSuspend)(nil), "memclnt.MemclntRxThreadSuspend") + api.RegisterMessage((*RPCCall)(nil), "memclnt.RPCCall") + api.RegisterMessage((*RPCCallReply)(nil), "memclnt.RPCCallReply") + api.RegisterMessage((*RxThreadExit)(nil), "memclnt.RxThreadExit") + api.RegisterMessage((*SockInitShm)(nil), "memclnt.SockInitShm") + api.RegisterMessage((*SockInitShmReply)(nil), "memclnt.SockInitShmReply") + api.RegisterMessage((*SockclntCreate)(nil), "memclnt.SockclntCreate") + api.RegisterMessage((*SockclntCreateReply)(nil), "memclnt.SockclntCreateReply") + api.RegisterMessage((*SockclntDelete)(nil), "memclnt.SockclntDelete") + api.RegisterMessage((*SockclntDeleteReply)(nil), "memclnt.SockclntDeleteReply") + api.RegisterMessage((*TracePluginMsgIds)(nil), "memclnt.TracePluginMsgIds") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*APIVersions)(nil), + (*APIVersionsReply)(nil), + (*GetFirstMsgID)(nil), + (*GetFirstMsgIDReply)(nil), + (*MemclntCreate)(nil), + (*MemclntCreateReply)(nil), + (*MemclntDelete)(nil), + (*MemclntDeleteReply)(nil), + (*MemclntKeepalive)(nil), + (*MemclntKeepaliveReply)(nil), + (*MemclntReadTimeout)(nil), + (*MemclntRxThreadSuspend)(nil), + (*RPCCall)(nil), + (*RPCCallReply)(nil), + (*RxThreadExit)(nil), + (*SockInitShm)(nil), + (*SockInitShmReply)(nil), + (*SockclntCreate)(nil), + (*SockclntCreateReply)(nil), + (*SockclntDelete)(nil), + (*SockclntDeleteReply)(nil), + (*TracePluginMsgIds)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/internal/testbinapi/binapi2001/memclnt/memclnt_rpc.ba.go b/internal/testbinapi/binapi2001/memclnt/memclnt_rpc.ba.go new file mode 100644 index 0000000..05dfc28 --- /dev/null +++ b/internal/testbinapi/binapi2001/memclnt/memclnt_rpc.ba.go @@ -0,0 +1,141 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memclnt + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for memclnt module. +type RPCService interface { + APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) + GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) + MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) + MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) + MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) + MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error + MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error + RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) + RxThreadExit(ctx context.Context, in *RxThreadExit) error + SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) + SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) + SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) + TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { + out := new(APIVersionsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { + out := new(GetFirstMsgIDReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { + out := new(MemclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { + out := new(MemclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { + out := new(MemclntKeepaliveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { + out := new(RPCCallReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { + out := new(SockInitShmReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { + out := new(SockclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { + out := new(SockclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { + c.ch.SendRequest(in) + return nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/internal/testbinapi/binapi2001/memif/memif.ba.go b/internal/testbinapi/binapi2001/memif/memif.ba.go new file mode 100644 index 0000000..4964117 --- /dev/null +++ b/internal/testbinapi/binapi2001/memif/memif.ba.go @@ -0,0 +1,1052 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/plugins/memif.api.json + +/* +Package memif contains generated code for VPP binary API defined by memif.api (version 3.0.0). + +It consists of: + 2 aliases + 8 enums + 10 messages +*/ +package memif + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "memif" + // APIVersion is the API version of this module. + APIVersion = "3.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x88dc56c9 +) + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MemifMode represents VPP binary API enum 'memif_mode'. +type MemifMode uint32 + +const ( + MEMIF_MODE_API_ETHERNET MemifMode = 0 + MEMIF_MODE_API_IP MemifMode = 1 + MEMIF_MODE_API_PUNT_INJECT MemifMode = 2 +) + +var ( + MemifMode_name = map[uint32]string{ + 0: "MEMIF_MODE_API_ETHERNET", + 1: "MEMIF_MODE_API_IP", + 2: "MEMIF_MODE_API_PUNT_INJECT", + } + MemifMode_value = map[string]uint32{ + "MEMIF_MODE_API_ETHERNET": 0, + "MEMIF_MODE_API_IP": 1, + "MEMIF_MODE_API_PUNT_INJECT": 2, + } +) + +func (x MemifMode) String() string { + s, ok := MemifMode_name[uint32(x)] + if ok { + return s + } + return "MemifMode(" + strconv.Itoa(int(x)) + ")" +} + +// MemifRole represents VPP binary API enum 'memif_role'. +type MemifRole uint32 + +const ( + MEMIF_ROLE_API_MASTER MemifRole = 0 + MEMIF_ROLE_API_SLAVE MemifRole = 1 +) + +var ( + MemifRole_name = map[uint32]string{ + 0: "MEMIF_ROLE_API_MASTER", + 1: "MEMIF_ROLE_API_SLAVE", + } + MemifRole_value = map[string]uint32{ + "MEMIF_ROLE_API_MASTER": 0, + "MEMIF_ROLE_API_SLAVE": 1, + } +) + +func (x MemifRole) String() string { + s, ok := MemifRole_name[uint32(x)] + if ok { + return s + } + return "MemifRole(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +// MemifCreate represents VPP binary API message 'memif_create'. +type MemifCreate struct { + Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` + Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` + RxQueues uint8 `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"` + TxQueues uint8 `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` + BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` + NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"` + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + Secret string `binapi:"string[24],name=secret" json:"secret,omitempty" struc:"[24]byte"` +} + +func (m *MemifCreate) Reset() { *m = MemifCreate{} } +func (*MemifCreate) GetMessageName() string { return "memif_create" } +func (*MemifCreate) GetCrcString() string { return "b1b25061" } +func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Role + size += 4 + // field[1] m.Mode + size += 4 + // field[1] m.RxQueues + size += 1 + // field[1] m.TxQueues + size += 1 + // field[1] m.ID + size += 4 + // field[1] m.SocketID + size += 4 + // field[1] m.RingSize + size += 4 + // field[1] m.BufferSize + size += 2 + // field[1] m.NoZeroCopy + size += 1 + // field[1] m.HwAddr + size += 6 + // field[1] m.Secret + size += 24 + return size +} +func (m *MemifCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Role + o.PutUint32(buf[pos:pos+4], uint32(m.Role)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + // field[1] m.RxQueues + buf[pos] = uint8(m.RxQueues) + pos += 1 + // field[1] m.TxQueues + buf[pos] = uint8(m.TxQueues) + pos += 1 + // field[1] m.ID + o.PutUint32(buf[pos:pos+4], uint32(m.ID)) + pos += 4 + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.RingSize + o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) + pos += 4 + // field[1] m.BufferSize + o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) + pos += 2 + // field[1] m.NoZeroCopy + if m.NoZeroCopy { + buf[pos] = 1 + } + pos += 1 + // field[1] m.HwAddr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.HwAddr) { + x = uint8(m.HwAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Secret + copy(buf[pos:pos+24], m.Secret) + pos += 24 + return buf, nil +} +func (m *MemifCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Role + m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.RxQueues + m.RxQueues = uint8(tmp[pos]) + pos += 1 + // field[1] m.TxQueues + m.TxQueues = uint8(tmp[pos]) + pos += 1 + // field[1] m.ID + m.ID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.RingSize + m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.BufferSize + m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.NoZeroCopy + m.NoZeroCopy = tmp[pos] != 0 + pos += 1 + // field[1] m.HwAddr + for i := 0; i < len(m.HwAddr); i++ { + m.HwAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Secret + { + nul := bytes.Index(tmp[pos:pos+24], []byte{0x00}) + m.Secret = codec.DecodeString(tmp[pos : pos+nul]) + pos += 24 + } + return nil +} + +// MemifCreateReply represents VPP binary API message 'memif_create_reply'. +type MemifCreateReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} } +func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" } +func (*MemifCreateReply) GetCrcString() string { return "5383d31f" } +func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *MemifCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemifDelete represents VPP binary API message 'memif_delete'. +type MemifDelete struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *MemifDelete) Reset() { *m = MemifDelete{} } +func (*MemifDelete) GetMessageName() string { return "memif_delete" } +func (*MemifDelete) GetCrcString() string { return "f9e6675e" } +func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *MemifDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *MemifDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemifDeleteReply represents VPP binary API message 'memif_delete_reply'. +type MemifDeleteReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} } +func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" } +func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" } +func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MemifDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemifDetails represents VPP binary API message 'memif_details'. +type MemifDetails struct { + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` + Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` + ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` + BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"` +} + +func (m *MemifDetails) Reset() { *m = MemifDetails{} } +func (*MemifDetails) GetMessageName() string { return "memif_details" } +func (*MemifDetails) GetCrcString() string { return "d0382c4c" } +func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.HwAddr + size += 6 + // field[1] m.ID + size += 4 + // field[1] m.Role + size += 4 + // field[1] m.Mode + size += 4 + // field[1] m.ZeroCopy + size += 1 + // field[1] m.SocketID + size += 4 + // field[1] m.RingSize + size += 4 + // field[1] m.BufferSize + size += 2 + // field[1] m.Flags + size += 4 + // field[1] m.IfName + size += 64 + return size +} +func (m *MemifDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.HwAddr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.HwAddr) { + x = uint8(m.HwAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.ID + o.PutUint32(buf[pos:pos+4], uint32(m.ID)) + pos += 4 + // field[1] m.Role + o.PutUint32(buf[pos:pos+4], uint32(m.Role)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + // field[1] m.ZeroCopy + if m.ZeroCopy { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.RingSize + o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) + pos += 4 + // field[1] m.BufferSize + o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) + pos += 2 + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + // field[1] m.IfName + copy(buf[pos:pos+64], m.IfName) + pos += 64 + return buf, nil +} +func (m *MemifDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.HwAddr + for i := 0; i < len(m.HwAddr); i++ { + m.HwAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.ID + m.ID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Role + m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ZeroCopy + m.ZeroCopy = tmp[pos] != 0 + pos += 1 + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.RingSize + m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.BufferSize + m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.IfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + +// MemifDump represents VPP binary API message 'memif_dump'. +type MemifDump struct{} + +func (m *MemifDump) Reset() { *m = MemifDump{} } +func (*MemifDump) GetMessageName() string { return "memif_dump" } +func (*MemifDump) GetCrcString() string { return "51077d14" } +func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemifDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MemifDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'. +type MemifSocketFilenameAddDel struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` +} + +func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} } +func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" } +func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" } +func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifSocketFilenameAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SocketID + size += 4 + // field[1] m.SocketFilename + size += 108 + return size +} +func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.SocketFilename + copy(buf[pos:pos+108], m.SocketFilename) + pos += 108 + return buf, nil +} +func (m *MemifSocketFilenameAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SocketFilename + { + nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) + m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) + pos += 108 + } + return nil +} + +// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'. +type MemifSocketFilenameAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} } +func (*MemifSocketFilenameAddDelReply) GetMessageName() string { + return "memif_socket_filename_add_del_reply" +} +func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifSocketFilenameAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MemifSocketFilenameAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'. +type MemifSocketFilenameDetails struct { + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` +} + +func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} } +func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" } +func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" } +func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MemifSocketFilenameDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SocketID + size += 4 + // field[1] m.SocketFilename + size += 108 + return size +} +func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.SocketFilename + copy(buf[pos:pos+108], m.SocketFilename) + pos += 108 + return buf, nil +} +func (m *MemifSocketFilenameDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SocketFilename + { + nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) + m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) + pos += 108 + } + return nil +} + +// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'. +type MemifSocketFilenameDump struct{} + +func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} } +func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" } +func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" } +func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MemifSocketFilenameDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MemifSocketFilenameDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +func init() { file_memif_binapi_init() } +func file_memif_binapi_init() { + api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate") + api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply") + api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete") + api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply") + api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails") + api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump") + api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel") + api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply") + api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails") + api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*MemifCreate)(nil), + (*MemifCreateReply)(nil), + (*MemifDelete)(nil), + (*MemifDeleteReply)(nil), + (*MemifDetails)(nil), + (*MemifDump)(nil), + (*MemifSocketFilenameAddDel)(nil), + (*MemifSocketFilenameAddDelReply)(nil), + (*MemifSocketFilenameDetails)(nil), + (*MemifSocketFilenameDump)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/internal/testbinapi/binapi2001/memif/memif_rpc.ba.go b/internal/testbinapi/binapi2001/memif/memif_rpc.ba.go new file mode 100644 index 0000000..8eda8f1 --- /dev/null +++ b/internal/testbinapi/binapi2001/memif/memif_rpc.ba.go @@ -0,0 +1,111 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memif + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for memif module. +type RPCService interface { + DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) + DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) + MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) + MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) + MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifClient{stream} + return x, nil +} + +type RPCService_DumpMemifClient interface { + Recv() (*MemifDetails, error) +} + +type serviceClient_DumpMemifClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { + m := new(MemifDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifSocketFilenameClient{stream} + return x, nil +} + +type RPCService_DumpMemifSocketFilenameClient interface { + Recv() (*MemifSocketFilenameDetails, error) +} + +type serviceClient_DumpMemifSocketFilenameClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { + m := new(MemifSocketFilenameDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { + out := new(MemifCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { + out := new(MemifDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { + out := new(MemifSocketFilenameAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/internal/testbinapi/binapi2001/sr/sr.ba.go b/internal/testbinapi/binapi2001/sr/sr.ba.go new file mode 100644 index 0000000..b0e423b --- /dev/null +++ b/internal/testbinapi/binapi2001/sr/sr.ba.go @@ -0,0 +1,1716 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/sr.api.json + +/* +Package sr contains generated code for VPP binary API defined by sr.api (version 1.2.0). + +It consists of: + 20 messages + 3 types +*/ +package sr + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "sr" + // APIVersion is the API version of this module. + APIVersion = "1.2.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xbf277f96 +) + +// SrIP6Address represents VPP binary API type 'sr_ip6_address'. +type SrIP6Address struct { + Data []byte `binapi:"u8[16],name=data" json:"data,omitempty" struc:"[16]byte"` +} + +func (*SrIP6Address) GetTypeName() string { return "sr_ip6_address" } + +// Srv6Sid represents VPP binary API type 'srv6_sid'. +type Srv6Sid struct { + Addr []byte `binapi:"u8[16],name=addr" json:"addr,omitempty" struc:"[16]byte"` +} + +func (*Srv6Sid) GetTypeName() string { return "srv6_sid" } + +// Srv6SidList represents VPP binary API type 'srv6_sid_list'. +type Srv6SidList struct { + NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids [16]Srv6Sid `binapi:"srv6_sid[16],name=sids" json:"sids,omitempty" struc:"[16]Srv6Sid"` +} + +func (*Srv6SidList) GetTypeName() string { return "srv6_sid_list" } + +// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. +type SrLocalsidAddDel struct { + IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` + Localsid Srv6Sid `binapi:"srv6_sid,name=localsid" json:"localsid,omitempty"` + EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` + Behavior uint8 `binapi:"u8,name=behavior" json:"behavior,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NhAddr6 []byte `binapi:"u8[16],name=nh_addr6" json:"nh_addr6,omitempty" struc:"[16]byte"` + NhAddr4 []byte `binapi:"u8[4],name=nh_addr4" json:"nh_addr4,omitempty" struc:"[4]byte"` +} + +func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } +func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" } +func (*SrLocalsidAddDel) GetCrcString() string { return "b30489eb" } +func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrLocalsidAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsDel + size += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + size += 16 + // field[1] m.EndPsp + size += 1 + // field[1] m.Behavior + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.VlanIndex + size += 4 + // field[1] m.FibTable + size += 4 + // field[1] m.NhAddr6 + size += 16 + // field[1] m.NhAddr4 + size += 4 + return size +} +func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsDel + buf[pos] = uint8(m.IsDel) + pos += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Localsid.Addr) { + x = uint8(m.Localsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.EndPsp + buf[pos] = uint8(m.EndPsp) + pos += 1 + // field[1] m.Behavior + buf[pos] = uint8(m.Behavior) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.VlanIndex + o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) + pos += 4 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.NhAddr6 + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.NhAddr6) { + x = uint8(m.NhAddr6[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NhAddr4 + for i := 0; i < 4; i++ { + var x uint8 + if i < len(m.NhAddr4) { + x = uint8(m.NhAddr4[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsDel + m.IsDel = uint8(tmp[pos]) + pos += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + m.Localsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Localsid.Addr); i++ { + m.Localsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.EndPsp + m.EndPsp = uint8(tmp[pos]) + pos += 1 + // field[1] m.Behavior + m.Behavior = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanIndex + m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NhAddr6 + m.NhAddr6 = make([]uint8, 16) + for i := 0; i < len(m.NhAddr6); i++ { + m.NhAddr6[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NhAddr4 + m.NhAddr4 = make([]uint8, 4) + for i := 0; i < len(m.NhAddr4); i++ { + m.NhAddr4[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. +type SrLocalsidAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrLocalsidAddDelReply) Reset() { *m = SrLocalsidAddDelReply{} } +func (*SrLocalsidAddDelReply) GetMessageName() string { return "sr_localsid_add_del_reply" } +func (*SrLocalsidAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrLocalsidAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrLocalsidAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrLocalsidAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. +type SrLocalsidsDetails struct { + Addr Srv6Sid `binapi:"srv6_sid,name=addr" json:"addr,omitempty"` + EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` + Behavior uint16 `binapi:"u16,name=behavior" json:"behavior,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + XconnectNhAddr6 []byte `binapi:"u8[16],name=xconnect_nh_addr6" json:"xconnect_nh_addr6,omitempty" struc:"[16]byte"` + XconnectNhAddr4 []byte `binapi:"u8[4],name=xconnect_nh_addr4" json:"xconnect_nh_addr4,omitempty" struc:"[4]byte"` + XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` +} + +func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } +func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" } +func (*SrLocalsidsDetails) GetCrcString() string { return "0791babc" } +func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrLocalsidsDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Addr + // field[2] m.Addr.Addr + size += 16 + // field[1] m.EndPsp + size += 1 + // field[1] m.Behavior + size += 2 + // field[1] m.FibTable + size += 4 + // field[1] m.VlanIndex + size += 4 + // field[1] m.XconnectNhAddr6 + size += 16 + // field[1] m.XconnectNhAddr4 + size += 4 + // field[1] m.XconnectIfaceOrVrfTable + size += 4 + return size +} +func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Addr + // field[2] m.Addr.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Addr.Addr) { + x = uint8(m.Addr.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.EndPsp + buf[pos] = uint8(m.EndPsp) + pos += 1 + // field[1] m.Behavior + o.PutUint16(buf[pos:pos+2], uint16(m.Behavior)) + pos += 2 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.VlanIndex + o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) + pos += 4 + // field[1] m.XconnectNhAddr6 + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.XconnectNhAddr6) { + x = uint8(m.XconnectNhAddr6[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.XconnectNhAddr4 + for i := 0; i < 4; i++ { + var x uint8 + if i < len(m.XconnectNhAddr4) { + x = uint8(m.XconnectNhAddr4[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.XconnectIfaceOrVrfTable + o.PutUint32(buf[pos:pos+4], uint32(m.XconnectIfaceOrVrfTable)) + pos += 4 + return buf, nil +} +func (m *SrLocalsidsDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Addr + // field[2] m.Addr.Addr + m.Addr.Addr = make([]uint8, 16) + for i := 0; i < len(m.Addr.Addr); i++ { + m.Addr.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.EndPsp + m.EndPsp = uint8(tmp[pos]) + pos += 1 + // field[1] m.Behavior + m.Behavior = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanIndex + m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.XconnectNhAddr6 + m.XconnectNhAddr6 = make([]uint8, 16) + for i := 0; i < len(m.XconnectNhAddr6); i++ { + m.XconnectNhAddr6[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.XconnectNhAddr4 + m.XconnectNhAddr4 = make([]uint8, 4) + for i := 0; i < len(m.XconnectNhAddr4); i++ { + m.XconnectNhAddr4[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.XconnectIfaceOrVrfTable + m.XconnectIfaceOrVrfTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. +type SrLocalsidsDump struct{} + +func (m *SrLocalsidsDump) Reset() { *m = SrLocalsidsDump{} } +func (*SrLocalsidsDump) GetMessageName() string { return "sr_localsids_dump" } +func (*SrLocalsidsDump) GetCrcString() string { return "51077d14" } +func (*SrLocalsidsDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrLocalsidsDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrLocalsidsDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrLocalsidsDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. +type SrPoliciesDetails struct { + Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` + Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"num_sid_lists,omitempty" struc:"sizeof=SidLists"` + SidLists []Srv6SidList `binapi:"srv6_sid_list[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"` +} + +func (m *SrPoliciesDetails) Reset() { *m = SrPoliciesDetails{} } +func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" } +func (*SrPoliciesDetails) GetCrcString() string { return "5087f460" } +func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPoliciesDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Bsid + // field[2] m.Bsid.Addr + size += 16 + // field[1] m.Type + size += 1 + // field[1] m.IsEncap + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.NumSidLists + size += 1 + // field[1] m.SidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var s1 Srv6SidList + _ = s1 + if j1 < len(m.SidLists) { + s1 = m.SidLists[j1] + } + // field[2] s1.NumSids + size += 1 + // field[2] s1.Weight + size += 4 + // field[2] s1.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(s1.Sids) { + s2 = s1.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + } + return size +} +func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Bsid + // field[2] m.Bsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Bsid.Addr) { + x = uint8(m.Bsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Type + buf[pos] = uint8(m.Type) + pos += 1 + // field[1] m.IsEncap + buf[pos] = uint8(m.IsEncap) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.NumSidLists + buf[pos] = uint8(len(m.SidLists)) + pos += 1 + // field[1] m.SidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var v1 Srv6SidList + if j1 < len(m.SidLists) { + v1 = m.SidLists[j1] + } + // field[2] v1.NumSids + buf[pos] = uint8(v1.NumSids) + pos += 1 + // field[2] v1.Weight + o.PutUint32(buf[pos:pos+4], uint32(v1.Weight)) + pos += 4 + // field[2] v1.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(v1.Sids) { + v2 = v1.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + } + return buf, nil +} +func (m *SrPoliciesDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Bsid + // field[2] m.Bsid.Addr + m.Bsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Bsid.Addr); i++ { + m.Bsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Type + m.Type = uint8(tmp[pos]) + pos += 1 + // field[1] m.IsEncap + m.IsEncap = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NumSidLists + m.NumSidLists = uint8(tmp[pos]) + pos += 1 + // field[1] m.SidLists + m.SidLists = make([]Srv6SidList, int(m.NumSidLists)) + for j1 := 0; j1 < int(m.NumSidLists); j1++ { + // field[2] m.SidLists[j1].NumSids + m.SidLists[j1].NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.SidLists[j1].Weight + m.SidLists[j1].Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.SidLists[j1].Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.SidLists[j1].Sids[j2].Addr + m.SidLists[j1].Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.SidLists[j1].Sids[j2].Addr); i++ { + m.SidLists[j1].Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + } + return nil +} + +// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. +type SrPoliciesDump struct{} + +func (m *SrPoliciesDump) Reset() { *m = SrPoliciesDump{} } +func (*SrPoliciesDump) GetMessageName() string { return "sr_policies_dump" } +func (*SrPoliciesDump) GetCrcString() string { return "51077d14" } +func (*SrPoliciesDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPoliciesDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrPoliciesDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrPoliciesDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. +type SrPolicyAdd struct { + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` + Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyAdd) Reset() { *m = SrPolicyAdd{} } +func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" } +func (*SrPolicyAdd) GetCrcString() string { return "4b6e2484" } +func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyAdd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + size += 16 + // field[1] m.Weight + size += 4 + // field[1] m.IsEncap + size += 1 + // field[1] m.Type + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + size += 1 + // field[2] m.Sids.Weight + size += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + return size +} +func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) + pos += 4 + // field[1] m.IsEncap + buf[pos] = uint8(m.IsEncap) + pos += 1 + // field[1] m.Type + buf[pos] = uint8(m.Type) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + buf[pos] = uint8(m.Sids.NumSids) + pos += 1 + // field[2] m.Sids.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(m.Sids.Sids) { + v2 = m.Sids.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + return buf, nil +} +func (m *SrPolicyAdd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Weight + m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsEncap + m.IsEncap = uint8(tmp[pos]) + pos += 1 + // field[1] m.Type + m.Type = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + m.Sids.NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.Sids.Weight + m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.Sids.Sids[j2].Addr + m.Sids.Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { + m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. +type SrPolicyAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyAddReply) Reset() { *m = SrPolicyAddReply{} } +func (*SrPolicyAddReply) GetMessageName() string { return "sr_policy_add_reply" } +func (*SrPolicyAddReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyAddReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyAddReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyAddReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyDel represents VPP binary API message 'sr_policy_del'. +type SrPolicyDel struct { + BsidAddr Srv6Sid `binapi:"srv6_sid,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` +} + +func (m *SrPolicyDel) Reset() { *m = SrPolicyDel{} } +func (*SrPolicyDel) GetMessageName() string { return "sr_policy_del" } +func (*SrPolicyDel) GetCrcString() string { return "e4133171" } +func (*SrPolicyDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + return size +} +func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr.Addr) { + x = uint8(m.BsidAddr.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + return buf, nil +} +func (m *SrPolicyDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + m.BsidAddr.Addr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr.Addr); i++ { + m.BsidAddr.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. +type SrPolicyDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyDelReply) Reset() { *m = SrPolicyDelReply{} } +func (*SrPolicyDelReply) GetMessageName() string { return "sr_policy_del_reply" } +func (*SrPolicyDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. +type SrPolicyMod struct { + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Operation uint8 `binapi:"u8,name=operation" json:"operation,omitempty"` + SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyMod) Reset() { *m = SrPolicyMod{} } +func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" } +func (*SrPolicyMod) GetCrcString() string { return "c1dfaee0" } +func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyMod) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + // field[1] m.FibTable + size += 4 + // field[1] m.Operation + size += 1 + // field[1] m.SlIndex + size += 4 + // field[1] m.Weight + size += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + size += 1 + // field[2] m.Sids.Weight + size += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + return size +} +func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.Operation + buf[pos] = uint8(m.Operation) + pos += 1 + // field[1] m.SlIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SlIndex)) + pos += 4 + // field[1] m.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + buf[pos] = uint8(m.Sids.NumSids) + pos += 1 + // field[2] m.Sids.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(m.Sids.Sids) { + v2 = m.Sids.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + return buf, nil +} +func (m *SrPolicyMod) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Operation + m.Operation = uint8(tmp[pos]) + pos += 1 + // field[1] m.SlIndex + m.SlIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Weight + m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + m.Sids.NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.Sids.Weight + m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.Sids.Sids[j2].Addr + m.Sids.Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { + m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. +type SrPolicyModReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyModReply) Reset() { *m = SrPolicyModReply{} } +func (*SrPolicyModReply) GetMessageName() string { return "sr_policy_mod_reply" } +func (*SrPolicyModReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyModReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyModReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyModReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyModReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSetEncapHopLimit represents VPP binary API message 'sr_set_encap_hop_limit'. +type SrSetEncapHopLimit struct { + HopLimit uint8 `binapi:"u8,name=hop_limit" json:"hop_limit,omitempty"` +} + +func (m *SrSetEncapHopLimit) Reset() { *m = SrSetEncapHopLimit{} } +func (*SrSetEncapHopLimit) GetMessageName() string { return "sr_set_encap_hop_limit" } +func (*SrSetEncapHopLimit) GetCrcString() string { return "aa75d7d0" } +func (*SrSetEncapHopLimit) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSetEncapHopLimit) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HopLimit + size += 1 + return size +} +func (m *SrSetEncapHopLimit) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HopLimit + buf[pos] = uint8(m.HopLimit) + pos += 1 + return buf, nil +} +func (m *SrSetEncapHopLimit) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HopLimit + m.HopLimit = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SrSetEncapHopLimitReply represents VPP binary API message 'sr_set_encap_hop_limit_reply'. +type SrSetEncapHopLimitReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapHopLimitReply) Reset() { *m = SrSetEncapHopLimitReply{} } +func (*SrSetEncapHopLimitReply) GetMessageName() string { return "sr_set_encap_hop_limit_reply" } +func (*SrSetEncapHopLimitReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapHopLimitReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSetEncapHopLimitReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSetEncapHopLimitReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSetEncapHopLimitReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. +type SrSetEncapSource struct { + EncapsSource []byte `binapi:"u8[16],name=encaps_source" json:"encaps_source,omitempty" struc:"[16]byte"` +} + +func (m *SrSetEncapSource) Reset() { *m = SrSetEncapSource{} } +func (*SrSetEncapSource) GetMessageName() string { return "sr_set_encap_source" } +func (*SrSetEncapSource) GetCrcString() string { return "d05bb4de" } +func (*SrSetEncapSource) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSetEncapSource) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.EncapsSource + size += 16 + return size +} +func (m *SrSetEncapSource) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.EncapsSource + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.EncapsSource) { + x = uint8(m.EncapsSource[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrSetEncapSource) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.EncapsSource + m.EncapsSource = make([]uint8, 16) + for i := 0; i < len(m.EncapsSource); i++ { + m.EncapsSource[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. +type SrSetEncapSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapSourceReply) Reset() { *m = SrSetEncapSourceReply{} } +func (*SrSetEncapSourceReply) GetMessageName() string { return "sr_set_encap_source_reply" } +func (*SrSetEncapSourceReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSetEncapSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSetEncapSourceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSetEncapSourceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. +type SrSteeringAddDel struct { + IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` + MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` +} + +func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } +func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" } +func (*SrSteeringAddDel) GetCrcString() string { return "28b5dcab" } +func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSteeringAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsDel + size += 1 + // field[1] m.BsidAddr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + // field[1] m.TableID + size += 4 + // field[1] m.PrefixAddr + size += 16 + // field[1] m.MaskWidth + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TrafficType + size += 1 + return size +} +func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsDel + buf[pos] = uint8(m.IsDel) + pos += 1 + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + // field[1] m.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) + pos += 4 + // field[1] m.PrefixAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.PrefixAddr) { + x = uint8(m.PrefixAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.MaskWidth + o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TrafficType + buf[pos] = uint8(m.TrafficType) + pos += 1 + return buf, nil +} +func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsDel + m.IsDel = uint8(tmp[pos]) + pos += 1 + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TableID + m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PrefixAddr + m.PrefixAddr = make([]uint8, 16) + for i := 0; i < len(m.PrefixAddr); i++ { + m.PrefixAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.MaskWidth + m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TrafficType + m.TrafficType = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. +type SrSteeringAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSteeringAddDelReply) Reset() { *m = SrSteeringAddDelReply{} } +func (*SrSteeringAddDelReply) GetMessageName() string { return "sr_steering_add_del_reply" } +func (*SrSteeringAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSteeringAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSteeringAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSteeringAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. +type SrSteeringPolDetails struct { + TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` + MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` +} + +func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } +func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" } +func (*SrSteeringPolDetails) GetCrcString() string { return "5627d483" } +func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSteeringPolDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.TrafficType + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.PrefixAddr + size += 16 + // field[1] m.MaskWidth + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + size += 16 + return size +} +func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.TrafficType + buf[pos] = uint8(m.TrafficType) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.PrefixAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.PrefixAddr) { + x = uint8(m.PrefixAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.MaskWidth + o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Bsid.Addr) { + x = uint8(m.Bsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrSteeringPolDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.TrafficType + m.TrafficType = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PrefixAddr + m.PrefixAddr = make([]uint8, 16) + for i := 0; i < len(m.PrefixAddr); i++ { + m.PrefixAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.MaskWidth + m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + m.Bsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Bsid.Addr); i++ { + m.Bsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. +type SrSteeringPolDump struct{} + +func (m *SrSteeringPolDump) Reset() { *m = SrSteeringPolDump{} } +func (*SrSteeringPolDump) GetMessageName() string { return "sr_steering_pol_dump" } +func (*SrSteeringPolDump) GetCrcString() string { return "51077d14" } +func (*SrSteeringPolDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSteeringPolDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrSteeringPolDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrSteeringPolDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +func init() { file_sr_binapi_init() } +func file_sr_binapi_init() { + api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr.SrLocalsidAddDel") + api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr.SrLocalsidAddDelReply") + api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr.SrLocalsidsDetails") + api.RegisterMessage((*SrLocalsidsDump)(nil), "sr.SrLocalsidsDump") + api.RegisterMessage((*SrPoliciesDetails)(nil), "sr.SrPoliciesDetails") + api.RegisterMessage((*SrPoliciesDump)(nil), "sr.SrPoliciesDump") + api.RegisterMessage((*SrPolicyAdd)(nil), "sr.SrPolicyAdd") + api.RegisterMessage((*SrPolicyAddReply)(nil), "sr.SrPolicyAddReply") + api.RegisterMessage((*SrPolicyDel)(nil), "sr.SrPolicyDel") + api.RegisterMessage((*SrPolicyDelReply)(nil), "sr.SrPolicyDelReply") + api.RegisterMessage((*SrPolicyMod)(nil), "sr.SrPolicyMod") + api.RegisterMessage((*SrPolicyModReply)(nil), "sr.SrPolicyModReply") + api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr.SrSetEncapHopLimit") + api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr.SrSetEncapHopLimitReply") + api.RegisterMessage((*SrSetEncapSource)(nil), "sr.SrSetEncapSource") + api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr.SrSetEncapSourceReply") + api.RegisterMessage((*SrSteeringAddDel)(nil), "sr.SrSteeringAddDel") + api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr.SrSteeringAddDelReply") + api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr.SrSteeringPolDetails") + api.RegisterMessage((*SrSteeringPolDump)(nil), "sr.SrSteeringPolDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SrLocalsidAddDel)(nil), + (*SrLocalsidAddDelReply)(nil), + (*SrLocalsidsDetails)(nil), + (*SrLocalsidsDump)(nil), + (*SrPoliciesDetails)(nil), + (*SrPoliciesDump)(nil), + (*SrPolicyAdd)(nil), + (*SrPolicyAddReply)(nil), + (*SrPolicyDel)(nil), + (*SrPolicyDelReply)(nil), + (*SrPolicyMod)(nil), + (*SrPolicyModReply)(nil), + (*SrSetEncapHopLimit)(nil), + (*SrSetEncapHopLimitReply)(nil), + (*SrSetEncapSource)(nil), + (*SrSetEncapSourceReply)(nil), + (*SrSteeringAddDel)(nil), + (*SrSteeringAddDelReply)(nil), + (*SrSteeringPolDetails)(nil), + (*SrSteeringPolDump)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/internal/testbinapi/binapi2001/sr/sr_rpc.ba.go b/internal/testbinapi/binapi2001/sr/sr_rpc.ba.go new file mode 100644 index 0000000..aeb3cde --- /dev/null +++ b/internal/testbinapi/binapi2001/sr/sr_rpc.ba.go @@ -0,0 +1,178 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package sr + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for sr module. +type RPCService interface { + DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) + DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) + DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) + SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) + SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) + SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) + SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) + SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) + SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) + SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrLocalsidsClient{stream} + return x, nil +} + +type RPCService_DumpSrLocalsidsClient interface { + Recv() (*SrLocalsidsDetails, error) +} + +type serviceClient_DumpSrLocalsidsClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrLocalsidsClient) Recv() (*SrLocalsidsDetails, error) { + m := new(SrLocalsidsDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrPoliciesClient{stream} + return x, nil +} + +type RPCService_DumpSrPoliciesClient interface { + Recv() (*SrPoliciesDetails, error) +} + +type serviceClient_DumpSrPoliciesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrPoliciesClient) Recv() (*SrPoliciesDetails, error) { + m := new(SrPoliciesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrSteeringPolClient{stream} + return x, nil +} + +type RPCService_DumpSrSteeringPolClient interface { + Recv() (*SrSteeringPolDetails, error) +} + +type serviceClient_DumpSrSteeringPolClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrSteeringPolClient) Recv() (*SrSteeringPolDetails, error) { + m := new(SrSteeringPolDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) { + out := new(SrLocalsidAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) { + out := new(SrPolicyAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { + out := new(SrPolicyDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { + out := new(SrPolicyModReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) { + out := new(SrSetEncapHopLimitReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { + out := new(SrSetEncapSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { + out := new(SrSteeringAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/internal/testbinapi/binapi2001/vpe/vpe.ba.go b/internal/testbinapi/binapi2001/vpe/vpe.ba.go new file mode 100644 index 0000000..e12bca4 --- /dev/null +++ b/internal/testbinapi/binapi2001/vpe/vpe.ba.go @@ -0,0 +1,1701 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/vpe.api.json + +/* +Package vpe contains generated code for VPP binary API defined by vpe.api (version 1.6.0). + +It consists of: + 2 aliases + 1 enum + 26 messages + 2 types +*/ +package vpe + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "vpe" + // APIVersion is the API version of this module. + APIVersion = "1.6.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xc6c0bcf6 +) + +// LogLevel represents VPP binary API enum 'log_level'. +type LogLevel uint32 + +const ( + VPE_API_LOG_LEVEL_EMERG LogLevel = 0 + VPE_API_LOG_LEVEL_ALERT LogLevel = 1 + VPE_API_LOG_LEVEL_CRIT LogLevel = 2 + VPE_API_LOG_LEVEL_ERR LogLevel = 3 + VPE_API_LOG_LEVEL_WARNING LogLevel = 4 + VPE_API_LOG_LEVEL_NOTICE LogLevel = 5 + VPE_API_LOG_LEVEL_INFO LogLevel = 6 + VPE_API_LOG_LEVEL_DEBUG LogLevel = 7 + VPE_API_LOG_LEVEL_DISABLED LogLevel = 8 +) + +var ( + LogLevel_name = map[uint32]string{ + 0: "VPE_API_LOG_LEVEL_EMERG", + 1: "VPE_API_LOG_LEVEL_ALERT", + 2: "VPE_API_LOG_LEVEL_CRIT", + 3: "VPE_API_LOG_LEVEL_ERR", + 4: "VPE_API_LOG_LEVEL_WARNING", + 5: "VPE_API_LOG_LEVEL_NOTICE", + 6: "VPE_API_LOG_LEVEL_INFO", + 7: "VPE_API_LOG_LEVEL_DEBUG", + 8: "VPE_API_LOG_LEVEL_DISABLED", + } + LogLevel_value = map[string]uint32{ + "VPE_API_LOG_LEVEL_EMERG": 0, + "VPE_API_LOG_LEVEL_ALERT": 1, + "VPE_API_LOG_LEVEL_CRIT": 2, + "VPE_API_LOG_LEVEL_ERR": 3, + "VPE_API_LOG_LEVEL_WARNING": 4, + "VPE_API_LOG_LEVEL_NOTICE": 5, + "VPE_API_LOG_LEVEL_INFO": 6, + "VPE_API_LOG_LEVEL_DEBUG": 7, + "VPE_API_LOG_LEVEL_DISABLED": 8, + } +) + +func (x LogLevel) String() string { + s, ok := LogLevel_name[uint32(x)] + if ok { + return s + } + return "LogLevel(" + strconv.Itoa(int(x)) + ")" +} + +// Timedelta represents VPP binary API alias 'timedelta'. +type Timedelta float64 + +// Timestamp represents VPP binary API alias 'timestamp'. +type Timestamp float64 + +// ThreadData represents VPP binary API type 'thread_data'. +type ThreadData struct { + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Name []byte `binapi:"u8[64],name=name" json:"name,omitempty" struc:"[64]byte"` + Type []byte `binapi:"u8[64],name=type" json:"type,omitempty" struc:"[64]byte"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + CPUID uint32 `binapi:"u32,name=cpu_id" json:"cpu_id,omitempty"` + Core uint32 `binapi:"u32,name=core" json:"core,omitempty"` + CPUSocket uint32 `binapi:"u32,name=cpu_socket" json:"cpu_socket,omitempty"` +} + +func (*ThreadData) GetTypeName() string { return "thread_data" } + +// Version represents VPP binary API type 'version'. +type Version struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` + Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` + PreRelease []byte `binapi:"u8[17],name=pre_release" json:"pre_release,omitempty" struc:"[17]byte"` + BuildMetadata []byte `binapi:"u8[17],name=build_metadata" json:"build_metadata,omitempty" struc:"[17]byte"` +} + +func (*Version) GetTypeName() string { return "version" } + +// AddNodeNext represents VPP binary API message 'add_node_next'. +type AddNodeNext struct { + NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` + NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` +} + +func (m *AddNodeNext) Reset() { *m = AddNodeNext{} } +func (*AddNodeNext) GetMessageName() string { return "add_node_next" } +func (*AddNodeNext) GetCrcString() string { return "9ab92f7a" } +func (*AddNodeNext) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *AddNodeNext) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.NodeName + size += 64 + // field[1] m.NextName + size += 64 + return size +} +func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.NodeName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NodeName) { + x = uint8(m.NodeName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NextName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NextName) { + x = uint8(m.NextName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *AddNodeNext) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.NodeName + m.NodeName = make([]uint8, 64) + for i := 0; i < len(m.NodeName); i++ { + m.NodeName[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NextName + m.NextName = make([]uint8, 64) + for i := 0; i < len(m.NextName); i++ { + m.NextName[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// AddNodeNextReply represents VPP binary API message 'add_node_next_reply'. +type AddNodeNextReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` +} + +func (m *AddNodeNextReply) Reset() { *m = AddNodeNextReply{} } +func (*AddNodeNextReply) GetMessageName() string { return "add_node_next_reply" } +func (*AddNodeNextReply) GetCrcString() string { return "2ed75f32" } +func (*AddNodeNextReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *AddNodeNextReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.NextIndex + size += 4 + return size +} +func (m *AddNodeNextReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.NextIndex + o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) + pos += 4 + return buf, nil +} +func (m *AddNodeNextReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NextIndex + m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// Cli represents VPP binary API message 'cli'. +type Cli struct { + CmdInShmem uint64 `binapi:"u64,name=cmd_in_shmem" json:"cmd_in_shmem,omitempty"` +} + +func (m *Cli) Reset() { *m = Cli{} } +func (*Cli) GetMessageName() string { return "cli" } +func (*Cli) GetCrcString() string { return "23bfbfff" } +func (*Cli) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *Cli) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.CmdInShmem + size += 8 + return size +} +func (m *Cli) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.CmdInShmem + o.PutUint64(buf[pos:pos+8], uint64(m.CmdInShmem)) + pos += 8 + return buf, nil +} +func (m *Cli) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.CmdInShmem + m.CmdInShmem = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// CliInband represents VPP binary API message 'cli_inband'. +type CliInband struct { + XXX_CmdLen uint32 `struc:"sizeof=Cmd"` + Cmd string `json:"cmd,omitempty"` +} + +func (m *CliInband) Reset() { *m = CliInband{} } +func (*CliInband) GetMessageName() string { return "cli_inband" } +func (*CliInband) GetCrcString() string { return "f8377302" } +func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *CliInband) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Cmd + size += 4 + len(m.Cmd) + return size +} +func (m *CliInband) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Cmd + o.PutUint32(buf[pos:pos+4], uint32(len(m.Cmd))) + pos += 4 + copy(buf[pos:pos+len(m.Cmd)], m.Cmd[:]) + pos += len(m.Cmd) + return buf, nil +} +func (m *CliInband) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Cmd + { + siz := o.Uint32(tmp[pos : pos+4]) + pos += 4 + m.Cmd = codec.DecodeString(tmp[pos : pos+int(siz)]) + pos += len(m.Cmd) + } + return nil +} + +// CliInbandReply represents VPP binary API message 'cli_inband_reply'. +type CliInbandReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + XXX_ReplyLen uint32 `struc:"sizeof=Reply"` + Reply string `json:"reply,omitempty"` +} + +func (m *CliInbandReply) Reset() { *m = CliInbandReply{} } +func (*CliInbandReply) GetMessageName() string { return "cli_inband_reply" } +func (*CliInbandReply) GetCrcString() string { return "05879051" } +func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CliInbandReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Reply + size += 4 + len(m.Reply) + return size +} +func (m *CliInbandReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Reply + o.PutUint32(buf[pos:pos+4], uint32(len(m.Reply))) + pos += 4 + copy(buf[pos:pos+len(m.Reply)], m.Reply[:]) + pos += len(m.Reply) + return buf, nil +} +func (m *CliInbandReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Reply + { + siz := o.Uint32(tmp[pos : pos+4]) + pos += 4 + m.Reply = codec.DecodeString(tmp[pos : pos+int(siz)]) + pos += len(m.Reply) + } + return nil +} + +// CliReply represents VPP binary API message 'cli_reply'. +type CliReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` +} + +func (m *CliReply) Reset() { *m = CliReply{} } +func (*CliReply) GetMessageName() string { return "cli_reply" } +func (*CliReply) GetCrcString() string { return "06d68297" } +func (*CliReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *CliReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ReplyInShmem + size += 8 + return size +} +func (m *CliReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ReplyInShmem + o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) + pos += 8 + return buf, nil +} +func (m *CliReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ReplyInShmem + m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// ControlPing represents VPP binary API message 'control_ping'. +type ControlPing struct{} + +func (m *ControlPing) Reset() { *m = ControlPing{} } +func (*ControlPing) GetMessageName() string { return "control_ping" } +func (*ControlPing) GetCrcString() string { return "51077d14" } +func (*ControlPing) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ControlPing) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ControlPing) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ControlPingReply represents VPP binary API message 'control_ping_reply'. +type ControlPingReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` +} + +func (m *ControlPingReply) Reset() { *m = ControlPingReply{} } +func (*ControlPingReply) GetMessageName() string { return "control_ping_reply" } +func (*ControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*ControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ClientIndex + size += 4 + // field[1] m.VpePID + size += 4 + return size +} +func (m *ControlPingReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ClientIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) + pos += 4 + // field[1] m.VpePID + o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) + pos += 4 + return buf, nil +} +func (m *ControlPingReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ClientIndex + m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VpePID + m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// GetF64EndianValue represents VPP binary API message 'get_f64_endian_value'. +type GetF64EndianValue struct { + F64One float64 `binapi:"f64,name=f64_one,default=1" json:"f64_one,omitempty"` +} + +func (m *GetF64EndianValue) Reset() { *m = GetF64EndianValue{} } +func (*GetF64EndianValue) GetMessageName() string { return "get_f64_endian_value" } +func (*GetF64EndianValue) GetCrcString() string { return "809fcd44" } +func (*GetF64EndianValue) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetF64EndianValue) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.F64One + size += 8 + return size +} +func (m *GetF64EndianValue) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.F64One + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64One))) + pos += 8 + return buf, nil +} +func (m *GetF64EndianValue) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.F64One + m.F64One = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// GetF64EndianValueReply represents VPP binary API message 'get_f64_endian_value_reply'. +type GetF64EndianValueReply struct { + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64OneResult float64 `binapi:"f64,name=f64_one_result" json:"f64_one_result,omitempty"` +} + +func (m *GetF64EndianValueReply) Reset() { *m = GetF64EndianValueReply{} } +func (*GetF64EndianValueReply) GetMessageName() string { return "get_f64_endian_value_reply" } +func (*GetF64EndianValueReply) GetCrcString() string { return "7e02e404" } +func (*GetF64EndianValueReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetF64EndianValueReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.F64OneResult + size += 8 + return size +} +func (m *GetF64EndianValueReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.F64OneResult + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64OneResult))) + pos += 8 + return buf, nil +} +func (m *GetF64EndianValueReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.F64OneResult + m.F64OneResult = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// GetF64IncrementByOne represents VPP binary API message 'get_f64_increment_by_one'. +type GetF64IncrementByOne struct { + F64Value float64 `binapi:"f64,name=f64_value,default=1" json:"f64_value,omitempty"` +} + +func (m *GetF64IncrementByOne) Reset() { *m = GetF64IncrementByOne{} } +func (*GetF64IncrementByOne) GetMessageName() string { return "get_f64_increment_by_one" } +func (*GetF64IncrementByOne) GetCrcString() string { return "b64f027e" } +func (*GetF64IncrementByOne) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetF64IncrementByOne) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.F64Value + size += 8 + return size +} +func (m *GetF64IncrementByOne) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.F64Value + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) + pos += 8 + return buf, nil +} +func (m *GetF64IncrementByOne) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.F64Value + m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// GetF64IncrementByOneReply represents VPP binary API message 'get_f64_increment_by_one_reply'. +type GetF64IncrementByOneReply struct { + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64Value float64 `binapi:"f64,name=f64_value" json:"f64_value,omitempty"` +} + +func (m *GetF64IncrementByOneReply) Reset() { *m = GetF64IncrementByOneReply{} } +func (*GetF64IncrementByOneReply) GetMessageName() string { return "get_f64_increment_by_one_reply" } +func (*GetF64IncrementByOneReply) GetCrcString() string { return "d25dbaa3" } +func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetF64IncrementByOneReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.F64Value + size += 8 + return size +} +func (m *GetF64IncrementByOneReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.F64Value + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) + pos += 8 + return buf, nil +} +func (m *GetF64IncrementByOneReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.F64Value + m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// GetNextIndex represents VPP binary API message 'get_next_index'. +type GetNextIndex struct { + NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` + NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` +} + +func (m *GetNextIndex) Reset() { *m = GetNextIndex{} } +func (*GetNextIndex) GetMessageName() string { return "get_next_index" } +func (*GetNextIndex) GetCrcString() string { return "9ab92f7a" } +func (*GetNextIndex) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetNextIndex) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.NodeName + size += 64 + // field[1] m.NextName + size += 64 + return size +} +func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.NodeName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NodeName) { + x = uint8(m.NodeName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NextName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NextName) { + x = uint8(m.NextName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *GetNextIndex) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.NodeName + m.NodeName = make([]uint8, 64) + for i := 0; i < len(m.NodeName); i++ { + m.NodeName[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NextName + m.NextName = make([]uint8, 64) + for i := 0; i < len(m.NextName); i++ { + m.NextName[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// GetNextIndexReply represents VPP binary API message 'get_next_index_reply'. +type GetNextIndexReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` +} + +func (m *GetNextIndexReply) Reset() { *m = GetNextIndexReply{} } +func (*GetNextIndexReply) GetMessageName() string { return "get_next_index_reply" } +func (*GetNextIndexReply) GetCrcString() string { return "2ed75f32" } +func (*GetNextIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetNextIndexReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.NextIndex + size += 4 + return size +} +func (m *GetNextIndexReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.NextIndex + o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) + pos += 4 + return buf, nil +} +func (m *GetNextIndexReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NextIndex + m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// GetNodeGraph represents VPP binary API message 'get_node_graph'. +type GetNodeGraph struct{} + +func (m *GetNodeGraph) Reset() { *m = GetNodeGraph{} } +func (*GetNodeGraph) GetMessageName() string { return "get_node_graph" } +func (*GetNodeGraph) GetCrcString() string { return "51077d14" } +func (*GetNodeGraph) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetNodeGraph) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GetNodeGraph) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *GetNodeGraph) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply'. +type GetNodeGraphReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` +} + +func (m *GetNodeGraphReply) Reset() { *m = GetNodeGraphReply{} } +func (*GetNodeGraphReply) GetMessageName() string { return "get_node_graph_reply" } +func (*GetNodeGraphReply) GetCrcString() string { return "06d68297" } +func (*GetNodeGraphReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetNodeGraphReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ReplyInShmem + size += 8 + return size +} +func (m *GetNodeGraphReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ReplyInShmem + o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) + pos += 8 + return buf, nil +} +func (m *GetNodeGraphReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ReplyInShmem + m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + +// GetNodeIndex represents VPP binary API message 'get_node_index'. +type GetNodeIndex struct { + NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` +} + +func (m *GetNodeIndex) Reset() { *m = GetNodeIndex{} } +func (*GetNodeIndex) GetMessageName() string { return "get_node_index" } +func (*GetNodeIndex) GetCrcString() string { return "6c9a495d" } +func (*GetNodeIndex) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *GetNodeIndex) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.NodeName + size += 64 + return size +} +func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.NodeName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NodeName) { + x = uint8(m.NodeName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *GetNodeIndex) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.NodeName + m.NodeName = make([]uint8, 64) + for i := 0; i < len(m.NodeName); i++ { + m.NodeName[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// GetNodeIndexReply represents VPP binary API message 'get_node_index_reply'. +type GetNodeIndexReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NodeIndex uint32 `binapi:"u32,name=node_index" json:"node_index,omitempty"` +} + +func (m *GetNodeIndexReply) Reset() { *m = GetNodeIndexReply{} } +func (*GetNodeIndexReply) GetMessageName() string { return "get_node_index_reply" } +func (*GetNodeIndexReply) GetCrcString() string { return "a8600b89" } +func (*GetNodeIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *GetNodeIndexReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.NodeIndex + size += 4 + return size +} +func (m *GetNodeIndexReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.NodeIndex + o.PutUint32(buf[pos:pos+4], uint32(m.NodeIndex)) + pos += 4 + return buf, nil +} +func (m *GetNodeIndexReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NodeIndex + m.NodeIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// LogDetails represents VPP binary API message 'log_details'. +type LogDetails struct { + Timestamp Timestamp `binapi:"timestamp,name=timestamp" json:"timestamp,omitempty"` + Level LogLevel `binapi:"log_level,name=level" json:"level,omitempty"` + MsgClass string `binapi:"string[32],name=msg_class" json:"msg_class,omitempty" struc:"[32]byte"` + Message string `binapi:"string[256],name=message" json:"message,omitempty" struc:"[256]byte"` +} + +func (m *LogDetails) Reset() { *m = LogDetails{} } +func (*LogDetails) GetMessageName() string { return "log_details" } +func (*LogDetails) GetCrcString() string { return "255827a1" } +func (*LogDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *LogDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Timestamp + size += 8 + // field[1] m.Level + size += 4 + // field[1] m.MsgClass + size += 32 + // field[1] m.Message + size += 256 + return size +} +func (m *LogDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Timestamp + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.Timestamp))) + pos += 8 + // field[1] m.Level + o.PutUint32(buf[pos:pos+4], uint32(m.Level)) + pos += 4 + // field[1] m.MsgClass + copy(buf[pos:pos+32], m.MsgClass) + pos += 32 + // field[1] m.Message + copy(buf[pos:pos+256], m.Message) + pos += 256 + return buf, nil +} +func (m *LogDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Timestamp + m.Timestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + // field[1] m.Level + m.Level = LogLevel(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MsgClass + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.MsgClass = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.Message + { + nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) + m.Message = codec.DecodeString(tmp[pos : pos+nul]) + pos += 256 + } + return nil +} + +// LogDump represents VPP binary API message 'log_dump'. +type LogDump struct { + StartTimestamp Timestamp `binapi:"timestamp,name=start_timestamp" json:"start_timestamp,omitempty"` +} + +func (m *LogDump) Reset() { *m = LogDump{} } +func (*LogDump) GetMessageName() string { return "log_dump" } +func (*LogDump) GetCrcString() string { return "6ab31753" } +func (*LogDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *LogDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.StartTimestamp + size += 8 + return size +} +func (m *LogDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.StartTimestamp + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.StartTimestamp))) + pos += 8 + return buf, nil +} +func (m *LogDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.StartTimestamp + m.StartTimestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +// ShowThreads represents VPP binary API message 'show_threads'. +type ShowThreads struct{} + +func (m *ShowThreads) Reset() { *m = ShowThreads{} } +func (*ShowThreads) GetMessageName() string { return "show_threads" } +func (*ShowThreads) GetCrcString() string { return "51077d14" } +func (*ShowThreads) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ShowThreads) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowThreads) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ShowThreads) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ShowThreadsReply represents VPP binary API message 'show_threads_reply'. +type ShowThreadsReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=ThreadData"` + ThreadData []ThreadData `binapi:"thread_data[count],name=thread_data" json:"thread_data,omitempty"` +} + +func (m *ShowThreadsReply) Reset() { *m = ShowThreadsReply{} } +func (*ShowThreadsReply) GetMessageName() string { return "show_threads_reply" } +func (*ShowThreadsReply) GetCrcString() string { return "f5e0b66f" } +func (*ShowThreadsReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ShowThreadsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Count + size += 4 + // field[1] m.ThreadData + for j1 := 0; j1 < len(m.ThreadData); j1++ { + var s1 ThreadData + _ = s1 + if j1 < len(m.ThreadData) { + s1 = m.ThreadData[j1] + } + // field[2] s1.ID + size += 4 + // field[2] s1.Name + size += 64 + // field[2] s1.Type + size += 64 + // field[2] s1.PID + size += 4 + // field[2] s1.CPUID + size += 4 + // field[2] s1.Core + size += 4 + // field[2] s1.CPUSocket + size += 4 + } + return size +} +func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.ThreadData))) + pos += 4 + // field[1] m.ThreadData + for j1 := 0; j1 < len(m.ThreadData); j1++ { + var v1 ThreadData + if j1 < len(m.ThreadData) { + v1 = m.ThreadData[j1] + } + // field[2] v1.ID + o.PutUint32(buf[pos:pos+4], uint32(v1.ID)) + pos += 4 + // field[2] v1.Name + for i := 0; i < 64; i++ { + var x uint8 + if i < len(v1.Name) { + x = uint8(v1.Name[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.Type + for i := 0; i < 64; i++ { + var x uint8 + if i < len(v1.Type) { + x = uint8(v1.Type[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.PID + o.PutUint32(buf[pos:pos+4], uint32(v1.PID)) + pos += 4 + // field[2] v1.CPUID + o.PutUint32(buf[pos:pos+4], uint32(v1.CPUID)) + pos += 4 + // field[2] v1.Core + o.PutUint32(buf[pos:pos+4], uint32(v1.Core)) + pos += 4 + // field[2] v1.CPUSocket + o.PutUint32(buf[pos:pos+4], uint32(v1.CPUSocket)) + pos += 4 + } + return buf, nil +} +func (m *ShowThreadsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ThreadData + m.ThreadData = make([]ThreadData, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.ThreadData[j1].ID + m.ThreadData[j1].ID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].Name + m.ThreadData[j1].Name = make([]uint8, 64) + for i := 0; i < len(m.ThreadData[j1].Name); i++ { + m.ThreadData[j1].Name[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.ThreadData[j1].Type + m.ThreadData[j1].Type = make([]uint8, 64) + for i := 0; i < len(m.ThreadData[j1].Type); i++ { + m.ThreadData[j1].Type[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.ThreadData[j1].PID + m.ThreadData[j1].PID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].CPUID + m.ThreadData[j1].CPUID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].Core + m.ThreadData[j1].Core = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].CPUSocket + m.ThreadData[j1].CPUSocket = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + +// ShowVersion represents VPP binary API message 'show_version'. +type ShowVersion struct{} + +func (m *ShowVersion) Reset() { *m = ShowVersion{} } +func (*ShowVersion) GetMessageName() string { return "show_version" } +func (*ShowVersion) GetCrcString() string { return "51077d14" } +func (*ShowVersion) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ShowVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowVersion) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ShowVersion) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ShowVersionReply represents VPP binary API message 'show_version_reply'. +type ShowVersionReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Program string `binapi:"string[32],name=program" json:"program,omitempty" struc:"[32]byte"` + Version string `binapi:"string[32],name=version" json:"version,omitempty" struc:"[32]byte"` + BuildDate string `binapi:"string[32],name=build_date" json:"build_date,omitempty" struc:"[32]byte"` + BuildDirectory string `binapi:"string[256],name=build_directory" json:"build_directory,omitempty" struc:"[256]byte"` +} + +func (m *ShowVersionReply) Reset() { *m = ShowVersionReply{} } +func (*ShowVersionReply) GetMessageName() string { return "show_version_reply" } +func (*ShowVersionReply) GetCrcString() string { return "c919bde1" } +func (*ShowVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ShowVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Program + size += 32 + // field[1] m.Version + size += 32 + // field[1] m.BuildDate + size += 32 + // field[1] m.BuildDirectory + size += 256 + return size +} +func (m *ShowVersionReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Program + copy(buf[pos:pos+32], m.Program) + pos += 32 + // field[1] m.Version + copy(buf[pos:pos+32], m.Version) + pos += 32 + // field[1] m.BuildDate + copy(buf[pos:pos+32], m.BuildDate) + pos += 32 + // field[1] m.BuildDirectory + copy(buf[pos:pos+256], m.BuildDirectory) + pos += 256 + return buf, nil +} +func (m *ShowVersionReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Program + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.Program = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.Version + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.Version = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.BuildDate + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.BuildDate = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.BuildDirectory + { + nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) + m.BuildDirectory = codec.DecodeString(tmp[pos : pos+nul]) + pos += 256 + } + return nil +} + +// ShowVpeSystemTime represents VPP binary API message 'show_vpe_system_time'. +type ShowVpeSystemTime struct{} + +func (m *ShowVpeSystemTime) Reset() { *m = ShowVpeSystemTime{} } +func (*ShowVpeSystemTime) GetMessageName() string { return "show_vpe_system_time" } +func (*ShowVpeSystemTime) GetCrcString() string { return "51077d14" } +func (*ShowVpeSystemTime) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ShowVpeSystemTime) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowVpeSystemTime) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ShowVpeSystemTime) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// ShowVpeSystemTimeReply represents VPP binary API message 'show_vpe_system_time_reply'. +type ShowVpeSystemTimeReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + VpeSystemTime Timestamp `binapi:"timestamp,name=vpe_system_time" json:"vpe_system_time,omitempty"` +} + +func (m *ShowVpeSystemTimeReply) Reset() { *m = ShowVpeSystemTimeReply{} } +func (*ShowVpeSystemTimeReply) GetMessageName() string { return "show_vpe_system_time_reply" } +func (*ShowVpeSystemTimeReply) GetCrcString() string { return "7ffd8193" } +func (*ShowVpeSystemTimeReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ShowVpeSystemTimeReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.VpeSystemTime + size += 8 + return size +} +func (m *ShowVpeSystemTimeReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.VpeSystemTime + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.VpeSystemTime))) + pos += 8 + return buf, nil +} +func (m *ShowVpeSystemTimeReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VpeSystemTime + m.VpeSystemTime = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +func init() { file_vpe_binapi_init() } +func file_vpe_binapi_init() { + api.RegisterMessage((*AddNodeNext)(nil), "vpe.AddNodeNext") + api.RegisterMessage((*AddNodeNextReply)(nil), "vpe.AddNodeNextReply") + api.RegisterMessage((*Cli)(nil), "vpe.Cli") + api.RegisterMessage((*CliInband)(nil), "vpe.CliInband") + api.RegisterMessage((*CliInbandReply)(nil), "vpe.CliInbandReply") + api.RegisterMessage((*CliReply)(nil), "vpe.CliReply") + api.RegisterMessage((*ControlPing)(nil), "vpe.ControlPing") + api.RegisterMessage((*ControlPingReply)(nil), "vpe.ControlPingReply") + api.RegisterMessage((*GetF64EndianValue)(nil), "vpe.GetF64EndianValue") + api.RegisterMessage((*GetF64EndianValueReply)(nil), "vpe.GetF64EndianValueReply") + api.RegisterMessage((*GetF64IncrementByOne)(nil), "vpe.GetF64IncrementByOne") + api.RegisterMessage((*GetF64IncrementByOneReply)(nil), "vpe.GetF64IncrementByOneReply") + api.RegisterMessage((*GetNextIndex)(nil), "vpe.GetNextIndex") + api.RegisterMessage((*GetNextIndexReply)(nil), "vpe.GetNextIndexReply") + api.RegisterMessage((*GetNodeGraph)(nil), "vpe.GetNodeGraph") + api.RegisterMessage((*GetNodeGraphReply)(nil), "vpe.GetNodeGraphReply") + api.RegisterMessage((*GetNodeIndex)(nil), "vpe.GetNodeIndex") + api.RegisterMessage((*GetNodeIndexReply)(nil), "vpe.GetNodeIndexReply") + api.RegisterMessage((*LogDetails)(nil), "vpe.LogDetails") + api.RegisterMessage((*LogDump)(nil), "vpe.LogDump") + api.RegisterMessage((*ShowThreads)(nil), "vpe.ShowThreads") + api.RegisterMessage((*ShowThreadsReply)(nil), "vpe.ShowThreadsReply") + api.RegisterMessage((*ShowVersion)(nil), "vpe.ShowVersion") + api.RegisterMessage((*ShowVersionReply)(nil), "vpe.ShowVersionReply") + api.RegisterMessage((*ShowVpeSystemTime)(nil), "vpe.ShowVpeSystemTime") + api.RegisterMessage((*ShowVpeSystemTimeReply)(nil), "vpe.ShowVpeSystemTimeReply") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*AddNodeNext)(nil), + (*AddNodeNextReply)(nil), + (*Cli)(nil), + (*CliInband)(nil), + (*CliInbandReply)(nil), + (*CliReply)(nil), + (*ControlPing)(nil), + (*ControlPingReply)(nil), + (*GetF64EndianValue)(nil), + (*GetF64EndianValueReply)(nil), + (*GetF64IncrementByOne)(nil), + (*GetF64IncrementByOneReply)(nil), + (*GetNextIndex)(nil), + (*GetNextIndexReply)(nil), + (*GetNodeGraph)(nil), + (*GetNodeGraphReply)(nil), + (*GetNodeIndex)(nil), + (*GetNodeIndexReply)(nil), + (*LogDetails)(nil), + (*LogDump)(nil), + (*ShowThreads)(nil), + (*ShowThreadsReply)(nil), + (*ShowVersion)(nil), + (*ShowVersionReply)(nil), + (*ShowVpeSystemTime)(nil), + (*ShowVpeSystemTimeReply)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go b/internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go new file mode 100644 index 0000000..e81fb91 --- /dev/null +++ b/internal/testbinapi/binapi2001/vpe/vpe_rpc.ba.go @@ -0,0 +1,174 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vpe + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for vpe module. +type RPCService interface { + DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) + AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) + Cli(ctx context.Context, in *Cli) (*CliReply, error) + CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) + ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) + GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) + GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) + GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) + GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) + GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) + ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) + ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) + ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpLogClient{stream} + return x, nil +} + +type RPCService_DumpLogClient interface { + Recv() (*LogDetails, error) +} + +type serviceClient_DumpLogClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpLogClient) Recv() (*LogDetails, error) { + m := new(LogDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { + out := new(AddNodeNextReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { + out := new(CliReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { + out := new(CliInbandReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { + out := new(ControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { + out := new(GetF64EndianValueReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { + out := new(GetF64IncrementByOneReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { + out := new(GetNextIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { + out := new(GetNodeGraphReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { + out := new(GetNodeIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { + out := new(ShowThreadsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { + out := new(ShowVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { + out := new(ShowVpeSystemTimeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/internal/version/version.go b/internal/version/version.go new file mode 100644 index 0000000..7148019 --- /dev/null +++ b/internal/version/version.go @@ -0,0 +1,85 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package version keeps track of versioning info for GoVPP. +package version + +import ( + "fmt" + "runtime" + "strconv" + "time" +) + +const ( + Major = 0 + Minor = 4 + Patch = 0 + PreRelease = "dev" +) + +// String formats the version string using semver format. +func String() string { + v := fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch) + if PreRelease != "" { + v += "-" + PreRelease + } + return v +} + +// Following variables should normally be updated via `-ldflags "-X ..."`. +// However, the version string is hard-coded to ensure it is always included +// even with bare go build/install. +var ( + name = "govpp" + version = "v0.4.0-dev" + commit = "unknown" + branch = "HEAD" + buildStamp = "" + buildUser = "" + buildHost = "" + + buildDate time.Time +) + +func init() { + buildstampInt64, _ := strconv.ParseInt(buildStamp, 10, 64) + if buildstampInt64 == 0 { + buildstampInt64 = time.Now().Unix() + } + buildDate = time.Unix(buildstampInt64, 0) +} + +func Version() string { + return version +} + +func Info() string { + return fmt.Sprintf(`%s %s`, name, version) +} + +func Verbose() string { + return fmt.Sprintf(`%s + Version: %s + Branch: %s + Revision: %s + Built by: %s@%s + Build date: %s + Go runtime: %s (%s/%s)`, + name, + version, branch, commit, + buildUser, buildHost, buildDate.Format(time.UnixDate), + runtime.Version(), runtime.GOOS, runtime.GOARCH, + ) +} diff --git a/version/version.go b/version/version.go deleted file mode 100644 index 8bde72c..0000000 --- a/version/version.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2019 Cisco and/or its affiliates. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at: -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package version - -import ( - "fmt" - "runtime" - "strconv" - "time" -) - -// Following variables should normally be updated via `-ldflags "-X ..."`. -// However, the version string is hard-coded to ensure it is always included -// even with bare go build/install. -var ( - name = "govpp" - version = "v0.4.0-dev" - commit = "unknown" - branch = "HEAD" - buildStamp = "" - buildUser = "" - buildHost = "" - - buildDate time.Time -) - -func init() { - buildstampInt64, _ := strconv.ParseInt(buildStamp, 10, 64) - if buildstampInt64 == 0 { - buildstampInt64 = time.Now().Unix() - } - buildDate = time.Unix(buildstampInt64, 0) -} - -func Version() string { - return version -} - -func Info() string { - return fmt.Sprintf(`%s %s`, name, version) -} - -func Verbose() string { - return fmt.Sprintf(`%s - Version: %s - Branch: %s - Revision: %s - Built by: %s@%s - Build date: %s - Go runtime: %s (%s/%s)`, - name, - version, branch, commit, - buildUser, buildHost, buildDate.Format(time.UnixDate), - runtime.Version(), runtime.GOOS, runtime.GOARCH, - ) -} -- cgit 1.2.3-korg