diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2020-07-17 10:36:28 +0200 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2020-07-17 11:43:41 +0200 |
commit | d1f24d37bd447b64e402298bb8eb2479681facf9 (patch) | |
tree | a3fc21ba730a91d8a402c7a5bf9c614e3677c4fc /binapi/tunnel_types | |
parent | 1548c7e12531e3d055567d761c580a1c7ff0ac40 (diff) |
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 <ofabry@cisco.com>
Diffstat (limited to 'binapi/tunnel_types')
-rw-r--r-- | binapi/tunnel_types/tunnel_types.ba.go | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/binapi/tunnel_types/tunnel_types.ba.go b/binapi/tunnel_types/tunnel_types.ba.go new file mode 100644 index 0000000..30cdba8 --- /dev/null +++ b/binapi/tunnel_types/tunnel_types.ba.go @@ -0,0 +1,108 @@ +// 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/tunnel_types.api.json + +// Package tunnel_types contains generated bindings for API file tunnel_types.api. +// +// Contents: +// 2 enums +// +package tunnel_types + +import ( + api "git.fd.io/govpp.git/api" + "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 + +// TunnelEncapDecapFlags defines enum 'tunnel_encap_decap_flags'. +type TunnelEncapDecapFlags uint8 + +const ( + TUNNEL_API_ENCAP_DECAP_FLAG_NONE TunnelEncapDecapFlags = 0 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF TunnelEncapDecapFlags = 1 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF TunnelEncapDecapFlags = 2 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP TunnelEncapDecapFlags = 4 + TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN TunnelEncapDecapFlags = 8 + TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN TunnelEncapDecapFlags = 16 +) + +var ( + TunnelEncapDecapFlags_name = map[uint8]string{ + 0: "TUNNEL_API_ENCAP_DECAP_FLAG_NONE", + 1: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF", + 2: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF", + 4: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP", + 8: "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN", + 16: "TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN", + } + TunnelEncapDecapFlags_value = map[string]uint8{ + "TUNNEL_API_ENCAP_DECAP_FLAG_NONE": 0, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DF": 1, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_SET_DF": 2, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP": 4, + "TUNNEL_API_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN": 8, + "TUNNEL_API_ENCAP_DECAP_FLAG_DECAP_COPY_ECN": 16, + } +) + +func (x TunnelEncapDecapFlags) String() string { + s, ok := TunnelEncapDecapFlags_name[uint8(x)] + if ok { + return s + } + str := func(n uint8) string { + s, ok := TunnelEncapDecapFlags_name[uint8(n)] + if ok { + return s + } + return "TunnelEncapDecapFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint8(0); i <= 8; i++ { + val := uint8(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint8(x)) + } + return s +} + +// TunnelMode defines enum 'tunnel_mode'. +type TunnelMode uint8 + +const ( + TUNNEL_API_MODE_P2P TunnelMode = 0 + TUNNEL_API_MODE_MP TunnelMode = 1 +) + +var ( + TunnelMode_name = map[uint8]string{ + 0: "TUNNEL_API_MODE_P2P", + 1: "TUNNEL_API_MODE_MP", + } + TunnelMode_value = map[string]uint8{ + "TUNNEL_API_MODE_P2P": 0, + "TUNNEL_API_MODE_MP": 1, + } +) + +func (x TunnelMode) String() string { + s, ok := TunnelMode_name[uint8(x)] + if ok { + return s + } + return "TunnelMode(" + strconv.Itoa(int(x)) + ")" +} |