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 --- binapi/lisp_types/lisp_types.ba.go | 177 +++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 binapi/lisp_types/lisp_types.ba.go (limited to 'binapi/lisp_types/lisp_types.ba.go') diff --git a/binapi/lisp_types/lisp_types.ba.go b/binapi/lisp_types/lisp_types.ba.go new file mode 100644 index 0000000..6bae4b7 --- /dev/null +++ b/binapi/lisp_types/lisp_types.ba.go @@ -0,0 +1,177 @@ +// 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/lisp_types.api.json + +// Package lisp_types contains generated bindings for API file lisp_types.api. +// +// Contents: +// 2 enums +// 5 structs +// 1 union +// +package lisp_types + +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 + +// EidType defines enum 'eid_type'. +type EidType uint8 + +const ( + EID_TYPE_API_PREFIX EidType = 0 + EID_TYPE_API_MAC EidType = 1 + EID_TYPE_API_NSH EidType = 2 +) + +var ( + EidType_name = map[uint8]string{ + 0: "EID_TYPE_API_PREFIX", + 1: "EID_TYPE_API_MAC", + 2: "EID_TYPE_API_NSH", + } + EidType_value = map[string]uint8{ + "EID_TYPE_API_PREFIX": 0, + "EID_TYPE_API_MAC": 1, + "EID_TYPE_API_NSH": 2, + } +) + +func (x EidType) String() string { + s, ok := EidType_name[uint8(x)] + if ok { + return s + } + return "EidType(" + strconv.Itoa(int(x)) + ")" +} + +// HmacKeyID defines enum 'hmac_key_id'. +type HmacKeyID uint8 + +const ( + KEY_ID_API_HMAC_NO_KEY HmacKeyID = 0 + KEY_ID_API_HMAC_SHA_1_96 HmacKeyID = 1 + KEY_ID_API_HMAC_SHA_256_128 HmacKeyID = 2 +) + +var ( + HmacKeyID_name = map[uint8]string{ + 0: "KEY_ID_API_HMAC_NO_KEY", + 1: "KEY_ID_API_HMAC_SHA_1_96", + 2: "KEY_ID_API_HMAC_SHA_256_128", + } + HmacKeyID_value = map[string]uint8{ + "KEY_ID_API_HMAC_NO_KEY": 0, + "KEY_ID_API_HMAC_SHA_1_96": 1, + "KEY_ID_API_HMAC_SHA_256_128": 2, + } +) + +func (x HmacKeyID) String() string { + s, ok := HmacKeyID_name[uint8(x)] + if ok { + return s + } + return "HmacKeyID(" + strconv.Itoa(int(x)) + ")" +} + +// Eid defines type 'eid'. +type Eid struct { + Type EidType `binapi:"eid_type,name=type" json:"type,omitempty"` + Address EidAddress `binapi:"eid_address,name=address" json:"address,omitempty"` +} + +// HmacKey defines type 'hmac_key'. +type HmacKey struct { + ID HmacKeyID `binapi:"hmac_key_id,name=id" json:"id,omitempty"` + Key []byte `binapi:"u8[64],name=key" json:"key,omitempty"` +} + +// LocalLocator defines type 'local_locator'. +type LocalLocator struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` +} + +// Nsh defines type 'nsh'. +type Nsh struct { + Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"` + Si uint8 `binapi:"u8,name=si" json:"si,omitempty"` +} + +// RemoteLocator defines type 'remote_locator'. +type RemoteLocator struct { + Priority uint8 `binapi:"u8,name=priority" json:"priority,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` + IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"` +} + +// EidAddress defines union 'eid_address'. +type EidAddress struct { + // Prefix *ip_types.Prefix + // Mac *ethernet_types.MacAddress + // Nsh *Nsh + XXX_UnionData [6]byte +} + +func EidAddressPrefix(a ip_types.Prefix) (u EidAddress) { + u.SetPrefix(a) + return +} +func (u *EidAddress) SetPrefix(a ip_types.Prefix) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeUint8(uint8(a.Address.Af)) + buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 0) + buf.EncodeUint8(uint8(a.Len)) +} +func (u *EidAddress) GetPrefix() (a ip_types.Prefix) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + a.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(a.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + a.Len = buf.DecodeUint8() + return +} + +func EidAddressMac(a ethernet_types.MacAddress) (u EidAddress) { + u.SetMac(a) + return +} +func (u *EidAddress) SetMac(a ethernet_types.MacAddress) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeBytes(a[:], 6) +} +func (u *EidAddress) GetMac() (a ethernet_types.MacAddress) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + copy(a[:], buf.DecodeBytes(6)) + return +} + +func EidAddressNsh(a Nsh) (u EidAddress) { + u.SetNsh(a) + return +} +func (u *EidAddress) SetNsh(a Nsh) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + buf.EncodeUint32(uint32(a.Spi)) + buf.EncodeUint8(uint8(a.Si)) +} +func (u *EidAddress) GetNsh() (a Nsh) { + var buf = codec.NewBuffer(u.XXX_UnionData[:]) + a.Spi = buf.DecodeUint32() + a.Si = buf.DecodeUint8() + return +} -- cgit 1.2.3-korg