Fix binapigen decoding and minor improvements
[govpp.git] / internal / testbinapi / binapi2001 / sctp / sctp.ba.go
diff --git a/internal/testbinapi/binapi2001/sctp/sctp.ba.go b/internal/testbinapi/binapi2001/sctp/sctp.ba.go
new file mode 100644 (file)
index 0000000..61aeab6
--- /dev/null
@@ -0,0 +1,285 @@
+// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
+// versions:
+//  binapi-generator: v0.4.0-dev
+//  VPP:              20.01
+// source: .vppapi/plugins/sctp.api.json
+
+// Package sctp contains generated bindings for API file sctp.api.
+//
+// Contents:
+//   6 messages
+//
+package sctp
+
+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    = "sctp"
+       APIVersion = "1.0.0"
+       VersionCrc = 0x35f411c4
+)
+
+// SctpAddSrcDstConnection defines message 'sctp_add_src_dst_connection'.
+type SctpAddSrcDstConnection struct {
+       IsIPv6     uint8  `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
+       VrfID      uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"`
+       SrcAddress []byte `binapi:"u8[16],name=src_address" json:"src_address,omitempty"`
+       DstAddress []byte `binapi:"u8[16],name=dst_address" json:"dst_address,omitempty"`
+}
+
+func (m *SctpAddSrcDstConnection) Reset()               { *m = SctpAddSrcDstConnection{} }
+func (*SctpAddSrcDstConnection) GetMessageName() string { return "sctp_add_src_dst_connection" }
+func (*SctpAddSrcDstConnection) GetCrcString() string   { return "45c59b2f" }
+func (*SctpAddSrcDstConnection) GetMessageType() api.MessageType {
+       return api.RequestMessage
+}
+
+func (m *SctpAddSrcDstConnection) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 1      // m.IsIPv6
+       size += 4      // m.VrfID
+       size += 1 * 16 // m.SrcAddress
+       size += 1 * 16 // m.DstAddress
+       return size
+}
+func (m *SctpAddSrcDstConnection) Marshal(b []byte) ([]byte, error) {
+       if b == nil {
+               b = make([]byte, m.Size())
+       }
+       buf := codec.NewBuffer(b)
+       buf.EncodeUint8(m.IsIPv6)
+       buf.EncodeUint32(m.VrfID)
+       buf.EncodeBytes(m.SrcAddress, 16)
+       buf.EncodeBytes(m.DstAddress, 16)
+       return buf.Bytes(), nil
+}
+func (m *SctpAddSrcDstConnection) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.IsIPv6 = buf.DecodeUint8()
+       m.VrfID = buf.DecodeUint32()
+       m.SrcAddress = make([]byte, 16)
+       copy(m.SrcAddress, buf.DecodeBytes(len(m.SrcAddress)))
+       m.DstAddress = make([]byte, 16)
+       copy(m.DstAddress, buf.DecodeBytes(len(m.DstAddress)))
+       return nil
+}
+
+// SctpAddSrcDstConnectionReply defines message 'sctp_add_src_dst_connection_reply'.
+type SctpAddSrcDstConnectionReply struct {
+       Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *SctpAddSrcDstConnectionReply) Reset() { *m = SctpAddSrcDstConnectionReply{} }
+func (*SctpAddSrcDstConnectionReply) GetMessageName() string {
+       return "sctp_add_src_dst_connection_reply"
+}
+func (*SctpAddSrcDstConnectionReply) GetCrcString() string { return "e8d4e804" }
+func (*SctpAddSrcDstConnectionReply) GetMessageType() api.MessageType {
+       return api.ReplyMessage
+}
+
+func (m *SctpAddSrcDstConnectionReply) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 4 // m.Retval
+       return size
+}
+func (m *SctpAddSrcDstConnectionReply) 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 *SctpAddSrcDstConnectionReply) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.Retval = buf.DecodeInt32()
+       return nil
+}
+
+// SctpConfig defines message 'sctp_config'.
+type SctpConfig struct {
+       NeverDelaySack uint8 `binapi:"u8,name=never_delay_sack" json:"never_delay_sack,omitempty"`
+       NeverBundle    uint8 `binapi:"u8,name=never_bundle" json:"never_bundle,omitempty"`
+}
+
+func (m *SctpConfig) Reset()               { *m = SctpConfig{} }
+func (*SctpConfig) GetMessageName() string { return "sctp_config" }
+func (*SctpConfig) GetCrcString() string   { return "7617eced" }
+func (*SctpConfig) GetMessageType() api.MessageType {
+       return api.RequestMessage
+}
+
+func (m *SctpConfig) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 1 // m.NeverDelaySack
+       size += 1 // m.NeverBundle
+       return size
+}
+func (m *SctpConfig) Marshal(b []byte) ([]byte, error) {
+       if b == nil {
+               b = make([]byte, m.Size())
+       }
+       buf := codec.NewBuffer(b)
+       buf.EncodeUint8(m.NeverDelaySack)
+       buf.EncodeUint8(m.NeverBundle)
+       return buf.Bytes(), nil
+}
+func (m *SctpConfig) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.NeverDelaySack = buf.DecodeUint8()
+       m.NeverBundle = buf.DecodeUint8()
+       return nil
+}
+
+// SctpConfigReply defines message 'sctp_config_reply'.
+type SctpConfigReply struct {
+       Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *SctpConfigReply) Reset()               { *m = SctpConfigReply{} }
+func (*SctpConfigReply) GetMessageName() string { return "sctp_config_reply" }
+func (*SctpConfigReply) GetCrcString() string   { return "e8d4e804" }
+func (*SctpConfigReply) GetMessageType() api.MessageType {
+       return api.ReplyMessage
+}
+
+func (m *SctpConfigReply) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 4 // m.Retval
+       return size
+}
+func (m *SctpConfigReply) 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 *SctpConfigReply) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.Retval = buf.DecodeInt32()
+       return nil
+}
+
+// SctpDelSrcDstConnection defines message 'sctp_del_src_dst_connection'.
+type SctpDelSrcDstConnection struct {
+       IsIPv6     uint8  `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"`
+       VrfID      uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"`
+       SrcAddress []byte `binapi:"u8[16],name=src_address" json:"src_address,omitempty"`
+       DstAddress []byte `binapi:"u8[16],name=dst_address" json:"dst_address,omitempty"`
+}
+
+func (m *SctpDelSrcDstConnection) Reset()               { *m = SctpDelSrcDstConnection{} }
+func (*SctpDelSrcDstConnection) GetMessageName() string { return "sctp_del_src_dst_connection" }
+func (*SctpDelSrcDstConnection) GetCrcString() string   { return "45c59b2f" }
+func (*SctpDelSrcDstConnection) GetMessageType() api.MessageType {
+       return api.RequestMessage
+}
+
+func (m *SctpDelSrcDstConnection) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 1      // m.IsIPv6
+       size += 4      // m.VrfID
+       size += 1 * 16 // m.SrcAddress
+       size += 1 * 16 // m.DstAddress
+       return size
+}
+func (m *SctpDelSrcDstConnection) Marshal(b []byte) ([]byte, error) {
+       if b == nil {
+               b = make([]byte, m.Size())
+       }
+       buf := codec.NewBuffer(b)
+       buf.EncodeUint8(m.IsIPv6)
+       buf.EncodeUint32(m.VrfID)
+       buf.EncodeBytes(m.SrcAddress, 16)
+       buf.EncodeBytes(m.DstAddress, 16)
+       return buf.Bytes(), nil
+}
+func (m *SctpDelSrcDstConnection) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.IsIPv6 = buf.DecodeUint8()
+       m.VrfID = buf.DecodeUint32()
+       m.SrcAddress = make([]byte, 16)
+       copy(m.SrcAddress, buf.DecodeBytes(len(m.SrcAddress)))
+       m.DstAddress = make([]byte, 16)
+       copy(m.DstAddress, buf.DecodeBytes(len(m.DstAddress)))
+       return nil
+}
+
+// SctpDelSrcDstConnectionReply defines message 'sctp_del_src_dst_connection_reply'.
+type SctpDelSrcDstConnectionReply struct {
+       Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
+}
+
+func (m *SctpDelSrcDstConnectionReply) Reset() { *m = SctpDelSrcDstConnectionReply{} }
+func (*SctpDelSrcDstConnectionReply) GetMessageName() string {
+       return "sctp_del_src_dst_connection_reply"
+}
+func (*SctpDelSrcDstConnectionReply) GetCrcString() string { return "e8d4e804" }
+func (*SctpDelSrcDstConnectionReply) GetMessageType() api.MessageType {
+       return api.ReplyMessage
+}
+
+func (m *SctpDelSrcDstConnectionReply) Size() (size int) {
+       if m == nil {
+               return 0
+       }
+       size += 4 // m.Retval
+       return size
+}
+func (m *SctpDelSrcDstConnectionReply) 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 *SctpDelSrcDstConnectionReply) Unmarshal(b []byte) error {
+       buf := codec.NewBuffer(b)
+       m.Retval = buf.DecodeInt32()
+       return nil
+}
+
+func init() { file_sctp_binapi_init() }
+func file_sctp_binapi_init() {
+       api.RegisterMessage((*SctpAddSrcDstConnection)(nil), "sctp_add_src_dst_connection_45c59b2f")
+       api.RegisterMessage((*SctpAddSrcDstConnectionReply)(nil), "sctp_add_src_dst_connection_reply_e8d4e804")
+       api.RegisterMessage((*SctpConfig)(nil), "sctp_config_7617eced")
+       api.RegisterMessage((*SctpConfigReply)(nil), "sctp_config_reply_e8d4e804")
+       api.RegisterMessage((*SctpDelSrcDstConnection)(nil), "sctp_del_src_dst_connection_45c59b2f")
+       api.RegisterMessage((*SctpDelSrcDstConnectionReply)(nil), "sctp_del_src_dst_connection_reply_e8d4e804")
+}
+
+// Messages returns list of all messages in this module.
+func AllMessages() []api.Message {
+       return []api.Message{
+               (*SctpAddSrcDstConnection)(nil),
+               (*SctpAddSrcDstConnectionReply)(nil),
+               (*SctpConfig)(nil),
+               (*SctpConfigReply)(nil),
+               (*SctpDelSrcDstConnection)(nil),
+               (*SctpDelSrcDstConnectionReply)(nil),
+       }
+}