Fix binapigen decoding and minor improvements
[govpp.git] / internal / testbinapi / binapi2001 / pg / pg.ba.go
diff --git a/internal/testbinapi/binapi2001/pg/pg.ba.go b/internal/testbinapi/binapi2001/pg/pg.ba.go
new file mode 100644 (file)
index 0000000..283ed12
--- /dev/null
@@ -0,0 +1,287 @@
+// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
+// versions:
+//  binapi-generator: v0.4.0-dev
+//  VPP:              20.01
+// source: .vppapi/core/pg.api.json
+
+// Package pg contains generated bindings for API file pg.api.
+//
+// Contents:
+//   6 messages
+//
+package pg
+
+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    = "pg"
+       APIVersion = "1.1.0"
+       VersionCrc = 0x2583e07b
+)
+
+// PgCapture defines message 'pg_capture'.
+type PgCapture struct {
+       InterfaceID    uint32 `binapi:"u32,name=interface_id" json:"interface_id,omitempty"`
+       IsEnabled      uint8  `binapi:"u8,name=is_enabled" json:"is_enabled,omitempty"`
+       Count          uint32 `binapi:"u32,name=count" json:"count,omitempty"`
+       PcapNameLength uint32 `binapi:"u32,name=pcap_name_length" json:"-"`
+       PcapFileName   []byte `binapi:"u8[pcap_name_length],name=pcap_file_name" json:"pcap_file_name,omitempty"`
+}
+
+func (m *PgCapture) Reset()               { *m = PgCapture{} }
+func (*PgCapture) GetMessageName() string { return "pg_capture" }
+func (*PgCapture) GetCrcString() string   { return "453da78d" }
+func (*PgCapture) GetMessageType() api.MessageType {
+       return api.RequestMessage
+}
+
+func (m *PgCapture) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 4                       // m.InterfaceID
+       size += 1                       // m.IsEnabled
+       size += 4                       // m.Count
+       size += 4                       // m.PcapNameLength
+       size += 1 * len(m.PcapFileName) // m.PcapFileName
+       return size
+}
+func (m *PgCapture) Marshal(b []byte) ([]byte, error) {
+       if b == nil {
+               b = make([]byte, m.Size())
+       }
+       buf := codec.NewBuffer(b)
+       buf.EncodeUint32(m.InterfaceID)
+       buf.EncodeUint8(m.IsEnabled)
+       buf.EncodeUint32(m.Count)
+       buf.EncodeUint32(uint32(len(m.PcapFileName)))
+       buf.EncodeBytes(m.PcapFileName, 0)
+       return buf.Bytes(), nil
+}
+func (m *PgCapture) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.InterfaceID = buf.DecodeUint32()
+       m.IsEnabled = buf.DecodeUint8()
+       m.Count = buf.DecodeUint32()
+       m.PcapNameLength = buf.DecodeUint32()
+       m.PcapFileName = make([]byte, m.PcapNameLength)
+       copy(m.PcapFileName, buf.DecodeBytes(len(m.PcapFileName)))
+       return nil
+}
+
+// PgCaptureReply defines message 'pg_capture_reply'.
+type PgCaptureReply struct {
+       Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *PgCaptureReply) Reset()               { *m = PgCaptureReply{} }
+func (*PgCaptureReply) GetMessageName() string { return "pg_capture_reply" }
+func (*PgCaptureReply) GetCrcString() string   { return "e8d4e804" }
+func (*PgCaptureReply) GetMessageType() api.MessageType {
+       return api.ReplyMessage
+}
+
+func (m *PgCaptureReply) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 4 // m.Retval
+       return size
+}
+func (m *PgCaptureReply) 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 *PgCaptureReply) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.Retval = buf.DecodeInt32()
+       return nil
+}
+
+// PgCreateInterface defines message 'pg_create_interface'.
+type PgCreateInterface struct {
+       InterfaceID uint32 `binapi:"u32,name=interface_id" json:"interface_id,omitempty"`
+       GsoEnabled  uint8  `binapi:"u8,name=gso_enabled" json:"gso_enabled,omitempty"`
+       GsoSize     uint32 `binapi:"u32,name=gso_size" json:"gso_size,omitempty"`
+}
+
+func (m *PgCreateInterface) Reset()               { *m = PgCreateInterface{} }
+func (*PgCreateInterface) GetMessageName() string { return "pg_create_interface" }
+func (*PgCreateInterface) GetCrcString() string   { return "b1ecff05" }
+func (*PgCreateInterface) GetMessageType() api.MessageType {
+       return api.RequestMessage
+}
+
+func (m *PgCreateInterface) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 4 // m.InterfaceID
+       size += 1 // m.GsoEnabled
+       size += 4 // m.GsoSize
+       return size
+}
+func (m *PgCreateInterface) Marshal(b []byte) ([]byte, error) {
+       if b == nil {
+               b = make([]byte, m.Size())
+       }
+       buf := codec.NewBuffer(b)
+       buf.EncodeUint32(m.InterfaceID)
+       buf.EncodeUint8(m.GsoEnabled)
+       buf.EncodeUint32(m.GsoSize)
+       return buf.Bytes(), nil
+}
+func (m *PgCreateInterface) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.InterfaceID = buf.DecodeUint32()
+       m.GsoEnabled = buf.DecodeUint8()
+       m.GsoSize = buf.DecodeUint32()
+       return nil
+}
+
+// PgCreateInterfaceReply defines message 'pg_create_interface_reply'.
+type PgCreateInterfaceReply struct {
+       Retval    int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
+       SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
+}
+
+func (m *PgCreateInterfaceReply) Reset()               { *m = PgCreateInterfaceReply{} }
+func (*PgCreateInterfaceReply) GetMessageName() string { return "pg_create_interface_reply" }
+func (*PgCreateInterfaceReply) GetCrcString() string   { return "fda5941f" }
+func (*PgCreateInterfaceReply) GetMessageType() api.MessageType {
+       return api.ReplyMessage
+}
+
+func (m *PgCreateInterfaceReply) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 4 // m.Retval
+       size += 4 // m.SwIfIndex
+       return size
+}
+func (m *PgCreateInterfaceReply) Marshal(b []byte) ([]byte, error) {
+       if b == nil {
+               b = make([]byte, m.Size())
+       }
+       buf := codec.NewBuffer(b)
+       buf.EncodeInt32(m.Retval)
+       buf.EncodeUint32(m.SwIfIndex)
+       return buf.Bytes(), nil
+}
+func (m *PgCreateInterfaceReply) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.Retval = buf.DecodeInt32()
+       m.SwIfIndex = buf.DecodeUint32()
+       return nil
+}
+
+// PgEnableDisable defines message 'pg_enable_disable'.
+type PgEnableDisable struct {
+       IsEnabled        uint8  `binapi:"u8,name=is_enabled" json:"is_enabled,omitempty"`
+       StreamNameLength uint32 `binapi:"u32,name=stream_name_length" json:"-"`
+       StreamName       []byte `binapi:"u8[stream_name_length],name=stream_name" json:"stream_name,omitempty"`
+}
+
+func (m *PgEnableDisable) Reset()               { *m = PgEnableDisable{} }
+func (*PgEnableDisable) GetMessageName() string { return "pg_enable_disable" }
+func (*PgEnableDisable) GetCrcString() string   { return "0cb71d10" }
+func (*PgEnableDisable) GetMessageType() api.MessageType {
+       return api.RequestMessage
+}
+
+func (m *PgEnableDisable) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 1                     // m.IsEnabled
+       size += 4                     // m.StreamNameLength
+       size += 1 * len(m.StreamName) // m.StreamName
+       return size
+}
+func (m *PgEnableDisable) Marshal(b []byte) ([]byte, error) {
+       if b == nil {
+               b = make([]byte, m.Size())
+       }
+       buf := codec.NewBuffer(b)
+       buf.EncodeUint8(m.IsEnabled)
+       buf.EncodeUint32(uint32(len(m.StreamName)))
+       buf.EncodeBytes(m.StreamName, 0)
+       return buf.Bytes(), nil
+}
+func (m *PgEnableDisable) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.IsEnabled = buf.DecodeUint8()
+       m.StreamNameLength = buf.DecodeUint32()
+       m.StreamName = make([]byte, m.StreamNameLength)
+       copy(m.StreamName, buf.DecodeBytes(len(m.StreamName)))
+       return nil
+}
+
+// PgEnableDisableReply defines message 'pg_enable_disable_reply'.
+type PgEnableDisableReply struct {
+       Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *PgEnableDisableReply) Reset()               { *m = PgEnableDisableReply{} }
+func (*PgEnableDisableReply) GetMessageName() string { return "pg_enable_disable_reply" }
+func (*PgEnableDisableReply) GetCrcString() string   { return "e8d4e804" }
+func (*PgEnableDisableReply) GetMessageType() api.MessageType {
+       return api.ReplyMessage
+}
+
+func (m *PgEnableDisableReply) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 4 // m.Retval
+       return size
+}
+func (m *PgEnableDisableReply) 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 *PgEnableDisableReply) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.Retval = buf.DecodeInt32()
+       return nil
+}
+
+func init() { file_pg_binapi_init() }
+func file_pg_binapi_init() {
+       api.RegisterMessage((*PgCapture)(nil), "pg_capture_453da78d")
+       api.RegisterMessage((*PgCaptureReply)(nil), "pg_capture_reply_e8d4e804")
+       api.RegisterMessage((*PgCreateInterface)(nil), "pg_create_interface_b1ecff05")
+       api.RegisterMessage((*PgCreateInterfaceReply)(nil), "pg_create_interface_reply_fda5941f")
+       api.RegisterMessage((*PgEnableDisable)(nil), "pg_enable_disable_0cb71d10")
+       api.RegisterMessage((*PgEnableDisableReply)(nil), "pg_enable_disable_reply_e8d4e804")
+}
+
+// Messages returns list of all messages in this module.
+func AllMessages() []api.Message {
+       return []api.Message{
+               (*PgCapture)(nil),
+               (*PgCaptureReply)(nil),
+               (*PgCreateInterface)(nil),
+               (*PgCreateInterfaceReply)(nil),
+               (*PgEnableDisable)(nil),
+               (*PgEnableDisableReply)(nil),
+       }
+}