summaryrefslogtreecommitdiffstats
path: root/internal/testbinapi/binapi2001/lldp/lldp.ba.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2020-07-22 04:40:55 +0200
committerOndrej Fabry <ofabry@cisco.com>2020-07-22 04:40:55 +0200
commit58da9ac6e691a8c660eb8ca838a154e11da0db68 (patch)
treea1bbda04c6d0621ce0fc20779276620f1820190b /internal/testbinapi/binapi2001/lldp/lldp.ba.go
parenta155cd438c6558da266c1c5931361ea088b35653 (diff)
Fix binapigen decoding and minor improvements
- fixed allocating byte slices before copying decoded data - simplified encoding functions - several minor improvements Change-Id: I6669424b89eb86333805cb1b57e4551169980cc2 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'internal/testbinapi/binapi2001/lldp/lldp.ba.go')
-rw-r--r--internal/testbinapi/binapi2001/lldp/lldp.ba.go212
1 files changed, 212 insertions, 0 deletions
diff --git a/internal/testbinapi/binapi2001/lldp/lldp.ba.go b/internal/testbinapi/binapi2001/lldp/lldp.ba.go
new file mode 100644
index 0000000..767087e
--- /dev/null
+++ b/internal/testbinapi/binapi2001/lldp/lldp.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.01
+// source: .vppapi/core/lldp.api.json
+
+// Package lldp contains generated bindings for API file lldp.api.
+//
+// Contents:
+// 4 messages
+//
+package lldp
+
+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 = "lldp"
+ APIVersion = "1.0.0"
+ VersionCrc = 0xabb21dd0
+)
+
+// LldpConfig defines message 'lldp_config'.
+type LldpConfig struct {
+ SystemName []byte `binapi:"u8[256],name=system_name" json:"system_name,omitempty"`
+ TxHold uint32 `binapi:"u32,name=tx_hold" json:"tx_hold,omitempty"`
+ TxInterval uint32 `binapi:"u32,name=tx_interval" json:"tx_interval,omitempty"`
+}
+
+func (m *LldpConfig) Reset() { *m = LldpConfig{} }
+func (*LldpConfig) GetMessageName() string { return "lldp_config" }
+func (*LldpConfig) GetCrcString() string { return "2410286f" }
+func (*LldpConfig) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *LldpConfig) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 1 * 256 // m.SystemName
+ size += 4 // m.TxHold
+ size += 4 // m.TxInterval
+ return size
+}
+func (m *LldpConfig) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeBytes(m.SystemName, 256)
+ buf.EncodeUint32(m.TxHold)
+ buf.EncodeUint32(m.TxInterval)
+ return buf.Bytes(), nil
+}
+func (m *LldpConfig) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.SystemName = make([]byte, 256)
+ copy(m.SystemName, buf.DecodeBytes(len(m.SystemName)))
+ m.TxHold = buf.DecodeUint32()
+ m.TxInterval = buf.DecodeUint32()
+ return nil
+}
+
+// LldpConfigReply defines message 'lldp_config_reply'.
+type LldpConfigReply struct {
+ Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *LldpConfigReply) Reset() { *m = LldpConfigReply{} }
+func (*LldpConfigReply) GetMessageName() string { return "lldp_config_reply" }
+func (*LldpConfigReply) GetCrcString() string { return "e8d4e804" }
+func (*LldpConfigReply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *LldpConfigReply) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 4 // m.Retval
+ return size
+}
+func (m *LldpConfigReply) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ return buf.Bytes(), nil
+}
+func (m *LldpConfigReply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = buf.DecodeInt32()
+ return nil
+}
+
+// SwInterfaceSetLldp defines message 'sw_interface_set_lldp'.
+type SwInterfaceSetLldp struct {
+ SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
+ PortDesc []byte `binapi:"u8[256],name=port_desc" json:"port_desc,omitempty"`
+ MgmtIP4 []byte `binapi:"u8[4],name=mgmt_ip4" json:"mgmt_ip4,omitempty"`
+ MgmtIP6 []byte `binapi:"u8[16],name=mgmt_ip6" json:"mgmt_ip6,omitempty"`
+ MgmtOid []byte `binapi:"u8[128],name=mgmt_oid" json:"mgmt_oid,omitempty"`
+ Enable uint8 `binapi:"u8,name=enable" json:"enable,omitempty"`
+}
+
+func (m *SwInterfaceSetLldp) Reset() { *m = SwInterfaceSetLldp{} }
+func (*SwInterfaceSetLldp) GetMessageName() string { return "sw_interface_set_lldp" }
+func (*SwInterfaceSetLldp) GetCrcString() string { return "2d85d156" }
+func (*SwInterfaceSetLldp) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *SwInterfaceSetLldp) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 4 // m.SwIfIndex
+ size += 1 * 256 // m.PortDesc
+ size += 1 * 4 // m.MgmtIP4
+ size += 1 * 16 // m.MgmtIP6
+ size += 1 * 128 // m.MgmtOid
+ size += 1 // m.Enable
+ return size
+}
+func (m *SwInterfaceSetLldp) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SwIfIndex)
+ buf.EncodeBytes(m.PortDesc, 256)
+ buf.EncodeBytes(m.MgmtIP4, 4)
+ buf.EncodeBytes(m.MgmtIP6, 16)
+ buf.EncodeBytes(m.MgmtOid, 128)
+ buf.EncodeUint8(m.Enable)
+ return buf.Bytes(), nil
+}
+func (m *SwInterfaceSetLldp) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.SwIfIndex = buf.DecodeUint32()
+ m.PortDesc = make([]byte, 256)
+ copy(m.PortDesc, buf.DecodeBytes(len(m.PortDesc)))
+ m.MgmtIP4 = make([]byte, 4)
+ copy(m.MgmtIP4, buf.DecodeBytes(len(m.MgmtIP4)))
+ m.MgmtIP6 = make([]byte, 16)
+ copy(m.MgmtIP6, buf.DecodeBytes(len(m.MgmtIP6)))
+ m.MgmtOid = make([]byte, 128)
+ copy(m.MgmtOid, buf.DecodeBytes(len(m.MgmtOid)))
+ m.Enable = buf.DecodeUint8()
+ return nil
+}
+
+// SwInterfaceSetLldpReply defines message 'sw_interface_set_lldp_reply'.
+type SwInterfaceSetLldpReply struct {
+ Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *SwInterfaceSetLldpReply) Reset() { *m = SwInterfaceSetLldpReply{} }
+func (*SwInterfaceSetLldpReply) GetMessageName() string { return "sw_interface_set_lldp_reply" }
+func (*SwInterfaceSetLldpReply) GetCrcString() string { return "e8d4e804" }
+func (*SwInterfaceSetLldpReply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *SwInterfaceSetLldpReply) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 4 // m.Retval
+ return size
+}
+func (m *SwInterfaceSetLldpReply) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ return buf.Bytes(), nil
+}
+func (m *SwInterfaceSetLldpReply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = buf.DecodeInt32()
+ return nil
+}
+
+func init() { file_lldp_binapi_init() }
+func file_lldp_binapi_init() {
+ api.RegisterMessage((*LldpConfig)(nil), "lldp_config_2410286f")
+ api.RegisterMessage((*LldpConfigReply)(nil), "lldp_config_reply_e8d4e804")
+ api.RegisterMessage((*SwInterfaceSetLldp)(nil), "sw_interface_set_lldp_2d85d156")
+ api.RegisterMessage((*SwInterfaceSetLldpReply)(nil), "sw_interface_set_lldp_reply_e8d4e804")
+}
+
+// Messages returns list of all messages in this module.
+func AllMessages() []api.Message {
+ return []api.Message{
+ (*LldpConfig)(nil),
+ (*LldpConfigReply)(nil),
+ (*SwInterfaceSetLldp)(nil),
+ (*SwInterfaceSetLldpReply)(nil),
+ }
+}