diff options
Diffstat (limited to 'examples/binapi')
22 files changed, 18761 insertions, 3112 deletions
diff --git a/examples/binapi/acl/acl.ba.go b/examples/binapi/acl/acl.ba.go index 1f9528e..b42fb5f 100644 --- a/examples/binapi/acl/acl.ba.go +++ b/examples/binapi/acl/acl.ba.go @@ -1,648 +1,2794 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 // source: /usr/share/vpp/api/plugins/acl.api.json /* -Package acl is a generated VPP binary API for 'acl' module. +Package acl contains generated code for VPP binary API defined by acl.api (version 1.0.1). It consists of: + 38 messages 2 types - 36 messages - 18 services */ package acl import ( - bytes "bytes" - context "context" + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" - io "io" - strconv "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 // please upgrade the GoVPP api package + const ( // ModuleName is the name of this module. ModuleName = "acl" // APIVersion is the API version of this module. APIVersion = "1.0.1" // VersionCrc is the CRC of this module. - VersionCrc = 0x8ed22cb9 + VersionCrc = 0x11c5c1e5 ) // ACLRule represents VPP binary API type 'acl_rule'. type ACLRule struct { - IsPermit uint8 - IsIPv6 uint8 - SrcIPAddr []byte `struc:"[16]byte"` - SrcIPPrefixLen uint8 - DstIPAddr []byte `struc:"[16]byte"` - DstIPPrefixLen uint8 - Proto uint8 - SrcportOrIcmptypeFirst uint16 - SrcportOrIcmptypeLast uint16 - DstportOrIcmpcodeFirst uint16 - DstportOrIcmpcodeLast uint16 - TCPFlagsMask uint8 - TCPFlagsValue uint8 -} - -func (*ACLRule) GetTypeName() string { - return "acl_rule" -} -func (*ACLRule) GetCrcString() string { - return "6f99bf4d" -} + IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` + SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` + DstIPAddr []byte `binapi:"u8[16],name=dst_ip_addr" json:"dst_ip_addr,omitempty" struc:"[16]byte"` + DstIPPrefixLen uint8 `binapi:"u8,name=dst_ip_prefix_len" json:"dst_ip_prefix_len,omitempty"` + Proto uint8 `binapi:"u8,name=proto" json:"proto,omitempty"` + SrcportOrIcmptypeFirst uint16 `binapi:"u16,name=srcport_or_icmptype_first" json:"srcport_or_icmptype_first,omitempty"` + SrcportOrIcmptypeLast uint16 `binapi:"u16,name=srcport_or_icmptype_last" json:"srcport_or_icmptype_last,omitempty"` + DstportOrIcmpcodeFirst uint16 `binapi:"u16,name=dstport_or_icmpcode_first" json:"dstport_or_icmpcode_first,omitempty"` + DstportOrIcmpcodeLast uint16 `binapi:"u16,name=dstport_or_icmpcode_last" json:"dstport_or_icmpcode_last,omitempty"` + TCPFlagsMask uint8 `binapi:"u8,name=tcp_flags_mask" json:"tcp_flags_mask,omitempty"` + TCPFlagsValue uint8 `binapi:"u8,name=tcp_flags_value" json:"tcp_flags_value,omitempty"` +} + +func (*ACLRule) GetTypeName() string { return "acl_rule" } // MacipACLRule represents VPP binary API type 'macip_acl_rule'. type MacipACLRule struct { - IsPermit uint8 - IsIPv6 uint8 - SrcMac []byte `struc:"[6]byte"` - SrcMacMask []byte `struc:"[6]byte"` - SrcIPAddr []byte `struc:"[16]byte"` - SrcIPPrefixLen uint8 + IsPermit uint8 `binapi:"u8,name=is_permit" json:"is_permit,omitempty"` + IsIPv6 uint8 `binapi:"u8,name=is_ipv6" json:"is_ipv6,omitempty"` + SrcMac []byte `binapi:"u8[6],name=src_mac" json:"src_mac,omitempty" struc:"[6]byte"` + SrcMacMask []byte `binapi:"u8[6],name=src_mac_mask" json:"src_mac_mask,omitempty" struc:"[6]byte"` + SrcIPAddr []byte `binapi:"u8[16],name=src_ip_addr" json:"src_ip_addr,omitempty" struc:"[16]byte"` + SrcIPPrefixLen uint8 `binapi:"u8,name=src_ip_prefix_len" json:"src_ip_prefix_len,omitempty"` } -func (*MacipACLRule) GetTypeName() string { - return "macip_acl_rule" -} -func (*MacipACLRule) GetCrcString() string { - return "70589f1e" -} +func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } // ACLAddReplace represents VPP binary API message 'acl_add_replace'. type ACLAddReplace struct { - ACLIndex uint32 - Tag []byte `struc:"[64]byte"` - Count uint32 `struc:"sizeof=R"` - R []ACLRule + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` } -func (*ACLAddReplace) GetMessageName() string { - return "acl_add_replace" -} -func (*ACLAddReplace) GetCrcString() string { - return "e839997e" -} -func (*ACLAddReplace) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } +func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } +func (*ACLAddReplace) GetCrcString() string { return "13bc8539" } +func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + // field[2] s1.DstIPAddr + size += 16 + // field[2] s1.DstIPPrefixLen + size += 1 + // field[2] s1.Proto + size += 1 + // field[2] s1.SrcportOrIcmptypeFirst + size += 2 + // field[2] s1.SrcportOrIcmptypeLast + size += 2 + // field[2] s1.DstportOrIcmpcodeFirst + size += 2 + // field[2] s1.DstportOrIcmpcodeLast + size += 2 + // field[2] s1.TCPFlagsMask + size += 1 + // field[2] s1.TCPFlagsValue + size += 1 + } + return size +} +func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 ACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + // field[2] v1.DstIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.DstIPAddr) { + x = uint8(v1.DstIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.DstIPPrefixLen + buf[pos] = uint8(v1.DstIPPrefixLen) + pos += 1 + // field[2] v1.Proto + buf[pos] = uint8(v1.Proto) + pos += 1 + // field[2] v1.SrcportOrIcmptypeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) + pos += 2 + // field[2] v1.SrcportOrIcmptypeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) + pos += 2 + // field[2] v1.TCPFlagsMask + buf[pos] = uint8(v1.TCPFlagsMask) + pos += 1 + // field[2] v1.TCPFlagsValue + buf[pos] = uint8(v1.TCPFlagsValue) + pos += 1 + } + return buf, nil +} +func (m *ACLAddReplace) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]ACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].DstIPAddr + m.R[j1].DstIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].DstIPAddr); i++ { + m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].DstIPPrefixLen + m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].Proto + m.R[j1].Proto = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcportOrIcmptypeFirst + m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].SrcportOrIcmptypeLast + m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeFirst + m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeLast + m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].TCPFlagsMask + m.R[j1].TCPFlagsMask = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].TCPFlagsValue + m.R[j1].TCPFlagsValue = uint8(tmp[pos]) + pos += 1 + } + return nil } // ACLAddReplaceReply represents VPP binary API message 'acl_add_replace_reply'. type ACLAddReplaceReply struct { - ACLIndex uint32 - Retval int32 + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } -func (*ACLAddReplaceReply) GetMessageName() string { - return "acl_add_replace_reply" -} -func (*ACLAddReplaceReply) GetCrcString() string { - return "ac407b0c" -} -func (*ACLAddReplaceReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *ACLAddReplaceReply) Reset() { *m = ACLAddReplaceReply{} } +func (*ACLAddReplaceReply) GetMessageName() string { return "acl_add_replace_reply" } +func (*ACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*ACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLAddReplaceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLDel represents VPP binary API message 'acl_del'. type ACLDel struct { - ACLIndex uint32 + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } -func (*ACLDel) GetMessageName() string { - return "acl_del" -} -func (*ACLDel) GetCrcString() string { - return "ef34fea4" -} -func (*ACLDel) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *ACLDel) Reset() { *m = ACLDel{} } +func (*ACLDel) GetMessageName() string { return "acl_del" } +func (*ACLDel) GetCrcString() string { return "ef34fea4" } +func (*ACLDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *ACLDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *ACLDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLDelReply represents VPP binary API message 'acl_del_reply'. type ACLDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } -func (*ACLDelReply) GetMessageName() string { - return "acl_del_reply" -} -func (*ACLDelReply) GetCrcString() string { - return "e8d4e804" -} -func (*ACLDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *ACLDelReply) Reset() { *m = ACLDelReply{} } +func (*ACLDelReply) GetMessageName() string { return "acl_del_reply" } +func (*ACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLDetails represents VPP binary API message 'acl_details'. type ACLDetails struct { - ACLIndex uint32 - Tag []byte `struc:"[64]byte"` - Count uint32 `struc:"sizeof=R"` - R []ACLRule + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []ACLRule `binapi:"acl_rule[count],name=r" json:"r,omitempty"` } -func (*ACLDetails) GetMessageName() string { - return "acl_details" -} -func (*ACLDetails) GetCrcString() string { - return "5bd895be" -} -func (*ACLDetails) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *ACLDetails) Reset() { *m = ACLDetails{} } +func (*ACLDetails) GetMessageName() string { return "acl_details" } +func (*ACLDetails) GetCrcString() string { return "f89d7a88" } +func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 ACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + // field[2] s1.DstIPAddr + size += 16 + // field[2] s1.DstIPPrefixLen + size += 1 + // field[2] s1.Proto + size += 1 + // field[2] s1.SrcportOrIcmptypeFirst + size += 2 + // field[2] s1.SrcportOrIcmptypeLast + size += 2 + // field[2] s1.DstportOrIcmpcodeFirst + size += 2 + // field[2] s1.DstportOrIcmpcodeLast + size += 2 + // field[2] s1.TCPFlagsMask + size += 1 + // field[2] s1.TCPFlagsValue + size += 1 + } + return size +} +func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 ACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + // field[2] v1.DstIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.DstIPAddr) { + x = uint8(v1.DstIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.DstIPPrefixLen + buf[pos] = uint8(v1.DstIPPrefixLen) + pos += 1 + // field[2] v1.Proto + buf[pos] = uint8(v1.Proto) + pos += 1 + // field[2] v1.SrcportOrIcmptypeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeFirst)) + pos += 2 + // field[2] v1.SrcportOrIcmptypeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.SrcportOrIcmptypeLast)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeFirst + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeFirst)) + pos += 2 + // field[2] v1.DstportOrIcmpcodeLast + o.PutUint16(buf[pos:pos+2], uint16(v1.DstportOrIcmpcodeLast)) + pos += 2 + // field[2] v1.TCPFlagsMask + buf[pos] = uint8(v1.TCPFlagsMask) + pos += 1 + // field[2] v1.TCPFlagsValue + buf[pos] = uint8(v1.TCPFlagsValue) + pos += 1 + } + return buf, nil +} +func (m *ACLDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]ACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].DstIPAddr + m.R[j1].DstIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].DstIPAddr); i++ { + m.R[j1].DstIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].DstIPPrefixLen + m.R[j1].DstIPPrefixLen = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].Proto + m.R[j1].Proto = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcportOrIcmptypeFirst + m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].SrcportOrIcmptypeLast + m.R[j1].SrcportOrIcmptypeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeFirst + m.R[j1].DstportOrIcmpcodeFirst = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].DstportOrIcmpcodeLast + m.R[j1].DstportOrIcmpcodeLast = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.R[j1].TCPFlagsMask + m.R[j1].TCPFlagsMask = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].TCPFlagsValue + m.R[j1].TCPFlagsValue = uint8(tmp[pos]) + pos += 1 + } + return nil } // ACLDump represents VPP binary API message 'acl_dump'. type ACLDump struct { - ACLIndex uint32 + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } -func (*ACLDump) GetMessageName() string { - return "acl_dump" -} -func (*ACLDump) GetCrcString() string { - return "ef34fea4" -} -func (*ACLDump) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *ACLDump) Reset() { *m = ACLDump{} } +func (*ACLDump) GetMessageName() string { return "acl_dump" } +func (*ACLDump) GetCrcString() string { return "ef34fea4" } +func (*ACLDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *ACLDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *ACLDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. type ACLInterfaceAddDel struct { - IsAdd uint8 - IsInput uint8 - SwIfIndex uint32 - ACLIndex uint32 + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + IsInput uint8 `binapi:"u8,name=is_input" json:"is_input,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } -func (*ACLInterfaceAddDel) GetMessageName() string { - return "acl_interface_add_del" -} -func (*ACLInterfaceAddDel) GetCrcString() string { - return "0b2aedd1" -} -func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } +func (*ACLInterfaceAddDel) GetMessageName() string { return "acl_interface_add_del" } +func (*ACLInterfaceAddDel) GetCrcString() string { return "0b2aedd1" } +func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.IsInput + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + buf[pos] = uint8(m.IsAdd) + pos += 1 + // field[1] m.IsInput + buf[pos] = uint8(m.IsInput) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = uint8(tmp[pos]) + pos += 1 + // field[1] m.IsInput + m.IsInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLInterfaceAddDelReply represents VPP binary API message 'acl_interface_add_del_reply'. type ACLInterfaceAddDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } -func (*ACLInterfaceAddDelReply) GetMessageName() string { - return "acl_interface_add_del_reply" -} -func (*ACLInterfaceAddDelReply) GetCrcString() string { - return "e8d4e804" -} -func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *ACLInterfaceAddDelReply) Reset() { *m = ACLInterfaceAddDelReply{} } +func (*ACLInterfaceAddDelReply) GetMessageName() string { return "acl_interface_add_del_reply" } +func (*ACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. type ACLInterfaceEtypeWhitelistDetails struct { - SwIfIndex uint32 - Count uint8 `struc:"sizeof=Whitelist"` - NInput uint8 - Whitelist []uint16 + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` } +func (m *ACLInterfaceEtypeWhitelistDetails) Reset() { *m = ACLInterfaceEtypeWhitelistDetails{} } func (*ACLInterfaceEtypeWhitelistDetails) GetMessageName() string { return "acl_interface_etype_whitelist_details" } -func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { - return "6a5d4e81" -} -func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { - return api.ReplyMessage +func (*ACLInterfaceEtypeWhitelistDetails) GetCrcString() string { return "6a5d4e81" } +func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceEtypeWhitelistDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Whitelist + size += 2 * len(m.Whitelist) + return size +} +func (m *ACLInterfaceEtypeWhitelistDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Whitelist)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Whitelist + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + return buf, nil +} +func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Whitelist + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + return nil } // ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. type ACLInterfaceEtypeWhitelistDump struct { - SwIfIndex uint32 + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` } +func (m *ACLInterfaceEtypeWhitelistDump) Reset() { *m = ACLInterfaceEtypeWhitelistDump{} } func (*ACLInterfaceEtypeWhitelistDump) GetMessageName() string { return "acl_interface_etype_whitelist_dump" } -func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { - return "529cb13f" -} -func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { - return api.RequestMessage +func (*ACLInterfaceEtypeWhitelistDump) GetCrcString() string { return "529cb13f" } +func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceEtypeWhitelistDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *ACLInterfaceEtypeWhitelistDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLInterfaceListDetails represents VPP binary API message 'acl_interface_list_details'. type ACLInterfaceListDetails struct { - SwIfIndex uint32 - Count uint8 `struc:"sizeof=Acls"` - NInput uint8 - Acls []uint32 + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } -func (*ACLInterfaceListDetails) GetMessageName() string { - return "acl_interface_list_details" -} -func (*ACLInterfaceListDetails) GetCrcString() string { - return "d5e80809" -} -func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } +func (*ACLInterfaceListDetails) GetMessageName() string { return "acl_interface_list_details" } +func (*ACLInterfaceListDetails) GetCrcString() string { return "d5e80809" } +func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *ACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Acls)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil } // ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. type ACLInterfaceListDump struct { - SwIfIndex uint32 + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` } -func (*ACLInterfaceListDump) GetMessageName() string { - return "acl_interface_list_dump" -} -func (*ACLInterfaceListDump) GetCrcString() string { - return "529cb13f" -} -func (*ACLInterfaceListDump) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } +func (*ACLInterfaceListDump) GetMessageName() string { return "acl_interface_list_dump" } +func (*ACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*ACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *ACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceListDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLInterfaceSetACLList represents VPP binary API message 'acl_interface_set_acl_list'. type ACLInterfaceSetACLList struct { - SwIfIndex uint32 - Count uint8 `struc:"sizeof=Acls"` - NInput uint8 - Acls []uint32 + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } -func (*ACLInterfaceSetACLList) GetMessageName() string { - return "acl_interface_set_acl_list" -} -func (*ACLInterfaceSetACLList) GetCrcString() string { - return "8baece38" -} -func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } +func (*ACLInterfaceSetACLList) GetMessageName() string { return "acl_interface_set_acl_list" } +func (*ACLInterfaceSetACLList) GetCrcString() string { return "8baece38" } +func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceSetACLList) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *ACLInterfaceSetACLList) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Acls)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *ACLInterfaceSetACLList) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil } // ACLInterfaceSetACLListReply represents VPP binary API message 'acl_interface_set_acl_list_reply'. type ACLInterfaceSetACLListReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } +func (m *ACLInterfaceSetACLListReply) Reset() { *m = ACLInterfaceSetACLListReply{} } func (*ACLInterfaceSetACLListReply) GetMessageName() string { return "acl_interface_set_acl_list_reply" } -func (*ACLInterfaceSetACLListReply) GetCrcString() string { - return "e8d4e804" -} -func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (*ACLInterfaceSetACLListReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceSetACLListReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLInterfaceSetACLListReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceSetACLListReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. type ACLInterfaceSetEtypeWhitelist struct { - SwIfIndex uint32 - Count uint8 `struc:"sizeof=Whitelist"` - NInput uint8 - Whitelist []uint16 + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Whitelist"` + NInput uint8 `binapi:"u8,name=n_input" json:"n_input,omitempty"` + Whitelist []uint16 `binapi:"u16[count],name=whitelist" json:"whitelist,omitempty"` } +func (m *ACLInterfaceSetEtypeWhitelist) Reset() { *m = ACLInterfaceSetEtypeWhitelist{} } func (*ACLInterfaceSetEtypeWhitelist) GetMessageName() string { return "acl_interface_set_etype_whitelist" } -func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { - return "f515efc5" -} -func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { - return api.RequestMessage +func (*ACLInterfaceSetEtypeWhitelist) GetCrcString() string { return "f515efc5" } +func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLInterfaceSetEtypeWhitelist) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.NInput + size += 1 + // field[1] m.Whitelist + size += 2 * len(m.Whitelist) + return size +} +func (m *ACLInterfaceSetEtypeWhitelist) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Whitelist)) + pos += 1 + // field[1] m.NInput + buf[pos] = uint8(m.NInput) + pos += 1 + // field[1] m.Whitelist + for i := 0; i < len(m.Whitelist); i++ { + var x uint16 + if i < len(m.Whitelist) { + x = uint16(m.Whitelist[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + return buf, nil +} +func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.NInput + m.NInput = uint8(tmp[pos]) + pos += 1 + // field[1] m.Whitelist + m.Whitelist = make([]uint16, m.Count) + for i := 0; i < len(m.Whitelist); i++ { + m.Whitelist[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + return nil } // ACLInterfaceSetEtypeWhitelistReply represents VPP binary API message 'acl_interface_set_etype_whitelist_reply'. type ACLInterfaceSetEtypeWhitelistReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } +func (m *ACLInterfaceSetEtypeWhitelistReply) Reset() { *m = ACLInterfaceSetEtypeWhitelistReply{} } func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageName() string { return "acl_interface_set_etype_whitelist_reply" } -func (*ACLInterfaceSetEtypeWhitelistReply) GetCrcString() string { - return "e8d4e804" -} -func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (*ACLInterfaceSetEtypeWhitelistReply) GetCrcString() string { return "e8d4e804" } +func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLInterfaceSetEtypeWhitelistReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLInterfaceSetEtypeWhitelistReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLPluginControlPing represents VPP binary API message 'acl_plugin_control_ping'. type ACLPluginControlPing struct{} -func (*ACLPluginControlPing) GetMessageName() string { - return "acl_plugin_control_ping" -} -func (*ACLPluginControlPing) GetCrcString() string { - return "51077d14" +func (m *ACLPluginControlPing) Reset() { *m = ACLPluginControlPing{} } +func (*ACLPluginControlPing) GetMessageName() string { return "acl_plugin_control_ping" } +func (*ACLPluginControlPing) GetCrcString() string { return "51077d14" } +func (*ACLPluginControlPing) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLPluginControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginControlPing) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil } -func (*ACLPluginControlPing) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *ACLPluginControlPing) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil } // ACLPluginControlPingReply represents VPP binary API message 'acl_plugin_control_ping_reply'. type ACLPluginControlPingReply struct { - Retval int32 - ClientIndex uint32 - VpePID uint32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` } -func (*ACLPluginControlPingReply) GetMessageName() string { - return "acl_plugin_control_ping_reply" -} -func (*ACLPluginControlPingReply) GetCrcString() string { - return "f6b0b8ca" -} -func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *ACLPluginControlPingReply) Reset() { *m = ACLPluginControlPingReply{} } +func (*ACLPluginControlPingReply) GetMessageName() string { return "acl_plugin_control_ping_reply" } +func (*ACLPluginControlPingReply) GetCrcString() string { return "f6b0b8ca" } +func (*ACLPluginControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLPluginControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ClientIndex + size += 4 + // field[1] m.VpePID + size += 4 + return size +} +func (m *ACLPluginControlPingReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ClientIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) + pos += 4 + // field[1] m.VpePID + o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) + pos += 4 + return buf, nil +} +func (m *ACLPluginControlPingReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ClientIndex + m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VpePID + m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // ACLPluginGetConnTableMaxEntries represents VPP binary API message 'acl_plugin_get_conn_table_max_entries'. type ACLPluginGetConnTableMaxEntries struct{} +func (m *ACLPluginGetConnTableMaxEntries) Reset() { *m = ACLPluginGetConnTableMaxEntries{} } func (*ACLPluginGetConnTableMaxEntries) GetMessageName() string { return "acl_plugin_get_conn_table_max_entries" } -func (*ACLPluginGetConnTableMaxEntries) GetCrcString() string { - return "51077d14" +func (*ACLPluginGetConnTableMaxEntries) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLPluginGetConnTableMaxEntries) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetConnTableMaxEntries) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil } -func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *ACLPluginGetConnTableMaxEntries) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil } // ACLPluginGetConnTableMaxEntriesReply represents VPP binary API message 'acl_plugin_get_conn_table_max_entries_reply'. type ACLPluginGetConnTableMaxEntriesReply struct { - ConnTableMaxEntries uint64 + ConnTableMaxEntries uint64 `binapi:"u64,name=conn_table_max_entries" json:"conn_table_max_entries,omitempty"` } +func (m *ACLPluginGetConnTableMaxEntriesReply) Reset() { *m = ACLPluginGetConnTableMaxEntriesReply{} } func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageName() string { return "acl_plugin_get_conn_table_max_entries_reply" } -func (*ACLPluginGetConnTableMaxEntriesReply) GetCrcString() string { - return "7a096d3d" -} +func (*ACLPluginGetConnTableMaxEntriesReply) GetCrcString() string { return "7a096d3d" } func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *ACLPluginGetConnTableMaxEntriesReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ConnTableMaxEntries + size += 8 + return size +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ConnTableMaxEntries + o.PutUint64(buf[pos:pos+8], uint64(m.ConnTableMaxEntries)) + pos += 8 + return buf, nil +} +func (m *ACLPluginGetConnTableMaxEntriesReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ConnTableMaxEntries + m.ConnTableMaxEntries = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + // ACLPluginGetVersion represents VPP binary API message 'acl_plugin_get_version'. type ACLPluginGetVersion struct{} -func (*ACLPluginGetVersion) GetMessageName() string { - return "acl_plugin_get_version" -} -func (*ACLPluginGetVersion) GetCrcString() string { - return "51077d14" +func (m *ACLPluginGetVersion) Reset() { *m = ACLPluginGetVersion{} } +func (*ACLPluginGetVersion) GetMessageName() string { return "acl_plugin_get_version" } +func (*ACLPluginGetVersion) GetCrcString() string { return "51077d14" } +func (*ACLPluginGetVersion) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLPluginGetVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ACLPluginGetVersion) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil } -func (*ACLPluginGetVersion) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *ACLPluginGetVersion) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil } // ACLPluginGetVersionReply represents VPP binary API message 'acl_plugin_get_version_reply'. type ACLPluginGetVersionReply struct { - Major uint32 - Minor uint32 + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` } -func (*ACLPluginGetVersionReply) GetMessageName() string { - return "acl_plugin_get_version_reply" +func (m *ACLPluginGetVersionReply) Reset() { *m = ACLPluginGetVersionReply{} } +func (*ACLPluginGetVersionReply) GetMessageName() string { return "acl_plugin_get_version_reply" } +func (*ACLPluginGetVersionReply) GetCrcString() string { return "9b32cf86" } +func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *ACLPluginGetVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Major + size += 4 + // field[1] m.Minor + size += 4 + return size +} +func (m *ACLPluginGetVersionReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Major + o.PutUint32(buf[pos:pos+4], uint32(m.Major)) + pos += 4 + // field[1] m.Minor + o.PutUint32(buf[pos:pos+4], uint32(m.Minor)) + pos += 4 + return buf, nil +} +func (m *ACLPluginGetVersionReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Major + m.Major = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Minor + m.Minor = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// ACLStatsIntfCountersEnable represents VPP binary API message 'acl_stats_intf_counters_enable'. +type ACLStatsIntfCountersEnable struct { + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` +} + +func (m *ACLStatsIntfCountersEnable) Reset() { *m = ACLStatsIntfCountersEnable{} } +func (*ACLStatsIntfCountersEnable) GetMessageName() string { return "acl_stats_intf_counters_enable" } +func (*ACLStatsIntfCountersEnable) GetCrcString() string { return "b3e225d2" } +func (*ACLStatsIntfCountersEnable) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *ACLStatsIntfCountersEnable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Enable + size += 1 + return size +} +func (m *ACLStatsIntfCountersEnable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Enable + if m.Enable { + buf[pos] = 1 + } + pos += 1 + return buf, nil } -func (*ACLPluginGetVersionReply) GetCrcString() string { - return "9b32cf86" +func (m *ACLStatsIntfCountersEnable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Enable + m.Enable = tmp[pos] != 0 + pos += 1 + return nil } -func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType { - return api.ReplyMessage + +// ACLStatsIntfCountersEnableReply represents VPP binary API message 'acl_stats_intf_counters_enable_reply'. +type ACLStatsIntfCountersEnableReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } -// MacipACLAdd represents VPP binary API message 'macip_acl_add'. -type MacipACLAdd struct { - Tag []byte `struc:"[64]byte"` - Count uint32 `struc:"sizeof=R"` - R []MacipACLRule +func (m *ACLStatsIntfCountersEnableReply) Reset() { *m = ACLStatsIntfCountersEnableReply{} } +func (*ACLStatsIntfCountersEnableReply) GetMessageName() string { + return "acl_stats_intf_counters_enable_reply" } +func (*ACLStatsIntfCountersEnableReply) GetCrcString() string { return "e8d4e804" } +func (*ACLStatsIntfCountersEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -func (*MacipACLAdd) GetMessageName() string { - return "macip_acl_add" +func (m *ACLStatsIntfCountersEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *ACLStatsIntfCountersEnableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *ACLStatsIntfCountersEnableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } -func (*MacipACLAdd) GetCrcString() string { - return "b3d3d65a" + +// MacipACLAdd represents VPP binary API message 'macip_acl_add'. +type MacipACLAdd struct { + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` } -func (*MacipACLAdd) GetMessageType() api.MessageType { - return api.RequestMessage + +func (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } +func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } +func (*MacipACLAdd) GetCrcString() string { return "0c680ca5" } +func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLAdd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcMac + size += 6 + // field[2] s1.SrcMacMask + size += 6 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + } + return size +} +func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 MacipACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcMac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMac) { + x = uint8(v1.SrcMac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcMacMask + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMacMask) { + x = uint8(v1.SrcMacMask[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + } + return buf, nil +} +func (m *MacipACLAdd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]MacipACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcMac + m.R[j1].SrcMac = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMac); i++ { + m.R[j1].SrcMac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcMacMask + m.R[j1].SrcMacMask = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMacMask); i++ { + m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + } + return nil } // MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. type MacipACLAddReplace struct { - ACLIndex uint32 - Tag []byte `struc:"[64]byte"` - Count uint32 `struc:"sizeof=R"` - R []MacipACLRule + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` } -func (*MacipACLAddReplace) GetMessageName() string { - return "macip_acl_add_replace" -} -func (*MacipACLAddReplace) GetCrcString() string { - return "a0e8c01b" -} -func (*MacipACLAddReplace) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } +func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } +func (*MacipACLAddReplace) GetCrcString() string { return "d3d313e7" } +func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLAddReplace) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcMac + size += 6 + // field[2] s1.SrcMacMask + size += 6 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + } + return size +} +func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 MacipACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcMac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMac) { + x = uint8(v1.SrcMac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcMacMask + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMacMask) { + x = uint8(v1.SrcMacMask[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + } + return buf, nil +} +func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]MacipACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcMac + m.R[j1].SrcMac = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMac); i++ { + m.R[j1].SrcMac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcMacMask + m.R[j1].SrcMacMask = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMacMask); i++ { + m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + } + return nil } // MacipACLAddReplaceReply represents VPP binary API message 'macip_acl_add_replace_reply'. type MacipACLAddReplaceReply struct { - ACLIndex uint32 - Retval int32 + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } -func (*MacipACLAddReplaceReply) GetMessageName() string { - return "macip_acl_add_replace_reply" -} -func (*MacipACLAddReplaceReply) GetCrcString() string { - return "ac407b0c" -} -func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *MacipACLAddReplaceReply) Reset() { *m = MacipACLAddReplaceReply{} } +func (*MacipACLAddReplaceReply) GetMessageName() string { return "macip_acl_add_replace_reply" } +func (*MacipACLAddReplaceReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLAddReplaceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLAddReplaceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLAddReplaceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // MacipACLAddReply represents VPP binary API message 'macip_acl_add_reply'. type MacipACLAddReply struct { - ACLIndex uint32 - Retval int32 + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } -func (*MacipACLAddReply) GetMessageName() string { - return "macip_acl_add_reply" -} -func (*MacipACLAddReply) GetCrcString() string { - return "ac407b0c" -} -func (*MacipACLAddReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *MacipACLAddReply) Reset() { *m = MacipACLAddReply{} } +func (*MacipACLAddReply) GetMessageName() string { return "macip_acl_add_reply" } +func (*MacipACLAddReply) GetCrcString() string { return "ac407b0c" } +func (*MacipACLAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLAddReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLAddReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLAddReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // MacipACLDel represents VPP binary API message 'macip_acl_del'. type MacipACLDel struct { - ACLIndex uint32 + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } -func (*MacipACLDel) GetMessageName() string { - return "macip_acl_del" -} -func (*MacipACLDel) GetCrcString() string { - return "ef34fea4" -} -func (*MacipACLDel) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *MacipACLDel) Reset() { *m = MacipACLDel{} } +func (*MacipACLDel) GetMessageName() string { return "macip_acl_del" } +func (*MacipACLDel) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *MacipACLDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // MacipACLDelReply represents VPP binary API message 'macip_acl_del_reply'. type MacipACLDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } -func (*MacipACLDelReply) GetMessageName() string { - return "macip_acl_del_reply" -} -func (*MacipACLDelReply) GetCrcString() string { - return "e8d4e804" -} -func (*MacipACLDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *MacipACLDelReply) Reset() { *m = MacipACLDelReply{} } +func (*MacipACLDelReply) GetMessageName() string { return "macip_acl_del_reply" } +func (*MacipACLDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // MacipACLDetails represents VPP binary API message 'macip_acl_details'. type MacipACLDetails struct { - ACLIndex uint32 - Tag []byte `struc:"[64]byte"` - Count uint32 `struc:"sizeof=R"` - R []MacipACLRule + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=R"` + R []MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"` } -func (*MacipACLDetails) GetMessageName() string { - return "macip_acl_details" -} -func (*MacipACLDetails) GetCrcString() string { - return "dd2b55ba" -} -func (*MacipACLDetails) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } +func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } +func (*MacipACLDetails) GetCrcString() string { return "e164e69a" } +func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + // field[1] m.Tag + size += 64 + // field[1] m.Count + size += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var s1 MacipACLRule + _ = s1 + if j1 < len(m.R) { + s1 = m.R[j1] + } + // field[2] s1.IsPermit + size += 1 + // field[2] s1.IsIPv6 + size += 1 + // field[2] s1.SrcMac + size += 6 + // field[2] s1.SrcMacMask + size += 6 + // field[2] s1.SrcIPAddr + size += 16 + // field[2] s1.SrcIPPrefixLen + size += 1 + } + return size +} +func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + // field[1] m.Tag + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.Tag) { + x = uint8(m.Tag[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) + pos += 4 + // field[1] m.R + for j1 := 0; j1 < len(m.R); j1++ { + var v1 MacipACLRule + if j1 < len(m.R) { + v1 = m.R[j1] + } + // field[2] v1.IsPermit + buf[pos] = uint8(v1.IsPermit) + pos += 1 + // field[2] v1.IsIPv6 + buf[pos] = uint8(v1.IsIPv6) + pos += 1 + // field[2] v1.SrcMac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMac) { + x = uint8(v1.SrcMac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcMacMask + for i := 0; i < 6; i++ { + var x uint8 + if i < len(v1.SrcMacMask) { + x = uint8(v1.SrcMacMask[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v1.SrcIPAddr) { + x = uint8(v1.SrcIPAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.SrcIPPrefixLen + buf[pos] = uint8(v1.SrcIPPrefixLen) + pos += 1 + } + return buf, nil +} +func (m *MacipACLDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + m.Tag = make([]uint8, 64) + for i := 0; i < len(m.Tag); i++ { + m.Tag[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.R + m.R = make([]MacipACLRule, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.R[j1].IsPermit + m.R[j1].IsPermit = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].IsIPv6 + m.R[j1].IsIPv6 = uint8(tmp[pos]) + pos += 1 + // field[2] m.R[j1].SrcMac + m.R[j1].SrcMac = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMac); i++ { + m.R[j1].SrcMac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcMacMask + m.R[j1].SrcMacMask = make([]uint8, 6) + for i := 0; i < len(m.R[j1].SrcMacMask); i++ { + m.R[j1].SrcMacMask[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPAddr + m.R[j1].SrcIPAddr = make([]uint8, 16) + for i := 0; i < len(m.R[j1].SrcIPAddr); i++ { + m.R[j1].SrcIPAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.R[j1].SrcIPPrefixLen + m.R[j1].SrcIPPrefixLen = uint8(tmp[pos]) + pos += 1 + } + return nil } // MacipACLDump represents VPP binary API message 'macip_acl_dump'. type MacipACLDump struct { - ACLIndex uint32 + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } -func (*MacipACLDump) GetMessageName() string { - return "macip_acl_dump" -} -func (*MacipACLDump) GetCrcString() string { - return "ef34fea4" -} -func (*MacipACLDump) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *MacipACLDump) Reset() { *m = MacipACLDump{} } +func (*MacipACLDump) GetMessageName() string { return "macip_acl_dump" } +func (*MacipACLDump) GetCrcString() string { return "ef34fea4" } +func (*MacipACLDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *MacipACLDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. type MacipACLInterfaceAddDel struct { - IsAdd uint8 - SwIfIndex uint32 - ACLIndex uint32 + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } -func (*MacipACLInterfaceAddDel) GetMessageName() string { - return "macip_acl_interface_add_del" -} -func (*MacipACLInterfaceAddDel) GetCrcString() string { - return "6a6be97c" -} -func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } +func (*MacipACLInterfaceAddDel) GetMessageName() string { return "macip_acl_interface_add_del" } +func (*MacipACLInterfaceAddDel) GetCrcString() string { return "6a6be97c" } +func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.ACLIndex + size += 4 + return size +} +func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + buf[pos] = uint8(m.IsAdd) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.ACLIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ACLIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ACLIndex + m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // MacipACLInterfaceAddDelReply represents VPP binary API message 'macip_acl_interface_add_del_reply'. type MacipACLInterfaceAddDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } +func (m *MacipACLInterfaceAddDelReply) Reset() { *m = MacipACLInterfaceAddDelReply{} } func (*MacipACLInterfaceAddDelReply) GetMessageName() string { return "macip_acl_interface_add_del_reply" } -func (*MacipACLInterfaceAddDelReply) GetCrcString() string { - return "e8d4e804" -} -func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (*MacipACLInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MacipACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MacipACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil } // MacipACLInterfaceGet represents VPP binary API message 'macip_acl_interface_get'. type MacipACLInterfaceGet struct{} -func (*MacipACLInterfaceGet) GetMessageName() string { - return "macip_acl_interface_get" -} -func (*MacipACLInterfaceGet) GetCrcString() string { - return "51077d14" +func (m *MacipACLInterfaceGet) Reset() { *m = MacipACLInterfaceGet{} } +func (*MacipACLInterfaceGet) GetMessageName() string { return "macip_acl_interface_get" } +func (*MacipACLInterfaceGet) GetCrcString() string { return "51077d14" } +func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *MacipACLInterfaceGet) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MacipACLInterfaceGet) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil } -func (*MacipACLInterfaceGet) GetMessageType() api.MessageType { - return api.RequestMessage +func (m *MacipACLInterfaceGet) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil } // MacipACLInterfaceGetReply represents VPP binary API message 'macip_acl_interface_get_reply'. type MacipACLInterfaceGetReply struct { - Count uint32 `struc:"sizeof=Acls"` - Acls []uint32 + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } -func (*MacipACLInterfaceGetReply) GetMessageName() string { - return "macip_acl_interface_get_reply" -} -func (*MacipACLInterfaceGetReply) GetCrcString() string { - return "accf9b05" -} -func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { - return api.ReplyMessage +func (m *MacipACLInterfaceGetReply) Reset() { *m = MacipACLInterfaceGetReply{} } +func (*MacipACLInterfaceGetReply) GetMessageName() string { return "macip_acl_interface_get_reply" } +func (*MacipACLInterfaceGetReply) GetCrcString() string { return "accf9b05" } +func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLInterfaceGetReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Count + size += 4 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *MacipACLInterfaceGetReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.Acls))) + pos += 4 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *MacipACLInterfaceGetReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil } // MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. type MacipACLInterfaceListDetails struct { - SwIfIndex uint32 - Count uint8 `struc:"sizeof=Acls"` - Acls []uint32 + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Count uint8 `binapi:"u8,name=count" json:"count,omitempty" struc:"sizeof=Acls"` + Acls []uint32 `binapi:"u32[count],name=acls" json:"acls,omitempty"` } +func (m *MacipACLInterfaceListDetails) Reset() { *m = MacipACLInterfaceListDetails{} } func (*MacipACLInterfaceListDetails) GetMessageName() string { return "macip_acl_interface_list_details" } -func (*MacipACLInterfaceListDetails) GetCrcString() string { - return "29783fa0" -} -func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { - return api.ReplyMessage +func (*MacipACLInterfaceListDetails) GetCrcString() string { return "29783fa0" } +func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *MacipACLInterfaceListDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Count + size += 1 + // field[1] m.Acls + size += 4 * len(m.Acls) + return size +} +func (m *MacipACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Count + buf[pos] = uint8(len(m.Acls)) + pos += 1 + // field[1] m.Acls + for i := 0; i < len(m.Acls); i++ { + var x uint32 + if i < len(m.Acls) { + x = uint32(m.Acls[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint8(tmp[pos]) + pos += 1 + // field[1] m.Acls + m.Acls = make([]uint32, m.Count) + for i := 0; i < len(m.Acls); i++ { + m.Acls[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil } // MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. type MacipACLInterfaceListDump struct { - SwIfIndex uint32 + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` } -func (*MacipACLInterfaceListDump) GetMessageName() string { - return "macip_acl_interface_list_dump" -} -func (*MacipACLInterfaceListDump) GetCrcString() string { - return "529cb13f" -} -func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { - return api.RequestMessage -} +func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } +func (*MacipACLInterfaceListDump) GetMessageName() string { return "macip_acl_interface_list_dump" } +func (*MacipACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } -func init() { +func (m *MacipACLInterfaceListDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *MacipACLInterfaceListDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *MacipACLInterfaceListDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_acl_binapi_init() } +func file_acl_binapi_init() { api.RegisterMessage((*ACLAddReplace)(nil), "acl.ACLAddReplace") api.RegisterMessage((*ACLAddReplaceReply)(nil), "acl.ACLAddReplaceReply") api.RegisterMessage((*ACLDel)(nil), "acl.ACLDel") @@ -665,6 +2811,8 @@ func init() { api.RegisterMessage((*ACLPluginGetConnTableMaxEntriesReply)(nil), "acl.ACLPluginGetConnTableMaxEntriesReply") api.RegisterMessage((*ACLPluginGetVersion)(nil), "acl.ACLPluginGetVersion") api.RegisterMessage((*ACLPluginGetVersionReply)(nil), "acl.ACLPluginGetVersionReply") + api.RegisterMessage((*ACLStatsIntfCountersEnable)(nil), "acl.ACLStatsIntfCountersEnable") + api.RegisterMessage((*ACLStatsIntfCountersEnableReply)(nil), "acl.ACLStatsIntfCountersEnableReply") api.RegisterMessage((*MacipACLAdd)(nil), "acl.MacipACLAdd") api.RegisterMessage((*MacipACLAddReplace)(nil), "acl.MacipACLAddReplace") api.RegisterMessage((*MacipACLAddReplaceReply)(nil), "acl.MacipACLAddReplaceReply") @@ -706,6 +2854,8 @@ func AllMessages() []api.Message { (*ACLPluginGetConnTableMaxEntriesReply)(nil), (*ACLPluginGetVersion)(nil), (*ACLPluginGetVersionReply)(nil), + (*ACLStatsIntfCountersEnable)(nil), + (*ACLStatsIntfCountersEnableReply)(nil), (*MacipACLAdd)(nil), (*MacipACLAddReplace)(nil), (*MacipACLAddReplaceReply)(nil), @@ -723,293 +2873,13 @@ func AllMessages() []api.Message { } } -// RPCService represents RPC service API for acl module. -type RPCService interface { - DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) - DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) - DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) - DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) - DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) - ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) - ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) - ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) - ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) - ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) - ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) - ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) - ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) - MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) - MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) - MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) - MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) - MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpACLClient{stream} - return x, nil -} - -type RPCService_DumpACLClient interface { - Recv() (*ACLDetails, error) -} - -type serviceClient_DumpACLClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpACLClient) Recv() (*ACLDetails, error) { - m := new(ACLDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpACLInterfaceEtypeWhitelistClient{stream} - return x, nil -} - -type RPCService_DumpACLInterfaceEtypeWhitelistClient interface { - Recv() (*ACLInterfaceEtypeWhitelistDetails, error) -} - -type serviceClient_DumpACLInterfaceEtypeWhitelistClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpACLInterfaceEtypeWhitelistClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { - m := new(ACLInterfaceEtypeWhitelistDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpACLInterfaceListClient{stream} - return x, nil -} - -type RPCService_DumpACLInterfaceListClient interface { - Recv() (*ACLInterfaceListDetails, error) -} - -type serviceClient_DumpACLInterfaceListClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpACLInterfaceListClient) Recv() (*ACLInterfaceListDetails, error) { - m := new(ACLInterfaceListDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMacipACLClient{stream} - return x, nil -} - -type RPCService_DumpMacipACLClient interface { - Recv() (*MacipACLDetails, error) -} - -type serviceClient_DumpMacipACLClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMacipACLClient) Recv() (*MacipACLDetails, error) { - m := new(MacipACLDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMacipACLInterfaceListClient{stream} - return x, nil -} - -type RPCService_DumpMacipACLInterfaceListClient interface { - Recv() (*MacipACLInterfaceListDetails, error) -} - -type serviceClient_DumpMacipACLInterfaceListClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMacipACLInterfaceListClient) Recv() (*MacipACLInterfaceListDetails, error) { - m := new(MacipACLInterfaceListDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { - out := new(ACLAddReplaceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { - out := new(ACLDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { - out := new(ACLInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { - out := new(ACLInterfaceSetACLListReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { - out := new(ACLInterfaceSetEtypeWhitelistReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { - out := new(ACLPluginControlPingReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { - out := new(ACLPluginGetConnTableMaxEntriesReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { - out := new(ACLPluginGetVersionReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { - out := new(MacipACLAddReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { - out := new(MacipACLAddReplaceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { - out := new(MacipACLDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { - out := new(MacipACLInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { - out := new(MacipACLInterfaceGetReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage +var _ = codec.DecodeString var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/acl/acl_rpc.ba.go b/examples/binapi/acl/acl_rpc.ba.go new file mode 100644 index 0000000..62b10c3 --- /dev/null +++ b/examples/binapi/acl/acl_rpc.ba.go @@ -0,0 +1,302 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package acl + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for acl module. +type RPCService interface { + DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) + DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) + DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) + DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) + DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) + ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) + ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) + ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) + ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) + ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) + ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) + ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) + ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) + ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) + MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) + MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) + MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) + MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) + MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpACL(ctx context.Context, in *ACLDump) (RPCService_DumpACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLClient{stream} + return x, nil +} + +type RPCService_DumpACLClient interface { + Recv() (*ACLDetails, error) +} + +type serviceClient_DumpACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLClient) Recv() (*ACLDetails, error) { + m := new(ACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceEtypeWhitelist(ctx context.Context, in *ACLInterfaceEtypeWhitelistDump) (RPCService_DumpACLInterfaceEtypeWhitelistClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceEtypeWhitelistClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceEtypeWhitelistClient interface { + Recv() (*ACLInterfaceEtypeWhitelistDetails, error) +} + +type serviceClient_DumpACLInterfaceEtypeWhitelistClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceEtypeWhitelistClient) Recv() (*ACLInterfaceEtypeWhitelistDetails, error) { + m := new(ACLInterfaceEtypeWhitelistDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpACLInterfaceList(ctx context.Context, in *ACLInterfaceListDump) (RPCService_DumpACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpACLInterfaceListClient interface { + Recv() (*ACLInterfaceListDetails, error) +} + +type serviceClient_DumpACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpACLInterfaceListClient) Recv() (*ACLInterfaceListDetails, error) { + m := new(ACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACL(ctx context.Context, in *MacipACLDump) (RPCService_DumpMacipACLClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLClient interface { + Recv() (*MacipACLDetails, error) +} + +type serviceClient_DumpMacipACLClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLClient) Recv() (*MacipACLDetails, error) { + m := new(MacipACLDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMacipACLInterfaceList(ctx context.Context, in *MacipACLInterfaceListDump) (RPCService_DumpMacipACLInterfaceListClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMacipACLInterfaceListClient{stream} + return x, nil +} + +type RPCService_DumpMacipACLInterfaceListClient interface { + Recv() (*MacipACLInterfaceListDetails, error) +} + +type serviceClient_DumpMacipACLInterfaceListClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMacipACLInterfaceListClient) Recv() (*MacipACLInterfaceListDetails, error) { + m := new(MacipACLInterfaceListDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) ACLAddReplace(ctx context.Context, in *ACLAddReplace) (*ACLAddReplaceReply, error) { + out := new(ACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLDel(ctx context.Context, in *ACLDel) (*ACLDelReply, error) { + out := new(ACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceAddDel(ctx context.Context, in *ACLInterfaceAddDel) (*ACLInterfaceAddDelReply, error) { + out := new(ACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetACLList(ctx context.Context, in *ACLInterfaceSetACLList) (*ACLInterfaceSetACLListReply, error) { + out := new(ACLInterfaceSetACLListReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLInterfaceSetEtypeWhitelist(ctx context.Context, in *ACLInterfaceSetEtypeWhitelist) (*ACLInterfaceSetEtypeWhitelistReply, error) { + out := new(ACLInterfaceSetEtypeWhitelistReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginControlPing(ctx context.Context, in *ACLPluginControlPing) (*ACLPluginControlPingReply, error) { + out := new(ACLPluginControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetConnTableMaxEntries(ctx context.Context, in *ACLPluginGetConnTableMaxEntries) (*ACLPluginGetConnTableMaxEntriesReply, error) { + out := new(ACLPluginGetConnTableMaxEntriesReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLPluginGetVersion(ctx context.Context, in *ACLPluginGetVersion) (*ACLPluginGetVersionReply, error) { + out := new(ACLPluginGetVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ACLStatsIntfCountersEnable(ctx context.Context, in *ACLStatsIntfCountersEnable) (*ACLStatsIntfCountersEnableReply, error) { + out := new(ACLStatsIntfCountersEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAdd(ctx context.Context, in *MacipACLAdd) (*MacipACLAddReply, error) { + out := new(MacipACLAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLAddReplace(ctx context.Context, in *MacipACLAddReplace) (*MacipACLAddReplaceReply, error) { + out := new(MacipACLAddReplaceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLDel(ctx context.Context, in *MacipACLDel) (*MacipACLDelReply, error) { + out := new(MacipACLDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceAddDel(ctx context.Context, in *MacipACLInterfaceAddDel) (*MacipACLInterfaceAddDelReply, error) { + out := new(MacipACLInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MacipACLInterfaceGet(ctx context.Context, in *MacipACLInterfaceGet) (*MacipACLInterfaceGetReply, error) { + out := new(MacipACLInterfaceGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/examples/binapi/af_packet/af_packet.ba.go b/examples/binapi/af_packet/af_packet.ba.go index 9660114..ab57c62 100644 --- a/examples/binapi/af_packet/af_packet.ba.go +++ b/examples/binapi/af_packet/af_packet.ba.go @@ -1,30 +1,38 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 // source: /usr/share/vpp/api/core/af_packet.api.json /* -Package af_packet is a generated VPP binary API for 'af_packet' module. +Package af_packet contains generated code for VPP binary API defined by af_packet.api (version 2.0.0). It consists of: - 6 enums 2 aliases + 6 enums 8 messages - 4 services */ package af_packet import ( "bytes" "context" + "encoding/binary" "io" + "math" "strconv" api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" - - ethernet_types "git.fd.io/govpp.git/examples/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" ) +// 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 // please upgrade the GoVPP api package + const ( // ModuleName is the name of this module. ModuleName = "af_packet" @@ -34,27 +42,230 @@ const ( VersionCrc = 0xba745e20 ) -type IfStatusFlags = interface_types.IfStatusFlags +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 -type IfType = interface_types.IfType +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) -type LinkDuplex = interface_types.LinkDuplex +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) -type MtuProto = interface_types.MtuProto +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} -type RxMode = interface_types.RxMode +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 -type SubIfFlags = interface_types.SubIfFlags +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) -type InterfaceIndex = interface_types.InterfaceIndex +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) -type MacAddress = ethernet_types.MacAddress +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} + +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} + +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} + +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 + +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 // AfPacketCreate represents VPP binary API message 'af_packet_create'. type AfPacketCreate struct { - HwAddr MacAddress - UseRandomHwAddr bool - HostIfName string `struc:"[64]byte"` + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` } func (m *AfPacketCreate) Reset() { *m = AfPacketCreate{} } @@ -62,10 +273,75 @@ func (*AfPacketCreate) GetMessageName() string { return "af_packet_crea func (*AfPacketCreate) GetCrcString() string { return "a190415f" } func (*AfPacketCreate) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *AfPacketCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HwAddr + size += 6 + // field[1] m.UseRandomHwAddr + size += 1 + // field[1] m.HostIfName + size += 64 + return size +} +func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HwAddr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.HwAddr) { + x = uint8(m.HwAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.UseRandomHwAddr + if m.UseRandomHwAddr { + buf[pos] = 1 + } + pos += 1 + // field[1] m.HostIfName + copy(buf[pos:pos+64], m.HostIfName) + pos += 64 + return buf, nil +} +func (m *AfPacketCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HwAddr + for i := 0; i < len(m.HwAddr); i++ { + m.HwAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.UseRandomHwAddr + m.UseRandomHwAddr = tmp[pos] != 0 + pos += 1 + // field[1] m.HostIfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'. type AfPacketCreateReply struct { - Retval int32 - SwIfIndex InterfaceIndex + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *AfPacketCreateReply) Reset() { *m = AfPacketCreateReply{} } @@ -73,9 +349,53 @@ func (*AfPacketCreateReply) GetMessageName() string { return "af_packet func (*AfPacketCreateReply) GetCrcString() string { return "5383d31f" } func (*AfPacketCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *AfPacketCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *AfPacketCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // AfPacketDelete represents VPP binary API message 'af_packet_delete'. type AfPacketDelete struct { - HostIfName string `struc:"[64]byte"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` } func (m *AfPacketDelete) Reset() { *m = AfPacketDelete{} } @@ -83,9 +403,48 @@ func (*AfPacketDelete) GetMessageName() string { return "af_packet_dele func (*AfPacketDelete) GetCrcString() string { return "863fa648" } func (*AfPacketDelete) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *AfPacketDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HostIfName + size += 64 + return size +} +func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HostIfName + copy(buf[pos:pos+64], m.HostIfName) + pos += 64 + return buf, nil +} +func (m *AfPacketDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HostIfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply'. type AfPacketDeleteReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *AfPacketDeleteReply) Reset() { *m = AfPacketDeleteReply{} } @@ -93,10 +452,46 @@ func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet func (*AfPacketDeleteReply) GetCrcString() string { return "e8d4e804" } func (*AfPacketDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *AfPacketDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *AfPacketDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // AfPacketDetails represents VPP binary API message 'af_packet_details'. type AfPacketDetails struct { - SwIfIndex InterfaceIndex - HostIfName string `struc:"[64]byte"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"` } func (m *AfPacketDetails) Reset() { *m = AfPacketDetails{} } @@ -104,6 +499,53 @@ func (*AfPacketDetails) GetMessageName() string { return "af_packet_det func (*AfPacketDetails) GetCrcString() string { return "58c7c042" } func (*AfPacketDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *AfPacketDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.HostIfName + size += 64 + return size +} +func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.HostIfName + copy(buf[pos:pos+64], m.HostIfName) + pos += 64 + return buf, nil +} +func (m *AfPacketDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.HostIfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.HostIfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // AfPacketDump represents VPP binary API message 'af_packet_dump'. type AfPacketDump struct{} @@ -112,10 +554,38 @@ func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" func (*AfPacketDump) GetCrcString() string { return "51077d14" } func (*AfPacketDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *AfPacketDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *AfPacketDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'. type AfPacketSetL4CksumOffload struct { - SwIfIndex InterfaceIndex - Set bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Set bool `binapi:"bool,name=set" json:"set,omitempty"` } func (m *AfPacketSetL4CksumOffload) Reset() { *m = AfPacketSetL4CksumOffload{} } @@ -123,9 +593,55 @@ func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_ func (*AfPacketSetL4CksumOffload) GetCrcString() string { return "319cd5c8" } func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *AfPacketSetL4CksumOffload) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Set + size += 1 + return size +} +func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Set + if m.Set { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *AfPacketSetL4CksumOffload) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Set + m.Set = tmp[pos] != 0 + pos += 1 + return nil +} + // AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply'. type AfPacketSetL4CksumOffloadReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} } @@ -135,7 +651,44 @@ func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string { func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" } func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { return api.ReplyMessage } -func init() { +func (m *AfPacketSetL4CksumOffloadReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_af_packet_binapi_init() } +func file_af_packet_binapi_init() { api.RegisterMessage((*AfPacketCreate)(nil), "af_packet.AfPacketCreate") api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet.AfPacketCreateReply") api.RegisterMessage((*AfPacketDelete)(nil), "af_packet.AfPacketDelete") @@ -160,85 +713,13 @@ func AllMessages() []api.Message { } } -// RPCService represents RPC service API for af_packet module. -type RPCService interface { - DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) - AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) - AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) - AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpAfPacketClient{stream} - return x, nil -} - -type RPCService_DumpAfPacketClient interface { - Recv() (*AfPacketDetails, error) -} - -type serviceClient_DumpAfPacketClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpAfPacketClient) Recv() (*AfPacketDetails, error) { - m := new(AfPacketDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { - out := new(AfPacketCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { - out := new(AfPacketDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { - out := new(AfPacketSetL4CksumOffloadReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage +var _ = codec.DecodeString var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/af_packet/af_packet_rpc.ba.go b/examples/binapi/af_packet/af_packet_rpc.ba.go new file mode 100644 index 0000000..d2df47a --- /dev/null +++ b/examples/binapi/af_packet/af_packet_rpc.ba.go @@ -0,0 +1,84 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package af_packet + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for af_packet module. +type RPCService interface { + DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) + AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) + AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpAfPacket(ctx context.Context, in *AfPacketDump) (RPCService_DumpAfPacketClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpAfPacketClient{stream} + return x, nil +} + +type RPCService_DumpAfPacketClient interface { + Recv() (*AfPacketDetails, error) +} + +type serviceClient_DumpAfPacketClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpAfPacketClient) Recv() (*AfPacketDetails, error) { + m := new(AfPacketDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) { + out := new(AfPacketCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { + out := new(AfPacketDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) { + out := new(AfPacketSetL4CksumOffloadReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/examples/binapi/ethernet_types/ethernet_types.ba.go b/examples/binapi/ethernet_types/ethernet_types.ba.go deleted file mode 100644 index fffa6b1..0000000 --- a/examples/binapi/ethernet_types/ethernet_types.ba.go +++ /dev/null @@ -1,44 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/ethernet_types.api.json - -/* -Package ethernet_types is a generated VPP binary API for 'ethernet_types' module. - -It consists of: - 1 alias -*/ -package ethernet_types - -import ( - "bytes" - "context" - "io" - "strconv" - - api "git.fd.io/govpp.git/api" - struc "github.com/lunixbochs/struc" -) - -const ( - // ModuleName is the name of this module. - ModuleName = "ethernet_types" - // VersionCrc is the CRC of this module. - VersionCrc = 0xd4ff2808 -) - -// MacAddress represents VPP binary API alias 'mac_address'. -type MacAddress [6]uint8 - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack diff --git a/examples/binapi/fib_types/fib_types.ba.go b/examples/binapi/fib_types/fib_types.ba.go new file mode 100644 index 0000000..dd725b6 --- /dev/null +++ b/examples/binapi/fib_types/fib_types.ba.go @@ -0,0 +1,522 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/fib_types.api.json + +/* +Package fib_types contains generated code for VPP binary API defined by fib_types.api (version 2.0.0). + +It consists of: + 5 aliases + 7 enums + 9 types + 1 union +*/ +package fib_types + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// 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 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "fib_types" + // APIVersion is the API version of this module. + APIVersion = "2.0.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0x57387845 +) + +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var ( + AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", + } + AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, + } +) + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return "AddressFamily(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathFlags represents VPP binary API enum 'fib_path_flags'. +type FibPathFlags uint32 + +const ( + FIB_API_PATH_FLAG_NONE FibPathFlags = 0 + FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1 + FIB_API_PATH_FLAG_RESOLVE_VIA_HOST FibPathFlags = 2 + FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 +) + +var ( + FibPathFlags_name = map[uint32]string{ + 0: "FIB_API_PATH_FLAG_NONE", + 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", + 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", + 4: "FIB_API_PATH_FLAG_POP_PW_CW", + } + FibPathFlags_value = map[string]uint32{ + "FIB_API_PATH_FLAG_NONE": 0, + "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, + "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, + "FIB_API_PATH_FLAG_POP_PW_CW": 4, + } +) + +func (x FibPathFlags) String() string { + s, ok := FibPathFlags_name[uint32(x)] + if ok { + return s + } + return "FibPathFlags(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. +type FibPathNhProto uint32 + +const ( + FIB_API_PATH_NH_PROTO_IP4 FibPathNhProto = 0 + FIB_API_PATH_NH_PROTO_IP6 FibPathNhProto = 1 + FIB_API_PATH_NH_PROTO_MPLS FibPathNhProto = 2 + FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3 + FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 +) + +var ( + FibPathNhProto_name = map[uint32]string{ + 0: "FIB_API_PATH_NH_PROTO_IP4", + 1: "FIB_API_PATH_NH_PROTO_IP6", + 2: "FIB_API_PATH_NH_PROTO_MPLS", + 3: "FIB_API_PATH_NH_PROTO_ETHERNET", + 4: "FIB_API_PATH_NH_PROTO_BIER", + } + FibPathNhProto_value = map[string]uint32{ + "FIB_API_PATH_NH_PROTO_IP4": 0, + "FIB_API_PATH_NH_PROTO_IP6": 1, + "FIB_API_PATH_NH_PROTO_MPLS": 2, + "FIB_API_PATH_NH_PROTO_ETHERNET": 3, + "FIB_API_PATH_NH_PROTO_BIER": 4, + } +) + +func (x FibPathNhProto) String() string { + s, ok := FibPathNhProto_name[uint32(x)] + if ok { + return s + } + return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")" +} + +// FibPathType represents VPP binary API enum 'fib_path_type'. +type FibPathType uint32 + +const ( + FIB_API_PATH_TYPE_NORMAL FibPathType = 0 + FIB_API_PATH_TYPE_LOCAL FibPathType = 1 + FIB_API_PATH_TYPE_DROP FibPathType = 2 + FIB_API_PATH_TYPE_UDP_ENCAP FibPathType = 3 + FIB_API_PATH_TYPE_BIER_IMP FibPathType = 4 + FIB_API_PATH_TYPE_ICMP_UNREACH FibPathType = 5 + FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6 + FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7 + FIB_API_PATH_TYPE_DVR FibPathType = 8 + FIB_API_PATH_TYPE_INTERFACE_RX FibPathType = 9 + FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 +) + +var ( + FibPathType_name = map[uint32]string{ + 0: "FIB_API_PATH_TYPE_NORMAL", + 1: "FIB_API_PATH_TYPE_LOCAL", + 2: "FIB_API_PATH_TYPE_DROP", + 3: "FIB_API_PATH_TYPE_UDP_ENCAP", + 4: "FIB_API_PATH_TYPE_BIER_IMP", + 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", + 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", + 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", + 8: "FIB_API_PATH_TYPE_DVR", + 9: "FIB_API_PATH_TYPE_INTERFACE_RX", + 10: "FIB_API_PATH_TYPE_CLASSIFY", + } + FibPathType_value = map[string]uint32{ + "FIB_API_PATH_TYPE_NORMAL": 0, + "FIB_API_PATH_TYPE_LOCAL": 1, + "FIB_API_PATH_TYPE_DROP": 2, + "FIB_API_PATH_TYPE_UDP_ENCAP": 3, + "FIB_API_PATH_TYPE_BIER_IMP": 4, + "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, + "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, + "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, + "FIB_API_PATH_TYPE_DVR": 8, + "FIB_API_PATH_TYPE_INTERFACE_RX": 9, + "FIB_API_PATH_TYPE_CLASSIFY": 10, + } +) + +func (x FibPathType) String() string { + s, ok := FibPathType_name[uint32(x)] + if ok { + return s + } + return "FibPathType(" + strconv.Itoa(int(x)) + ")" +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var ( + IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", + } + IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, + } +) + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return "IPDscp(" + strconv.Itoa(int(x)) + ")" +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var ( + IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", + } + IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, + } +) + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return "IPEcn(" + strconv.Itoa(int(x)) + ")" +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var ( + IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", + } + IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, + } +) + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return "IPProto(" + strconv.Itoa(int(x)) + ")" +} + +// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. +type AddressWithPrefix Prefix + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. +type IP4AddressWithPrefix IP4Prefix + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. +type IP6AddressWithPrefix IP6Prefix + +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` +} + +func (*Address) GetTypeName() string { return "address" } + +// FibMplsLabel represents VPP binary API type 'fib_mpls_label'. +type FibMplsLabel struct { + IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"` + Label uint32 `binapi:"u32,name=label" json:"label,omitempty"` + TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` + Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"` +} + +func (*FibMplsLabel) GetTypeName() string { return "fib_mpls_label" } + +// FibPath represents VPP binary API type 'fib_path'. +type FibPath struct { + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` + Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` + Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"` + Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"` + Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"` + Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"` + NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"` + LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty" struc:"[16]FibMplsLabel"` +} + +func (*FibPath) GetTypeName() string { return "fib_path" } + +// FibPathNh represents VPP binary API type 'fib_path_nh'. +type FibPathNh struct { + Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` + ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` + ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` + ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` +} + +func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` +} + +func (*Mprefix) GetTypeName() string { return "mprefix" } + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*Prefix) GetTypeName() string { return "prefix" } + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` +} + +func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { return "address_union" } + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/gen.go b/examples/binapi/gen.go index 7c2030c..a19ca34 100644 --- a/examples/binapi/gen.go +++ b/examples/binapi/gen.go @@ -2,19 +2,4 @@ package binapi // Generate Go code from the VPP APIs located in the /usr/share/vpp/api directory. -//go:generate binapi-generator --output-dir=. --input-file=/usr/share/vpp/api/core/ethernet_types.api.json -//go:generate binapi-generator --output-dir=. --input-file=/usr/share/vpp/api/core/interface_types.api.json -//go:generate binapi-generator --output-dir=. --input-file=/usr/share/vpp/api/core/ip_types.api.json -//go:generate binapi-generator --output-dir=. --input-file=/usr/share/vpp/api/core/vpe_types.api.json - -//go:generate -command binapigen binapi-generator --output-dir=. --import-prefix=git.fd.io/govpp.git/examples/binapi --input-types=/usr/share/vpp/api/core/ethernet_types.api.json,/usr/share/vpp/api/core/ip_types.api.json,/usr/share/vpp/api/core/interface_types.api.json,/usr/share/vpp/api/core/vpe_types.api.json - -//go:generate binapigen --input-file=/usr/share/vpp/api/core/af_packet.api.json -//go:generate binapigen --input-file=/usr/share/vpp/api/core/interface.api.json -//go:generate binapigen --input-file=/usr/share/vpp/api/core/ip.api.json -//go:generate binapigen --input-file=/usr/share/vpp/api/core/memclnt.api.json -//go:generate binapigen --input-file=/usr/share/vpp/api/core/vpe.api.json -//go:generate binapigen --input-file=/usr/share/vpp/api/plugins/memif.api.json - -// VPP version -///go:generate sh -c "dpkg-query -f '$DOLLAR{Version}' -W vpp > VPP_VERSION" +//go:generate binapi-generator --import-prefix=git.fd.io/govpp.git/examples/binapi af_packet interface ip memclnt vpe sr acl memif ip_types fib_types diff --git a/examples/binapi/interface_types/interface_types.ba.go b/examples/binapi/interface_types/interface_types.ba.go deleted file mode 100644 index a9a34d1..0000000 --- a/examples/binapi/interface_types/interface_types.ba.go +++ /dev/null @@ -1,252 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/interface_types.api.json - -/* -Package interface_types is a generated VPP binary API for 'interface_types' module. - -It consists of: - 6 enums - 1 alias -*/ -package interface_types - -import ( - "bytes" - "context" - "io" - "strconv" - - api "git.fd.io/govpp.git/api" - struc "github.com/lunixbochs/struc" -) - -const ( - // ModuleName is the name of this module. - ModuleName = "interface_types" - // VersionCrc is the CRC of this module. - VersionCrc = 0xc97be83d -) - -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. -type IfStatusFlags uint32 - -const ( - IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 - IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 -) - -var IfStatusFlags_name = map[uint32]string{ - 1: "IF_STATUS_API_FLAG_ADMIN_UP", - 2: "IF_STATUS_API_FLAG_LINK_UP", -} - -var IfStatusFlags_value = map[string]uint32{ - "IF_STATUS_API_FLAG_ADMIN_UP": 1, - "IF_STATUS_API_FLAG_LINK_UP": 2, -} - -func (x IfStatusFlags) String() string { - s, ok := IfStatusFlags_name[uint32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} - -// IfType represents VPP binary API enum 'if_type'. -type IfType uint32 - -const ( - IF_API_TYPE_HARDWARE IfType = 1 - IF_API_TYPE_SUB IfType = 2 - IF_API_TYPE_P2P IfType = 3 - IF_API_TYPE_PIPE IfType = 4 -) - -var IfType_name = map[uint32]string{ - 1: "IF_API_TYPE_HARDWARE", - 2: "IF_API_TYPE_SUB", - 3: "IF_API_TYPE_P2P", - 4: "IF_API_TYPE_PIPE", -} - -var IfType_value = map[string]uint32{ - "IF_API_TYPE_HARDWARE": 1, - "IF_API_TYPE_SUB": 2, - "IF_API_TYPE_P2P": 3, - "IF_API_TYPE_PIPE": 4, -} - -func (x IfType) String() string { - s, ok := IfType_name[uint32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} - -// LinkDuplex represents VPP binary API enum 'link_duplex'. -type LinkDuplex uint32 - -const ( - LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 - LINK_DUPLEX_API_HALF LinkDuplex = 1 - LINK_DUPLEX_API_FULL LinkDuplex = 2 -) - -var LinkDuplex_name = map[uint32]string{ - 0: "LINK_DUPLEX_API_UNKNOWN", - 1: "LINK_DUPLEX_API_HALF", - 2: "LINK_DUPLEX_API_FULL", -} - -var LinkDuplex_value = map[string]uint32{ - "LINK_DUPLEX_API_UNKNOWN": 0, - "LINK_DUPLEX_API_HALF": 1, - "LINK_DUPLEX_API_FULL": 2, -} - -func (x LinkDuplex) String() string { - s, ok := LinkDuplex_name[uint32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} - -// MtuProto represents VPP binary API enum 'mtu_proto'. -type MtuProto uint32 - -const ( - MTU_PROTO_API_L3 MtuProto = 1 - MTU_PROTO_API_IP4 MtuProto = 2 - MTU_PROTO_API_IP6 MtuProto = 3 - MTU_PROTO_API_MPLS MtuProto = 4 - MTU_PROTO_API_N MtuProto = 5 -) - -var MtuProto_name = map[uint32]string{ - 1: "MTU_PROTO_API_L3", - 2: "MTU_PROTO_API_IP4", - 3: "MTU_PROTO_API_IP6", - 4: "MTU_PROTO_API_MPLS", - 5: "MTU_PROTO_API_N", -} - -var MtuProto_value = map[string]uint32{ - "MTU_PROTO_API_L3": 1, - "MTU_PROTO_API_IP4": 2, - "MTU_PROTO_API_IP6": 3, - "MTU_PROTO_API_MPLS": 4, - "MTU_PROTO_API_N": 5, -} - -func (x MtuProto) String() string { - s, ok := MtuProto_name[uint32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} - -// RxMode represents VPP binary API enum 'rx_mode'. -type RxMode uint32 - -const ( - RX_MODE_API_UNKNOWN RxMode = 0 - RX_MODE_API_POLLING RxMode = 1 - RX_MODE_API_INTERRUPT RxMode = 2 - RX_MODE_API_ADAPTIVE RxMode = 3 - RX_MODE_API_DEFAULT RxMode = 4 -) - -var RxMode_name = map[uint32]string{ - 0: "RX_MODE_API_UNKNOWN", - 1: "RX_MODE_API_POLLING", - 2: "RX_MODE_API_INTERRUPT", - 3: "RX_MODE_API_ADAPTIVE", - 4: "RX_MODE_API_DEFAULT", -} - -var RxMode_value = map[string]uint32{ - "RX_MODE_API_UNKNOWN": 0, - "RX_MODE_API_POLLING": 1, - "RX_MODE_API_INTERRUPT": 2, - "RX_MODE_API_ADAPTIVE": 3, - "RX_MODE_API_DEFAULT": 4, -} - -func (x RxMode) String() string { - s, ok := RxMode_name[uint32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} - -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. -type SubIfFlags uint32 - -const ( - SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 - SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 - SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 - SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 - SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 - SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 - SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 - SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 - SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 - SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 -) - -var SubIfFlags_name = map[uint32]string{ - 1: "SUB_IF_API_FLAG_NO_TAGS", - 2: "SUB_IF_API_FLAG_ONE_TAG", - 4: "SUB_IF_API_FLAG_TWO_TAGS", - 8: "SUB_IF_API_FLAG_DOT1AD", - 16: "SUB_IF_API_FLAG_EXACT_MATCH", - 32: "SUB_IF_API_FLAG_DEFAULT", - 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", - 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", - 254: "SUB_IF_API_FLAG_MASK_VNET", - 256: "SUB_IF_API_FLAG_DOT1AH", -} - -var SubIfFlags_value = map[string]uint32{ - "SUB_IF_API_FLAG_NO_TAGS": 1, - "SUB_IF_API_FLAG_ONE_TAG": 2, - "SUB_IF_API_FLAG_TWO_TAGS": 4, - "SUB_IF_API_FLAG_DOT1AD": 8, - "SUB_IF_API_FLAG_EXACT_MATCH": 16, - "SUB_IF_API_FLAG_DEFAULT": 32, - "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, - "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, - "SUB_IF_API_FLAG_MASK_VNET": 254, - "SUB_IF_API_FLAG_DOT1AH": 256, -} - -func (x SubIfFlags) String() string { - s, ok := SubIfFlags_name[uint32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} - -// InterfaceIndex represents VPP binary API alias 'interface_index'. -type InterfaceIndex uint32 - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack diff --git a/examples/binapi/interfaces/interfaces.ba.go b/examples/binapi/interfaces/interfaces.ba.go index 7d4031f..82e8f3c 100644 --- a/examples/binapi/interfaces/interfaces.ba.go +++ b/examples/binapi/interfaces/interfaces.ba.go @@ -1,33 +1,40 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 // source: /usr/share/vpp/api/core/interface.api.json /* -Package interfaces is a generated VPP binary API for 'interface' module. +Package interfaces contains generated code for VPP binary API defined by interface.api (version 3.2.2). It consists of: - 10 enums 7 aliases + 10 enums + 53 messages 6 types 1 union - 53 messages - 26 services */ package interfaces import ( "bytes" "context" + "encoding/binary" "io" + "math" "strconv" api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" - - ethernet_types "git.fd.io/govpp.git/examples/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" - ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" ) +// 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 // please upgrade the GoVPP api package + const ( // ModuleName is the name of this module. ModuleName = "interface" @@ -37,58 +44,536 @@ const ( VersionCrc = 0xfebc3ffa ) -type AddressFamily = ip_types.AddressFamily +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var ( + AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", + } + AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, + } +) + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return "AddressFamily(" + strconv.Itoa(int(x)) + ")" +} + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 + +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) + +var ( + IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", + } + IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, + } +) + +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return "IPDscp(" + strconv.Itoa(int(x)) + ")" +} + +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var ( + IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", + } + IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, + } +) + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return "IPEcn(" + strconv.Itoa(int(x)) + ")" +} -type IfStatusFlags = interface_types.IfStatusFlags +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 -type IfType = interface_types.IfType +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) -type IPDscp = ip_types.IPDscp +var ( + IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", + } + IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, + } +) -type IPEcn = ip_types.IPEcn +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return "IPProto(" + strconv.Itoa(int(x)) + ")" +} -type IPProto = ip_types.IPProto +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 -type LinkDuplex = interface_types.LinkDuplex +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) -type MtuProto = interface_types.MtuProto +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) -type RxMode = interface_types.RxMode +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} -type SubIfFlags = interface_types.SubIfFlags +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 -type AddressWithPrefix = ip_types.AddressWithPrefix +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) -type InterfaceIndex = interface_types.InterfaceIndex +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) -type IP4Address = ip_types.IP4Address +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" +} -type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 -type IP6Address = ip_types.IP6Address +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) -type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) -type MacAddress = ethernet_types.MacAddress +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] + if ok { + return s + } + return "RxMode(" + strconv.Itoa(int(x)) + ")" +} -type Address = ip_types.Address +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 -type IP4Prefix = ip_types.IP4Prefix +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} + +// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. +type AddressWithPrefix Prefix + +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 + +// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. +type IP4AddressWithPrefix IP4Prefix + +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 + +// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. +type IP6AddressWithPrefix IP6Prefix -type IP6Prefix = ip_types.IP6Prefix +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 -type Mprefix = ip_types.Mprefix +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` +} + +func (*Address) GetTypeName() string { return "address" } + +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} -type Prefix = ip_types.Prefix +func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } -type PrefixMatcher = ip_types.PrefixMatcher +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } + +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` +} -type AddressUnion = ip_types.AddressUnion +func (*Mprefix) GetTypeName() string { return "mprefix" } + +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*Prefix) GetTypeName() string { return "prefix" } + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` +} + +func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } + +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { return "address_union" } + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} // CollectDetailedInterfaceStats represents VPP binary API message 'collect_detailed_interface_stats'. type CollectDetailedInterfaceStats struct { - SwIfIndex InterfaceIndex - EnableDisable bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` } func (m *CollectDetailedInterfaceStats) Reset() { *m = CollectDetailedInterfaceStats{} } @@ -98,9 +583,55 @@ func (*CollectDetailedInterfaceStats) GetMessageName() string { func (*CollectDetailedInterfaceStats) GetCrcString() string { return "5501adee" } func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *CollectDetailedInterfaceStats) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.EnableDisable + size += 1 + return size +} +func (m *CollectDetailedInterfaceStats) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.EnableDisable + if m.EnableDisable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *CollectDetailedInterfaceStats) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.EnableDisable + m.EnableDisable = tmp[pos] != 0 + pos += 1 + return nil +} + // CollectDetailedInterfaceStatsReply represents VPP binary API message 'collect_detailed_interface_stats_reply'. type CollectDetailedInterfaceStatsReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *CollectDetailedInterfaceStatsReply) Reset() { *m = CollectDetailedInterfaceStatsReply{} } @@ -110,9 +641,45 @@ func (*CollectDetailedInterfaceStatsReply) GetMessageName() string { func (*CollectDetailedInterfaceStatsReply) GetCrcString() string { return "e8d4e804" } func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *CollectDetailedInterfaceStatsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *CollectDetailedInterfaceStatsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *CollectDetailedInterfaceStatsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // CreateLoopback represents VPP binary API message 'create_loopback'. type CreateLoopback struct { - MacAddress MacAddress + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` } func (m *CreateLoopback) Reset() { *m = CreateLoopback{} } @@ -120,11 +687,55 @@ func (*CreateLoopback) GetMessageName() string { return "create_loopbac func (*CreateLoopback) GetCrcString() string { return "42bb5d22" } func (*CreateLoopback) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *CreateLoopback) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.MacAddress + size += 6 + return size +} +func (m *CreateLoopback) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *CreateLoopback) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + // CreateLoopbackInstance represents VPP binary API message 'create_loopback_instance'. type CreateLoopbackInstance struct { - MacAddress MacAddress - IsSpecified bool - UserInstance uint32 + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` + IsSpecified bool `binapi:"bool,name=is_specified" json:"is_specified,omitempty"` + UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"` } func (m *CreateLoopbackInstance) Reset() { *m = CreateLoopbackInstance{} } @@ -132,10 +743,72 @@ func (*CreateLoopbackInstance) GetMessageName() string { return "create func (*CreateLoopbackInstance) GetCrcString() string { return "d36a3ee2" } func (*CreateLoopbackInstance) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *CreateLoopbackInstance) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.MacAddress + size += 6 + // field[1] m.IsSpecified + size += 1 + // field[1] m.UserInstance + size += 4 + return size +} +func (m *CreateLoopbackInstance) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.IsSpecified + if m.IsSpecified { + buf[pos] = 1 + } + pos += 1 + // field[1] m.UserInstance + o.PutUint32(buf[pos:pos+4], uint32(m.UserInstance)) + pos += 4 + return buf, nil +} +func (m *CreateLoopbackInstance) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.IsSpecified + m.IsSpecified = tmp[pos] != 0 + pos += 1 + // field[1] m.UserInstance + m.UserInstance = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // CreateLoopbackInstanceReply represents VPP binary API message 'create_loopback_instance_reply'. type CreateLoopbackInstanceReply struct { - Retval int32 - SwIfIndex InterfaceIndex + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *CreateLoopbackInstanceReply) Reset() { *m = CreateLoopbackInstanceReply{} } @@ -143,10 +816,54 @@ func (*CreateLoopbackInstanceReply) GetMessageName() string { return "c func (*CreateLoopbackInstanceReply) GetCrcString() string { return "5383d31f" } func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *CreateLoopbackInstanceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateLoopbackInstanceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateLoopbackInstanceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // CreateLoopbackReply represents VPP binary API message 'create_loopback_reply'. type CreateLoopbackReply struct { - Retval int32 - SwIfIndex InterfaceIndex + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *CreateLoopbackReply) Reset() { *m = CreateLoopbackReply{} } @@ -154,13 +871,57 @@ func (*CreateLoopbackReply) GetMessageName() string { return "create_lo func (*CreateLoopbackReply) GetCrcString() string { return "5383d31f" } func (*CreateLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *CreateLoopbackReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateLoopbackReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateLoopbackReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // CreateSubif represents VPP binary API message 'create_subif'. type CreateSubif struct { - SwIfIndex InterfaceIndex - SubID uint32 - SubIfFlags SubIfFlags - OuterVlanID uint16 - InnerVlanID uint16 + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + OuterVlanID uint16 `binapi:"u16,name=outer_vlan_id" json:"outer_vlan_id,omitempty"` + InnerVlanID uint16 `binapi:"u16,name=inner_vlan_id" json:"inner_vlan_id,omitempty"` } func (m *CreateSubif) Reset() { *m = CreateSubif{} } @@ -168,10 +929,78 @@ func (*CreateSubif) GetMessageName() string { return "create_subif" } func (*CreateSubif) GetCrcString() string { return "cb371063" } func (*CreateSubif) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *CreateSubif) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.SubID + size += 4 + // field[1] m.SubIfFlags + size += 4 + // field[1] m.OuterVlanID + size += 2 + // field[1] m.InnerVlanID + size += 2 + return size +} +func (m *CreateSubif) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.SubID + o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) + pos += 4 + // field[1] m.SubIfFlags + o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) + pos += 4 + // field[1] m.OuterVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.OuterVlanID)) + pos += 2 + // field[1] m.InnerVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.InnerVlanID)) + pos += 2 + return buf, nil +} +func (m *CreateSubif) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SubID + m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SubIfFlags + m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.OuterVlanID + m.OuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.InnerVlanID + m.InnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + // CreateSubifReply represents VPP binary API message 'create_subif_reply'. type CreateSubifReply struct { - Retval int32 - SwIfIndex InterfaceIndex + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *CreateSubifReply) Reset() { *m = CreateSubifReply{} } @@ -179,10 +1008,54 @@ func (*CreateSubifReply) GetMessageName() string { return "create_subif func (*CreateSubifReply) GetCrcString() string { return "5383d31f" } func (*CreateSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *CreateSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateSubifReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateSubifReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // CreateVlanSubif represents VPP binary API message 'create_vlan_subif'. type CreateVlanSubif struct { - SwIfIndex InterfaceIndex - VlanID uint32 + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanID uint32 `binapi:"u32,name=vlan_id" json:"vlan_id,omitempty"` } func (m *CreateVlanSubif) Reset() { *m = CreateVlanSubif{} } @@ -190,10 +1063,54 @@ func (*CreateVlanSubif) GetMessageName() string { return "create_vlan_s func (*CreateVlanSubif) GetCrcString() string { return "af34ac8b" } func (*CreateVlanSubif) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *CreateVlanSubif) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.VlanID + size += 4 + return size +} +func (m *CreateVlanSubif) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.VlanID + o.PutUint32(buf[pos:pos+4], uint32(m.VlanID)) + pos += 4 + return buf, nil +} +func (m *CreateVlanSubif) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanID + m.VlanID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // CreateVlanSubifReply represents VPP binary API message 'create_vlan_subif_reply'. type CreateVlanSubifReply struct { - Retval int32 - SwIfIndex InterfaceIndex + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *CreateVlanSubifReply) Reset() { *m = CreateVlanSubifReply{} } @@ -201,9 +1118,53 @@ func (*CreateVlanSubifReply) GetMessageName() string { return "create_v func (*CreateVlanSubifReply) GetCrcString() string { return "5383d31f" } func (*CreateVlanSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *CreateVlanSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *CreateVlanSubifReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *CreateVlanSubifReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // DeleteLoopback represents VPP binary API message 'delete_loopback'. type DeleteLoopback struct { - SwIfIndex InterfaceIndex + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *DeleteLoopback) Reset() { *m = DeleteLoopback{} } @@ -211,9 +1172,45 @@ func (*DeleteLoopback) GetMessageName() string { return "delete_loopbac func (*DeleteLoopback) GetCrcString() string { return "f9e6675e" } func (*DeleteLoopback) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *DeleteLoopback) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *DeleteLoopback) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *DeleteLoopback) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // DeleteLoopbackReply represents VPP binary API message 'delete_loopback_reply'. type DeleteLoopbackReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *DeleteLoopbackReply) Reset() { *m = DeleteLoopbackReply{} } @@ -221,9 +1218,45 @@ func (*DeleteLoopbackReply) GetMessageName() string { return "delete_lo func (*DeleteLoopbackReply) GetCrcString() string { return "e8d4e804" } func (*DeleteLoopbackReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *DeleteLoopbackReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *DeleteLoopbackReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *DeleteLoopbackReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // DeleteSubif represents VPP binary API message 'delete_subif'. type DeleteSubif struct { - SwIfIndex InterfaceIndex + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *DeleteSubif) Reset() { *m = DeleteSubif{} } @@ -231,9 +1264,45 @@ func (*DeleteSubif) GetMessageName() string { return "delete_subif" } func (*DeleteSubif) GetCrcString() string { return "f9e6675e" } func (*DeleteSubif) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *DeleteSubif) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *DeleteSubif) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *DeleteSubif) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // DeleteSubifReply represents VPP binary API message 'delete_subif_reply'. type DeleteSubifReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *DeleteSubifReply) Reset() { *m = DeleteSubifReply{} } @@ -241,10 +1310,46 @@ func (*DeleteSubifReply) GetMessageName() string { return "delete_subif func (*DeleteSubifReply) GetCrcString() string { return "e8d4e804" } func (*DeleteSubifReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *DeleteSubifReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *DeleteSubifReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *DeleteSubifReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // HwInterfaceSetMtu represents VPP binary API message 'hw_interface_set_mtu'. type HwInterfaceSetMtu struct { - SwIfIndex InterfaceIndex - Mtu uint16 + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu uint16 `binapi:"u16,name=mtu" json:"mtu,omitempty"` } func (m *HwInterfaceSetMtu) Reset() { *m = HwInterfaceSetMtu{} } @@ -252,9 +1357,53 @@ func (*HwInterfaceSetMtu) GetMessageName() string { return "hw_interfac func (*HwInterfaceSetMtu) GetCrcString() string { return "e6746899" } func (*HwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *HwInterfaceSetMtu) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Mtu + size += 2 + return size +} +func (m *HwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Mtu + o.PutUint16(buf[pos:pos+2], uint16(m.Mtu)) + pos += 2 + return buf, nil +} +func (m *HwInterfaceSetMtu) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mtu + m.Mtu = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + // HwInterfaceSetMtuReply represents VPP binary API message 'hw_interface_set_mtu_reply'. type HwInterfaceSetMtuReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *HwInterfaceSetMtuReply) Reset() { *m = HwInterfaceSetMtuReply{} } @@ -262,10 +1411,46 @@ func (*HwInterfaceSetMtuReply) GetMessageName() string { return "hw_int func (*HwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *HwInterfaceSetMtuReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *HwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *HwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // InterfaceNameRenumber represents VPP binary API message 'interface_name_renumber'. type InterfaceNameRenumber struct { - SwIfIndex InterfaceIndex - NewShowDevInstance uint32 + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + NewShowDevInstance uint32 `binapi:"u32,name=new_show_dev_instance" json:"new_show_dev_instance,omitempty"` } func (m *InterfaceNameRenumber) Reset() { *m = InterfaceNameRenumber{} } @@ -273,9 +1458,53 @@ func (*InterfaceNameRenumber) GetMessageName() string { return "interfa func (*InterfaceNameRenumber) GetCrcString() string { return "2b8858b8" } func (*InterfaceNameRenumber) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *InterfaceNameRenumber) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.NewShowDevInstance + size += 4 + return size +} +func (m *InterfaceNameRenumber) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.NewShowDevInstance + o.PutUint32(buf[pos:pos+4], uint32(m.NewShowDevInstance)) + pos += 4 + return buf, nil +} +func (m *InterfaceNameRenumber) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NewShowDevInstance + m.NewShowDevInstance = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // InterfaceNameRenumberReply represents VPP binary API message 'interface_name_renumber_reply'. type InterfaceNameRenumberReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *InterfaceNameRenumberReply) Reset() { *m = InterfaceNameRenumberReply{} } @@ -283,12 +1512,48 @@ func (*InterfaceNameRenumberReply) GetMessageName() string { return "in func (*InterfaceNameRenumberReply) GetCrcString() string { return "e8d4e804" } func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *InterfaceNameRenumberReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *InterfaceNameRenumberReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *InterfaceNameRenumberReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceAddDelAddress represents VPP binary API message 'sw_interface_add_del_address'. type SwInterfaceAddDelAddress struct { - SwIfIndex InterfaceIndex - IsAdd bool - DelAll bool - Prefix AddressWithPrefix + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + DelAll bool `binapi:"bool,name=del_all" json:"del_all,omitempty"` + Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` } func (m *SwInterfaceAddDelAddress) Reset() { *m = SwInterfaceAddDelAddress{} } @@ -296,9 +1561,95 @@ func (*SwInterfaceAddDelAddress) GetMessageName() string { return "sw_i func (*SwInterfaceAddDelAddress) GetCrcString() string { return "5803d5c4" } func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceAddDelAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsAdd + size += 1 + // field[1] m.DelAll + size += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *SwInterfaceAddDelAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.DelAll + if m.DelAll { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *SwInterfaceAddDelAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.DelAll + m.DelAll = tmp[pos] != 0 + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + // SwInterfaceAddDelAddressReply represents VPP binary API message 'sw_interface_add_del_address_reply'. type SwInterfaceAddDelAddressReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceAddDelAddressReply) Reset() { *m = SwInterfaceAddDelAddressReply{} } @@ -308,11 +1659,47 @@ func (*SwInterfaceAddDelAddressReply) GetMessageName() string { func (*SwInterfaceAddDelAddressReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceAddDelAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceAddDelAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceAddDelAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceAddDelMacAddress represents VPP binary API message 'sw_interface_add_del_mac_address'. type SwInterfaceAddDelMacAddress struct { - SwIfIndex uint32 - Addr MacAddress - IsAdd uint8 + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Addr MacAddress `binapi:"mac_address,name=addr" json:"addr,omitempty"` + IsAdd uint8 `binapi:"u8,name=is_add" json:"is_add,omitempty"` } func (m *SwInterfaceAddDelMacAddress) Reset() { *m = SwInterfaceAddDelMacAddress{} } @@ -322,9 +1709,69 @@ func (*SwInterfaceAddDelMacAddress) GetMessageName() string { func (*SwInterfaceAddDelMacAddress) GetCrcString() string { return "638bb9f4" } func (*SwInterfaceAddDelMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceAddDelMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Addr + size += 6 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *SwInterfaceAddDelMacAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Addr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.Addr) { + x = uint8(m.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.IsAdd + buf[pos] = uint8(m.IsAdd) + pos += 1 + return buf, nil +} +func (m *SwInterfaceAddDelMacAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Addr + for i := 0; i < len(m.Addr); i++ { + m.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.IsAdd + m.IsAdd = uint8(tmp[pos]) + pos += 1 + return nil +} + // SwInterfaceAddDelMacAddressReply represents VPP binary API message 'sw_interface_add_del_mac_address_reply'. type SwInterfaceAddDelMacAddressReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceAddDelMacAddressReply) Reset() { *m = SwInterfaceAddDelMacAddressReply{} } @@ -334,9 +1781,45 @@ func (*SwInterfaceAddDelMacAddressReply) GetMessageName() string { func (*SwInterfaceAddDelMacAddressReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceAddDelMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceAddDelMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceAddDelMacAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceAddDelMacAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceClearStats represents VPP binary API message 'sw_interface_clear_stats'. type SwInterfaceClearStats struct { - SwIfIndex InterfaceIndex + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *SwInterfaceClearStats) Reset() { *m = SwInterfaceClearStats{} } @@ -344,9 +1827,45 @@ func (*SwInterfaceClearStats) GetMessageName() string { return "sw_inte func (*SwInterfaceClearStats) GetCrcString() string { return "f9e6675e" } func (*SwInterfaceClearStats) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceClearStats) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *SwInterfaceClearStats) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceClearStats) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceClearStatsReply represents VPP binary API message 'sw_interface_clear_stats_reply'. type SwInterfaceClearStatsReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceClearStatsReply) Reset() { *m = SwInterfaceClearStatsReply{} } @@ -354,34 +1873,70 @@ func (*SwInterfaceClearStatsReply) GetMessageName() string { return "sw func (*SwInterfaceClearStatsReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceClearStatsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceClearStatsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceClearStatsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceDetails represents VPP binary API message 'sw_interface_details'. type SwInterfaceDetails struct { - SwIfIndex InterfaceIndex - SupSwIfIndex uint32 - L2Address MacAddress - Flags IfStatusFlags - Type IfType - LinkDuplex LinkDuplex - LinkSpeed uint32 - LinkMtu uint16 - Mtu []uint32 `struc:"[4]uint32"` - SubID uint32 - SubNumberOfTags uint8 - SubOuterVlanID uint16 - SubInnerVlanID uint16 - SubIfFlags SubIfFlags - VtrOp uint32 - VtrPushDot1q uint32 - VtrTag1 uint32 - VtrTag2 uint32 - OuterTag uint16 - BDmac MacAddress - BSmac MacAddress - BVlanid uint16 - ISid uint32 - InterfaceName string `struc:"[64]byte"` - InterfaceDevType string `struc:"[64]byte"` - Tag string `struc:"[64]byte"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SupSwIfIndex uint32 `binapi:"u32,name=sup_sw_if_index" json:"sup_sw_if_index,omitempty"` + L2Address MacAddress `binapi:"mac_address,name=l2_address" json:"l2_address,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Type IfType `binapi:"if_type,name=type" json:"type,omitempty"` + LinkDuplex LinkDuplex `binapi:"link_duplex,name=link_duplex" json:"link_duplex,omitempty"` + LinkSpeed uint32 `binapi:"u32,name=link_speed" json:"link_speed,omitempty"` + LinkMtu uint16 `binapi:"u16,name=link_mtu" json:"link_mtu,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` + SubID uint32 `binapi:"u32,name=sub_id" json:"sub_id,omitempty"` + SubNumberOfTags uint8 `binapi:"u8,name=sub_number_of_tags" json:"sub_number_of_tags,omitempty"` + SubOuterVlanID uint16 `binapi:"u16,name=sub_outer_vlan_id" json:"sub_outer_vlan_id,omitempty"` + SubInnerVlanID uint16 `binapi:"u16,name=sub_inner_vlan_id" json:"sub_inner_vlan_id,omitempty"` + SubIfFlags SubIfFlags `binapi:"sub_if_flags,name=sub_if_flags" json:"sub_if_flags,omitempty"` + VtrOp uint32 `binapi:"u32,name=vtr_op" json:"vtr_op,omitempty"` + VtrPushDot1q uint32 `binapi:"u32,name=vtr_push_dot1q" json:"vtr_push_dot1q,omitempty"` + VtrTag1 uint32 `binapi:"u32,name=vtr_tag1" json:"vtr_tag1,omitempty"` + VtrTag2 uint32 `binapi:"u32,name=vtr_tag2" json:"vtr_tag2,omitempty"` + OuterTag uint16 `binapi:"u16,name=outer_tag" json:"outer_tag,omitempty"` + BDmac MacAddress `binapi:"mac_address,name=b_dmac" json:"b_dmac,omitempty"` + BSmac MacAddress `binapi:"mac_address,name=b_smac" json:"b_smac,omitempty"` + BVlanid uint16 `binapi:"u16,name=b_vlanid" json:"b_vlanid,omitempty"` + ISid uint32 `binapi:"u32,name=i_sid" json:"i_sid,omitempty"` + InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty" struc:"[64]byte"` + InterfaceDevType string `binapi:"string[64],name=interface_dev_type" json:"interface_dev_type,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` } func (m *SwInterfaceDetails) Reset() { *m = SwInterfaceDetails{} } @@ -389,12 +1944,290 @@ func (*SwInterfaceDetails) GetMessageName() string { return "sw_interfa func (*SwInterfaceDetails) GetCrcString() string { return "17b69fa2" } func (*SwInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.SupSwIfIndex + size += 4 + // field[1] m.L2Address + size += 6 + // field[1] m.Flags + size += 4 + // field[1] m.Type + size += 4 + // field[1] m.LinkDuplex + size += 4 + // field[1] m.LinkSpeed + size += 4 + // field[1] m.LinkMtu + size += 2 + // field[1] m.Mtu + size += 16 + // field[1] m.SubID + size += 4 + // field[1] m.SubNumberOfTags + size += 1 + // field[1] m.SubOuterVlanID + size += 2 + // field[1] m.SubInnerVlanID + size += 2 + // field[1] m.SubIfFlags + size += 4 + // field[1] m.VtrOp + size += 4 + // field[1] m.VtrPushDot1q + size += 4 + // field[1] m.VtrTag1 + size += 4 + // field[1] m.VtrTag2 + size += 4 + // field[1] m.OuterTag + size += 2 + // field[1] m.BDmac + size += 6 + // field[1] m.BSmac + size += 6 + // field[1] m.BVlanid + size += 2 + // field[1] m.ISid + size += 4 + // field[1] m.InterfaceName + size += 64 + // field[1] m.InterfaceDevType + size += 64 + // field[1] m.Tag + size += 64 + return size +} +func (m *SwInterfaceDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.SupSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SupSwIfIndex)) + pos += 4 + // field[1] m.L2Address + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.L2Address) { + x = uint8(m.L2Address[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + // field[1] m.LinkDuplex + o.PutUint32(buf[pos:pos+4], uint32(m.LinkDuplex)) + pos += 4 + // field[1] m.LinkSpeed + o.PutUint32(buf[pos:pos+4], uint32(m.LinkSpeed)) + pos += 4 + // field[1] m.LinkMtu + o.PutUint16(buf[pos:pos+2], uint16(m.LinkMtu)) + pos += 2 + // field[1] m.Mtu + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + // field[1] m.SubID + o.PutUint32(buf[pos:pos+4], uint32(m.SubID)) + pos += 4 + // field[1] m.SubNumberOfTags + buf[pos] = uint8(m.SubNumberOfTags) + pos += 1 + // field[1] m.SubOuterVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.SubOuterVlanID)) + pos += 2 + // field[1] m.SubInnerVlanID + o.PutUint16(buf[pos:pos+2], uint16(m.SubInnerVlanID)) + pos += 2 + // field[1] m.SubIfFlags + o.PutUint32(buf[pos:pos+4], uint32(m.SubIfFlags)) + pos += 4 + // field[1] m.VtrOp + o.PutUint32(buf[pos:pos+4], uint32(m.VtrOp)) + pos += 4 + // field[1] m.VtrPushDot1q + o.PutUint32(buf[pos:pos+4], uint32(m.VtrPushDot1q)) + pos += 4 + // field[1] m.VtrTag1 + o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag1)) + pos += 4 + // field[1] m.VtrTag2 + o.PutUint32(buf[pos:pos+4], uint32(m.VtrTag2)) + pos += 4 + // field[1] m.OuterTag + o.PutUint16(buf[pos:pos+2], uint16(m.OuterTag)) + pos += 2 + // field[1] m.BDmac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.BDmac) { + x = uint8(m.BDmac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.BSmac + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.BSmac) { + x = uint8(m.BSmac[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.BVlanid + o.PutUint16(buf[pos:pos+2], uint16(m.BVlanid)) + pos += 2 + // field[1] m.ISid + o.PutUint32(buf[pos:pos+4], uint32(m.ISid)) + pos += 4 + // field[1] m.InterfaceName + copy(buf[pos:pos+64], m.InterfaceName) + pos += 64 + // field[1] m.InterfaceDevType + copy(buf[pos:pos+64], m.InterfaceDevType) + pos += 64 + // field[1] m.Tag + copy(buf[pos:pos+64], m.Tag) + pos += 64 + return buf, nil +} +func (m *SwInterfaceDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SupSwIfIndex + m.SupSwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.L2Address + for i := 0; i < len(m.L2Address); i++ { + m.L2Address[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Type + m.Type = IfType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.LinkDuplex + m.LinkDuplex = LinkDuplex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.LinkSpeed + m.LinkSpeed = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.LinkMtu + m.LinkMtu = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.Mtu + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + // field[1] m.SubID + m.SubID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SubNumberOfTags + m.SubNumberOfTags = uint8(tmp[pos]) + pos += 1 + // field[1] m.SubOuterVlanID + m.SubOuterVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.SubInnerVlanID + m.SubInnerVlanID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.SubIfFlags + m.SubIfFlags = SubIfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrOp + m.VtrOp = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrPushDot1q + m.VtrPushDot1q = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrTag1 + m.VtrTag1 = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VtrTag2 + m.VtrTag2 = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.OuterTag + m.OuterTag = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.BDmac + for i := 0; i < len(m.BDmac); i++ { + m.BDmac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.BSmac + for i := 0; i < len(m.BSmac); i++ { + m.BSmac[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.BVlanid + m.BVlanid = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.ISid + m.ISid = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.InterfaceName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.InterfaceName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + // field[1] m.InterfaceDevType + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.InterfaceDevType = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + // field[1] m.Tag + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. type SwInterfaceDump struct { - SwIfIndex InterfaceIndex - NameFilterValid bool - XXX_NameFilterLen uint32 `struc:"sizeof=NameFilter"` - NameFilter string + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` + NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"` + XXX_NameFilterLen uint32 `struc:"sizeof=NameFilter"` + NameFilter string `json:"name_filter,omitempty"` } func (m *SwInterfaceDump) Reset() { *m = SwInterfaceDump{} } @@ -402,12 +2235,72 @@ func (*SwInterfaceDump) GetMessageName() string { return "sw_interface_ func (*SwInterfaceDump) GetCrcString() string { return "aa610c27" } func (*SwInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.NameFilterValid + size += 1 + // field[1] m.NameFilter + size += 4 + len(m.NameFilter) + return size +} +func (m *SwInterfaceDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.NameFilterValid + if m.NameFilterValid { + buf[pos] = 1 + } + pos += 1 + // field[1] m.NameFilter + o.PutUint32(buf[pos:pos+4], uint32(len(m.NameFilter))) + pos += 4 + copy(buf[pos:pos+len(m.NameFilter)], m.NameFilter[:]) + pos += len(m.NameFilter) + return buf, nil +} +func (m *SwInterfaceDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NameFilterValid + m.NameFilterValid = tmp[pos] != 0 + pos += 1 + // field[1] m.NameFilter + { + siz := o.Uint32(tmp[pos : pos+4]) + pos += 4 + m.NameFilter = codec.DecodeString(tmp[pos : pos+int(siz)]) + pos += len(m.NameFilter) + } + return nil +} + // SwInterfaceEvent represents VPP binary API message 'sw_interface_event'. type SwInterfaceEvent struct { - PID uint32 - SwIfIndex InterfaceIndex - Flags IfStatusFlags - Deleted bool + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + Deleted bool `binapi:"bool,name=deleted" json:"deleted,omitempty"` } func (m *SwInterfaceEvent) Reset() { *m = SwInterfaceEvent{} } @@ -415,9 +2308,71 @@ func (*SwInterfaceEvent) GetMessageName() string { return "sw_interface func (*SwInterfaceEvent) GetCrcString() string { return "f709f78d" } func (*SwInterfaceEvent) GetMessageType() api.MessageType { return api.EventMessage } +func (m *SwInterfaceEvent) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.PID + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Flags + size += 4 + // field[1] m.Deleted + size += 1 + return size +} +func (m *SwInterfaceEvent) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.PID + o.PutUint32(buf[pos:pos+4], uint32(m.PID)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + // field[1] m.Deleted + if m.Deleted { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceEvent) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.PID + m.PID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Deleted + m.Deleted = tmp[pos] != 0 + pos += 1 + return nil +} + // SwInterfaceGetMacAddress represents VPP binary API message 'sw_interface_get_mac_address'. type SwInterfaceGetMacAddress struct { - SwIfIndex InterfaceIndex + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *SwInterfaceGetMacAddress) Reset() { *m = SwInterfaceGetMacAddress{} } @@ -425,10 +2380,46 @@ func (*SwInterfaceGetMacAddress) GetMessageName() string { return "sw_i func (*SwInterfaceGetMacAddress) GetCrcString() string { return "f9e6675e" } func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceGetMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *SwInterfaceGetMacAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceGetMacAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceGetMacAddressReply represents VPP binary API message 'sw_interface_get_mac_address_reply'. type SwInterfaceGetMacAddressReply struct { - Retval int32 - MacAddress MacAddress + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` } func (m *SwInterfaceGetMacAddressReply) Reset() { *m = SwInterfaceGetMacAddressReply{} } @@ -438,10 +2429,62 @@ func (*SwInterfaceGetMacAddressReply) GetMessageName() string { func (*SwInterfaceGetMacAddressReply) GetCrcString() string { return "40ef2c08" } func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceGetMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.MacAddress + size += 6 + return size +} +func (m *SwInterfaceGetMacAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SwInterfaceGetMacAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + // SwInterfaceGetTable represents VPP binary API message 'sw_interface_get_table'. type SwInterfaceGetTable struct { - SwIfIndex InterfaceIndex - IsIPv6 bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` } func (m *SwInterfaceGetTable) Reset() { *m = SwInterfaceGetTable{} } @@ -449,10 +2492,56 @@ func (*SwInterfaceGetTable) GetMessageName() string { return "sw_interf func (*SwInterfaceGetTable) GetCrcString() string { return "2d033de4" } func (*SwInterfaceGetTable) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceGetTable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *SwInterfaceGetTable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceGetTable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + // SwInterfaceGetTableReply represents VPP binary API message 'sw_interface_get_table_reply'. type SwInterfaceGetTableReply struct { - Retval int32 - VrfID uint32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` } func (m *SwInterfaceGetTableReply) Reset() { *m = SwInterfaceGetTableReply{} } @@ -460,12 +2549,56 @@ func (*SwInterfaceGetTableReply) GetMessageName() string { return "sw_i func (*SwInterfaceGetTableReply) GetCrcString() string { return "a6eb0109" } func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceGetTableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.VrfID + size += 4 + return size +} +func (m *SwInterfaceGetTableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceGetTableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceRxPlacementDetails represents VPP binary API message 'sw_interface_rx_placement_details'. type SwInterfaceRxPlacementDetails struct { - SwIfIndex InterfaceIndex - QueueID uint32 - WorkerID uint32 - Mode RxMode + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` } func (m *SwInterfaceRxPlacementDetails) Reset() { *m = SwInterfaceRxPlacementDetails{} } @@ -475,9 +2608,69 @@ func (*SwInterfaceRxPlacementDetails) GetMessageName() string { func (*SwInterfaceRxPlacementDetails) GetCrcString() string { return "f6d7d024" } func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceRxPlacementDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.QueueID + size += 4 + // field[1] m.WorkerID + size += 4 + // field[1] m.Mode + size += 4 + return size +} +func (m *SwInterfaceRxPlacementDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.QueueID + o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) + pos += 4 + // field[1] m.WorkerID + o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceRxPlacementDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.QueueID + m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.WorkerID + m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceRxPlacementDump represents VPP binary API message 'sw_interface_rx_placement_dump'. type SwInterfaceRxPlacementDump struct { - SwIfIndex InterfaceIndex + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *SwInterfaceRxPlacementDump) Reset() { *m = SwInterfaceRxPlacementDump{} } @@ -485,10 +2678,46 @@ func (*SwInterfaceRxPlacementDump) GetMessageName() string { return "sw func (*SwInterfaceRxPlacementDump) GetCrcString() string { return "f9e6675e" } func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceRxPlacementDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *SwInterfaceRxPlacementDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceRxPlacementDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetFlags represents VPP binary API message 'sw_interface_set_flags'. type SwInterfaceSetFlags struct { - SwIfIndex InterfaceIndex - Flags IfStatusFlags + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` } func (m *SwInterfaceSetFlags) Reset() { *m = SwInterfaceSetFlags{} } @@ -496,9 +2725,53 @@ func (*SwInterfaceSetFlags) GetMessageName() string { return "sw_interf func (*SwInterfaceSetFlags) GetCrcString() string { return "6a2b491a" } func (*SwInterfaceSetFlags) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceSetFlags) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Flags + size += 4 + return size +} +func (m *SwInterfaceSetFlags) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetFlags) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetFlagsReply represents VPP binary API message 'sw_interface_set_flags_reply'. type SwInterfaceSetFlagsReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceSetFlagsReply) Reset() { *m = SwInterfaceSetFlagsReply{} } @@ -506,10 +2779,46 @@ func (*SwInterfaceSetFlagsReply) GetMessageName() string { return "sw_i func (*SwInterfaceSetFlagsReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceSetFlagsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetFlagsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetFlagsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetIPDirectedBroadcast represents VPP binary API message 'sw_interface_set_ip_directed_broadcast'. type SwInterfaceSetIPDirectedBroadcast struct { - SwIfIndex InterfaceIndex - Enable bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` } func (m *SwInterfaceSetIPDirectedBroadcast) Reset() { *m = SwInterfaceSetIPDirectedBroadcast{} } @@ -519,9 +2828,55 @@ func (*SwInterfaceSetIPDirectedBroadcast) GetMessageName() string { func (*SwInterfaceSetIPDirectedBroadcast) GetCrcString() string { return "ae6cfcfb" } func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceSetIPDirectedBroadcast) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Enable + size += 1 + return size +} +func (m *SwInterfaceSetIPDirectedBroadcast) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Enable + if m.Enable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceSetIPDirectedBroadcast) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Enable + m.Enable = tmp[pos] != 0 + pos += 1 + return nil +} + // SwInterfaceSetIPDirectedBroadcastReply represents VPP binary API message 'sw_interface_set_ip_directed_broadcast_reply'. type SwInterfaceSetIPDirectedBroadcastReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceSetIPDirectedBroadcastReply) Reset() { @@ -535,10 +2890,46 @@ func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType return api.ReplyMessage } +func (m *SwInterfaceSetIPDirectedBroadcastReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetIPDirectedBroadcastReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetIPDirectedBroadcastReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetMacAddress represents VPP binary API message 'sw_interface_set_mac_address'. type SwInterfaceSetMacAddress struct { - SwIfIndex InterfaceIndex - MacAddress MacAddress + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` } func (m *SwInterfaceSetMacAddress) Reset() { *m = SwInterfaceSetMacAddress{} } @@ -546,9 +2937,61 @@ func (*SwInterfaceSetMacAddress) GetMessageName() string { return "sw_i func (*SwInterfaceSetMacAddress) GetCrcString() string { return "6aca746a" } func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceSetMacAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.MacAddress + size += 6 + return size +} +func (m *SwInterfaceSetMacAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.MacAddress) { + x = uint8(m.MacAddress[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SwInterfaceSetMacAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MacAddress + for i := 0; i < len(m.MacAddress); i++ { + m.MacAddress[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + // SwInterfaceSetMacAddressReply represents VPP binary API message 'sw_interface_set_mac_address_reply'. type SwInterfaceSetMacAddressReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceSetMacAddressReply) Reset() { *m = SwInterfaceSetMacAddressReply{} } @@ -558,10 +3001,46 @@ func (*SwInterfaceSetMacAddressReply) GetMessageName() string { func (*SwInterfaceSetMacAddressReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceSetMacAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetMacAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetMacAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetMtu represents VPP binary API message 'sw_interface_set_mtu'. type SwInterfaceSetMtu struct { - SwIfIndex InterfaceIndex - Mtu []uint32 `struc:"[4]uint32"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Mtu []uint32 `binapi:"u32[4],name=mtu" json:"mtu,omitempty" struc:"[4]uint32"` } func (m *SwInterfaceSetMtu) Reset() { *m = SwInterfaceSetMtu{} } @@ -569,9 +3048,62 @@ func (*SwInterfaceSetMtu) GetMessageName() string { return "sw_interfac func (*SwInterfaceSetMtu) GetCrcString() string { return "5cbe85e5" } func (*SwInterfaceSetMtu) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceSetMtu) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Mtu + size += 16 + return size +} +func (m *SwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Mtu + for i := 0; i < 4; i++ { + var x uint32 + if i < len(m.Mtu) { + x = uint32(m.Mtu[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *SwInterfaceSetMtu) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mtu + m.Mtu = make([]uint32, 4) + for i := 0; i < len(m.Mtu); i++ { + m.Mtu[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + // SwInterfaceSetMtuReply represents VPP binary API message 'sw_interface_set_mtu_reply'. type SwInterfaceSetMtuReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceSetMtuReply) Reset() { *m = SwInterfaceSetMtuReply{} } @@ -579,12 +3111,48 @@ func (*SwInterfaceSetMtuReply) GetMessageName() string { return "sw_int func (*SwInterfaceSetMtuReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceSetMtuReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetMtuReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetRxMode represents VPP binary API message 'sw_interface_set_rx_mode'. type SwInterfaceSetRxMode struct { - SwIfIndex InterfaceIndex - QueueIDValid bool - QueueID uint32 - Mode RxMode + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueIDValid bool `binapi:"bool,name=queue_id_valid" json:"queue_id_valid,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + Mode RxMode `binapi:"rx_mode,name=mode" json:"mode,omitempty"` } func (m *SwInterfaceSetRxMode) Reset() { *m = SwInterfaceSetRxMode{} } @@ -592,9 +3160,71 @@ func (*SwInterfaceSetRxMode) GetMessageName() string { return "sw_inter func (*SwInterfaceSetRxMode) GetCrcString() string { return "780f5cee" } func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceSetRxMode) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.QueueIDValid + size += 1 + // field[1] m.QueueID + size += 4 + // field[1] m.Mode + size += 4 + return size +} +func (m *SwInterfaceSetRxMode) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.QueueIDValid + if m.QueueIDValid { + buf[pos] = 1 + } + pos += 1 + // field[1] m.QueueID + o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetRxMode) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.QueueIDValid + m.QueueIDValid = tmp[pos] != 0 + pos += 1 + // field[1] m.QueueID + m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = RxMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetRxModeReply represents VPP binary API message 'sw_interface_set_rx_mode_reply'. type SwInterfaceSetRxModeReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceSetRxModeReply) Reset() { *m = SwInterfaceSetRxModeReply{} } @@ -602,12 +3232,48 @@ func (*SwInterfaceSetRxModeReply) GetMessageName() string { return "sw_ func (*SwInterfaceSetRxModeReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceSetRxModeReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetRxModeReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetRxModeReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetRxPlacement represents VPP binary API message 'sw_interface_set_rx_placement'. type SwInterfaceSetRxPlacement struct { - SwIfIndex InterfaceIndex - QueueID uint32 - WorkerID uint32 - IsMain bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + QueueID uint32 `binapi:"u32,name=queue_id" json:"queue_id,omitempty"` + WorkerID uint32 `binapi:"u32,name=worker_id" json:"worker_id,omitempty"` + IsMain bool `binapi:"bool,name=is_main" json:"is_main,omitempty"` } func (m *SwInterfaceSetRxPlacement) Reset() { *m = SwInterfaceSetRxPlacement{} } @@ -615,9 +3281,71 @@ func (*SwInterfaceSetRxPlacement) GetMessageName() string { return "sw_ func (*SwInterfaceSetRxPlacement) GetCrcString() string { return "db65f3c9" } func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceSetRxPlacement) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.QueueID + size += 4 + // field[1] m.WorkerID + size += 4 + // field[1] m.IsMain + size += 1 + return size +} +func (m *SwInterfaceSetRxPlacement) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.QueueID + o.PutUint32(buf[pos:pos+4], uint32(m.QueueID)) + pos += 4 + // field[1] m.WorkerID + o.PutUint32(buf[pos:pos+4], uint32(m.WorkerID)) + pos += 4 + // field[1] m.IsMain + if m.IsMain { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceSetRxPlacement) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.QueueID + m.QueueID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.WorkerID + m.WorkerID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsMain + m.IsMain = tmp[pos] != 0 + pos += 1 + return nil +} + // SwInterfaceSetRxPlacementReply represents VPP binary API message 'sw_interface_set_rx_placement_reply'. type SwInterfaceSetRxPlacementReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceSetRxPlacementReply) Reset() { *m = SwInterfaceSetRxPlacementReply{} } @@ -627,11 +3355,47 @@ func (*SwInterfaceSetRxPlacementReply) GetMessageName() string { func (*SwInterfaceSetRxPlacementReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceSetRxPlacementReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetRxPlacementReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetRxPlacementReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetTable represents VPP binary API message 'sw_interface_set_table'. type SwInterfaceSetTable struct { - SwIfIndex InterfaceIndex - IsIPv6 bool - VrfID uint32 + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` } func (m *SwInterfaceSetTable) Reset() { *m = SwInterfaceSetTable{} } @@ -639,9 +3403,63 @@ func (*SwInterfaceSetTable) GetMessageName() string { return "sw_interf func (*SwInterfaceSetTable) GetCrcString() string { return "df42a577" } func (*SwInterfaceSetTable) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceSetTable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + // field[1] m.VrfID + size += 4 + return size +} +func (m *SwInterfaceSetTable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetTable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetTableReply represents VPP binary API message 'sw_interface_set_table_reply'. type SwInterfaceSetTableReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceSetTableReply) Reset() { *m = SwInterfaceSetTableReply{} } @@ -649,11 +3467,47 @@ func (*SwInterfaceSetTableReply) GetMessageName() string { return "sw_i func (*SwInterfaceSetTableReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceSetTableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetTableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetTableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceSetUnnumbered represents VPP binary API message 'sw_interface_set_unnumbered'. type SwInterfaceSetUnnumbered struct { - SwIfIndex InterfaceIndex - UnnumberedSwIfIndex InterfaceIndex - IsAdd bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + UnnumberedSwIfIndex InterfaceIndex `binapi:"interface_index,name=unnumbered_sw_if_index" json:"unnumbered_sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` } func (m *SwInterfaceSetUnnumbered) Reset() { *m = SwInterfaceSetUnnumbered{} } @@ -661,9 +3515,63 @@ func (*SwInterfaceSetUnnumbered) GetMessageName() string { return "sw_i func (*SwInterfaceSetUnnumbered) GetCrcString() string { return "938ef33b" } func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceSetUnnumbered) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.UnnumberedSwIfIndex + size += 4 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *SwInterfaceSetUnnumbered) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.UnnumberedSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.UnnumberedSwIfIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceSetUnnumbered) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.UnnumberedSwIfIndex + m.UnnumberedSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + return nil +} + // SwInterfaceSetUnnumberedReply represents VPP binary API message 'sw_interface_set_unnumbered_reply'. type SwInterfaceSetUnnumberedReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceSetUnnumberedReply) Reset() { *m = SwInterfaceSetUnnumberedReply{} } @@ -673,11 +3581,47 @@ func (*SwInterfaceSetUnnumberedReply) GetMessageName() string { func (*SwInterfaceSetUnnumberedReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceSetUnnumberedReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceSetUnnumberedReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceSetUnnumberedReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. type SwInterfaceTagAddDel struct { - IsAdd bool - SwIfIndex InterfaceIndex - Tag string `struc:"[64]byte"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Tag string `binapi:"string[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` } func (m *SwInterfaceTagAddDel) Reset() { *m = SwInterfaceTagAddDel{} } @@ -685,9 +3629,66 @@ func (*SwInterfaceTagAddDel) GetMessageName() string { return "sw_inter func (*SwInterfaceTagAddDel) GetCrcString() string { return "426f8bc1" } func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceTagAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Tag + size += 64 + return size +} +func (m *SwInterfaceTagAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Tag + copy(buf[pos:pos+64], m.Tag) + pos += 64 + return buf, nil +} +func (m *SwInterfaceTagAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Tag + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // SwInterfaceTagAddDelReply represents VPP binary API message 'sw_interface_tag_add_del_reply'. type SwInterfaceTagAddDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceTagAddDelReply) Reset() { *m = SwInterfaceTagAddDelReply{} } @@ -695,10 +3696,46 @@ func (*SwInterfaceTagAddDelReply) GetMessageName() string { return "sw_ func (*SwInterfaceTagAddDelReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceTagAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceTagAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceTagAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // WantInterfaceEvents represents VPP binary API message 'want_interface_events'. type WantInterfaceEvents struct { - EnableDisable uint32 - PID uint32 + EnableDisable uint32 `binapi:"u32,name=enable_disable" json:"enable_disable,omitempty"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` } func (m *WantInterfaceEvents) Reset() { *m = WantInterfaceEvents{} } @@ -706,9 +3743,53 @@ func (*WantInterfaceEvents) GetMessageName() string { return "want_inte func (*WantInterfaceEvents) GetCrcString() string { return "476f5a08" } func (*WantInterfaceEvents) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *WantInterfaceEvents) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.EnableDisable + size += 4 + // field[1] m.PID + size += 4 + return size +} +func (m *WantInterfaceEvents) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.EnableDisable + o.PutUint32(buf[pos:pos+4], uint32(m.EnableDisable)) + pos += 4 + // field[1] m.PID + o.PutUint32(buf[pos:pos+4], uint32(m.PID)) + pos += 4 + return buf, nil +} +func (m *WantInterfaceEvents) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.EnableDisable + m.EnableDisable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PID + m.PID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // WantInterfaceEventsReply represents VPP binary API message 'want_interface_events_reply'. type WantInterfaceEventsReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *WantInterfaceEventsReply) Reset() { *m = WantInterfaceEventsReply{} } @@ -716,7 +3797,44 @@ func (*WantInterfaceEventsReply) GetMessageName() string { return "want func (*WantInterfaceEventsReply) GetCrcString() string { return "e8d4e804" } func (*WantInterfaceEventsReply) GetMessageType() api.MessageType { return api.ReplyMessage } -func init() { +func (m *WantInterfaceEventsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *WantInterfaceEventsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *WantInterfaceEventsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_interfaces_binapi_init() } +func file_interfaces_binapi_init() { api.RegisterMessage((*CollectDetailedInterfaceStats)(nil), "interface.CollectDetailedInterfaceStats") api.RegisterMessage((*CollectDetailedInterfaceStatsReply)(nil), "interface.CollectDetailedInterfaceStatsReply") api.RegisterMessage((*CreateLoopback)(nil), "interface.CreateLoopback") @@ -831,322 +3949,13 @@ func AllMessages() []api.Message { } } -// RPCService represents RPC service API for interface module. -type RPCService interface { - DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) - DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) - CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) - CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) - CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) - CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) - CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) - DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) - DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) - HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) - InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) - SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) - SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) - SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) - SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) - SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) - SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) - SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) - SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) - SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) - SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) - SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) - SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) - SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) - SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) - WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSwInterfaceClient{stream} - return x, nil -} - -type RPCService_DumpSwInterfaceClient interface { - Recv() (*SwInterfaceDetails, error) -} - -type serviceClient_DumpSwInterfaceClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSwInterfaceClient) Recv() (*SwInterfaceDetails, error) { - m := new(SwInterfaceDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpSwInterfaceRxPlacementClient{stream} - return x, nil -} - -type RPCService_DumpSwInterfaceRxPlacementClient interface { - Recv() (*SwInterfaceRxPlacementDetails, error) -} - -type serviceClient_DumpSwInterfaceRxPlacementClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpSwInterfaceRxPlacementClient) Recv() (*SwInterfaceRxPlacementDetails, error) { - m := new(SwInterfaceRxPlacementDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { - out := new(CollectDetailedInterfaceStatsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { - out := new(CreateLoopbackReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { - out := new(CreateLoopbackInstanceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { - out := new(CreateSubifReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { - out := new(CreateVlanSubifReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { - out := new(DeleteLoopbackReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { - out := new(DeleteSubifReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { - out := new(HwInterfaceSetMtuReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { - out := new(InterfaceNameRenumberReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { - out := new(SwInterfaceAddDelAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { - out := new(SwInterfaceAddDelMacAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { - out := new(SwInterfaceClearStatsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { - out := new(SwInterfaceGetMacAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { - out := new(SwInterfaceGetTableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { - out := new(SwInterfaceSetFlagsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { - out := new(SwInterfaceSetIPDirectedBroadcastReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { - out := new(SwInterfaceSetMacAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { - out := new(SwInterfaceSetMtuReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { - out := new(SwInterfaceSetRxModeReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { - out := new(SwInterfaceSetRxPlacementReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { - out := new(SwInterfaceSetTableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { - out := new(SwInterfaceSetUnnumberedReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { - out := new(SwInterfaceTagAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { - out := new(WantInterfaceEventsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage +var _ = codec.DecodeString var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/interfaces/interfaces_rpc.ba.go b/examples/binapi/interfaces/interfaces_rpc.ba.go new file mode 100644 index 0000000..e30aed9 --- /dev/null +++ b/examples/binapi/interfaces/interfaces_rpc.ba.go @@ -0,0 +1,321 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package interfaces + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for interface module. +type RPCService interface { + DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) + DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) + CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) + CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) + CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) + CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) + CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) + DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) + DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) + HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) + InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) + SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) + SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) + SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) + SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) + SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) + SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) + SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) + SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) + SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) + SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) + SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) + SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) + SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) + SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) + WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSwInterface(ctx context.Context, in *SwInterfaceDump) (RPCService_DumpSwInterfaceClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceClient interface { + Recv() (*SwInterfaceDetails, error) +} + +type serviceClient_DumpSwInterfaceClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceClient) Recv() (*SwInterfaceDetails, error) { + m := new(SwInterfaceDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSwInterfaceRxPlacement(ctx context.Context, in *SwInterfaceRxPlacementDump) (RPCService_DumpSwInterfaceRxPlacementClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSwInterfaceRxPlacementClient{stream} + return x, nil +} + +type RPCService_DumpSwInterfaceRxPlacementClient interface { + Recv() (*SwInterfaceRxPlacementDetails, error) +} + +type serviceClient_DumpSwInterfaceRxPlacementClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSwInterfaceRxPlacementClient) Recv() (*SwInterfaceRxPlacementDetails, error) { + m := new(SwInterfaceRxPlacementDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) CollectDetailedInterfaceStats(ctx context.Context, in *CollectDetailedInterfaceStats) (*CollectDetailedInterfaceStatsReply, error) { + out := new(CollectDetailedInterfaceStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopback(ctx context.Context, in *CreateLoopback) (*CreateLoopbackReply, error) { + out := new(CreateLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateLoopbackInstance(ctx context.Context, in *CreateLoopbackInstance) (*CreateLoopbackInstanceReply, error) { + out := new(CreateLoopbackInstanceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateSubif(ctx context.Context, in *CreateSubif) (*CreateSubifReply, error) { + out := new(CreateSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CreateVlanSubif(ctx context.Context, in *CreateVlanSubif) (*CreateVlanSubifReply, error) { + out := new(CreateVlanSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteLoopback(ctx context.Context, in *DeleteLoopback) (*DeleteLoopbackReply, error) { + out := new(DeleteLoopbackReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) DeleteSubif(ctx context.Context, in *DeleteSubif) (*DeleteSubifReply, error) { + out := new(DeleteSubifReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) HwInterfaceSetMtu(ctx context.Context, in *HwInterfaceSetMtu) (*HwInterfaceSetMtuReply, error) { + out := new(HwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) InterfaceNameRenumber(ctx context.Context, in *InterfaceNameRenumber) (*InterfaceNameRenumberReply, error) { + out := new(InterfaceNameRenumberReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelAddress(ctx context.Context, in *SwInterfaceAddDelAddress) (*SwInterfaceAddDelAddressReply, error) { + out := new(SwInterfaceAddDelAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceAddDelMacAddress(ctx context.Context, in *SwInterfaceAddDelMacAddress) (*SwInterfaceAddDelMacAddressReply, error) { + out := new(SwInterfaceAddDelMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceClearStats(ctx context.Context, in *SwInterfaceClearStats) (*SwInterfaceClearStatsReply, error) { + out := new(SwInterfaceClearStatsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetMacAddress(ctx context.Context, in *SwInterfaceGetMacAddress) (*SwInterfaceGetMacAddressReply, error) { + out := new(SwInterfaceGetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceGetTable(ctx context.Context, in *SwInterfaceGetTable) (*SwInterfaceGetTableReply, error) { + out := new(SwInterfaceGetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetFlags(ctx context.Context, in *SwInterfaceSetFlags) (*SwInterfaceSetFlagsReply, error) { + out := new(SwInterfaceSetFlagsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetIPDirectedBroadcast(ctx context.Context, in *SwInterfaceSetIPDirectedBroadcast) (*SwInterfaceSetIPDirectedBroadcastReply, error) { + out := new(SwInterfaceSetIPDirectedBroadcastReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMacAddress(ctx context.Context, in *SwInterfaceSetMacAddress) (*SwInterfaceSetMacAddressReply, error) { + out := new(SwInterfaceSetMacAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetMtu(ctx context.Context, in *SwInterfaceSetMtu) (*SwInterfaceSetMtuReply, error) { + out := new(SwInterfaceSetMtuReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxMode(ctx context.Context, in *SwInterfaceSetRxMode) (*SwInterfaceSetRxModeReply, error) { + out := new(SwInterfaceSetRxModeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetRxPlacement(ctx context.Context, in *SwInterfaceSetRxPlacement) (*SwInterfaceSetRxPlacementReply, error) { + out := new(SwInterfaceSetRxPlacementReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetTable(ctx context.Context, in *SwInterfaceSetTable) (*SwInterfaceSetTableReply, error) { + out := new(SwInterfaceSetTableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceSetUnnumbered(ctx context.Context, in *SwInterfaceSetUnnumbered) (*SwInterfaceSetUnnumberedReply, error) { + out := new(SwInterfaceSetUnnumberedReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceTagAddDel(ctx context.Context, in *SwInterfaceTagAddDel) (*SwInterfaceTagAddDelReply, error) { + out := new(SwInterfaceTagAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) WantInterfaceEvents(ctx context.Context, in *WantInterfaceEvents) (*WantInterfaceEventsReply, error) { + out := new(WantInterfaceEventsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/examples/binapi/ip/ip.ba.go b/examples/binapi/ip/ip.ba.go index f02cc9e..b15a489 100644 --- a/examples/binapi/ip/ip.ba.go +++ b/examples/binapi/ip/ip.ba.go @@ -1,33 +1,40 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 // source: /usr/share/vpp/api/core/ip.api.json /* -Package ip is a generated VPP binary API for 'ip' module. +Package ip contains generated code for VPP binary API defined by ip.api (version 3.0.1). It consists of: - 15 enums 7 aliases + 15 enums + 60 messages 14 types 1 union - 60 messages - 30 services */ package ip import ( "bytes" "context" + "encoding/binary" "io" + "math" "strconv" api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" - - ethernet_types "git.fd.io/govpp.git/examples/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" - ip_types "git.fd.io/govpp.git/examples/binapi/ip_types" ) +// 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 // please upgrade the GoVPP api package + const ( // ModuleName is the name of this module. ModuleName = "ip" @@ -37,7 +44,32 @@ const ( VersionCrc = 0xfc3fea46 ) -type AddressFamily = ip_types.AddressFamily +// AddressFamily represents VPP binary API enum 'address_family'. +type AddressFamily uint32 + +const ( + ADDRESS_IP4 AddressFamily = 0 + ADDRESS_IP6 AddressFamily = 1 +) + +var ( + AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", + } + AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, + } +) + +func (x AddressFamily) String() string { + s, ok := AddressFamily_name[uint32(x)] + if ok { + return s + } + return "AddressFamily(" + strconv.Itoa(int(x)) + ")" +} // FibPathFlags represents VPP binary API enum 'fib_path_flags'. type FibPathFlags uint32 @@ -49,26 +81,27 @@ const ( FIB_API_PATH_FLAG_POP_PW_CW FibPathFlags = 4 ) -var FibPathFlags_name = map[uint32]string{ - 0: "FIB_API_PATH_FLAG_NONE", - 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", - 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", - 4: "FIB_API_PATH_FLAG_POP_PW_CW", -} - -var FibPathFlags_value = map[string]uint32{ - "FIB_API_PATH_FLAG_NONE": 0, - "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, - "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, - "FIB_API_PATH_FLAG_POP_PW_CW": 4, -} +var ( + FibPathFlags_name = map[uint32]string{ + 0: "FIB_API_PATH_FLAG_NONE", + 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED", + 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST", + 4: "FIB_API_PATH_FLAG_POP_PW_CW", + } + FibPathFlags_value = map[string]uint32{ + "FIB_API_PATH_FLAG_NONE": 0, + "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1, + "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST": 2, + "FIB_API_PATH_FLAG_POP_PW_CW": 4, + } +) func (x FibPathFlags) String() string { s, ok := FibPathFlags_name[uint32(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "FibPathFlags(" + strconv.Itoa(int(x)) + ")" } // FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'. @@ -82,28 +115,29 @@ const ( FIB_API_PATH_NH_PROTO_BIER FibPathNhProto = 4 ) -var FibPathNhProto_name = map[uint32]string{ - 0: "FIB_API_PATH_NH_PROTO_IP4", - 1: "FIB_API_PATH_NH_PROTO_IP6", - 2: "FIB_API_PATH_NH_PROTO_MPLS", - 3: "FIB_API_PATH_NH_PROTO_ETHERNET", - 4: "FIB_API_PATH_NH_PROTO_BIER", -} - -var FibPathNhProto_value = map[string]uint32{ - "FIB_API_PATH_NH_PROTO_IP4": 0, - "FIB_API_PATH_NH_PROTO_IP6": 1, - "FIB_API_PATH_NH_PROTO_MPLS": 2, - "FIB_API_PATH_NH_PROTO_ETHERNET": 3, - "FIB_API_PATH_NH_PROTO_BIER": 4, -} +var ( + FibPathNhProto_name = map[uint32]string{ + 0: "FIB_API_PATH_NH_PROTO_IP4", + 1: "FIB_API_PATH_NH_PROTO_IP6", + 2: "FIB_API_PATH_NH_PROTO_MPLS", + 3: "FIB_API_PATH_NH_PROTO_ETHERNET", + 4: "FIB_API_PATH_NH_PROTO_BIER", + } + FibPathNhProto_value = map[string]uint32{ + "FIB_API_PATH_NH_PROTO_IP4": 0, + "FIB_API_PATH_NH_PROTO_IP6": 1, + "FIB_API_PATH_NH_PROTO_MPLS": 2, + "FIB_API_PATH_NH_PROTO_ETHERNET": 3, + "FIB_API_PATH_NH_PROTO_BIER": 4, + } +) func (x FibPathNhProto) String() string { s, ok := FibPathNhProto_name[uint32(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")" } // FibPathType represents VPP binary API enum 'fib_path_type'. @@ -123,51 +157,276 @@ const ( FIB_API_PATH_TYPE_CLASSIFY FibPathType = 10 ) -var FibPathType_name = map[uint32]string{ - 0: "FIB_API_PATH_TYPE_NORMAL", - 1: "FIB_API_PATH_TYPE_LOCAL", - 2: "FIB_API_PATH_TYPE_DROP", - 3: "FIB_API_PATH_TYPE_UDP_ENCAP", - 4: "FIB_API_PATH_TYPE_BIER_IMP", - 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", - 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", - 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", - 8: "FIB_API_PATH_TYPE_DVR", - 9: "FIB_API_PATH_TYPE_INTERFACE_RX", - 10: "FIB_API_PATH_TYPE_CLASSIFY", -} - -var FibPathType_value = map[string]uint32{ - "FIB_API_PATH_TYPE_NORMAL": 0, - "FIB_API_PATH_TYPE_LOCAL": 1, - "FIB_API_PATH_TYPE_DROP": 2, - "FIB_API_PATH_TYPE_UDP_ENCAP": 3, - "FIB_API_PATH_TYPE_BIER_IMP": 4, - "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, - "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, - "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, - "FIB_API_PATH_TYPE_DVR": 8, - "FIB_API_PATH_TYPE_INTERFACE_RX": 9, - "FIB_API_PATH_TYPE_CLASSIFY": 10, -} +var ( + FibPathType_name = map[uint32]string{ + 0: "FIB_API_PATH_TYPE_NORMAL", + 1: "FIB_API_PATH_TYPE_LOCAL", + 2: "FIB_API_PATH_TYPE_DROP", + 3: "FIB_API_PATH_TYPE_UDP_ENCAP", + 4: "FIB_API_PATH_TYPE_BIER_IMP", + 5: "FIB_API_PATH_TYPE_ICMP_UNREACH", + 6: "FIB_API_PATH_TYPE_ICMP_PROHIBIT", + 7: "FIB_API_PATH_TYPE_SOURCE_LOOKUP", + 8: "FIB_API_PATH_TYPE_DVR", + 9: "FIB_API_PATH_TYPE_INTERFACE_RX", + 10: "FIB_API_PATH_TYPE_CLASSIFY", + } + FibPathType_value = map[string]uint32{ + "FIB_API_PATH_TYPE_NORMAL": 0, + "FIB_API_PATH_TYPE_LOCAL": 1, + "FIB_API_PATH_TYPE_DROP": 2, + "FIB_API_PATH_TYPE_UDP_ENCAP": 3, + "FIB_API_PATH_TYPE_BIER_IMP": 4, + "FIB_API_PATH_TYPE_ICMP_UNREACH": 5, + "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6, + "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7, + "FIB_API_PATH_TYPE_DVR": 8, + "FIB_API_PATH_TYPE_INTERFACE_RX": 9, + "FIB_API_PATH_TYPE_CLASSIFY": 10, + } +) func (x FibPathType) String() string { s, ok := FibPathType_name[uint32(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "FibPathType(" + strconv.Itoa(int(x)) + ")" +} + +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} + +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 + +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" } -type IfStatusFlags = interface_types.IfStatusFlags +// IPDscp represents VPP binary API enum 'ip_dscp'. +type IPDscp uint8 -type IfType = interface_types.IfType +const ( + IP_API_DSCP_CS0 IPDscp = 0 + IP_API_DSCP_CS1 IPDscp = 8 + IP_API_DSCP_AF11 IPDscp = 10 + IP_API_DSCP_AF12 IPDscp = 12 + IP_API_DSCP_AF13 IPDscp = 14 + IP_API_DSCP_CS2 IPDscp = 16 + IP_API_DSCP_AF21 IPDscp = 18 + IP_API_DSCP_AF22 IPDscp = 20 + IP_API_DSCP_AF23 IPDscp = 22 + IP_API_DSCP_CS3 IPDscp = 24 + IP_API_DSCP_AF31 IPDscp = 26 + IP_API_DSCP_AF32 IPDscp = 28 + IP_API_DSCP_AF33 IPDscp = 30 + IP_API_DSCP_CS4 IPDscp = 32 + IP_API_DSCP_AF41 IPDscp = 34 + IP_API_DSCP_AF42 IPDscp = 36 + IP_API_DSCP_AF43 IPDscp = 38 + IP_API_DSCP_CS5 IPDscp = 40 + IP_API_DSCP_EF IPDscp = 46 + IP_API_DSCP_CS6 IPDscp = 48 + IP_API_DSCP_CS7 IPDscp = 50 +) -type IPDscp = ip_types.IPDscp +var ( + IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", + } + IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, + } +) -type IPEcn = ip_types.IPEcn +func (x IPDscp) String() string { + s, ok := IPDscp_name[uint8(x)] + if ok { + return s + } + return "IPDscp(" + strconv.Itoa(int(x)) + ")" +} -type IPProto = ip_types.IPProto +// IPEcn represents VPP binary API enum 'ip_ecn'. +type IPEcn uint8 + +const ( + IP_API_ECN_NONE IPEcn = 0 + IP_API_ECN_ECT0 IPEcn = 1 + IP_API_ECN_ECT1 IPEcn = 2 + IP_API_ECN_CE IPEcn = 3 +) + +var ( + IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", + } + IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, + } +) + +func (x IPEcn) String() string { + s, ok := IPEcn_name[uint8(x)] + if ok { + return s + } + return "IPEcn(" + strconv.Itoa(int(x)) + ")" +} + +// IPProto represents VPP binary API enum 'ip_proto'. +type IPProto uint32 + +const ( + IP_API_PROTO_HOPOPT IPProto = 0 + IP_API_PROTO_ICMP IPProto = 1 + IP_API_PROTO_IGMP IPProto = 2 + IP_API_PROTO_TCP IPProto = 6 + IP_API_PROTO_UDP IPProto = 17 + IP_API_PROTO_GRE IPProto = 47 + IP_API_PROTO_AH IPProto = 50 + IP_API_PROTO_ESP IPProto = 51 + IP_API_PROTO_EIGRP IPProto = 88 + IP_API_PROTO_OSPF IPProto = 89 + IP_API_PROTO_SCTP IPProto = 132 + IP_API_PROTO_RESERVED IPProto = 255 +) + +var ( + IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", + } + IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, + } +) + +func (x IPProto) String() string { + s, ok := IPProto_name[uint32(x)] + if ok { + return s + } + return "IPProto(" + strconv.Itoa(int(x)) + ")" +} // IPReassType represents VPP binary API enum 'ip_reass_type'. type IPReassType uint32 @@ -177,25 +436,54 @@ const ( IP_REASS_TYPE_SHALLOW_VIRTUAL IPReassType = 1 ) -var IPReassType_name = map[uint32]string{ - 0: "IP_REASS_TYPE_FULL", - 1: "IP_REASS_TYPE_SHALLOW_VIRTUAL", -} - -var IPReassType_value = map[string]uint32{ - "IP_REASS_TYPE_FULL": 0, - "IP_REASS_TYPE_SHALLOW_VIRTUAL": 1, -} +var ( + IPReassType_name = map[uint32]string{ + 0: "IP_REASS_TYPE_FULL", + 1: "IP_REASS_TYPE_SHALLOW_VIRTUAL", + } + IPReassType_value = map[string]uint32{ + "IP_REASS_TYPE_FULL": 0, + "IP_REASS_TYPE_SHALLOW_VIRTUAL": 1, + } +) func (x IPReassType) String() string { s, ok := IPReassType_name[uint32(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "IPReassType(" + strconv.Itoa(int(x)) + ")" } -type LinkDuplex = interface_types.LinkDuplex +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} // MfibItfFlags represents VPP binary API enum 'mfib_itf_flags'. type MfibItfFlags uint32 @@ -209,155 +497,357 @@ const ( MFIB_API_ITF_FLAG_DONT_PRESERVE MfibItfFlags = 16 ) -var MfibItfFlags_name = map[uint32]string{ - 0: "MFIB_API_ITF_FLAG_NONE", - 1: "MFIB_API_ITF_FLAG_NEGATE_SIGNAL", - 2: "MFIB_API_ITF_FLAG_ACCEPT", - 4: "MFIB_API_ITF_FLAG_FORWARD", - 8: "MFIB_API_ITF_FLAG_SIGNAL_PRESENT", - 16: "MFIB_API_ITF_FLAG_DONT_PRESERVE", +var ( + MfibItfFlags_name = map[uint32]string{ + 0: "MFIB_API_ITF_FLAG_NONE", + 1: "MFIB_API_ITF_FLAG_NEGATE_SIGNAL", + 2: "MFIB_API_ITF_FLAG_ACCEPT", + 4: "MFIB_API_ITF_FLAG_FORWARD", + 8: "MFIB_API_ITF_FLAG_SIGNAL_PRESENT", + 16: "MFIB_API_ITF_FLAG_DONT_PRESERVE", + } + MfibItfFlags_value = map[string]uint32{ + "MFIB_API_ITF_FLAG_NONE": 0, + "MFIB_API_ITF_FLAG_NEGATE_SIGNAL": 1, + "MFIB_API_ITF_FLAG_ACCEPT": 2, + "MFIB_API_ITF_FLAG_FORWARD": 4, + "MFIB_API_ITF_FLAG_SIGNAL_PRESENT": 8, + "MFIB_API_ITF_FLAG_DONT_PRESERVE": 16, + } +) + +func (x MfibItfFlags) String() string { + s, ok := MfibItfFlags_name[uint32(x)] + if ok { + return s + } + return "MfibItfFlags(" + strconv.Itoa(int(x)) + ")" } -var MfibItfFlags_value = map[string]uint32{ - "MFIB_API_ITF_FLAG_NONE": 0, - "MFIB_API_ITF_FLAG_NEGATE_SIGNAL": 1, - "MFIB_API_ITF_FLAG_ACCEPT": 2, - "MFIB_API_ITF_FLAG_FORWARD": 4, - "MFIB_API_ITF_FLAG_SIGNAL_PRESENT": 8, - "MFIB_API_ITF_FLAG_DONT_PRESERVE": 16, +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" } -func (x MfibItfFlags) String() string { - s, ok := MfibItfFlags_name[uint32(x)] +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "RxMode(" + strconv.Itoa(int(x)) + ")" } -type MtuProto = interface_types.MtuProto +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 -type RxMode = interface_types.RxMode +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) + +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) + +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} -type SubIfFlags = interface_types.SubIfFlags +// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. +type AddressWithPrefix Prefix -type AddressWithPrefix = ip_types.AddressWithPrefix +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 -type InterfaceIndex = interface_types.InterfaceIndex +// IP4Address represents VPP binary API alias 'ip4_address'. +type IP4Address [4]uint8 -type IP4Address = ip_types.IP4Address +// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. +type IP4AddressWithPrefix IP4Prefix -type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix +// IP6Address represents VPP binary API alias 'ip6_address'. +type IP6Address [16]uint8 -type IP6Address = ip_types.IP6Address +// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. +type IP6AddressWithPrefix IP6Prefix -type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 -type MacAddress = ethernet_types.MacAddress +// Address represents VPP binary API type 'address'. +type Address struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` +} -type Address = ip_types.Address +func (*Address) GetTypeName() string { return "address" } // FibMplsLabel represents VPP binary API type 'fib_mpls_label'. type FibMplsLabel struct { - IsUniform uint8 - Label uint32 - TTL uint8 - Exp uint8 + IsUniform uint8 `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"` + Label uint32 `binapi:"u32,name=label" json:"label,omitempty"` + TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` + Exp uint8 `binapi:"u8,name=exp" json:"exp,omitempty"` } func (*FibMplsLabel) GetTypeName() string { return "fib_mpls_label" } // FibPath represents VPP binary API type 'fib_path'. type FibPath struct { - SwIfIndex uint32 - TableID uint32 - RpfID uint32 - Weight uint8 - Preference uint8 - Type FibPathType - Flags FibPathFlags - Proto FibPathNhProto - Nh FibPathNh - NLabels uint8 - LabelStack []FibMplsLabel `struc:"[16]FibMplsLabel"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Weight uint8 `binapi:"u8,name=weight" json:"weight,omitempty"` + Preference uint8 `binapi:"u8,name=preference" json:"preference,omitempty"` + Type FibPathType `binapi:"fib_path_type,name=type" json:"type,omitempty"` + Flags FibPathFlags `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"` + Proto FibPathNhProto `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"` + Nh FibPathNh `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"` + NLabels uint8 `binapi:"u8,name=n_labels" json:"n_labels,omitempty"` + LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty" struc:"[16]FibMplsLabel"` } func (*FibPath) GetTypeName() string { return "fib_path" } // FibPathNh represents VPP binary API type 'fib_path_nh'. type FibPathNh struct { - Address AddressUnion - ViaLabel uint32 - ObjID uint32 - ClassifyTableIndex uint32 + Address AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"` + ViaLabel uint32 `binapi:"u32,name=via_label" json:"via_label,omitempty"` + ObjID uint32 `binapi:"u32,name=obj_id" json:"obj_id,omitempty"` + ClassifyTableIndex uint32 `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"` } func (*FibPathNh) GetTypeName() string { return "fib_path_nh" } -type IP4Prefix = ip_types.IP4Prefix +// IP4Prefix represents VPP binary API type 'ip4_prefix'. +type IP4Prefix struct { + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} + +func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } + +// IP6Prefix represents VPP binary API type 'ip6_prefix'. +type IP6Prefix struct { + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} -type IP6Prefix = ip_types.IP6Prefix +func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } // IPMroute represents VPP binary API type 'ip_mroute'. type IPMroute struct { - TableID uint32 - EntryFlags uint32 - RpfID uint32 - Prefix Mprefix - NPaths uint8 `struc:"sizeof=Paths"` - Paths []MfibPath + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + EntryFlags uint32 `binapi:"u32,name=entry_flags" json:"entry_flags,omitempty"` + RpfID uint32 `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"` + Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` + Paths []MfibPath `binapi:"mfib_path[n_paths],name=paths" json:"paths,omitempty"` } func (*IPMroute) GetTypeName() string { return "ip_mroute" } // IPRoute represents VPP binary API type 'ip_route'. type IPRoute struct { - TableID uint32 - StatsIndex uint32 - Prefix Prefix - NPaths uint8 `struc:"sizeof=Paths"` - Paths []FibPath + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NPaths uint8 `binapi:"u8,name=n_paths" json:"n_paths,omitempty" struc:"sizeof=Paths"` + Paths []FibPath `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"` } func (*IPRoute) GetTypeName() string { return "ip_route" } // IPTable represents VPP binary API type 'ip_table'. type IPTable struct { - TableID uint32 - IsIP6 bool - Name string `struc:"[64]byte"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` } func (*IPTable) GetTypeName() string { return "ip_table" } // MfibPath represents VPP binary API type 'mfib_path'. type MfibPath struct { - ItfFlags MfibItfFlags - Path FibPath + ItfFlags MfibItfFlags `binapi:"mfib_itf_flags,name=itf_flags" json:"itf_flags,omitempty"` + Path FibPath `binapi:"fib_path,name=path" json:"path,omitempty"` } func (*MfibPath) GetTypeName() string { return "mfib_path" } -type Mprefix = ip_types.Mprefix +// Mprefix represents VPP binary API type 'mprefix'. +type Mprefix struct { + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` +} + +func (*Mprefix) GetTypeName() string { return "mprefix" } -type Prefix = ip_types.Prefix +// Prefix represents VPP binary API type 'prefix'. +type Prefix struct { + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` +} -type PrefixMatcher = ip_types.PrefixMatcher +func (*Prefix) GetTypeName() string { return "prefix" } + +// PrefixMatcher represents VPP binary API type 'prefix_matcher'. +type PrefixMatcher struct { + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` +} + +func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } // PuntRedirect represents VPP binary API type 'punt_redirect'. type PuntRedirect struct { - RxSwIfIndex InterfaceIndex - TxSwIfIndex InterfaceIndex - Nh Address + RxSwIfIndex InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` + TxSwIfIndex InterfaceIndex `binapi:"interface_index,name=tx_sw_if_index" json:"tx_sw_if_index,omitempty"` + Nh Address `binapi:"address,name=nh" json:"nh,omitempty"` } func (*PuntRedirect) GetTypeName() string { return "punt_redirect" } -type AddressUnion = ip_types.AddressUnion +// AddressUnion represents VPP binary API union 'address_union'. +type AddressUnion struct { + XXX_UnionData [16]byte +} + +func (*AddressUnion) GetTypeName() string { return "address_union" } + +func AddressUnionIP4(a IP4Address) (u AddressUnion) { + u.SetIP4(a) + return +} +func (u *AddressUnion) SetIP4(a IP4Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP4() (a IP4Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} + +func AddressUnionIP6(a IP6Address) (u AddressUnion) { + u.SetIP6(a) + return +} +func (u *AddressUnion) SetIP6(a IP6Address) { + var b = new(bytes.Buffer) + if err := struc.Pack(b, &a); err != nil { + return + } + copy(u.XXX_UnionData[:], b.Bytes()) +} +func (u *AddressUnion) GetIP6() (a IP6Address) { + var b = bytes.NewReader(u.XXX_UnionData[:]) + struc.Unpack(b, &a) + return +} // IoamDisable represents VPP binary API message 'ioam_disable'. type IoamDisable struct { - ID uint16 + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` } func (m *IoamDisable) Reset() { *m = IoamDisable{} } @@ -365,9 +855,45 @@ func (*IoamDisable) GetMessageName() string { return "ioam_disable" } func (*IoamDisable) GetCrcString() string { return "6b16a45e" } func (*IoamDisable) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IoamDisable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ID + size += 2 + return size +} +func (m *IoamDisable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ID + o.PutUint16(buf[pos:pos+2], uint16(m.ID)) + pos += 2 + return buf, nil +} +func (m *IoamDisable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ID + m.ID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + // IoamDisableReply represents VPP binary API message 'ioam_disable_reply'. type IoamDisableReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IoamDisableReply) Reset() { *m = IoamDisableReply{} } @@ -375,14 +901,50 @@ func (*IoamDisableReply) GetMessageName() string { return "ioam_disable func (*IoamDisableReply) GetCrcString() string { return "e8d4e804" } func (*IoamDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IoamDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IoamDisableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IoamDisableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IoamEnable represents VPP binary API message 'ioam_enable'. type IoamEnable struct { - ID uint16 - Seqno bool - Analyse bool - PotEnable bool - TraceEnable bool - NodeID uint32 + ID uint16 `binapi:"u16,name=id" json:"id,omitempty"` + Seqno bool `binapi:"bool,name=seqno" json:"seqno,omitempty"` + Analyse bool `binapi:"bool,name=analyse" json:"analyse,omitempty"` + PotEnable bool `binapi:"bool,name=pot_enable" json:"pot_enable,omitempty"` + TraceEnable bool `binapi:"bool,name=trace_enable" json:"trace_enable,omitempty"` + NodeID uint32 `binapi:"u32,name=node_id" json:"node_id,omitempty"` } func (m *IoamEnable) Reset() { *m = IoamEnable{} } @@ -390,9 +952,93 @@ func (*IoamEnable) GetMessageName() string { return "ioam_enable" } func (*IoamEnable) GetCrcString() string { return "51ccd868" } func (*IoamEnable) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IoamEnable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.ID + size += 2 + // field[1] m.Seqno + size += 1 + // field[1] m.Analyse + size += 1 + // field[1] m.PotEnable + size += 1 + // field[1] m.TraceEnable + size += 1 + // field[1] m.NodeID + size += 4 + return size +} +func (m *IoamEnable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.ID + o.PutUint16(buf[pos:pos+2], uint16(m.ID)) + pos += 2 + // field[1] m.Seqno + if m.Seqno { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Analyse + if m.Analyse { + buf[pos] = 1 + } + pos += 1 + // field[1] m.PotEnable + if m.PotEnable { + buf[pos] = 1 + } + pos += 1 + // field[1] m.TraceEnable + if m.TraceEnable { + buf[pos] = 1 + } + pos += 1 + // field[1] m.NodeID + o.PutUint32(buf[pos:pos+4], uint32(m.NodeID)) + pos += 4 + return buf, nil +} +func (m *IoamEnable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.ID + m.ID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.Seqno + m.Seqno = tmp[pos] != 0 + pos += 1 + // field[1] m.Analyse + m.Analyse = tmp[pos] != 0 + pos += 1 + // field[1] m.PotEnable + m.PotEnable = tmp[pos] != 0 + pos += 1 + // field[1] m.TraceEnable + m.TraceEnable = tmp[pos] != 0 + pos += 1 + // field[1] m.NodeID + m.NodeID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IoamEnableReply represents VPP binary API message 'ioam_enable_reply'. type IoamEnableReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IoamEnableReply) Reset() { *m = IoamEnableReply{} } @@ -400,10 +1046,46 @@ func (*IoamEnableReply) GetMessageName() string { return "ioam_enable_r func (*IoamEnableReply) GetCrcString() string { return "e8d4e804" } func (*IoamEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IoamEnableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IoamEnableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IoamEnableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPAddressDetails represents VPP binary API message 'ip_address_details'. type IPAddressDetails struct { - SwIfIndex InterfaceIndex - Prefix AddressWithPrefix + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix AddressWithPrefix `binapi:"address_with_prefix,name=prefix" json:"prefix,omitempty"` } func (m *IPAddressDetails) Reset() { *m = IPAddressDetails{} } @@ -411,10 +1093,76 @@ func (*IPAddressDetails) GetMessageName() string { return "ip_address_d func (*IPAddressDetails) GetCrcString() string { return "b1199745" } func (*IPAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPAddressDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *IPAddressDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *IPAddressDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + // IPAddressDump represents VPP binary API message 'ip_address_dump'. type IPAddressDump struct { - SwIfIndex InterfaceIndex - IsIPv6 bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` } func (m *IPAddressDump) Reset() { *m = IPAddressDump{} } @@ -422,11 +1170,57 @@ func (*IPAddressDump) GetMessageName() string { return "ip_address_dump func (*IPAddressDump) GetCrcString() string { return "2d033de4" } func (*IPAddressDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPAddressDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPAddressDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPAddressDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + // IPContainerProxyAddDel represents VPP binary API message 'ip_container_proxy_add_del'. type IPContainerProxyAddDel struct { - Pfx Prefix - SwIfIndex InterfaceIndex - IsAdd bool + Pfx Prefix `binapi:"prefix,name=pfx" json:"pfx,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` } func (m *IPContainerProxyAddDel) Reset() { *m = IPContainerProxyAddDel{} } @@ -434,9 +1228,85 @@ func (*IPContainerProxyAddDel) GetMessageName() string { return "ip_con func (*IPContainerProxyAddDel) GetCrcString() string { return "91189f40" } func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPContainerProxyAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Pfx + // field[2] m.Pfx.Address + // field[3] m.Pfx.Address.Af + size += 4 + // field[3] m.Pfx.Address.Un + size += 16 + // field[2] m.Pfx.Len + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *IPContainerProxyAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Pfx + // field[2] m.Pfx.Address + // field[3] m.Pfx.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Pfx.Address.Af)) + pos += 4 + // field[3] m.Pfx.Address.Un + copy(buf[pos:pos+16], m.Pfx.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Pfx.Len + buf[pos] = uint8(m.Pfx.Len) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPContainerProxyAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Pfx + // field[2] m.Pfx.Address + // field[3] m.Pfx.Address.Af + m.Pfx.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Pfx.Address.Un + copy(m.Pfx.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Pfx.Len + m.Pfx.Len = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + return nil +} + // IPContainerProxyAddDelReply represents VPP binary API message 'ip_container_proxy_add_del_reply'. type IPContainerProxyAddDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPContainerProxyAddDelReply) Reset() { *m = IPContainerProxyAddDelReply{} } @@ -446,10 +1316,46 @@ func (*IPContainerProxyAddDelReply) GetMessageName() string { func (*IPContainerProxyAddDelReply) GetCrcString() string { return "e8d4e804" } func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPContainerProxyAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPContainerProxyAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPContainerProxyAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPContainerProxyDetails represents VPP binary API message 'ip_container_proxy_details'. type IPContainerProxyDetails struct { - SwIfIndex InterfaceIndex - Prefix Prefix + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` } func (m *IPContainerProxyDetails) Reset() { *m = IPContainerProxyDetails{} } @@ -457,6 +1363,72 @@ func (*IPContainerProxyDetails) GetMessageName() string { return "ip_co func (*IPContainerProxyDetails) GetCrcString() string { return "0ee460e8" } func (*IPContainerProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPContainerProxyDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + return size +} +func (m *IPContainerProxyDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + return buf, nil +} +func (m *IPContainerProxyDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + return nil +} + // IPContainerProxyDump represents VPP binary API message 'ip_container_proxy_dump'. type IPContainerProxyDump struct{} @@ -465,10 +1437,38 @@ func (*IPContainerProxyDump) GetMessageName() string { return "ip_conta func (*IPContainerProxyDump) GetCrcString() string { return "51077d14" } func (*IPContainerProxyDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPContainerProxyDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPContainerProxyDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *IPContainerProxyDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // IPDetails represents VPP binary API message 'ip_details'. type IPDetails struct { - SwIfIndex InterfaceIndex - IsIPv6 bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` } func (m *IPDetails) Reset() { *m = IPDetails{} } @@ -476,9 +1476,55 @@ func (*IPDetails) GetMessageName() string { return "ip_details" } func (*IPDetails) GetCrcString() string { return "eb152d07" } func (*IPDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + // IPDump represents VPP binary API message 'ip_dump'. type IPDump struct { - IsIPv6 bool + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` } func (m *IPDump) Reset() { *m = IPDump{} } @@ -486,11 +1532,49 @@ func (*IPDump) GetMessageName() string { return "ip_dump" } func (*IPDump) GetCrcString() string { return "98d231ca" } func (*IPDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + // IPMrouteAddDel represents VPP binary API message 'ip_mroute_add_del'. type IPMrouteAddDel struct { - IsAdd bool - IsMultipath bool - Route IPMroute + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` + Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` } func (m *IPMrouteAddDel) Reset() { *m = IPMrouteAddDel{} } @@ -498,10 +1582,315 @@ func (*IPMrouteAddDel) GetMessageName() string { return "ip_mroute_add_ func (*IPMrouteAddDel) GetCrcString() string { return "f6627d17" } func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPMrouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.IsMultipath + size += 1 + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.EntryFlags + size += 4 + // field[2] m.Route.RpfID + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + size += 4 + // field[3] m.Route.Prefix.GrpAddressLength + size += 2 + // field[3] m.Route.Prefix.GrpAddress + size += 16 + // field[3] m.Route.Prefix.SrcAddress + size += 16 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 MfibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.ItfFlags + size += 4 + // field[3] s2.Path + // field[4] s2.Path.SwIfIndex + size += 4 + // field[4] s2.Path.TableID + size += 4 + // field[4] s2.Path.RpfID + size += 4 + // field[4] s2.Path.Weight + size += 1 + // field[4] s2.Path.Preference + size += 1 + // field[4] s2.Path.Type + size += 4 + // field[4] s2.Path.Flags + size += 4 + // field[4] s2.Path.Proto + size += 4 + // field[4] s2.Path.Nh + // field[5] s2.Path.Nh.Address + size += 16 + // field[5] s2.Path.Nh.ViaLabel + size += 4 + // field[5] s2.Path.Nh.ObjID + size += 4 + // field[5] s2.Path.Nh.ClassifyTableIndex + size += 4 + // field[4] s2.Path.NLabels + size += 1 + // field[4] s2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var s4 FibMplsLabel + _ = s4 + if j4 < len(s2.Path.LabelStack) { + s4 = s2.Path.LabelStack[j4] + } + // field[5] s4.IsUniform + size += 1 + // field[5] s4.Label + size += 4 + // field[5] s4.TTL + size += 1 + // field[5] s4.Exp + size += 1 + } + } + return size +} +func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.IsMultipath + if m.IsMultipath { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.EntryFlags + o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) + pos += 4 + // field[2] m.Route.RpfID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) + pos += 16 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 MfibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.ItfFlags + o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) + pos += 4 + // field[3] v2.Path + // field[4] v2.Path.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) + pos += 4 + // field[4] v2.Path.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) + pos += 4 + // field[4] v2.Path.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) + pos += 4 + // field[4] v2.Path.Weight + buf[pos] = uint8(v2.Path.Weight) + pos += 1 + // field[4] v2.Path.Preference + buf[pos] = uint8(v2.Path.Preference) + pos += 1 + // field[4] v2.Path.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) + pos += 4 + // field[4] v2.Path.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) + pos += 4 + // field[4] v2.Path.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) + pos += 4 + // field[4] v2.Path.Nh + // field[5] v2.Path.Nh.Address + copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[5] v2.Path.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) + pos += 4 + // field[5] v2.Path.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) + pos += 4 + // field[5] v2.Path.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) + pos += 4 + // field[4] v2.Path.NLabels + buf[pos] = uint8(v2.Path.NLabels) + pos += 1 + // field[4] v2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var v4 FibMplsLabel + if j4 < len(v2.Path.LabelStack) { + v4 = v2.Path.LabelStack[j4] + } + // field[5] v4.IsUniform + buf[pos] = uint8(v4.IsUniform) + pos += 1 + // field[5] v4.Label + o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) + pos += 4 + // field[5] v4.TTL + buf[pos] = uint8(v4.TTL) + pos += 1 + // field[5] v4.Exp + buf[pos] = uint8(v4.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPMrouteAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.IsMultipath + m.IsMultipath = tmp[pos] != 0 + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.EntryFlags + m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.RpfID + m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].ItfFlags + m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Path + // field[4] m.Route.Paths[j2].Path.SwIfIndex + m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.TableID + m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.RpfID + m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Weight + m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Preference + m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Type + m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Flags + m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Proto + m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Nh + // field[5] m.Route.Paths[j2].Path.Nh.Address + copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel + m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ObjID + m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex + m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.NLabels + m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform + m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label + m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL + m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp + m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + // IPMrouteAddDelReply represents VPP binary API message 'ip_mroute_add_del_reply'. type IPMrouteAddDelReply struct { - Retval int32 - StatsIndex uint32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` } func (m *IPMrouteAddDelReply) Reset() { *m = IPMrouteAddDelReply{} } @@ -509,9 +1898,53 @@ func (*IPMrouteAddDelReply) GetMessageName() string { return "ip_mroute func (*IPMrouteAddDelReply) GetCrcString() string { return "1992deab" } func (*IPMrouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPMrouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.StatsIndex + size += 4 + return size +} +func (m *IPMrouteAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) + pos += 4 + return buf, nil +} +func (m *IPMrouteAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.StatsIndex + m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPMrouteDetails represents VPP binary API message 'ip_mroute_details'. type IPMrouteDetails struct { - Route IPMroute + Route IPMroute `binapi:"ip_mroute,name=route" json:"route,omitempty"` } func (m *IPMrouteDetails) Reset() { *m = IPMrouteDetails{} } @@ -519,9 +1952,294 @@ func (*IPMrouteDetails) GetMessageName() string { return "ip_mroute_det func (*IPMrouteDetails) GetCrcString() string { return "c1cb4b44" } func (*IPMrouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPMrouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.EntryFlags + size += 4 + // field[2] m.Route.RpfID + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + size += 4 + // field[3] m.Route.Prefix.GrpAddressLength + size += 2 + // field[3] m.Route.Prefix.GrpAddress + size += 16 + // field[3] m.Route.Prefix.SrcAddress + size += 16 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 MfibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.ItfFlags + size += 4 + // field[3] s2.Path + // field[4] s2.Path.SwIfIndex + size += 4 + // field[4] s2.Path.TableID + size += 4 + // field[4] s2.Path.RpfID + size += 4 + // field[4] s2.Path.Weight + size += 1 + // field[4] s2.Path.Preference + size += 1 + // field[4] s2.Path.Type + size += 4 + // field[4] s2.Path.Flags + size += 4 + // field[4] s2.Path.Proto + size += 4 + // field[4] s2.Path.Nh + // field[5] s2.Path.Nh.Address + size += 16 + // field[5] s2.Path.Nh.ViaLabel + size += 4 + // field[5] s2.Path.Nh.ObjID + size += 4 + // field[5] s2.Path.Nh.ClassifyTableIndex + size += 4 + // field[4] s2.Path.NLabels + size += 1 + // field[4] s2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var s4 FibMplsLabel + _ = s4 + if j4 < len(s2.Path.LabelStack) { + s4 = s2.Path.LabelStack[j4] + } + // field[5] s4.IsUniform + size += 1 + // field[5] s4.Label + size += 4 + // field[5] s4.TTL + size += 1 + // field[5] s4.Exp + size += 1 + } + } + return size +} +func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.EntryFlags + o.PutUint32(buf[pos:pos+4], uint32(m.Route.EntryFlags)) + pos += 4 + // field[2] m.Route.RpfID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.RpfID)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Af)) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + o.PutUint16(buf[pos:pos+2], uint16(m.Route.Prefix.GrpAddressLength)) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(buf[pos:pos+16], m.Route.Prefix.GrpAddress.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(buf[pos:pos+16], m.Route.Prefix.SrcAddress.XXX_UnionData[:]) + pos += 16 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 MfibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.ItfFlags + o.PutUint32(buf[pos:pos+4], uint32(v2.ItfFlags)) + pos += 4 + // field[3] v2.Path + // field[4] v2.Path.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.SwIfIndex)) + pos += 4 + // field[4] v2.Path.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.TableID)) + pos += 4 + // field[4] v2.Path.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.RpfID)) + pos += 4 + // field[4] v2.Path.Weight + buf[pos] = uint8(v2.Path.Weight) + pos += 1 + // field[4] v2.Path.Preference + buf[pos] = uint8(v2.Path.Preference) + pos += 1 + // field[4] v2.Path.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Type)) + pos += 4 + // field[4] v2.Path.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Flags)) + pos += 4 + // field[4] v2.Path.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Proto)) + pos += 4 + // field[4] v2.Path.Nh + // field[5] v2.Path.Nh.Address + copy(buf[pos:pos+16], v2.Path.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[5] v2.Path.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ViaLabel)) + pos += 4 + // field[5] v2.Path.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ObjID)) + pos += 4 + // field[5] v2.Path.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Path.Nh.ClassifyTableIndex)) + pos += 4 + // field[4] v2.Path.NLabels + buf[pos] = uint8(v2.Path.NLabels) + pos += 1 + // field[4] v2.Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + var v4 FibMplsLabel + if j4 < len(v2.Path.LabelStack) { + v4 = v2.Path.LabelStack[j4] + } + // field[5] v4.IsUniform + buf[pos] = uint8(v4.IsUniform) + pos += 1 + // field[5] v4.Label + o.PutUint32(buf[pos:pos+4], uint32(v4.Label)) + pos += 4 + // field[5] v4.TTL + buf[pos] = uint8(v4.TTL) + pos += 1 + // field[5] v4.Exp + buf[pos] = uint8(v4.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPMrouteDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.EntryFlags + m.Route.EntryFlags = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.RpfID + m.Route.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Af + m.Route.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Prefix.GrpAddressLength + m.Route.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[3] m.Route.Prefix.GrpAddress + copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.SrcAddress + copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]MfibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].ItfFlags + m.Route.Paths[j2].ItfFlags = MfibItfFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Path + // field[4] m.Route.Paths[j2].Path.SwIfIndex + m.Route.Paths[j2].Path.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.TableID + m.Route.Paths[j2].Path.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.RpfID + m.Route.Paths[j2].Path.RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Weight + m.Route.Paths[j2].Path.Weight = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Preference + m.Route.Paths[j2].Path.Preference = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.Type + m.Route.Paths[j2].Path.Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Flags + m.Route.Paths[j2].Path.Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Proto + m.Route.Paths[j2].Path.Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.Nh + // field[5] m.Route.Paths[j2].Path.Nh.Address + copy(m.Route.Paths[j2].Path.Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[5] m.Route.Paths[j2].Path.Nh.ViaLabel + m.Route.Paths[j2].Path.Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ObjID + m.Route.Paths[j2].Path.Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.Nh.ClassifyTableIndex + m.Route.Paths[j2].Path.Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Path.NLabels + m.Route.Paths[j2].Path.NLabels = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].Path.LabelStack + for j4 := 0; j4 < 16; j4++ { + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].IsUniform + m.Route.Paths[j2].Path.LabelStack[j4].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Label + m.Route.Paths[j2].Path.LabelStack[j4].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].TTL + m.Route.Paths[j2].Path.LabelStack[j4].TTL = uint8(tmp[pos]) + pos += 1 + // field[5] m.Route.Paths[j2].Path.LabelStack[j4].Exp + m.Route.Paths[j2].Path.LabelStack[j4].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + // IPMrouteDump represents VPP binary API message 'ip_mroute_dump'. type IPMrouteDump struct { - Table IPTable + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` } func (m *IPMrouteDump) Reset() { *m = IPMrouteDump{} } @@ -529,9 +2247,69 @@ func (*IPMrouteDump) GetMessageName() string { return "ip_mroute_dump" func (*IPMrouteDump) GetCrcString() string { return "b9d2e09e" } func (*IPMrouteDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPMrouteDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPMrouteDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPMrouteDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // IPMtableDetails represents VPP binary API message 'ip_mtable_details'. type IPMtableDetails struct { - Table IPTable + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` } func (m *IPMtableDetails) Reset() { *m = IPMtableDetails{} } @@ -539,6 +2317,66 @@ func (*IPMtableDetails) GetMessageName() string { return "ip_mtable_det func (*IPMtableDetails) GetCrcString() string { return "b9d2e09e" } func (*IPMtableDetails) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPMtableDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPMtableDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPMtableDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // IPMtableDump represents VPP binary API message 'ip_mtable_dump'. type IPMtableDump struct{} @@ -547,11 +2385,39 @@ func (*IPMtableDump) GetMessageName() string { return "ip_mtable_dump" func (*IPMtableDump) GetCrcString() string { return "51077d14" } func (*IPMtableDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPMtableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPMtableDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *IPMtableDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // IPPuntPolice represents VPP binary API message 'ip_punt_police'. type IPPuntPolice struct { - PolicerIndex uint32 - IsAdd bool - IsIP6 bool + PolicerIndex uint32 `binapi:"u32,name=policer_index" json:"policer_index,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` } func (m *IPPuntPolice) Reset() { *m = IPPuntPolice{} } @@ -559,9 +2425,65 @@ func (*IPPuntPolice) GetMessageName() string { return "ip_punt_police" func (*IPPuntPolice) GetCrcString() string { return "db867cea" } func (*IPPuntPolice) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPPuntPolice) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.PolicerIndex + size += 4 + // field[1] m.IsAdd + size += 1 + // field[1] m.IsIP6 + size += 1 + return size +} +func (m *IPPuntPolice) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.PolicerIndex + o.PutUint32(buf[pos:pos+4], uint32(m.PolicerIndex)) + pos += 4 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPPuntPolice) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.PolicerIndex + m.PolicerIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + return nil +} + // IPPuntPoliceReply represents VPP binary API message 'ip_punt_police_reply'. type IPPuntPoliceReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPPuntPoliceReply) Reset() { *m = IPPuntPoliceReply{} } @@ -569,10 +2491,46 @@ func (*IPPuntPoliceReply) GetMessageName() string { return "ip_punt_pol func (*IPPuntPoliceReply) GetCrcString() string { return "e8d4e804" } func (*IPPuntPoliceReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPPuntPoliceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPPuntPoliceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPPuntPoliceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPPuntRedirect represents VPP binary API message 'ip_punt_redirect'. type IPPuntRedirect struct { - Punt PuntRedirect - IsAdd bool + Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` } func (m *IPPuntRedirect) Reset() { *m = IPPuntRedirect{} } @@ -580,9 +2538,85 @@ func (*IPPuntRedirect) GetMessageName() string { return "ip_punt_redire func (*IPPuntRedirect) GetCrcString() string { return "a9a5592c" } func (*IPPuntRedirect) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPPuntRedirect) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + size += 4 + // field[2] m.Punt.TxSwIfIndex + size += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + size += 4 + // field[3] m.Punt.Nh.Un + size += 16 + // field[1] m.IsAdd + size += 1 + return size +} +func (m *IPPuntRedirect) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) + pos += 16 + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPPuntRedirect) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + return nil +} + // IPPuntRedirectDetails represents VPP binary API message 'ip_punt_redirect_details'. type IPPuntRedirectDetails struct { - Punt PuntRedirect + Punt PuntRedirect `binapi:"punt_redirect,name=punt" json:"punt,omitempty"` } func (m *IPPuntRedirectDetails) Reset() { *m = IPPuntRedirectDetails{} } @@ -590,10 +2624,76 @@ func (*IPPuntRedirectDetails) GetMessageName() string { return "ip_punt func (*IPPuntRedirectDetails) GetCrcString() string { return "3924f5d3" } func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPPuntRedirectDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + size += 4 + // field[2] m.Punt.TxSwIfIndex + size += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + size += 4 + // field[3] m.Punt.Nh.Un + size += 16 + return size +} +func (m *IPPuntRedirectDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.RxSwIfIndex)) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.TxSwIfIndex)) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Punt.Nh.Af)) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(buf[pos:pos+16], m.Punt.Nh.Un.XXX_UnionData[:]) + pos += 16 + return buf, nil +} +func (m *IPPuntRedirectDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Punt + // field[2] m.Punt.RxSwIfIndex + m.Punt.RxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.TxSwIfIndex + m.Punt.TxSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Punt.Nh + // field[3] m.Punt.Nh.Af + m.Punt.Nh.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Punt.Nh.Un + copy(m.Punt.Nh.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + return nil +} + // IPPuntRedirectDump represents VPP binary API message 'ip_punt_redirect_dump'. type IPPuntRedirectDump struct { - SwIfIndex InterfaceIndex - IsIPv6 bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` } func (m *IPPuntRedirectDump) Reset() { *m = IPPuntRedirectDump{} } @@ -601,9 +2701,55 @@ func (*IPPuntRedirectDump) GetMessageName() string { return "ip_punt_re func (*IPPuntRedirectDump) GetCrcString() string { return "2d033de4" } func (*IPPuntRedirectDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPPuntRedirectDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IsIPv6 + size += 1 + return size +} +func (m *IPPuntRedirectDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPPuntRedirectDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + return nil +} + // IPPuntRedirectReply represents VPP binary API message 'ip_punt_redirect_reply'. type IPPuntRedirectReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPPuntRedirectReply) Reset() { *m = IPPuntRedirectReply{} } @@ -611,12 +2757,48 @@ func (*IPPuntRedirectReply) GetMessageName() string { return "ip_punt_r func (*IPPuntRedirectReply) GetCrcString() string { return "e8d4e804" } func (*IPPuntRedirectReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPPuntRedirectReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPPuntRedirectReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPPuntRedirectReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPReassemblyEnableDisable represents VPP binary API message 'ip_reassembly_enable_disable'. type IPReassemblyEnableDisable struct { - SwIfIndex InterfaceIndex - EnableIP4 bool - EnableIP6 bool - Type IPReassType + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + EnableIP4 bool `binapi:"bool,name=enable_ip4" json:"enable_ip4,omitempty"` + EnableIP6 bool `binapi:"bool,name=enable_ip6" json:"enable_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` } func (m *IPReassemblyEnableDisable) Reset() { *m = IPReassemblyEnableDisable{} } @@ -624,9 +2806,73 @@ func (*IPReassemblyEnableDisable) GetMessageName() string { return "ip_ func (*IPReassemblyEnableDisable) GetCrcString() string { return "885c85a6" } func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPReassemblyEnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.EnableIP4 + size += 1 + // field[1] m.EnableIP6 + size += 1 + // field[1] m.Type + size += 4 + return size +} +func (m *IPReassemblyEnableDisable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.EnableIP4 + if m.EnableIP4 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.EnableIP6 + if m.EnableIP6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + return buf, nil +} +func (m *IPReassemblyEnableDisable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.EnableIP4 + m.EnableIP4 = tmp[pos] != 0 + pos += 1 + // field[1] m.EnableIP6 + m.EnableIP6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Type + m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPReassemblyEnableDisableReply represents VPP binary API message 'ip_reassembly_enable_disable_reply'. type IPReassemblyEnableDisableReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPReassemblyEnableDisableReply) Reset() { *m = IPReassemblyEnableDisableReply{} } @@ -636,10 +2882,46 @@ func (*IPReassemblyEnableDisableReply) GetMessageName() string { func (*IPReassemblyEnableDisableReply) GetCrcString() string { return "e8d4e804" } func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPReassemblyEnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPReassemblyEnableDisableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPReassemblyEnableDisableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPReassemblyGet represents VPP binary API message 'ip_reassembly_get'. type IPReassemblyGet struct { - IsIP6 bool - Type IPReassType + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` } func (m *IPReassemblyGet) Reset() { *m = IPReassemblyGet{} } @@ -647,14 +2929,60 @@ func (*IPReassemblyGet) GetMessageName() string { return "ip_reassembly func (*IPReassemblyGet) GetCrcString() string { return "ea13ff63" } func (*IPReassemblyGet) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPReassemblyGet) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsIP6 + size += 1 + // field[1] m.Type + size += 4 + return size +} +func (m *IPReassemblyGet) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + return buf, nil +} +func (m *IPReassemblyGet) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Type + m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPReassemblyGetReply represents VPP binary API message 'ip_reassembly_get_reply'. type IPReassemblyGetReply struct { - Retval int32 - TimeoutMs uint32 - MaxReassemblies uint32 - MaxReassemblyLength uint32 - ExpireWalkIntervalMs uint32 - IsIP6 bool + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` + MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` + MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` + ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` } func (m *IPReassemblyGetReply) Reset() { *m = IPReassemblyGetReply{} } @@ -662,14 +2990,92 @@ func (*IPReassemblyGetReply) GetMessageName() string { return "ip_reass func (*IPReassemblyGetReply) GetCrcString() string { return "d5eb8d34" } func (*IPReassemblyGetReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPReassemblyGetReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.TimeoutMs + size += 4 + // field[1] m.MaxReassemblies + size += 4 + // field[1] m.MaxReassemblyLength + size += 4 + // field[1] m.ExpireWalkIntervalMs + size += 4 + // field[1] m.IsIP6 + size += 1 + return size +} +func (m *IPReassemblyGetReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.TimeoutMs + o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) + pos += 4 + // field[1] m.MaxReassemblies + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) + pos += 4 + // field[1] m.MaxReassemblyLength + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) + pos += 4 + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *IPReassemblyGetReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TimeoutMs + m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblies + m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblyLength + m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + return nil +} + // IPReassemblySet represents VPP binary API message 'ip_reassembly_set'. type IPReassemblySet struct { - TimeoutMs uint32 - MaxReassemblies uint32 - MaxReassemblyLength uint32 - ExpireWalkIntervalMs uint32 - IsIP6 bool - Type IPReassType + TimeoutMs uint32 `binapi:"u32,name=timeout_ms" json:"timeout_ms,omitempty"` + MaxReassemblies uint32 `binapi:"u32,name=max_reassemblies" json:"max_reassemblies,omitempty"` + MaxReassemblyLength uint32 `binapi:"u32,name=max_reassembly_length" json:"max_reassembly_length,omitempty"` + ExpireWalkIntervalMs uint32 `binapi:"u32,name=expire_walk_interval_ms" json:"expire_walk_interval_ms,omitempty"` + IsIP6 bool `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"` + Type IPReassType `binapi:"ip_reass_type,name=type" json:"type,omitempty"` } func (m *IPReassemblySet) Reset() { *m = IPReassemblySet{} } @@ -677,9 +3083,87 @@ func (*IPReassemblySet) GetMessageName() string { return "ip_reassembly func (*IPReassemblySet) GetCrcString() string { return "16467d25" } func (*IPReassemblySet) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPReassemblySet) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.TimeoutMs + size += 4 + // field[1] m.MaxReassemblies + size += 4 + // field[1] m.MaxReassemblyLength + size += 4 + // field[1] m.ExpireWalkIntervalMs + size += 4 + // field[1] m.IsIP6 + size += 1 + // field[1] m.Type + size += 4 + return size +} +func (m *IPReassemblySet) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.TimeoutMs + o.PutUint32(buf[pos:pos+4], uint32(m.TimeoutMs)) + pos += 4 + // field[1] m.MaxReassemblies + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblies)) + pos += 4 + // field[1] m.MaxReassemblyLength + o.PutUint32(buf[pos:pos+4], uint32(m.MaxReassemblyLength)) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + o.PutUint32(buf[pos:pos+4], uint32(m.ExpireWalkIntervalMs)) + pos += 4 + // field[1] m.IsIP6 + if m.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Type + o.PutUint32(buf[pos:pos+4], uint32(m.Type)) + pos += 4 + return buf, nil +} +func (m *IPReassemblySet) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.TimeoutMs + m.TimeoutMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblies + m.MaxReassemblies = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MaxReassemblyLength + m.MaxReassemblyLength = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ExpireWalkIntervalMs + m.ExpireWalkIntervalMs = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIP6 + m.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Type + m.Type = IPReassType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPReassemblySetReply represents VPP binary API message 'ip_reassembly_set_reply'. type IPReassemblySetReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPReassemblySetReply) Reset() { *m = IPReassemblySetReply{} } @@ -687,11 +3171,47 @@ func (*IPReassemblySetReply) GetMessageName() string { return "ip_reass func (*IPReassemblySetReply) GetCrcString() string { return "e8d4e804" } func (*IPReassemblySetReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPReassemblySetReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPReassemblySetReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPReassemblySetReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPRouteAddDel represents VPP binary API message 'ip_route_add_del'. type IPRouteAddDel struct { - IsAdd bool - IsMultipath bool - Route IPRoute + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsMultipath bool `binapi:"bool,name=is_multipath" json:"is_multipath,omitempty"` + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` } func (m *IPRouteAddDel) Reset() { *m = IPRouteAddDel{} } @@ -699,10 +3219,291 @@ func (*IPRouteAddDel) GetMessageName() string { return "ip_route_add_de func (*IPRouteAddDel) GetCrcString() string { return "c1ff832d" } func (*IPRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPRouteAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.IsMultipath + size += 1 + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.StatsIndex + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + size += 4 + // field[4] m.Route.Prefix.Address.Un + size += 16 + // field[3] m.Route.Prefix.Len + size += 1 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.SwIfIndex + size += 4 + // field[3] s2.TableID + size += 4 + // field[3] s2.RpfID + size += 4 + // field[3] s2.Weight + size += 1 + // field[3] s2.Preference + size += 1 + // field[3] s2.Type + size += 4 + // field[3] s2.Flags + size += 4 + // field[3] s2.Proto + size += 4 + // field[3] s2.Nh + // field[4] s2.Nh.Address + size += 16 + // field[4] s2.Nh.ViaLabel + size += 4 + // field[4] s2.Nh.ObjID + size += 4 + // field[4] s2.Nh.ClassifyTableIndex + size += 4 + // field[3] s2.NLabels + size += 1 + // field[3] s2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var s3 FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + // field[4] s3.IsUniform + size += 1 + // field[4] s3.Label + size += 4 + // field[4] s3.TTL + size += 1 + // field[4] s3.Exp + size += 1 + } + } + return size +} +func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.IsMultipath + if m.IsMultipath { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.Len + buf[pos] = uint8(m.Route.Prefix.Len) + pos += 1 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 FibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) + pos += 4 + // field[3] v2.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) + pos += 4 + // field[3] v2.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) + pos += 4 + // field[3] v2.Weight + buf[pos] = uint8(v2.Weight) + pos += 1 + // field[3] v2.Preference + buf[pos] = uint8(v2.Preference) + pos += 1 + // field[3] v2.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) + pos += 4 + // field[3] v2.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) + pos += 4 + // field[3] v2.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) + pos += 4 + // field[3] v2.Nh + // field[4] v2.Nh.Address + copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[4] v2.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) + pos += 4 + // field[4] v2.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) + pos += 4 + // field[4] v2.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) + pos += 4 + // field[3] v2.NLabels + buf[pos] = uint8(v2.NLabels) + pos += 1 + // field[3] v2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var v3 FibMplsLabel + if j3 < len(v2.LabelStack) { + v3 = v2.LabelStack[j3] + } + // field[4] v3.IsUniform + buf[pos] = uint8(v3.IsUniform) + pos += 1 + // field[4] v3.Label + o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) + pos += 4 + // field[4] v3.TTL + buf[pos] = uint8(v3.TTL) + pos += 1 + // field[4] v3.Exp + buf[pos] = uint8(v3.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPRouteAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.IsMultipath + m.IsMultipath = tmp[pos] != 0 + pos += 1 + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.StatsIndex + m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.Len + m.Route.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].SwIfIndex + m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].TableID + m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].RpfID + m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Weight + m.Route.Paths[j2].Weight = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Preference + m.Route.Paths[j2].Preference = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Type + m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Flags + m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Proto + m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Nh + // field[4] m.Route.Paths[j2].Nh.Address + copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[4] m.Route.Paths[j2].Nh.ViaLabel + m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ObjID + m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex + m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].NLabels + m.Route.Paths[j2].NLabels = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].LabelStack + for j3 := 0; j3 < 16; j3++ { + // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform + m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Label + m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].LabelStack[j3].TTL + m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Exp + m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + // IPRouteAddDelReply represents VPP binary API message 'ip_route_add_del_reply'. type IPRouteAddDelReply struct { - Retval int32 - StatsIndex uint32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"` } func (m *IPRouteAddDelReply) Reset() { *m = IPRouteAddDelReply{} } @@ -710,9 +3511,53 @@ func (*IPRouteAddDelReply) GetMessageName() string { return "ip_route_a func (*IPRouteAddDelReply) GetCrcString() string { return "1992deab" } func (*IPRouteAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPRouteAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.StatsIndex + size += 4 + return size +} +func (m *IPRouteAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.StatsIndex)) + pos += 4 + return buf, nil +} +func (m *IPRouteAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.StatsIndex + m.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPRouteDetails represents VPP binary API message 'ip_route_details'. type IPRouteDetails struct { - Route IPRoute + Route IPRoute `binapi:"ip_route,name=route" json:"route,omitempty"` } func (m *IPRouteDetails) Reset() { *m = IPRouteDetails{} } @@ -720,9 +3565,270 @@ func (*IPRouteDetails) GetMessageName() string { return "ip_route_detai func (*IPRouteDetails) GetCrcString() string { return "d1ffaae1" } func (*IPRouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPRouteDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Route + // field[2] m.Route.TableID + size += 4 + // field[2] m.Route.StatsIndex + size += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + size += 4 + // field[4] m.Route.Prefix.Address.Un + size += 16 + // field[3] m.Route.Prefix.Len + size += 1 + // field[2] m.Route.NPaths + size += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var s2 FibPath + _ = s2 + if j2 < len(m.Route.Paths) { + s2 = m.Route.Paths[j2] + } + // field[3] s2.SwIfIndex + size += 4 + // field[3] s2.TableID + size += 4 + // field[3] s2.RpfID + size += 4 + // field[3] s2.Weight + size += 1 + // field[3] s2.Preference + size += 1 + // field[3] s2.Type + size += 4 + // field[3] s2.Flags + size += 4 + // field[3] s2.Proto + size += 4 + // field[3] s2.Nh + // field[4] s2.Nh.Address + size += 16 + // field[4] s2.Nh.ViaLabel + size += 4 + // field[4] s2.Nh.ObjID + size += 4 + // field[4] s2.Nh.ClassifyTableIndex + size += 4 + // field[3] s2.NLabels + size += 1 + // field[3] s2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var s3 FibMplsLabel + _ = s3 + if j3 < len(s2.LabelStack) { + s3 = s2.LabelStack[j3] + } + // field[4] s3.IsUniform + size += 1 + // field[4] s3.Label + size += 4 + // field[4] s3.TTL + size += 1 + // field[4] s3.Exp + size += 1 + } + } + return size +} +func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Route + // field[2] m.Route.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Route.TableID)) + pos += 4 + // field[2] m.Route.StatsIndex + o.PutUint32(buf[pos:pos+4], uint32(m.Route.StatsIndex)) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Route.Prefix.Address.Af)) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(buf[pos:pos+16], m.Route.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] m.Route.Prefix.Len + buf[pos] = uint8(m.Route.Prefix.Len) + pos += 1 + // field[2] m.Route.NPaths + buf[pos] = uint8(len(m.Route.Paths)) + pos += 1 + // field[2] m.Route.Paths + for j2 := 0; j2 < len(m.Route.Paths); j2++ { + var v2 FibPath + if j2 < len(m.Route.Paths) { + v2 = m.Route.Paths[j2] + } + // field[3] v2.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.SwIfIndex)) + pos += 4 + // field[3] v2.TableID + o.PutUint32(buf[pos:pos+4], uint32(v2.TableID)) + pos += 4 + // field[3] v2.RpfID + o.PutUint32(buf[pos:pos+4], uint32(v2.RpfID)) + pos += 4 + // field[3] v2.Weight + buf[pos] = uint8(v2.Weight) + pos += 1 + // field[3] v2.Preference + buf[pos] = uint8(v2.Preference) + pos += 1 + // field[3] v2.Type + o.PutUint32(buf[pos:pos+4], uint32(v2.Type)) + pos += 4 + // field[3] v2.Flags + o.PutUint32(buf[pos:pos+4], uint32(v2.Flags)) + pos += 4 + // field[3] v2.Proto + o.PutUint32(buf[pos:pos+4], uint32(v2.Proto)) + pos += 4 + // field[3] v2.Nh + // field[4] v2.Nh.Address + copy(buf[pos:pos+16], v2.Nh.Address.XXX_UnionData[:]) + pos += 16 + // field[4] v2.Nh.ViaLabel + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ViaLabel)) + pos += 4 + // field[4] v2.Nh.ObjID + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ObjID)) + pos += 4 + // field[4] v2.Nh.ClassifyTableIndex + o.PutUint32(buf[pos:pos+4], uint32(v2.Nh.ClassifyTableIndex)) + pos += 4 + // field[3] v2.NLabels + buf[pos] = uint8(v2.NLabels) + pos += 1 + // field[3] v2.LabelStack + for j3 := 0; j3 < 16; j3++ { + var v3 FibMplsLabel + if j3 < len(v2.LabelStack) { + v3 = v2.LabelStack[j3] + } + // field[4] v3.IsUniform + buf[pos] = uint8(v3.IsUniform) + pos += 1 + // field[4] v3.Label + o.PutUint32(buf[pos:pos+4], uint32(v3.Label)) + pos += 4 + // field[4] v3.TTL + buf[pos] = uint8(v3.TTL) + pos += 1 + // field[4] v3.Exp + buf[pos] = uint8(v3.Exp) + pos += 1 + } + } + return buf, nil +} +func (m *IPRouteDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Route + // field[2] m.Route.TableID + m.Route.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.StatsIndex + m.Route.StatsIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Route.Prefix + // field[3] m.Route.Prefix.Address + // field[4] m.Route.Prefix.Address.Af + m.Route.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Prefix.Address.Un + copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.Route.Prefix.Len + m.Route.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.NPaths + m.Route.NPaths = uint8(tmp[pos]) + pos += 1 + // field[2] m.Route.Paths + m.Route.Paths = make([]FibPath, int(m.Route.NPaths)) + for j2 := 0; j2 < int(m.Route.NPaths); j2++ { + // field[3] m.Route.Paths[j2].SwIfIndex + m.Route.Paths[j2].SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].TableID + m.Route.Paths[j2].TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].RpfID + m.Route.Paths[j2].RpfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Weight + m.Route.Paths[j2].Weight = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Preference + m.Route.Paths[j2].Preference = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].Type + m.Route.Paths[j2].Type = FibPathType(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Flags + m.Route.Paths[j2].Flags = FibPathFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Proto + m.Route.Paths[j2].Proto = FibPathNhProto(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].Nh + // field[4] m.Route.Paths[j2].Nh.Address + copy(m.Route.Paths[j2].Nh.Address.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[4] m.Route.Paths[j2].Nh.ViaLabel + m.Route.Paths[j2].Nh.ViaLabel = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ObjID + m.Route.Paths[j2].Nh.ObjID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].Nh.ClassifyTableIndex + m.Route.Paths[j2].Nh.ClassifyTableIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Route.Paths[j2].NLabels + m.Route.Paths[j2].NLabels = uint8(tmp[pos]) + pos += 1 + // field[3] m.Route.Paths[j2].LabelStack + for j3 := 0; j3 < 16; j3++ { + // field[4] m.Route.Paths[j2].LabelStack[j3].IsUniform + m.Route.Paths[j2].LabelStack[j3].IsUniform = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Label + m.Route.Paths[j2].LabelStack[j3].Label = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[4] m.Route.Paths[j2].LabelStack[j3].TTL + m.Route.Paths[j2].LabelStack[j3].TTL = uint8(tmp[pos]) + pos += 1 + // field[4] m.Route.Paths[j2].LabelStack[j3].Exp + m.Route.Paths[j2].LabelStack[j3].Exp = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + // IPRouteDump represents VPP binary API message 'ip_route_dump'. type IPRouteDump struct { - Table IPTable + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` } func (m *IPRouteDump) Reset() { *m = IPRouteDump{} } @@ -730,14 +3836,74 @@ func (*IPRouteDump) GetMessageName() string { return "ip_route_dump" } func (*IPRouteDump) GetCrcString() string { return "b9d2e09e" } func (*IPRouteDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPRouteDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPRouteDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPRouteDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // IPSourceAndPortRangeCheckAddDel represents VPP binary API message 'ip_source_and_port_range_check_add_del'. type IPSourceAndPortRangeCheckAddDel struct { - IsAdd bool - Prefix Prefix - NumberOfRanges uint8 - LowPorts []uint16 `struc:"[32]uint16"` - HighPorts []uint16 `struc:"[32]uint16"` - VrfID uint32 + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Prefix Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"` + NumberOfRanges uint8 `binapi:"u8,name=number_of_ranges" json:"number_of_ranges,omitempty"` + LowPorts []uint16 `binapi:"u16[32],name=low_ports" json:"low_ports,omitempty" struc:"[32]uint16"` + HighPorts []uint16 `binapi:"u16[32],name=high_ports" json:"high_ports,omitempty" struc:"[32]uint16"` + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` } func (m *IPSourceAndPortRangeCheckAddDel) Reset() { *m = IPSourceAndPortRangeCheckAddDel{} } @@ -747,9 +3913,127 @@ func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { return "8bfc76f2" } func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPSourceAndPortRangeCheckAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + size += 4 + // field[3] m.Prefix.Address.Un + size += 16 + // field[2] m.Prefix.Len + size += 1 + // field[1] m.NumberOfRanges + size += 1 + // field[1] m.LowPorts + size += 64 + // field[1] m.HighPorts + size += 64 + // field[1] m.VrfID + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Address.Af)) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(buf[pos:pos+16], m.Prefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.Len + buf[pos] = uint8(m.Prefix.Len) + pos += 1 + // field[1] m.NumberOfRanges + buf[pos] = uint8(m.NumberOfRanges) + pos += 1 + // field[1] m.LowPorts + for i := 0; i < 32; i++ { + var x uint16 + if i < len(m.LowPorts) { + x = uint16(m.LowPorts[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + // field[1] m.HighPorts + for i := 0; i < 32; i++ { + var x uint16 + if i < len(m.HighPorts) { + x = uint16(m.HighPorts[i]) + } + o.PutUint16(buf[pos:pos+2], uint16(x)) + pos += 2 + } + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.Prefix + // field[2] m.Prefix.Address + // field[3] m.Prefix.Address.Af + m.Prefix.Address.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[3] m.Prefix.Address.Un + copy(m.Prefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.Len + m.Prefix.Len = uint8(tmp[pos]) + pos += 1 + // field[1] m.NumberOfRanges + m.NumberOfRanges = uint8(tmp[pos]) + pos += 1 + // field[1] m.LowPorts + m.LowPorts = make([]uint16, 32) + for i := 0; i < len(m.LowPorts); i++ { + m.LowPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + // field[1] m.HighPorts + m.HighPorts = make([]uint16, 32) + for i := 0; i < len(m.HighPorts); i++ { + m.HighPorts[i] = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + } + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPSourceAndPortRangeCheckAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_add_del_reply'. type IPSourceAndPortRangeCheckAddDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPSourceAndPortRangeCheckAddDelReply) Reset() { *m = IPSourceAndPortRangeCheckAddDelReply{} } @@ -761,14 +4045,50 @@ func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPSourceAndPortRangeCheckAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPSourceAndPortRangeCheckInterfaceAddDel represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del'. type IPSourceAndPortRangeCheckInterfaceAddDel struct { - IsAdd bool - SwIfIndex InterfaceIndex - TCPInVrfID uint32 - TCPOutVrfID uint32 - UDPInVrfID uint32 - UDPOutVrfID uint32 + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TCPInVrfID uint32 `binapi:"u32,name=tcp_in_vrf_id" json:"tcp_in_vrf_id,omitempty"` + TCPOutVrfID uint32 `binapi:"u32,name=tcp_out_vrf_id" json:"tcp_out_vrf_id,omitempty"` + UDPInVrfID uint32 `binapi:"u32,name=udp_in_vrf_id" json:"udp_in_vrf_id,omitempty"` + UDPOutVrfID uint32 `binapi:"u32,name=udp_out_vrf_id" json:"udp_out_vrf_id,omitempty"` } func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Reset() { @@ -782,9 +4102,87 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageTyp return api.RequestMessage } +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TCPInVrfID + size += 4 + // field[1] m.TCPOutVrfID + size += 4 + // field[1] m.UDPInVrfID + size += 4 + // field[1] m.UDPOutVrfID + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TCPInVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.TCPInVrfID)) + pos += 4 + // field[1] m.TCPOutVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.TCPOutVrfID)) + pos += 4 + // field[1] m.UDPInVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.UDPInVrfID)) + pos += 4 + // field[1] m.UDPOutVrfID + o.PutUint32(buf[pos:pos+4], uint32(m.UDPOutVrfID)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TCPInVrfID + m.TCPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TCPOutVrfID + m.TCPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.UDPInVrfID + m.UDPInVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.UDPOutVrfID + m.UDPOutVrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPSourceAndPortRangeCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_and_port_range_check_interface_add_del_reply'. type IPSourceAndPortRangeCheckInterfaceAddDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Reset() { @@ -798,11 +4196,47 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.Messa return api.ReplyMessage } +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPSourceCheckInterfaceAddDel represents VPP binary API message 'ip_source_check_interface_add_del'. type IPSourceCheckInterfaceAddDel struct { - IsAdd bool - Loose bool - SwIfIndex InterfaceIndex + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Loose bool `binapi:"bool,name=loose" json:"loose,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *IPSourceCheckInterfaceAddDel) Reset() { *m = IPSourceCheckInterfaceAddDel{} } @@ -812,9 +4246,65 @@ func (*IPSourceCheckInterfaceAddDel) GetMessageName() string { func (*IPSourceCheckInterfaceAddDel) GetCrcString() string { return "6612356b" } func (*IPSourceCheckInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPSourceCheckInterfaceAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.Loose + size += 1 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *IPSourceCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Loose + if m.Loose { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *IPSourceCheckInterfaceAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.Loose + m.Loose = tmp[pos] != 0 + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPSourceCheckInterfaceAddDelReply represents VPP binary API message 'ip_source_check_interface_add_del_reply'. type IPSourceCheckInterfaceAddDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPSourceCheckInterfaceAddDelReply) Reset() { *m = IPSourceCheckInterfaceAddDelReply{} } @@ -824,10 +4314,46 @@ func (*IPSourceCheckInterfaceAddDelReply) GetMessageName() string { func (*IPSourceCheckInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" } func (*IPSourceCheckInterfaceAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPSourceCheckInterfaceAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPSourceCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPSourceCheckInterfaceAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPTableAddDel represents VPP binary API message 'ip_table_add_del'. type IPTableAddDel struct { - IsAdd bool - Table IPTable + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` } func (m *IPTableAddDel) Reset() { *m = IPTableAddDel{} } @@ -835,9 +4361,79 @@ func (*IPTableAddDel) GetMessageName() string { return "ip_table_add_de func (*IPTableAddDel) GetCrcString() string { return "0ffdaec0" } func (*IPTableAddDel) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPTableAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // IPTableAddDelReply represents VPP binary API message 'ip_table_add_del_reply'. type IPTableAddDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPTableAddDelReply) Reset() { *m = IPTableAddDelReply{} } @@ -845,9 +4441,45 @@ func (*IPTableAddDelReply) GetMessageName() string { return "ip_table_a func (*IPTableAddDelReply) GetCrcString() string { return "e8d4e804" } func (*IPTableAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPTableAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPTableDetails represents VPP binary API message 'ip_table_details'. type IPTableDetails struct { - Table IPTable + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` } func (m *IPTableDetails) Reset() { *m = IPTableDetails{} } @@ -855,6 +4487,66 @@ func (*IPTableDetails) GetMessageName() string { return "ip_table_detai func (*IPTableDetails) GetCrcString() string { return "c79fca0f" } func (*IPTableDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPTableDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // IPTableDump represents VPP binary API message 'ip_table_dump'. type IPTableDump struct{} @@ -863,9 +4555,37 @@ func (*IPTableDump) GetMessageName() string { return "ip_table_dump" } func (*IPTableDump) GetCrcString() string { return "51077d14" } func (*IPTableDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPTableDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *IPTableDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *IPTableDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // IPTableFlush represents VPP binary API message 'ip_table_flush'. type IPTableFlush struct { - Table IPTable + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` } func (m *IPTableFlush) Reset() { *m = IPTableFlush{} } @@ -873,9 +4593,69 @@ func (*IPTableFlush) GetMessageName() string { return "ip_table_flush" func (*IPTableFlush) GetCrcString() string { return "b9d2e09e" } func (*IPTableFlush) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPTableFlush) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableFlush) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableFlush) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // IPTableFlushReply represents VPP binary API message 'ip_table_flush_reply'. type IPTableFlushReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPTableFlushReply) Reset() { *m = IPTableFlushReply{} } @@ -883,9 +4663,45 @@ func (*IPTableFlushReply) GetMessageName() string { return "ip_table_fl func (*IPTableFlushReply) GetCrcString() string { return "e8d4e804" } func (*IPTableFlushReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPTableFlushReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableFlushReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableFlushReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPTableReplaceBegin represents VPP binary API message 'ip_table_replace_begin'. type IPTableReplaceBegin struct { - Table IPTable + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` } func (m *IPTableReplaceBegin) Reset() { *m = IPTableReplaceBegin{} } @@ -893,9 +4709,69 @@ func (*IPTableReplaceBegin) GetMessageName() string { return "ip_table_ func (*IPTableReplaceBegin) GetCrcString() string { return "b9d2e09e" } func (*IPTableReplaceBegin) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPTableReplaceBegin) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableReplaceBegin) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableReplaceBegin) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // IPTableReplaceBeginReply represents VPP binary API message 'ip_table_replace_begin_reply'. type IPTableReplaceBeginReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPTableReplaceBeginReply) Reset() { *m = IPTableReplaceBeginReply{} } @@ -903,9 +4779,45 @@ func (*IPTableReplaceBeginReply) GetMessageName() string { return "ip_t func (*IPTableReplaceBeginReply) GetCrcString() string { return "e8d4e804" } func (*IPTableReplaceBeginReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPTableReplaceBeginReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableReplaceBeginReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableReplaceBeginReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPTableReplaceEnd represents VPP binary API message 'ip_table_replace_end'. type IPTableReplaceEnd struct { - Table IPTable + Table IPTable `binapi:"ip_table,name=table" json:"table,omitempty"` } func (m *IPTableReplaceEnd) Reset() { *m = IPTableReplaceEnd{} } @@ -913,9 +4825,69 @@ func (*IPTableReplaceEnd) GetMessageName() string { return "ip_table_re func (*IPTableReplaceEnd) GetCrcString() string { return "b9d2e09e" } func (*IPTableReplaceEnd) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPTableReplaceEnd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Table + // field[2] m.Table.TableID + size += 4 + // field[2] m.Table.IsIP6 + size += 1 + // field[2] m.Table.Name + size += 64 + return size +} +func (m *IPTableReplaceEnd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Table + // field[2] m.Table.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.Table.TableID)) + pos += 4 + // field[2] m.Table.IsIP6 + if m.Table.IsIP6 { + buf[pos] = 1 + } + pos += 1 + // field[2] m.Table.Name + copy(buf[pos:pos+64], m.Table.Name) + pos += 64 + return buf, nil +} +func (m *IPTableReplaceEnd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Table + // field[2] m.Table.TableID + m.Table.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Table.IsIP6 + m.Table.IsIP6 = tmp[pos] != 0 + pos += 1 + // field[2] m.Table.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Table.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // IPTableReplaceEndReply represents VPP binary API message 'ip_table_replace_end_reply'. type IPTableReplaceEndReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *IPTableReplaceEndReply) Reset() { *m = IPTableReplaceEndReply{} } @@ -923,10 +4895,46 @@ func (*IPTableReplaceEndReply) GetMessageName() string { return "ip_tab func (*IPTableReplaceEndReply) GetCrcString() string { return "e8d4e804" } func (*IPTableReplaceEndReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPTableReplaceEndReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *IPTableReplaceEndReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *IPTableReplaceEndReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPUnnumberedDetails represents VPP binary API message 'ip_unnumbered_details'. type IPUnnumberedDetails struct { - SwIfIndex InterfaceIndex - IPSwIfIndex InterfaceIndex + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IPSwIfIndex InterfaceIndex `binapi:"interface_index,name=ip_sw_if_index" json:"ip_sw_if_index,omitempty"` } func (m *IPUnnumberedDetails) Reset() { *m = IPUnnumberedDetails{} } @@ -934,9 +4942,53 @@ func (*IPUnnumberedDetails) GetMessageName() string { return "ip_unnumb func (*IPUnnumberedDetails) GetCrcString() string { return "aa12a483" } func (*IPUnnumberedDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *IPUnnumberedDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IPSwIfIndex + size += 4 + return size +} +func (m *IPUnnumberedDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IPSwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.IPSwIfIndex)) + pos += 4 + return buf, nil +} +func (m *IPUnnumberedDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IPSwIfIndex + m.IPSwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // IPUnnumberedDump represents VPP binary API message 'ip_unnumbered_dump'. type IPUnnumberedDump struct { - SwIfIndex InterfaceIndex + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *IPUnnumberedDump) Reset() { *m = IPUnnumberedDump{} } @@ -944,13 +4996,49 @@ func (*IPUnnumberedDump) GetMessageName() string { return "ip_unnumbere func (*IPUnnumberedDump) GetCrcString() string { return "f9e6675e" } func (*IPUnnumberedDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *IPUnnumberedDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *IPUnnumberedDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *IPUnnumberedDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // MfibSignalDetails represents VPP binary API message 'mfib_signal_details'. type MfibSignalDetails struct { - SwIfIndex InterfaceIndex - TableID uint32 - Prefix Mprefix - IPPacketLen uint16 - IPPacketData []byte `struc:"[256]byte"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + Prefix Mprefix `binapi:"mprefix,name=prefix" json:"prefix,omitempty"` + IPPacketLen uint16 `binapi:"u16,name=ip_packet_len" json:"ip_packet_len,omitempty"` + IPPacketData []byte `binapi:"u8[256],name=ip_packet_data" json:"ip_packet_data,omitempty" struc:"[256]byte"` } func (m *MfibSignalDetails) Reset() { *m = MfibSignalDetails{} } @@ -958,6 +5046,110 @@ func (*MfibSignalDetails) GetMessageName() string { return "mfib_signal func (*MfibSignalDetails) GetCrcString() string { return "64398a9a" } func (*MfibSignalDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MfibSignalDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TableID + size += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Af + size += 4 + // field[2] m.Prefix.GrpAddressLength + size += 2 + // field[2] m.Prefix.GrpAddress + size += 16 + // field[2] m.Prefix.SrcAddress + size += 16 + // field[1] m.IPPacketLen + size += 2 + // field[1] m.IPPacketData + size += 256 + return size +} +func (m *MfibSignalDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Af + o.PutUint32(buf[pos:pos+4], uint32(m.Prefix.Af)) + pos += 4 + // field[2] m.Prefix.GrpAddressLength + o.PutUint16(buf[pos:pos+2], uint16(m.Prefix.GrpAddressLength)) + pos += 2 + // field[2] m.Prefix.GrpAddress + copy(buf[pos:pos+16], m.Prefix.GrpAddress.XXX_UnionData[:]) + pos += 16 + // field[2] m.Prefix.SrcAddress + copy(buf[pos:pos+16], m.Prefix.SrcAddress.XXX_UnionData[:]) + pos += 16 + // field[1] m.IPPacketLen + o.PutUint16(buf[pos:pos+2], uint16(m.IPPacketLen)) + pos += 2 + // field[1] m.IPPacketData + for i := 0; i < 256; i++ { + var x uint8 + if i < len(m.IPPacketData) { + x = uint8(m.IPPacketData[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *MfibSignalDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TableID + m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Prefix + // field[2] m.Prefix.Af + m.Prefix.Af = AddressFamily(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Prefix.GrpAddressLength + m.Prefix.GrpAddressLength = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.Prefix.GrpAddress + copy(m.Prefix.GrpAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[2] m.Prefix.SrcAddress + copy(m.Prefix.SrcAddress.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[1] m.IPPacketLen + m.IPPacketLen = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.IPPacketData + m.IPPacketData = make([]uint8, 256) + for i := 0; i < len(m.IPPacketData); i++ { + m.IPPacketData[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + // MfibSignalDump represents VPP binary API message 'mfib_signal_dump'. type MfibSignalDump struct{} @@ -966,17 +5158,45 @@ func (*MfibSignalDump) GetMessageName() string { return "mfib_signal_du func (*MfibSignalDump) GetCrcString() string { return "51077d14" } func (*MfibSignalDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MfibSignalDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MfibSignalDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MfibSignalDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // SetIPFlowHash represents VPP binary API message 'set_ip_flow_hash'. type SetIPFlowHash struct { - VrfID uint32 - IsIPv6 bool - Src bool - Dst bool - Sport bool - Dport bool - Proto bool - Reverse bool - Symmetric bool + VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"` + IsIPv6 bool `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"` + Src bool `binapi:"bool,name=src" json:"src,omitempty"` + Dst bool `binapi:"bool,name=dst" json:"dst,omitempty"` + Sport bool `binapi:"bool,name=sport" json:"sport,omitempty"` + Dport bool `binapi:"bool,name=dport" json:"dport,omitempty"` + Proto bool `binapi:"bool,name=proto" json:"proto,omitempty"` + Reverse bool `binapi:"bool,name=reverse" json:"reverse,omitempty"` + Symmetric bool `binapi:"bool,name=symmetric" json:"symmetric,omitempty"` } func (m *SetIPFlowHash) Reset() { *m = SetIPFlowHash{} } @@ -984,9 +5204,125 @@ func (*SetIPFlowHash) GetMessageName() string { return "set_ip_flow_has func (*SetIPFlowHash) GetCrcString() string { return "084ee09e" } func (*SetIPFlowHash) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SetIPFlowHash) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.VrfID + size += 4 + // field[1] m.IsIPv6 + size += 1 + // field[1] m.Src + size += 1 + // field[1] m.Dst + size += 1 + // field[1] m.Sport + size += 1 + // field[1] m.Dport + size += 1 + // field[1] m.Proto + size += 1 + // field[1] m.Reverse + size += 1 + // field[1] m.Symmetric + size += 1 + return size +} +func (m *SetIPFlowHash) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.VrfID + o.PutUint32(buf[pos:pos+4], uint32(m.VrfID)) + pos += 4 + // field[1] m.IsIPv6 + if m.IsIPv6 { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Src + if m.Src { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Dst + if m.Dst { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Sport + if m.Sport { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Dport + if m.Dport { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Proto + if m.Proto { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Reverse + if m.Reverse { + buf[pos] = 1 + } + pos += 1 + // field[1] m.Symmetric + if m.Symmetric { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SetIPFlowHash) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.VrfID + m.VrfID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsIPv6 + m.IsIPv6 = tmp[pos] != 0 + pos += 1 + // field[1] m.Src + m.Src = tmp[pos] != 0 + pos += 1 + // field[1] m.Dst + m.Dst = tmp[pos] != 0 + pos += 1 + // field[1] m.Sport + m.Sport = tmp[pos] != 0 + pos += 1 + // field[1] m.Dport + m.Dport = tmp[pos] != 0 + pos += 1 + // field[1] m.Proto + m.Proto = tmp[pos] != 0 + pos += 1 + // field[1] m.Reverse + m.Reverse = tmp[pos] != 0 + pos += 1 + // field[1] m.Symmetric + m.Symmetric = tmp[pos] != 0 + pos += 1 + return nil +} + // SetIPFlowHashReply represents VPP binary API message 'set_ip_flow_hash_reply'. type SetIPFlowHashReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SetIPFlowHashReply) Reset() { *m = SetIPFlowHashReply{} } @@ -994,10 +5330,46 @@ func (*SetIPFlowHashReply) GetMessageName() string { return "set_ip_flo func (*SetIPFlowHashReply) GetCrcString() string { return "e8d4e804" } func (*SetIPFlowHashReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SetIPFlowHashReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SetIPFlowHashReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SetIPFlowHashReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceIP6EnableDisable represents VPP binary API message 'sw_interface_ip6_enable_disable'. type SwInterfaceIP6EnableDisable struct { - SwIfIndex InterfaceIndex - Enable bool + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` } func (m *SwInterfaceIP6EnableDisable) Reset() { *m = SwInterfaceIP6EnableDisable{} } @@ -1005,9 +5377,55 @@ func (*SwInterfaceIP6EnableDisable) GetMessageName() string { return "s func (*SwInterfaceIP6EnableDisable) GetCrcString() string { return "ae6cfcfb" } func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceIP6EnableDisable) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Enable + size += 1 + return size +} +func (m *SwInterfaceIP6EnableDisable) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Enable + if m.Enable { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *SwInterfaceIP6EnableDisable) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Enable + m.Enable = tmp[pos] != 0 + pos += 1 + return nil +} + // SwInterfaceIP6EnableDisableReply represents VPP binary API message 'sw_interface_ip6_enable_disable_reply'. type SwInterfaceIP6EnableDisableReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceIP6EnableDisableReply) Reset() { *m = SwInterfaceIP6EnableDisableReply{} } @@ -1017,10 +5435,46 @@ func (*SwInterfaceIP6EnableDisableReply) GetMessageName() string { func (*SwInterfaceIP6EnableDisableReply) GetCrcString() string { return "e8d4e804" } func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SwInterfaceIP6EnableDisableReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceIP6EnableDisableReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SwInterfaceIP6SetLinkLocalAddress represents VPP binary API message 'sw_interface_ip6_set_link_local_address'. type SwInterfaceIP6SetLinkLocalAddress struct { - SwIfIndex InterfaceIndex - IP IP6Address + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + IP IP6Address `binapi:"ip6_address,name=ip" json:"ip,omitempty"` } func (m *SwInterfaceIP6SetLinkLocalAddress) Reset() { *m = SwInterfaceIP6SetLinkLocalAddress{} } @@ -1030,9 +5484,61 @@ func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageName() string { func (*SwInterfaceIP6SetLinkLocalAddress) GetCrcString() string { return "2931d9fa" } func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SwInterfaceIP6SetLinkLocalAddress) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.IP + size += 16 + return size +} +func (m *SwInterfaceIP6SetLinkLocalAddress) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.IP + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.IP) { + x = uint8(m.IP[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SwInterfaceIP6SetLinkLocalAddress) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IP + for i := 0; i < len(m.IP); i++ { + m.IP[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + // SwInterfaceIP6SetLinkLocalAddressReply represents VPP binary API message 'sw_interface_ip6_set_link_local_address_reply'. type SwInterfaceIP6SetLinkLocalAddressReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SwInterfaceIP6SetLinkLocalAddressReply) Reset() { @@ -1046,7 +5552,44 @@ func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageType() api.MessageType return api.ReplyMessage } -func init() { +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SwInterfaceIP6SetLinkLocalAddressReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +func init() { file_ip_binapi_init() } +func file_ip_binapi_init() { api.RegisterMessage((*IoamDisable)(nil), "ip.IoamDisable") api.RegisterMessage((*IoamDisableReply)(nil), "ip.IoamDisableReply") api.RegisterMessage((*IoamEnable)(nil), "ip.IoamEnable") @@ -1175,498 +5718,13 @@ func AllMessages() []api.Message { } } -// RPCService represents RPC service API for ip module. -type RPCService interface { - DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) - DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) - DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) - DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) - DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) - DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) - DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) - DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) - DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) - DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) - IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) - IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) - IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) - IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) - IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) - IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) - IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) - IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) - IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) - IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) - IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) - IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) - IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) - IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) - IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) - IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) - IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) - SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) - SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) - SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPAddressClient{stream} - return x, nil -} - -type RPCService_DumpIPAddressClient interface { - Recv() (*IPAddressDetails, error) -} - -type serviceClient_DumpIPAddressClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPAddressClient) Recv() (*IPAddressDetails, error) { - m := new(IPAddressDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPContainerProxyClient{stream} - return x, nil -} - -type RPCService_DumpIPContainerProxyClient interface { - Recv() (*IPContainerProxyDetails, error) -} - -type serviceClient_DumpIPContainerProxyClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPContainerProxyClient) Recv() (*IPContainerProxyDetails, error) { - m := new(IPContainerProxyDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPClient{stream} - return x, nil -} - -type RPCService_DumpIPClient interface { - Recv() (*IPDetails, error) -} - -type serviceClient_DumpIPClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPClient) Recv() (*IPDetails, error) { - m := new(IPDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPMrouteClient{stream} - return x, nil -} - -type RPCService_DumpIPMrouteClient interface { - Recv() (*IPMrouteDetails, error) -} - -type serviceClient_DumpIPMrouteClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPMrouteClient) Recv() (*IPMrouteDetails, error) { - m := new(IPMrouteDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPMtableClient{stream} - return x, nil -} - -type RPCService_DumpIPMtableClient interface { - Recv() (*IPMtableDetails, error) -} - -type serviceClient_DumpIPMtableClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPMtableClient) Recv() (*IPMtableDetails, error) { - m := new(IPMtableDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPPuntRedirectClient{stream} - return x, nil -} - -type RPCService_DumpIPPuntRedirectClient interface { - Recv() (*IPPuntRedirectDetails, error) -} - -type serviceClient_DumpIPPuntRedirectClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPPuntRedirectClient) Recv() (*IPPuntRedirectDetails, error) { - m := new(IPPuntRedirectDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPRouteClient{stream} - return x, nil -} - -type RPCService_DumpIPRouteClient interface { - Recv() (*IPRouteDetails, error) -} - -type serviceClient_DumpIPRouteClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPRouteClient) Recv() (*IPRouteDetails, error) { - m := new(IPRouteDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPTableClient{stream} - return x, nil -} - -type RPCService_DumpIPTableClient interface { - Recv() (*IPTableDetails, error) -} - -type serviceClient_DumpIPTableClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPTableClient) Recv() (*IPTableDetails, error) { - m := new(IPTableDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpIPUnnumberedClient{stream} - return x, nil -} - -type RPCService_DumpIPUnnumberedClient interface { - Recv() (*IPUnnumberedDetails, error) -} - -type serviceClient_DumpIPUnnumberedClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpIPUnnumberedClient) Recv() (*IPUnnumberedDetails, error) { - m := new(IPUnnumberedDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMfibSignalClient{stream} - return x, nil -} - -type RPCService_DumpMfibSignalClient interface { - Recv() (*MfibSignalDetails, error) -} - -type serviceClient_DumpMfibSignalClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMfibSignalClient) Recv() (*MfibSignalDetails, error) { - m := new(MfibSignalDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { - out := new(IoamDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { - out := new(IoamEnableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { - out := new(IPContainerProxyAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { - out := new(IPMrouteAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { - out := new(IPPuntPoliceReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { - out := new(IPPuntRedirectReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { - out := new(IPReassemblyEnableDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { - out := new(IPReassemblyGetReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { - out := new(IPReassemblySetReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { - out := new(IPRouteAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { - out := new(IPSourceAndPortRangeCheckAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { - out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) { - out := new(IPSourceCheckInterfaceAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { - out := new(IPTableAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) { - out := new(IPTableFlushReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) { - out := new(IPTableReplaceBeginReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) { - out := new(IPTableReplaceEndReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { - out := new(SetIPFlowHashReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { - out := new(SwInterfaceIP6EnableDisableReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { - out := new(SwInterfaceIP6SetLinkLocalAddressReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage +var _ = codec.DecodeString var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/ip/ip_rpc.ba.go b/examples/binapi/ip/ip_rpc.ba.go new file mode 100644 index 0000000..e0580d5 --- /dev/null +++ b/examples/binapi/ip/ip_rpc.ba.go @@ -0,0 +1,497 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ip + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for ip module. +type RPCService interface { + DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) + DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) + DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) + DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) + DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) + DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) + DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) + DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) + DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) + DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) + IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) + IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) + IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) + IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) + IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) + IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) + IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) + IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) + IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) + IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) + IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) + IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) + IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) + IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) + IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) + IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) + IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) + SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) + SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) + SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpIPAddress(ctx context.Context, in *IPAddressDump) (RPCService_DumpIPAddressClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPAddressClient{stream} + return x, nil +} + +type RPCService_DumpIPAddressClient interface { + Recv() (*IPAddressDetails, error) +} + +type serviceClient_DumpIPAddressClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPAddressClient) Recv() (*IPAddressDetails, error) { + m := new(IPAddressDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPContainerProxy(ctx context.Context, in *IPContainerProxyDump) (RPCService_DumpIPContainerProxyClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPContainerProxyClient{stream} + return x, nil +} + +type RPCService_DumpIPContainerProxyClient interface { + Recv() (*IPContainerProxyDetails, error) +} + +type serviceClient_DumpIPContainerProxyClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPContainerProxyClient) Recv() (*IPContainerProxyDetails, error) { + m := new(IPContainerProxyDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIP(ctx context.Context, in *IPDump) (RPCService_DumpIPClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPClient{stream} + return x, nil +} + +type RPCService_DumpIPClient interface { + Recv() (*IPDetails, error) +} + +type serviceClient_DumpIPClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPClient) Recv() (*IPDetails, error) { + m := new(IPDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMroute(ctx context.Context, in *IPMrouteDump) (RPCService_DumpIPMrouteClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMrouteClient{stream} + return x, nil +} + +type RPCService_DumpIPMrouteClient interface { + Recv() (*IPMrouteDetails, error) +} + +type serviceClient_DumpIPMrouteClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMrouteClient) Recv() (*IPMrouteDetails, error) { + m := new(IPMrouteDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPMtable(ctx context.Context, in *IPMtableDump) (RPCService_DumpIPMtableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPMtableClient{stream} + return x, nil +} + +type RPCService_DumpIPMtableClient interface { + Recv() (*IPMtableDetails, error) +} + +type serviceClient_DumpIPMtableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPMtableClient) Recv() (*IPMtableDetails, error) { + m := new(IPMtableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPPuntRedirect(ctx context.Context, in *IPPuntRedirectDump) (RPCService_DumpIPPuntRedirectClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPPuntRedirectClient{stream} + return x, nil +} + +type RPCService_DumpIPPuntRedirectClient interface { + Recv() (*IPPuntRedirectDetails, error) +} + +type serviceClient_DumpIPPuntRedirectClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPPuntRedirectClient) Recv() (*IPPuntRedirectDetails, error) { + m := new(IPPuntRedirectDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPRoute(ctx context.Context, in *IPRouteDump) (RPCService_DumpIPRouteClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPRouteClient{stream} + return x, nil +} + +type RPCService_DumpIPRouteClient interface { + Recv() (*IPRouteDetails, error) +} + +type serviceClient_DumpIPRouteClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPRouteClient) Recv() (*IPRouteDetails, error) { + m := new(IPRouteDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPTable(ctx context.Context, in *IPTableDump) (RPCService_DumpIPTableClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPTableClient{stream} + return x, nil +} + +type RPCService_DumpIPTableClient interface { + Recv() (*IPTableDetails, error) +} + +type serviceClient_DumpIPTableClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPTableClient) Recv() (*IPTableDetails, error) { + m := new(IPTableDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpIPUnnumbered(ctx context.Context, in *IPUnnumberedDump) (RPCService_DumpIPUnnumberedClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpIPUnnumberedClient{stream} + return x, nil +} + +type RPCService_DumpIPUnnumberedClient interface { + Recv() (*IPUnnumberedDetails, error) +} + +type serviceClient_DumpIPUnnumberedClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpIPUnnumberedClient) Recv() (*IPUnnumberedDetails, error) { + m := new(IPUnnumberedDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMfibSignal(ctx context.Context, in *MfibSignalDump) (RPCService_DumpMfibSignalClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMfibSignalClient{stream} + return x, nil +} + +type RPCService_DumpMfibSignalClient interface { + Recv() (*MfibSignalDetails, error) +} + +type serviceClient_DumpMfibSignalClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMfibSignalClient) Recv() (*MfibSignalDetails, error) { + m := new(MfibSignalDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) IoamDisable(ctx context.Context, in *IoamDisable) (*IoamDisableReply, error) { + out := new(IoamDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IoamEnable(ctx context.Context, in *IoamEnable) (*IoamEnableReply, error) { + out := new(IoamEnableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPContainerProxyAddDel(ctx context.Context, in *IPContainerProxyAddDel) (*IPContainerProxyAddDelReply, error) { + out := new(IPContainerProxyAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPMrouteAddDel(ctx context.Context, in *IPMrouteAddDel) (*IPMrouteAddDelReply, error) { + out := new(IPMrouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntPolice(ctx context.Context, in *IPPuntPolice) (*IPPuntPoliceReply, error) { + out := new(IPPuntPoliceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPPuntRedirect(ctx context.Context, in *IPPuntRedirect) (*IPPuntRedirectReply, error) { + out := new(IPPuntRedirectReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyEnableDisable(ctx context.Context, in *IPReassemblyEnableDisable) (*IPReassemblyEnableDisableReply, error) { + out := new(IPReassemblyEnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblyGet(ctx context.Context, in *IPReassemblyGet) (*IPReassemblyGetReply, error) { + out := new(IPReassemblyGetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPReassemblySet(ctx context.Context, in *IPReassemblySet) (*IPReassemblySetReply, error) { + out := new(IPReassemblySetReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPRouteAddDel(ctx context.Context, in *IPRouteAddDel) (*IPRouteAddDelReply, error) { + out := new(IPRouteAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckAddDel) (*IPSourceAndPortRangeCheckAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceAndPortRangeCheckInterfaceAddDel(ctx context.Context, in *IPSourceAndPortRangeCheckInterfaceAddDel) (*IPSourceAndPortRangeCheckInterfaceAddDelReply, error) { + out := new(IPSourceAndPortRangeCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPSourceCheckInterfaceAddDel(ctx context.Context, in *IPSourceCheckInterfaceAddDel) (*IPSourceCheckInterfaceAddDelReply, error) { + out := new(IPSourceCheckInterfaceAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableAddDel(ctx context.Context, in *IPTableAddDel) (*IPTableAddDelReply, error) { + out := new(IPTableAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableFlush(ctx context.Context, in *IPTableFlush) (*IPTableFlushReply, error) { + out := new(IPTableFlushReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableReplaceBegin(ctx context.Context, in *IPTableReplaceBegin) (*IPTableReplaceBeginReply, error) { + out := new(IPTableReplaceBeginReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) IPTableReplaceEnd(ctx context.Context, in *IPTableReplaceEnd) (*IPTableReplaceEndReply, error) { + out := new(IPTableReplaceEndReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SetIPFlowHash(ctx context.Context, in *SetIPFlowHash) (*SetIPFlowHashReply, error) { + out := new(SetIPFlowHashReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6EnableDisable(ctx context.Context, in *SwInterfaceIP6EnableDisable) (*SwInterfaceIP6EnableDisableReply, error) { + out := new(SwInterfaceIP6EnableDisableReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SwInterfaceIP6SetLinkLocalAddress(ctx context.Context, in *SwInterfaceIP6SetLinkLocalAddress) (*SwInterfaceIP6SetLinkLocalAddressReply, error) { + out := new(SwInterfaceIP6SetLinkLocalAddressReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/examples/binapi/ip_types/ip_types.ba.go b/examples/binapi/ip_types/ip_types.ba.go index e812b8b..9335060 100644 --- a/examples/binapi/ip_types/ip_types.ba.go +++ b/examples/binapi/ip_types/ip_types.ba.go @@ -1,12 +1,15 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 // source: /usr/share/vpp/api/core/ip_types.api.json /* -Package ip_types is a generated VPP binary API for 'ip_types' module. +Package ip_types contains generated code for VPP binary API defined by ip_types.api (version 3.0.0). It consists of: - 4 enums 5 aliases + 4 enums 6 types 1 union */ @@ -15,13 +18,22 @@ package ip_types import ( "bytes" "context" + "encoding/binary" "io" + "math" "strconv" api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" ) +// 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 // please upgrade the GoVPP api package + const ( // ModuleName is the name of this module. ModuleName = "ip_types" @@ -39,22 +51,23 @@ const ( ADDRESS_IP6 AddressFamily = 1 ) -var AddressFamily_name = map[uint32]string{ - 0: "ADDRESS_IP4", - 1: "ADDRESS_IP6", -} - -var AddressFamily_value = map[string]uint32{ - "ADDRESS_IP4": 0, - "ADDRESS_IP6": 1, -} +var ( + AddressFamily_name = map[uint32]string{ + 0: "ADDRESS_IP4", + 1: "ADDRESS_IP6", + } + AddressFamily_value = map[string]uint32{ + "ADDRESS_IP4": 0, + "ADDRESS_IP6": 1, + } +) func (x AddressFamily) String() string { s, ok := AddressFamily_name[uint32(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "AddressFamily(" + strconv.Itoa(int(x)) + ")" } // IPDscp represents VPP binary API enum 'ip_dscp'. @@ -84,60 +97,61 @@ const ( IP_API_DSCP_CS7 IPDscp = 50 ) -var IPDscp_name = map[uint8]string{ - 0: "IP_API_DSCP_CS0", - 8: "IP_API_DSCP_CS1", - 10: "IP_API_DSCP_AF11", - 12: "IP_API_DSCP_AF12", - 14: "IP_API_DSCP_AF13", - 16: "IP_API_DSCP_CS2", - 18: "IP_API_DSCP_AF21", - 20: "IP_API_DSCP_AF22", - 22: "IP_API_DSCP_AF23", - 24: "IP_API_DSCP_CS3", - 26: "IP_API_DSCP_AF31", - 28: "IP_API_DSCP_AF32", - 30: "IP_API_DSCP_AF33", - 32: "IP_API_DSCP_CS4", - 34: "IP_API_DSCP_AF41", - 36: "IP_API_DSCP_AF42", - 38: "IP_API_DSCP_AF43", - 40: "IP_API_DSCP_CS5", - 46: "IP_API_DSCP_EF", - 48: "IP_API_DSCP_CS6", - 50: "IP_API_DSCP_CS7", -} - -var IPDscp_value = map[string]uint8{ - "IP_API_DSCP_CS0": 0, - "IP_API_DSCP_CS1": 8, - "IP_API_DSCP_AF11": 10, - "IP_API_DSCP_AF12": 12, - "IP_API_DSCP_AF13": 14, - "IP_API_DSCP_CS2": 16, - "IP_API_DSCP_AF21": 18, - "IP_API_DSCP_AF22": 20, - "IP_API_DSCP_AF23": 22, - "IP_API_DSCP_CS3": 24, - "IP_API_DSCP_AF31": 26, - "IP_API_DSCP_AF32": 28, - "IP_API_DSCP_AF33": 30, - "IP_API_DSCP_CS4": 32, - "IP_API_DSCP_AF41": 34, - "IP_API_DSCP_AF42": 36, - "IP_API_DSCP_AF43": 38, - "IP_API_DSCP_CS5": 40, - "IP_API_DSCP_EF": 46, - "IP_API_DSCP_CS6": 48, - "IP_API_DSCP_CS7": 50, -} +var ( + IPDscp_name = map[uint8]string{ + 0: "IP_API_DSCP_CS0", + 8: "IP_API_DSCP_CS1", + 10: "IP_API_DSCP_AF11", + 12: "IP_API_DSCP_AF12", + 14: "IP_API_DSCP_AF13", + 16: "IP_API_DSCP_CS2", + 18: "IP_API_DSCP_AF21", + 20: "IP_API_DSCP_AF22", + 22: "IP_API_DSCP_AF23", + 24: "IP_API_DSCP_CS3", + 26: "IP_API_DSCP_AF31", + 28: "IP_API_DSCP_AF32", + 30: "IP_API_DSCP_AF33", + 32: "IP_API_DSCP_CS4", + 34: "IP_API_DSCP_AF41", + 36: "IP_API_DSCP_AF42", + 38: "IP_API_DSCP_AF43", + 40: "IP_API_DSCP_CS5", + 46: "IP_API_DSCP_EF", + 48: "IP_API_DSCP_CS6", + 50: "IP_API_DSCP_CS7", + } + IPDscp_value = map[string]uint8{ + "IP_API_DSCP_CS0": 0, + "IP_API_DSCP_CS1": 8, + "IP_API_DSCP_AF11": 10, + "IP_API_DSCP_AF12": 12, + "IP_API_DSCP_AF13": 14, + "IP_API_DSCP_CS2": 16, + "IP_API_DSCP_AF21": 18, + "IP_API_DSCP_AF22": 20, + "IP_API_DSCP_AF23": 22, + "IP_API_DSCP_CS3": 24, + "IP_API_DSCP_AF31": 26, + "IP_API_DSCP_AF32": 28, + "IP_API_DSCP_AF33": 30, + "IP_API_DSCP_CS4": 32, + "IP_API_DSCP_AF41": 34, + "IP_API_DSCP_AF42": 36, + "IP_API_DSCP_AF43": 38, + "IP_API_DSCP_CS5": 40, + "IP_API_DSCP_EF": 46, + "IP_API_DSCP_CS6": 48, + "IP_API_DSCP_CS7": 50, + } +) func (x IPDscp) String() string { s, ok := IPDscp_name[uint8(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "IPDscp(" + strconv.Itoa(int(x)) + ")" } // IPEcn represents VPP binary API enum 'ip_ecn'. @@ -150,26 +164,27 @@ const ( IP_API_ECN_CE IPEcn = 3 ) -var IPEcn_name = map[uint8]string{ - 0: "IP_API_ECN_NONE", - 1: "IP_API_ECN_ECT0", - 2: "IP_API_ECN_ECT1", - 3: "IP_API_ECN_CE", -} - -var IPEcn_value = map[string]uint8{ - "IP_API_ECN_NONE": 0, - "IP_API_ECN_ECT0": 1, - "IP_API_ECN_ECT1": 2, - "IP_API_ECN_CE": 3, -} +var ( + IPEcn_name = map[uint8]string{ + 0: "IP_API_ECN_NONE", + 1: "IP_API_ECN_ECT0", + 2: "IP_API_ECN_ECT1", + 3: "IP_API_ECN_CE", + } + IPEcn_value = map[string]uint8{ + "IP_API_ECN_NONE": 0, + "IP_API_ECN_ECT0": 1, + "IP_API_ECN_ECT1": 2, + "IP_API_ECN_CE": 3, + } +) func (x IPEcn) String() string { s, ok := IPEcn_name[uint8(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "IPEcn(" + strconv.Itoa(int(x)) + ")" } // IPProto represents VPP binary API enum 'ip_proto'. @@ -190,42 +205,43 @@ const ( IP_API_PROTO_RESERVED IPProto = 255 ) -var IPProto_name = map[uint32]string{ - 0: "IP_API_PROTO_HOPOPT", - 1: "IP_API_PROTO_ICMP", - 2: "IP_API_PROTO_IGMP", - 6: "IP_API_PROTO_TCP", - 17: "IP_API_PROTO_UDP", - 47: "IP_API_PROTO_GRE", - 50: "IP_API_PROTO_AH", - 51: "IP_API_PROTO_ESP", - 88: "IP_API_PROTO_EIGRP", - 89: "IP_API_PROTO_OSPF", - 132: "IP_API_PROTO_SCTP", - 255: "IP_API_PROTO_RESERVED", -} - -var IPProto_value = map[string]uint32{ - "IP_API_PROTO_HOPOPT": 0, - "IP_API_PROTO_ICMP": 1, - "IP_API_PROTO_IGMP": 2, - "IP_API_PROTO_TCP": 6, - "IP_API_PROTO_UDP": 17, - "IP_API_PROTO_GRE": 47, - "IP_API_PROTO_AH": 50, - "IP_API_PROTO_ESP": 51, - "IP_API_PROTO_EIGRP": 88, - "IP_API_PROTO_OSPF": 89, - "IP_API_PROTO_SCTP": 132, - "IP_API_PROTO_RESERVED": 255, -} +var ( + IPProto_name = map[uint32]string{ + 0: "IP_API_PROTO_HOPOPT", + 1: "IP_API_PROTO_ICMP", + 2: "IP_API_PROTO_IGMP", + 6: "IP_API_PROTO_TCP", + 17: "IP_API_PROTO_UDP", + 47: "IP_API_PROTO_GRE", + 50: "IP_API_PROTO_AH", + 51: "IP_API_PROTO_ESP", + 88: "IP_API_PROTO_EIGRP", + 89: "IP_API_PROTO_OSPF", + 132: "IP_API_PROTO_SCTP", + 255: "IP_API_PROTO_RESERVED", + } + IPProto_value = map[string]uint32{ + "IP_API_PROTO_HOPOPT": 0, + "IP_API_PROTO_ICMP": 1, + "IP_API_PROTO_IGMP": 2, + "IP_API_PROTO_TCP": 6, + "IP_API_PROTO_UDP": 17, + "IP_API_PROTO_GRE": 47, + "IP_API_PROTO_AH": 50, + "IP_API_PROTO_ESP": 51, + "IP_API_PROTO_EIGRP": 88, + "IP_API_PROTO_OSPF": 89, + "IP_API_PROTO_SCTP": 132, + "IP_API_PROTO_RESERVED": 255, + } +) func (x IPProto) String() string { s, ok := IPProto_name[uint32(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "IPProto(" + strconv.Itoa(int(x)) + ")" } // AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. @@ -245,50 +261,50 @@ type IP6AddressWithPrefix IP6Prefix // Address represents VPP binary API type 'address'. type Address struct { - Af AddressFamily - Un AddressUnion + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + Un AddressUnion `binapi:"address_union,name=un" json:"un,omitempty"` } func (*Address) GetTypeName() string { return "address" } // IP4Prefix represents VPP binary API type 'ip4_prefix'. type IP4Prefix struct { - Address IP4Address - Len uint8 + Address IP4Address `binapi:"ip4_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` } func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" } // IP6Prefix represents VPP binary API type 'ip6_prefix'. type IP6Prefix struct { - Address IP6Address - Len uint8 + Address IP6Address `binapi:"ip6_address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` } func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" } // Mprefix represents VPP binary API type 'mprefix'. type Mprefix struct { - Af AddressFamily - GrpAddressLength uint16 - GrpAddress AddressUnion - SrcAddress AddressUnion + Af AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` + GrpAddressLength uint16 `binapi:"u16,name=grp_address_length" json:"grp_address_length,omitempty"` + GrpAddress AddressUnion `binapi:"address_union,name=grp_address" json:"grp_address,omitempty"` + SrcAddress AddressUnion `binapi:"address_union,name=src_address" json:"src_address,omitempty"` } func (*Mprefix) GetTypeName() string { return "mprefix" } // Prefix represents VPP binary API type 'prefix'. type Prefix struct { - Address Address - Len uint8 + Address Address `binapi:"address,name=address" json:"address,omitempty"` + Len uint8 `binapi:"u8,name=len" json:"len,omitempty"` } func (*Prefix) GetTypeName() string { return "prefix" } // PrefixMatcher represents VPP binary API type 'prefix_matcher'. type PrefixMatcher struct { - Le uint8 - Ge uint8 + Le uint8 `binapi:"u8,name=le" json:"le,omitempty"` + Ge uint8 `binapi:"u8,name=ge" json:"ge,omitempty"` } func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" } @@ -334,16 +350,13 @@ func (u *AddressUnion) GetIP6() (a IP6Address) { return } -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage +var _ = codec.DecodeString var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/memclnt/memclnt.ba.go b/examples/binapi/memclnt/memclnt.ba.go index a3ca389..c6b1256 100644 --- a/examples/binapi/memclnt/memclnt.ba.go +++ b/examples/binapi/memclnt/memclnt.ba.go @@ -1,26 +1,37 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 // source: /usr/share/vpp/api/core/memclnt.api.json /* -Package memclnt is a generated VPP binary API for 'memclnt' module. +Package memclnt contains generated code for VPP binary API defined by memclnt.api (version 2.1.0). It consists of: - 2 types 22 messages - 13 services + 2 types */ package memclnt import ( "bytes" "context" + "encoding/binary" "io" + "math" "strconv" api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" ) +// 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 // please upgrade the GoVPP api package + const ( // ModuleName is the name of this module. ModuleName = "memclnt" @@ -32,18 +43,18 @@ const ( // MessageTableEntry represents VPP binary API type 'message_table_entry'. type MessageTableEntry struct { - Index uint16 - Name string `struc:"[64]byte"` + Index uint16 `binapi:"u16,name=index" json:"index,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` } func (*MessageTableEntry) GetTypeName() string { return "message_table_entry" } // ModuleVersion represents VPP binary API type 'module_version'. type ModuleVersion struct { - Major uint32 - Minor uint32 - Patch uint32 - Name string `struc:"[64]byte"` + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` + Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` } func (*ModuleVersion) GetTypeName() string { return "module_version" } @@ -56,11 +67,39 @@ func (*APIVersions) GetMessageName() string { return "api_versions" } func (*APIVersions) GetCrcString() string { return "51077d14" } func (*APIVersions) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *APIVersions) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *APIVersions) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *APIVersions) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // APIVersionsReply represents VPP binary API message 'api_versions_reply'. type APIVersionsReply struct { - Retval int32 - Count uint32 `struc:"sizeof=APIVersions"` - APIVersions []ModuleVersion + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=APIVersions"` + APIVersions []ModuleVersion `binapi:"module_version[count],name=api_versions" json:"api_versions,omitempty"` } func (m *APIVersionsReply) Reset() { *m = APIVersionsReply{} } @@ -68,9 +107,107 @@ func (*APIVersionsReply) GetMessageName() string { return "api_versions func (*APIVersionsReply) GetCrcString() string { return "5f0d99d6" } func (*APIVersionsReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *APIVersionsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Count + size += 4 + // field[1] m.APIVersions + for j1 := 0; j1 < len(m.APIVersions); j1++ { + var s1 ModuleVersion + _ = s1 + if j1 < len(m.APIVersions) { + s1 = m.APIVersions[j1] + } + // field[2] s1.Major + size += 4 + // field[2] s1.Minor + size += 4 + // field[2] s1.Patch + size += 4 + // field[2] s1.Name + size += 64 + } + return size +} +func (m *APIVersionsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.APIVersions))) + pos += 4 + // field[1] m.APIVersions + for j1 := 0; j1 < len(m.APIVersions); j1++ { + var v1 ModuleVersion + if j1 < len(m.APIVersions) { + v1 = m.APIVersions[j1] + } + // field[2] v1.Major + o.PutUint32(buf[pos:pos+4], uint32(v1.Major)) + pos += 4 + // field[2] v1.Minor + o.PutUint32(buf[pos:pos+4], uint32(v1.Minor)) + pos += 4 + // field[2] v1.Patch + o.PutUint32(buf[pos:pos+4], uint32(v1.Patch)) + pos += 4 + // field[2] v1.Name + copy(buf[pos:pos+64], v1.Name) + pos += 64 + } + return buf, nil +} +func (m *APIVersionsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.APIVersions + m.APIVersions = make([]ModuleVersion, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.APIVersions[j1].Major + m.APIVersions[j1].Major = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.APIVersions[j1].Minor + m.APIVersions[j1].Minor = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.APIVersions[j1].Patch + m.APIVersions[j1].Patch = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.APIVersions[j1].Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.APIVersions[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + } + return nil +} + // GetFirstMsgID represents VPP binary API message 'get_first_msg_id'. type GetFirstMsgID struct { - Name string `struc:"[64]byte"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` } func (m *GetFirstMsgID) Reset() { *m = GetFirstMsgID{} } @@ -78,10 +215,49 @@ func (*GetFirstMsgID) GetMessageName() string { return "get_first_msg_i func (*GetFirstMsgID) GetCrcString() string { return "ebf79a66" } func (*GetFirstMsgID) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *GetFirstMsgID) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Name + size += 64 + return size +} +func (m *GetFirstMsgID) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Name + copy(buf[pos:pos+64], m.Name) + pos += 64 + return buf, nil +} +func (m *GetFirstMsgID) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // GetFirstMsgIDReply represents VPP binary API message 'get_first_msg_id_reply'. type GetFirstMsgIDReply struct { - Retval int32 - FirstMsgID uint16 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` } func (m *GetFirstMsgIDReply) Reset() { *m = GetFirstMsgIDReply{} } @@ -89,12 +265,56 @@ func (*GetFirstMsgIDReply) GetMessageName() string { return "get_first_ func (*GetFirstMsgIDReply) GetCrcString() string { return "7d337472" } func (*GetFirstMsgIDReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *GetFirstMsgIDReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.FirstMsgID + size += 2 + return size +} +func (m *GetFirstMsgIDReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.FirstMsgID + o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) + pos += 2 + return buf, nil +} +func (m *GetFirstMsgIDReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FirstMsgID + m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + // MemclntCreate represents VPP binary API message 'memclnt_create'. type MemclntCreate struct { - CtxQuota int32 - InputQueue uint64 - Name string `struc:"[64]byte"` - APIVersions []uint32 `struc:"[8]uint32"` + CtxQuota int32 `binapi:"i32,name=ctx_quota" json:"ctx_quota,omitempty"` + InputQueue uint64 `binapi:"u64,name=input_queue" json:"input_queue,omitempty"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` + APIVersions []uint32 `binapi:"u32[8],name=api_versions" json:"api_versions,omitempty" struc:"[8]uint32"` } func (m *MemclntCreate) Reset() { *m = MemclntCreate{} } @@ -102,12 +322,84 @@ func (*MemclntCreate) GetMessageName() string { return "memclnt_create" func (*MemclntCreate) GetCrcString() string { return "9c5e1c2f" } func (*MemclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemclntCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.CtxQuota + size += 4 + // field[1] m.InputQueue + size += 8 + // field[1] m.Name + size += 64 + // field[1] m.APIVersions + size += 32 + return size +} +func (m *MemclntCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.CtxQuota + o.PutUint32(buf[pos:pos+4], uint32(m.CtxQuota)) + pos += 4 + // field[1] m.InputQueue + o.PutUint64(buf[pos:pos+8], uint64(m.InputQueue)) + pos += 8 + // field[1] m.Name + copy(buf[pos:pos+64], m.Name) + pos += 64 + // field[1] m.APIVersions + for i := 0; i < 8; i++ { + var x uint32 + if i < len(m.APIVersions) { + x = uint32(m.APIVersions[i]) + } + o.PutUint32(buf[pos:pos+4], uint32(x)) + pos += 4 + } + return buf, nil +} +func (m *MemclntCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.CtxQuota + m.CtxQuota = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.InputQueue + m.InputQueue = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + // field[1] m.APIVersions + m.APIVersions = make([]uint32, 8) + for i := 0; i < len(m.APIVersions); i++ { + m.APIVersions[i] = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + // MemclntCreateReply represents VPP binary API message 'memclnt_create_reply'. type MemclntCreateReply struct { - Response int32 - Handle uint64 - Index uint32 - MessageTable uint64 + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + MessageTable uint64 `binapi:"u64,name=message_table" json:"message_table,omitempty"` } func (m *MemclntCreateReply) Reset() { *m = MemclntCreateReply{} } @@ -115,11 +407,71 @@ func (*MemclntCreateReply) GetMessageName() string { return "memclnt_cr func (*MemclntCreateReply) GetCrcString() string { return "42ec4560" } func (*MemclntCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemclntCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + // field[1] m.Handle + size += 8 + // field[1] m.Index + size += 4 + // field[1] m.MessageTable + size += 8 + return size +} +func (m *MemclntCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + // field[1] m.Handle + o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) + pos += 8 + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + // field[1] m.MessageTable + o.PutUint64(buf[pos:pos+8], uint64(m.MessageTable)) + pos += 8 + return buf, nil +} +func (m *MemclntCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Handle + m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MessageTable + m.MessageTable = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + // MemclntDelete represents VPP binary API message 'memclnt_delete'. type MemclntDelete struct { - Index uint32 - Handle uint64 - DoCleanup bool + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` + DoCleanup bool `binapi:"bool,name=do_cleanup" json:"do_cleanup,omitempty"` } func (m *MemclntDelete) Reset() { *m = MemclntDelete{} } @@ -127,10 +479,64 @@ func (*MemclntDelete) GetMessageName() string { return "memclnt_delete" func (*MemclntDelete) GetCrcString() string { return "7e1c04e3" } func (*MemclntDelete) GetMessageType() api.MessageType { return api.OtherMessage } +func (m *MemclntDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Index + size += 4 + // field[1] m.Handle + size += 8 + // field[1] m.DoCleanup + size += 1 + return size +} +func (m *MemclntDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + // field[1] m.Handle + o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) + pos += 8 + // field[1] m.DoCleanup + if m.DoCleanup { + buf[pos] = 1 + } + pos += 1 + return buf, nil +} +func (m *MemclntDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Handle + m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.DoCleanup + m.DoCleanup = tmp[pos] != 0 + pos += 1 + return nil +} + // MemclntDeleteReply represents VPP binary API message 'memclnt_delete_reply'. type MemclntDeleteReply struct { - Response int32 - Handle uint64 + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Handle uint64 `binapi:"u64,name=handle" json:"handle,omitempty"` } func (m *MemclntDeleteReply) Reset() { *m = MemclntDeleteReply{} } @@ -138,6 +544,50 @@ func (*MemclntDeleteReply) GetMessageName() string { return "memclnt_de func (*MemclntDeleteReply) GetCrcString() string { return "3d3b6312" } func (*MemclntDeleteReply) GetMessageType() api.MessageType { return api.OtherMessage } +func (m *MemclntDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + // field[1] m.Handle + size += 8 + return size +} +func (m *MemclntDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + // field[1] m.Handle + o.PutUint64(buf[pos:pos+8], uint64(m.Handle)) + pos += 8 + return buf, nil +} +func (m *MemclntDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Handle + m.Handle = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + // MemclntKeepalive represents VPP binary API message 'memclnt_keepalive'. type MemclntKeepalive struct{} @@ -146,9 +596,37 @@ func (*MemclntKeepalive) GetMessageName() string { return "memclnt_keep func (*MemclntKeepalive) GetCrcString() string { return "51077d14" } func (*MemclntKeepalive) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemclntKeepalive) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemclntKeepalive) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MemclntKeepalive) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // MemclntKeepaliveReply represents VPP binary API message 'memclnt_keepalive_reply'. type MemclntKeepaliveReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *MemclntKeepaliveReply) Reset() { *m = MemclntKeepaliveReply{} } @@ -156,9 +634,45 @@ func (*MemclntKeepaliveReply) GetMessageName() string { return "memclnt func (*MemclntKeepaliveReply) GetCrcString() string { return "e8d4e804" } func (*MemclntKeepaliveReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemclntKeepaliveReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MemclntKeepaliveReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MemclntKeepaliveReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // MemclntReadTimeout represents VPP binary API message 'memclnt_read_timeout'. type MemclntReadTimeout struct { - Dummy uint8 + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` } func (m *MemclntReadTimeout) Reset() { *m = MemclntReadTimeout{} } @@ -166,9 +680,45 @@ func (*MemclntReadTimeout) GetMessageName() string { return "memclnt_re func (*MemclntReadTimeout) GetCrcString() string { return "c3a3a452" } func (*MemclntReadTimeout) GetMessageType() api.MessageType { return api.OtherMessage } +func (m *MemclntReadTimeout) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Dummy + size += 1 + return size +} +func (m *MemclntReadTimeout) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Dummy + buf[pos] = uint8(m.Dummy) + pos += 1 + return buf, nil +} +func (m *MemclntReadTimeout) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Dummy + m.Dummy = uint8(tmp[pos]) + pos += 1 + return nil +} + // MemclntRxThreadSuspend represents VPP binary API message 'memclnt_rx_thread_suspend'. type MemclntRxThreadSuspend struct { - Dummy uint8 + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` } func (m *MemclntRxThreadSuspend) Reset() { *m = MemclntRxThreadSuspend{} } @@ -176,14 +726,50 @@ func (*MemclntRxThreadSuspend) GetMessageName() string { return "memcln func (*MemclntRxThreadSuspend) GetCrcString() string { return "c3a3a452" } func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType { return api.OtherMessage } +func (m *MemclntRxThreadSuspend) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Dummy + size += 1 + return size +} +func (m *MemclntRxThreadSuspend) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Dummy + buf[pos] = uint8(m.Dummy) + pos += 1 + return buf, nil +} +func (m *MemclntRxThreadSuspend) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Dummy + m.Dummy = uint8(tmp[pos]) + pos += 1 + return nil +} + // RPCCall represents VPP binary API message 'rpc_call'. type RPCCall struct { - Function uint64 - Multicast uint8 - NeedBarrierSync uint8 - SendReply uint8 - DataLen uint32 `struc:"sizeof=Data"` - Data []byte + Function uint64 `binapi:"u64,name=function" json:"function,omitempty"` + Multicast uint8 `binapi:"u8,name=multicast" json:"multicast,omitempty"` + NeedBarrierSync uint8 `binapi:"u8,name=need_barrier_sync" json:"need_barrier_sync,omitempty"` + SendReply uint8 `binapi:"u8,name=send_reply" json:"send_reply,omitempty"` + DataLen uint32 `binapi:"u32,name=data_len" json:"data_len,omitempty" struc:"sizeof=Data"` + Data []byte `binapi:"u8[data_len],name=data" json:"data,omitempty"` } func (m *RPCCall) Reset() { *m = RPCCall{} } @@ -191,9 +777,94 @@ func (*RPCCall) GetMessageName() string { return "rpc_call" } func (*RPCCall) GetCrcString() string { return "7e8a2c95" } func (*RPCCall) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *RPCCall) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Function + size += 8 + // field[1] m.Multicast + size += 1 + // field[1] m.NeedBarrierSync + size += 1 + // field[1] m.SendReply + size += 1 + // field[1] m.DataLen + size += 4 + // field[1] m.Data + size += 1 * len(m.Data) + return size +} +func (m *RPCCall) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Function + o.PutUint64(buf[pos:pos+8], uint64(m.Function)) + pos += 8 + // field[1] m.Multicast + buf[pos] = uint8(m.Multicast) + pos += 1 + // field[1] m.NeedBarrierSync + buf[pos] = uint8(m.NeedBarrierSync) + pos += 1 + // field[1] m.SendReply + buf[pos] = uint8(m.SendReply) + pos += 1 + // field[1] m.DataLen + o.PutUint32(buf[pos:pos+4], uint32(len(m.Data))) + pos += 4 + // field[1] m.Data + for i := 0; i < len(m.Data); i++ { + var x uint8 + if i < len(m.Data) { + x = uint8(m.Data[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *RPCCall) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Function + m.Function = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + // field[1] m.Multicast + m.Multicast = uint8(tmp[pos]) + pos += 1 + // field[1] m.NeedBarrierSync + m.NeedBarrierSync = uint8(tmp[pos]) + pos += 1 + // field[1] m.SendReply + m.SendReply = uint8(tmp[pos]) + pos += 1 + // field[1] m.DataLen + m.DataLen = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Data + m.Data = make([]uint8, m.DataLen) + for i := 0; i < len(m.Data); i++ { + m.Data[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + // RPCCallReply represents VPP binary API message 'rpc_call_reply'. type RPCCallReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *RPCCallReply) Reset() { *m = RPCCallReply{} } @@ -201,9 +872,45 @@ func (*RPCCallReply) GetMessageName() string { return "rpc_call_reply" func (*RPCCallReply) GetCrcString() string { return "e8d4e804" } func (*RPCCallReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *RPCCallReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *RPCCallReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *RPCCallReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // RxThreadExit represents VPP binary API message 'rx_thread_exit'. type RxThreadExit struct { - Dummy uint8 + Dummy uint8 `binapi:"u8,name=dummy" json:"dummy,omitempty"` } func (m *RxThreadExit) Reset() { *m = RxThreadExit{} } @@ -211,11 +918,47 @@ func (*RxThreadExit) GetMessageName() string { return "rx_thread_exit" func (*RxThreadExit) GetCrcString() string { return "c3a3a452" } func (*RxThreadExit) GetMessageType() api.MessageType { return api.OtherMessage } +func (m *RxThreadExit) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Dummy + size += 1 + return size +} +func (m *RxThreadExit) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Dummy + buf[pos] = uint8(m.Dummy) + pos += 1 + return buf, nil +} +func (m *RxThreadExit) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Dummy + m.Dummy = uint8(tmp[pos]) + pos += 1 + return nil +} + // SockInitShm represents VPP binary API message 'sock_init_shm'. type SockInitShm struct { - RequestedSize uint32 - Nitems uint8 `struc:"sizeof=Configs"` - Configs []uint64 + RequestedSize uint32 `binapi:"u32,name=requested_size" json:"requested_size,omitempty"` + Nitems uint8 `binapi:"u8,name=nitems" json:"nitems,omitempty" struc:"sizeof=Configs"` + Configs []uint64 `binapi:"u64[nitems],name=configs" json:"configs,omitempty"` } func (m *SockInitShm) Reset() { *m = SockInitShm{} } @@ -223,9 +966,70 @@ func (*SockInitShm) GetMessageName() string { return "sock_init_shm" } func (*SockInitShm) GetCrcString() string { return "51646d92" } func (*SockInitShm) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SockInitShm) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.RequestedSize + size += 4 + // field[1] m.Nitems + size += 1 + // field[1] m.Configs + size += 8 * len(m.Configs) + return size +} +func (m *SockInitShm) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.RequestedSize + o.PutUint32(buf[pos:pos+4], uint32(m.RequestedSize)) + pos += 4 + // field[1] m.Nitems + buf[pos] = uint8(len(m.Configs)) + pos += 1 + // field[1] m.Configs + for i := 0; i < len(m.Configs); i++ { + var x uint64 + if i < len(m.Configs) { + x = uint64(m.Configs[i]) + } + o.PutUint64(buf[pos:pos+8], uint64(x)) + pos += 8 + } + return buf, nil +} +func (m *SockInitShm) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.RequestedSize + m.RequestedSize = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Nitems + m.Nitems = uint8(tmp[pos]) + pos += 1 + // field[1] m.Configs + m.Configs = make([]uint64, m.Nitems) + for i := 0; i < len(m.Configs); i++ { + m.Configs[i] = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + } + return nil +} + // SockInitShmReply represents VPP binary API message 'sock_init_shm_reply'. type SockInitShmReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *SockInitShmReply) Reset() { *m = SockInitShmReply{} } @@ -233,9 +1037,45 @@ func (*SockInitShmReply) GetMessageName() string { return "sock_init_sh func (*SockInitShmReply) GetCrcString() string { return "e8d4e804" } func (*SockInitShmReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SockInitShmReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SockInitShmReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SockInitShmReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SockclntCreate represents VPP binary API message 'sockclnt_create'. type SockclntCreate struct { - Name string `struc:"[64]byte"` + Name string `binapi:"string[64],name=name" json:"name,omitempty" struc:"[64]byte"` } func (m *SockclntCreate) Reset() { *m = SockclntCreate{} } @@ -243,12 +1083,51 @@ func (*SockclntCreate) GetMessageName() string { return "sockclnt_creat func (*SockclntCreate) GetCrcString() string { return "455fb9c4" } func (*SockclntCreate) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SockclntCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Name + size += 64 + return size +} +func (m *SockclntCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Name + copy(buf[pos:pos+64], m.Name) + pos += 64 + return buf, nil +} +func (m *SockclntCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // SockclntCreateReply represents VPP binary API message 'sockclnt_create_reply'. type SockclntCreateReply struct { - Response int32 - Index uint32 - Count uint16 `struc:"sizeof=MessageTable"` - MessageTable []MessageTableEntry + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` + Count uint16 `binapi:"u16,name=count" json:"count,omitempty" struc:"sizeof=MessageTable"` + MessageTable []MessageTableEntry `binapi:"message_table_entry[count],name=message_table" json:"message_table,omitempty"` } func (m *SockclntCreateReply) Reset() { *m = SockclntCreateReply{} } @@ -256,9 +1135,99 @@ func (*SockclntCreateReply) GetMessageName() string { return "sockclnt_ func (*SockclntCreateReply) GetCrcString() string { return "35166268" } func (*SockclntCreateReply) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SockclntCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + // field[1] m.Index + size += 4 + // field[1] m.Count + size += 2 + // field[1] m.MessageTable + for j1 := 0; j1 < len(m.MessageTable); j1++ { + var s1 MessageTableEntry + _ = s1 + if j1 < len(m.MessageTable) { + s1 = m.MessageTable[j1] + } + // field[2] s1.Index + size += 2 + // field[2] s1.Name + size += 64 + } + return size +} +func (m *SockclntCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + // field[1] m.Count + o.PutUint16(buf[pos:pos+2], uint16(len(m.MessageTable))) + pos += 2 + // field[1] m.MessageTable + for j1 := 0; j1 < len(m.MessageTable); j1++ { + var v1 MessageTableEntry + if j1 < len(m.MessageTable) { + v1 = m.MessageTable[j1] + } + // field[2] v1.Index + o.PutUint16(buf[pos:pos+2], uint16(v1.Index)) + pos += 2 + // field[2] v1.Name + copy(buf[pos:pos+64], v1.Name) + pos += 64 + } + return buf, nil +} +func (m *SockclntCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.MessageTable + m.MessageTable = make([]MessageTableEntry, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.MessageTable[j1].Index + m.MessageTable[j1].Index = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[2] m.MessageTable[j1].Name + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.MessageTable[j1].Name = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + } + return nil +} + // SockclntDelete represents VPP binary API message 'sockclnt_delete'. type SockclntDelete struct { - Index uint32 + Index uint32 `binapi:"u32,name=index" json:"index,omitempty"` } func (m *SockclntDelete) Reset() { *m = SockclntDelete{} } @@ -266,9 +1235,45 @@ func (*SockclntDelete) GetMessageName() string { return "sockclnt_delet func (*SockclntDelete) GetCrcString() string { return "8ac76db6" } func (*SockclntDelete) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *SockclntDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Index + size += 4 + return size +} +func (m *SockclntDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Index + o.PutUint32(buf[pos:pos+4], uint32(m.Index)) + pos += 4 + return buf, nil +} +func (m *SockclntDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Index + m.Index = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // SockclntDeleteReply represents VPP binary API message 'sockclnt_delete_reply'. type SockclntDeleteReply struct { - Response int32 + Response int32 `binapi:"i32,name=response" json:"response,omitempty"` } func (m *SockclntDeleteReply) Reset() { *m = SockclntDeleteReply{} } @@ -276,11 +1281,47 @@ func (*SockclntDeleteReply) GetMessageName() string { return "sockclnt_ func (*SockclntDeleteReply) GetCrcString() string { return "8f38b1ee" } func (*SockclntDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *SockclntDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Response + size += 4 + return size +} +func (m *SockclntDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Response + o.PutUint32(buf[pos:pos+4], uint32(m.Response)) + pos += 4 + return buf, nil +} +func (m *SockclntDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Response + m.Response = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // TracePluginMsgIds represents VPP binary API message 'trace_plugin_msg_ids'. type TracePluginMsgIds struct { - PluginName string `struc:"[128]byte"` - FirstMsgID uint16 - LastMsgID uint16 + PluginName string `binapi:"string[128],name=plugin_name" json:"plugin_name,omitempty" struc:"[128]byte"` + FirstMsgID uint16 `binapi:"u16,name=first_msg_id" json:"first_msg_id,omitempty"` + LastMsgID uint16 `binapi:"u16,name=last_msg_id" json:"last_msg_id,omitempty"` } func (m *TracePluginMsgIds) Reset() { *m = TracePluginMsgIds{} } @@ -288,7 +1329,63 @@ func (*TracePluginMsgIds) GetMessageName() string { return "trace_plugi func (*TracePluginMsgIds) GetCrcString() string { return "f476d3ce" } func (*TracePluginMsgIds) GetMessageType() api.MessageType { return api.RequestMessage } -func init() { +func (m *TracePluginMsgIds) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.PluginName + size += 128 + // field[1] m.FirstMsgID + size += 2 + // field[1] m.LastMsgID + size += 2 + return size +} +func (m *TracePluginMsgIds) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.PluginName + copy(buf[pos:pos+128], m.PluginName) + pos += 128 + // field[1] m.FirstMsgID + o.PutUint16(buf[pos:pos+2], uint16(m.FirstMsgID)) + pos += 2 + // field[1] m.LastMsgID + o.PutUint16(buf[pos:pos+2], uint16(m.LastMsgID)) + pos += 2 + return buf, nil +} +func (m *TracePluginMsgIds) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.PluginName + { + nul := bytes.Index(tmp[pos:pos+128], []byte{0x00}) + m.PluginName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 128 + } + // field[1] m.FirstMsgID + m.FirstMsgID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.LastMsgID + m.LastMsgID = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + return nil +} + +func init() { file_memclnt_binapi_init() } +func file_memclnt_binapi_init() { api.RegisterMessage((*APIVersions)(nil), "memclnt.APIVersions") api.RegisterMessage((*APIVersionsReply)(nil), "memclnt.APIVersionsReply") api.RegisterMessage((*GetFirstMsgID)(nil), "memclnt.GetFirstMsgID") @@ -341,142 +1438,13 @@ func AllMessages() []api.Message { } } -// RPCService represents RPC service API for memclnt module. -type RPCService interface { - APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) - GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) - MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) - MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) - MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) - MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error - MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error - RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) - RxThreadExit(ctx context.Context, in *RxThreadExit) error - SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) - SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) - SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) - TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { - out := new(APIVersionsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { - out := new(GetFirstMsgIDReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { - out := new(MemclntCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { - out := new(MemclntDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { - out := new(MemclntKeepaliveReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { - c.ch.SendRequest(in) - return nil -} - -func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { - c.ch.SendRequest(in) - return nil -} - -func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { - out := new(RPCCallReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { - c.ch.SendRequest(in) - return nil -} - -func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { - out := new(SockInitShmReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { - out := new(SockclntCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { - out := new(SockclntDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { - c.ch.SendRequest(in) - return nil -} - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage +var _ = codec.DecodeString var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/memclnt/memclnt_rpc.ba.go b/examples/binapi/memclnt/memclnt_rpc.ba.go new file mode 100644 index 0000000..05dfc28 --- /dev/null +++ b/examples/binapi/memclnt/memclnt_rpc.ba.go @@ -0,0 +1,141 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memclnt + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for memclnt module. +type RPCService interface { + APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) + GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) + MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) + MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) + MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) + MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error + MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error + RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) + RxThreadExit(ctx context.Context, in *RxThreadExit) error + SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) + SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) + SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) + TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) APIVersions(ctx context.Context, in *APIVersions) (*APIVersionsReply, error) { + out := new(APIVersionsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetFirstMsgID(ctx context.Context, in *GetFirstMsgID) (*GetFirstMsgIDReply, error) { + out := new(GetFirstMsgIDReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntCreate(ctx context.Context, in *MemclntCreate) (*MemclntCreateReply, error) { + out := new(MemclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntDelete(ctx context.Context, in *MemclntDelete) (*MemclntDeleteReply, error) { + out := new(MemclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntKeepalive(ctx context.Context, in *MemclntKeepalive) (*MemclntKeepaliveReply, error) { + out := new(MemclntKeepaliveReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemclntReadTimeout(ctx context.Context, in *MemclntReadTimeout) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) MemclntRxThreadSuspend(ctx context.Context, in *MemclntRxThreadSuspend) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) RPCCall(ctx context.Context, in *RPCCall) (*RPCCallReply, error) { + out := new(RPCCallReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) RxThreadExit(ctx context.Context, in *RxThreadExit) error { + c.ch.SendRequest(in) + return nil +} + +func (c *serviceClient) SockInitShm(ctx context.Context, in *SockInitShm) (*SockInitShmReply, error) { + out := new(SockInitShmReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntCreate(ctx context.Context, in *SockclntCreate) (*SockclntCreateReply, error) { + out := new(SockclntCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SockclntDelete(ctx context.Context, in *SockclntDelete) (*SockclntDeleteReply, error) { + out := new(SockclntDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) TracePluginMsgIds(ctx context.Context, in *TracePluginMsgIds) error { + c.ch.SendRequest(in) + return nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/examples/binapi/memif/memif.ba.go b/examples/binapi/memif/memif.ba.go index 2388cc2..60aadf3 100644 --- a/examples/binapi/memif/memif.ba.go +++ b/examples/binapi/memif/memif.ba.go @@ -1,30 +1,38 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 // source: /usr/share/vpp/api/plugins/memif.api.json /* -Package memif is a generated VPP binary API for 'memif' module. +Package memif contains generated code for VPP binary API defined by memif.api (version 3.0.0). It consists of: - 8 enums 2 aliases + 8 enums 10 messages - 5 services */ package memif import ( "bytes" "context" + "encoding/binary" "io" + "math" "strconv" api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" - - ethernet_types "git.fd.io/govpp.git/examples/binapi/ethernet_types" - interface_types "git.fd.io/govpp.git/examples/binapi/interface_types" ) +// 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 // please upgrade the GoVPP api package + const ( // ModuleName is the name of this module. ModuleName = "memif" @@ -34,11 +42,95 @@ const ( VersionCrc = 0x88dc56c9 ) -type IfStatusFlags = interface_types.IfStatusFlags +// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +type IfStatusFlags uint32 + +const ( + IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1 + IF_STATUS_API_FLAG_LINK_UP IfStatusFlags = 2 +) + +var ( + IfStatusFlags_name = map[uint32]string{ + 1: "IF_STATUS_API_FLAG_ADMIN_UP", + 2: "IF_STATUS_API_FLAG_LINK_UP", + } + IfStatusFlags_value = map[string]uint32{ + "IF_STATUS_API_FLAG_ADMIN_UP": 1, + "IF_STATUS_API_FLAG_LINK_UP": 2, + } +) + +func (x IfStatusFlags) String() string { + s, ok := IfStatusFlags_name[uint32(x)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" +} -type IfType = interface_types.IfType +// IfType represents VPP binary API enum 'if_type'. +type IfType uint32 -type LinkDuplex = interface_types.LinkDuplex +const ( + IF_API_TYPE_HARDWARE IfType = 1 + IF_API_TYPE_SUB IfType = 2 + IF_API_TYPE_P2P IfType = 3 + IF_API_TYPE_PIPE IfType = 4 +) + +var ( + IfType_name = map[uint32]string{ + 1: "IF_API_TYPE_HARDWARE", + 2: "IF_API_TYPE_SUB", + 3: "IF_API_TYPE_P2P", + 4: "IF_API_TYPE_PIPE", + } + IfType_value = map[string]uint32{ + "IF_API_TYPE_HARDWARE": 1, + "IF_API_TYPE_SUB": 2, + "IF_API_TYPE_P2P": 3, + "IF_API_TYPE_PIPE": 4, + } +) + +func (x IfType) String() string { + s, ok := IfType_name[uint32(x)] + if ok { + return s + } + return "IfType(" + strconv.Itoa(int(x)) + ")" +} + +// LinkDuplex represents VPP binary API enum 'link_duplex'. +type LinkDuplex uint32 + +const ( + LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0 + LINK_DUPLEX_API_HALF LinkDuplex = 1 + LINK_DUPLEX_API_FULL LinkDuplex = 2 +) + +var ( + LinkDuplex_name = map[uint32]string{ + 0: "LINK_DUPLEX_API_UNKNOWN", + 1: "LINK_DUPLEX_API_HALF", + 2: "LINK_DUPLEX_API_FULL", + } + LinkDuplex_value = map[string]uint32{ + "LINK_DUPLEX_API_UNKNOWN": 0, + "LINK_DUPLEX_API_HALF": 1, + "LINK_DUPLEX_API_FULL": 2, + } +) + +func (x LinkDuplex) String() string { + s, ok := LinkDuplex_name[uint32(x)] + if ok { + return s + } + return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" +} // MemifMode represents VPP binary API enum 'memif_mode'. type MemifMode uint32 @@ -49,24 +141,25 @@ const ( MEMIF_MODE_API_PUNT_INJECT MemifMode = 2 ) -var MemifMode_name = map[uint32]string{ - 0: "MEMIF_MODE_API_ETHERNET", - 1: "MEMIF_MODE_API_IP", - 2: "MEMIF_MODE_API_PUNT_INJECT", -} - -var MemifMode_value = map[string]uint32{ - "MEMIF_MODE_API_ETHERNET": 0, - "MEMIF_MODE_API_IP": 1, - "MEMIF_MODE_API_PUNT_INJECT": 2, -} +var ( + MemifMode_name = map[uint32]string{ + 0: "MEMIF_MODE_API_ETHERNET", + 1: "MEMIF_MODE_API_IP", + 2: "MEMIF_MODE_API_PUNT_INJECT", + } + MemifMode_value = map[string]uint32{ + "MEMIF_MODE_API_ETHERNET": 0, + "MEMIF_MODE_API_IP": 1, + "MEMIF_MODE_API_PUNT_INJECT": 2, + } +) func (x MemifMode) String() string { s, ok := MemifMode_name[uint32(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "MemifMode(" + strconv.Itoa(int(x)) + ")" } // MemifRole represents VPP binary API enum 'memif_role'. @@ -77,47 +170,167 @@ const ( MEMIF_ROLE_API_SLAVE MemifRole = 1 ) -var MemifRole_name = map[uint32]string{ - 0: "MEMIF_ROLE_API_MASTER", - 1: "MEMIF_ROLE_API_SLAVE", +var ( + MemifRole_name = map[uint32]string{ + 0: "MEMIF_ROLE_API_MASTER", + 1: "MEMIF_ROLE_API_SLAVE", + } + MemifRole_value = map[string]uint32{ + "MEMIF_ROLE_API_MASTER": 0, + "MEMIF_ROLE_API_SLAVE": 1, + } +) + +func (x MemifRole) String() string { + s, ok := MemifRole_name[uint32(x)] + if ok { + return s + } + return "MemifRole(" + strconv.Itoa(int(x)) + ")" } -var MemifRole_value = map[string]uint32{ - "MEMIF_ROLE_API_MASTER": 0, - "MEMIF_ROLE_API_SLAVE": 1, +// MtuProto represents VPP binary API enum 'mtu_proto'. +type MtuProto uint32 + +const ( + MTU_PROTO_API_L3 MtuProto = 1 + MTU_PROTO_API_IP4 MtuProto = 2 + MTU_PROTO_API_IP6 MtuProto = 3 + MTU_PROTO_API_MPLS MtuProto = 4 + MTU_PROTO_API_N MtuProto = 5 +) + +var ( + MtuProto_name = map[uint32]string{ + 1: "MTU_PROTO_API_L3", + 2: "MTU_PROTO_API_IP4", + 3: "MTU_PROTO_API_IP6", + 4: "MTU_PROTO_API_MPLS", + 5: "MTU_PROTO_API_N", + } + MtuProto_value = map[string]uint32{ + "MTU_PROTO_API_L3": 1, + "MTU_PROTO_API_IP4": 2, + "MTU_PROTO_API_IP6": 3, + "MTU_PROTO_API_MPLS": 4, + "MTU_PROTO_API_N": 5, + } +) + +func (x MtuProto) String() string { + s, ok := MtuProto_name[uint32(x)] + if ok { + return s + } + return "MtuProto(" + strconv.Itoa(int(x)) + ")" } -func (x MemifRole) String() string { - s, ok := MemifRole_name[uint32(x)] +// RxMode represents VPP binary API enum 'rx_mode'. +type RxMode uint32 + +const ( + RX_MODE_API_UNKNOWN RxMode = 0 + RX_MODE_API_POLLING RxMode = 1 + RX_MODE_API_INTERRUPT RxMode = 2 + RX_MODE_API_ADAPTIVE RxMode = 3 + RX_MODE_API_DEFAULT RxMode = 4 +) + +var ( + RxMode_name = map[uint32]string{ + 0: "RX_MODE_API_UNKNOWN", + 1: "RX_MODE_API_POLLING", + 2: "RX_MODE_API_INTERRUPT", + 3: "RX_MODE_API_ADAPTIVE", + 4: "RX_MODE_API_DEFAULT", + } + RxMode_value = map[string]uint32{ + "RX_MODE_API_UNKNOWN": 0, + "RX_MODE_API_POLLING": 1, + "RX_MODE_API_INTERRUPT": 2, + "RX_MODE_API_ADAPTIVE": 3, + "RX_MODE_API_DEFAULT": 4, + } +) + +func (x RxMode) String() string { + s, ok := RxMode_name[uint32(x)] if ok { return s } - return strconv.Itoa(int(x)) + return "RxMode(" + strconv.Itoa(int(x)) + ")" } -type MtuProto = interface_types.MtuProto +// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +type SubIfFlags uint32 -type RxMode = interface_types.RxMode +const ( + SUB_IF_API_FLAG_NO_TAGS SubIfFlags = 1 + SUB_IF_API_FLAG_ONE_TAG SubIfFlags = 2 + SUB_IF_API_FLAG_TWO_TAGS SubIfFlags = 4 + SUB_IF_API_FLAG_DOT1AD SubIfFlags = 8 + SUB_IF_API_FLAG_EXACT_MATCH SubIfFlags = 16 + SUB_IF_API_FLAG_DEFAULT SubIfFlags = 32 + SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64 + SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128 + SUB_IF_API_FLAG_MASK_VNET SubIfFlags = 254 + SUB_IF_API_FLAG_DOT1AH SubIfFlags = 256 +) -type SubIfFlags = interface_types.SubIfFlags +var ( + SubIfFlags_name = map[uint32]string{ + 1: "SUB_IF_API_FLAG_NO_TAGS", + 2: "SUB_IF_API_FLAG_ONE_TAG", + 4: "SUB_IF_API_FLAG_TWO_TAGS", + 8: "SUB_IF_API_FLAG_DOT1AD", + 16: "SUB_IF_API_FLAG_EXACT_MATCH", + 32: "SUB_IF_API_FLAG_DEFAULT", + 64: "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY", + 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY", + 254: "SUB_IF_API_FLAG_MASK_VNET", + 256: "SUB_IF_API_FLAG_DOT1AH", + } + SubIfFlags_value = map[string]uint32{ + "SUB_IF_API_FLAG_NO_TAGS": 1, + "SUB_IF_API_FLAG_ONE_TAG": 2, + "SUB_IF_API_FLAG_TWO_TAGS": 4, + "SUB_IF_API_FLAG_DOT1AD": 8, + "SUB_IF_API_FLAG_EXACT_MATCH": 16, + "SUB_IF_API_FLAG_DEFAULT": 32, + "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64, + "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128, + "SUB_IF_API_FLAG_MASK_VNET": 254, + "SUB_IF_API_FLAG_DOT1AH": 256, + } +) -type InterfaceIndex = interface_types.InterfaceIndex +func (x SubIfFlags) String() string { + s, ok := SubIfFlags_name[uint32(x)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" +} -type MacAddress = ethernet_types.MacAddress +// InterfaceIndex represents VPP binary API alias 'interface_index'. +type InterfaceIndex uint32 + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 // MemifCreate represents VPP binary API message 'memif_create'. type MemifCreate struct { - Role MemifRole - Mode MemifMode - RxQueues uint8 - TxQueues uint8 - ID uint32 - SocketID uint32 - RingSize uint32 - BufferSize uint16 - NoZeroCopy bool - HwAddr MacAddress - Secret string `struc:"[24]byte"` + Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` + Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` + RxQueues uint8 `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"` + TxQueues uint8 `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` + BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` + NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"` + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + Secret string `binapi:"string[24],name=secret" json:"secret,omitempty" struc:"[24]byte"` } func (m *MemifCreate) Reset() { *m = MemifCreate{} } @@ -125,10 +338,139 @@ func (*MemifCreate) GetMessageName() string { return "memif_create" } func (*MemifCreate) GetCrcString() string { return "b1b25061" } func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemifCreate) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Role + size += 4 + // field[1] m.Mode + size += 4 + // field[1] m.RxQueues + size += 1 + // field[1] m.TxQueues + size += 1 + // field[1] m.ID + size += 4 + // field[1] m.SocketID + size += 4 + // field[1] m.RingSize + size += 4 + // field[1] m.BufferSize + size += 2 + // field[1] m.NoZeroCopy + size += 1 + // field[1] m.HwAddr + size += 6 + // field[1] m.Secret + size += 24 + return size +} +func (m *MemifCreate) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Role + o.PutUint32(buf[pos:pos+4], uint32(m.Role)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + // field[1] m.RxQueues + buf[pos] = uint8(m.RxQueues) + pos += 1 + // field[1] m.TxQueues + buf[pos] = uint8(m.TxQueues) + pos += 1 + // field[1] m.ID + o.PutUint32(buf[pos:pos+4], uint32(m.ID)) + pos += 4 + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.RingSize + o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) + pos += 4 + // field[1] m.BufferSize + o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) + pos += 2 + // field[1] m.NoZeroCopy + if m.NoZeroCopy { + buf[pos] = 1 + } + pos += 1 + // field[1] m.HwAddr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.HwAddr) { + x = uint8(m.HwAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Secret + copy(buf[pos:pos+24], m.Secret) + pos += 24 + return buf, nil +} +func (m *MemifCreate) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Role + m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.RxQueues + m.RxQueues = uint8(tmp[pos]) + pos += 1 + // field[1] m.TxQueues + m.TxQueues = uint8(tmp[pos]) + pos += 1 + // field[1] m.ID + m.ID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.RingSize + m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.BufferSize + m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.NoZeroCopy + m.NoZeroCopy = tmp[pos] != 0 + pos += 1 + // field[1] m.HwAddr + for i := 0; i < len(m.HwAddr); i++ { + m.HwAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Secret + { + nul := bytes.Index(tmp[pos:pos+24], []byte{0x00}) + m.Secret = codec.DecodeString(tmp[pos : pos+nul]) + pos += 24 + } + return nil +} + // MemifCreateReply represents VPP binary API message 'memif_create_reply'. type MemifCreateReply struct { - Retval int32 - SwIfIndex InterfaceIndex + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} } @@ -136,9 +478,53 @@ func (*MemifCreateReply) GetMessageName() string { return "memif_create func (*MemifCreateReply) GetCrcString() string { return "5383d31f" } func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemifCreateReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *MemifCreateReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // MemifDelete represents VPP binary API message 'memif_delete'. type MemifDelete struct { - SwIfIndex InterfaceIndex + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *MemifDelete) Reset() { *m = MemifDelete{} } @@ -146,9 +532,45 @@ func (*MemifDelete) GetMessageName() string { return "memif_delete" } func (*MemifDelete) GetCrcString() string { return "f9e6675e" } func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemifDelete) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + return size +} +func (m *MemifDelete) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + return buf, nil +} +func (m *MemifDelete) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // MemifDeleteReply represents VPP binary API message 'memif_delete_reply'. type MemifDeleteReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} } @@ -156,19 +578,55 @@ func (*MemifDeleteReply) GetMessageName() string { return "memif_delete func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" } func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemifDeleteReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MemifDeleteReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // MemifDetails represents VPP binary API message 'memif_details'. type MemifDetails struct { - SwIfIndex InterfaceIndex - HwAddr MacAddress - ID uint32 - Role MemifRole - Mode MemifMode - ZeroCopy bool - SocketID uint32 - RingSize uint32 - BufferSize uint16 - Flags IfStatusFlags - IfName string `struc:"[64]byte"` + SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` + Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` + ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` + BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` + Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` + IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"` } func (m *MemifDetails) Reset() { *m = MemifDetails{} } @@ -176,6 +634,135 @@ func (*MemifDetails) GetMessageName() string { return "memif_details" } func (*MemifDetails) GetCrcString() string { return "d0382c4c" } func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemifDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SwIfIndex + size += 4 + // field[1] m.HwAddr + size += 6 + // field[1] m.ID + size += 4 + // field[1] m.Role + size += 4 + // field[1] m.Mode + size += 4 + // field[1] m.ZeroCopy + size += 1 + // field[1] m.SocketID + size += 4 + // field[1] m.RingSize + size += 4 + // field[1] m.BufferSize + size += 2 + // field[1] m.Flags + size += 4 + // field[1] m.IfName + size += 64 + return size +} +func (m *MemifDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.HwAddr + for i := 0; i < 6; i++ { + var x uint8 + if i < len(m.HwAddr) { + x = uint8(m.HwAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.ID + o.PutUint32(buf[pos:pos+4], uint32(m.ID)) + pos += 4 + // field[1] m.Role + o.PutUint32(buf[pos:pos+4], uint32(m.Role)) + pos += 4 + // field[1] m.Mode + o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) + pos += 4 + // field[1] m.ZeroCopy + if m.ZeroCopy { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.RingSize + o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) + pos += 4 + // field[1] m.BufferSize + o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) + pos += 2 + // field[1] m.Flags + o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) + pos += 4 + // field[1] m.IfName + copy(buf[pos:pos+64], m.IfName) + pos += 64 + return buf, nil +} +func (m *MemifDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SwIfIndex + m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.HwAddr + for i := 0; i < len(m.HwAddr); i++ { + m.HwAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.ID + m.ID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Role + m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Mode + m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ZeroCopy + m.ZeroCopy = tmp[pos] != 0 + pos += 1 + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.RingSize + m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.BufferSize + m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.Flags + m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IfName + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.IfName = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 + } + return nil +} + // MemifDump represents VPP binary API message 'memif_dump'. type MemifDump struct{} @@ -184,11 +771,39 @@ func (*MemifDump) GetMessageName() string { return "memif_dump" } func (*MemifDump) GetCrcString() string { return "51077d14" } func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemifDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemifDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MemifDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'. type MemifSocketFilenameAddDel struct { - IsAdd bool - SocketID uint32 - SocketFilename string `struc:"[108]byte"` + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` } func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} } @@ -196,9 +811,66 @@ func (*MemifSocketFilenameAddDel) GetMessageName() string { return "mem func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" } func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemifSocketFilenameAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsAdd + size += 1 + // field[1] m.SocketID + size += 4 + // field[1] m.SocketFilename + size += 108 + return size +} +func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsAdd + if m.IsAdd { + buf[pos] = 1 + } + pos += 1 + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.SocketFilename + copy(buf[pos:pos+108], m.SocketFilename) + pos += 108 + return buf, nil +} +func (m *MemifSocketFilenameAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsAdd + m.IsAdd = tmp[pos] != 0 + pos += 1 + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SocketFilename + { + nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) + m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) + pos += 108 + } + return nil +} + // MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'. type MemifSocketFilenameAddDelReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} } @@ -208,10 +880,46 @@ func (*MemifSocketFilenameAddDelReply) GetMessageName() string { func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" } func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemifSocketFilenameAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *MemifSocketFilenameAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'. type MemifSocketFilenameDetails struct { - SocketID uint32 - SocketFilename string `struc:"[108]byte"` + SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` } func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} } @@ -219,6 +927,53 @@ func (*MemifSocketFilenameDetails) GetMessageName() string { return "me func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" } func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemifSocketFilenameDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.SocketID + size += 4 + // field[1] m.SocketFilename + size += 108 + return size +} +func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.SocketID + o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) + pos += 4 + // field[1] m.SocketFilename + copy(buf[pos:pos+108], m.SocketFilename) + pos += 108 + return buf, nil +} +func (m *MemifSocketFilenameDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.SocketID + m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SocketFilename + { + nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) + m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) + pos += 108 + } + return nil +} + // MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'. type MemifSocketFilenameDump struct{} @@ -227,7 +982,36 @@ func (*MemifSocketFilenameDump) GetMessageName() string { return "memif func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" } func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage } -func init() { +func (m *MemifSocketFilenameDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *MemifSocketFilenameDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +func init() { file_memif_binapi_init() } +func file_memif_binapi_init() { api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate") api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply") api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete") @@ -256,112 +1040,13 @@ func AllMessages() []api.Message { } } -// RPCService represents RPC service API for memif module. -type RPCService interface { - DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) - DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) - MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) - MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) - MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMemifClient{stream} - return x, nil -} - -type RPCService_DumpMemifClient interface { - Recv() (*MemifDetails, error) -} - -type serviceClient_DumpMemifClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { - m := new(MemifDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMemifSocketFilenameClient{stream} - return x, nil -} - -type RPCService_DumpMemifSocketFilenameClient interface { - Recv() (*MemifSocketFilenameDetails, error) -} - -type serviceClient_DumpMemifSocketFilenameClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { - m := new(MemifSocketFilenameDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { - out := new(MemifCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { - out := new(MemifDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { - out := new(MemifSocketFilenameAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage +var _ = codec.DecodeString var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/memif/memif_rpc.ba.go b/examples/binapi/memif/memif_rpc.ba.go new file mode 100644 index 0000000..8eda8f1 --- /dev/null +++ b/examples/binapi/memif/memif_rpc.ba.go @@ -0,0 +1,111 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package memif + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for memif module. +type RPCService interface { + DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) + DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) + MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) + MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) + MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifClient{stream} + return x, nil +} + +type RPCService_DumpMemifClient interface { + Recv() (*MemifDetails, error) +} + +type serviceClient_DumpMemifClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { + m := new(MemifDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpMemifSocketFilenameClient{stream} + return x, nil +} + +type RPCService_DumpMemifSocketFilenameClient interface { + Recv() (*MemifSocketFilenameDetails, error) +} + +type serviceClient_DumpMemifSocketFilenameClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { + m := new(MemifSocketFilenameDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { + out := new(MemifCreateReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { + out := new(MemifDeleteReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { + out := new(MemifSocketFilenameAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/examples/binapi/sr/sr.ba.go b/examples/binapi/sr/sr.ba.go new file mode 100644 index 0000000..b870456 --- /dev/null +++ b/examples/binapi/sr/sr.ba.go @@ -0,0 +1,1716 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 +// source: /usr/share/vpp/api/core/sr.api.json + +/* +Package sr contains generated code for VPP binary API defined by sr.api (version 1.2.0). + +It consists of: + 20 messages + 3 types +*/ +package sr + +import ( + "bytes" + "context" + "encoding/binary" + "io" + "math" + "strconv" + + api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" + struc "github.com/lunixbochs/struc" +) + +// 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 // please upgrade the GoVPP api package + +const ( + // ModuleName is the name of this module. + ModuleName = "sr" + // APIVersion is the API version of this module. + APIVersion = "1.2.0" + // VersionCrc is the CRC of this module. + VersionCrc = 0xbf277f96 +) + +// SrIP6Address represents VPP binary API type 'sr_ip6_address'. +type SrIP6Address struct { + Data []byte `binapi:"u8[16],name=data" json:"data,omitempty" struc:"[16]byte"` +} + +func (*SrIP6Address) GetTypeName() string { return "sr_ip6_address" } + +// Srv6Sid represents VPP binary API type 'srv6_sid'. +type Srv6Sid struct { + Addr []byte `binapi:"u8[16],name=addr" json:"addr,omitempty" struc:"[16]byte"` +} + +func (*Srv6Sid) GetTypeName() string { return "srv6_sid" } + +// Srv6SidList represents VPP binary API type 'srv6_sid_list'. +type Srv6SidList struct { + NumSids uint8 `binapi:"u8,name=num_sids" json:"num_sids,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids [16]Srv6Sid `binapi:"srv6_sid[16],name=sids" json:"sids,omitempty" struc:"[16]Srv6Sid"` +} + +func (*Srv6SidList) GetTypeName() string { return "srv6_sid_list" } + +// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. +type SrLocalsidAddDel struct { + IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` + Localsid Srv6Sid `binapi:"srv6_sid,name=localsid" json:"localsid,omitempty"` + EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` + Behavior uint8 `binapi:"u8,name=behavior" json:"behavior,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NhAddr6 []byte `binapi:"u8[16],name=nh_addr6" json:"nh_addr6,omitempty" struc:"[16]byte"` + NhAddr4 []byte `binapi:"u8[4],name=nh_addr4" json:"nh_addr4,omitempty" struc:"[4]byte"` +} + +func (m *SrLocalsidAddDel) Reset() { *m = SrLocalsidAddDel{} } +func (*SrLocalsidAddDel) GetMessageName() string { return "sr_localsid_add_del" } +func (*SrLocalsidAddDel) GetCrcString() string { return "b30489eb" } +func (*SrLocalsidAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrLocalsidAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsDel + size += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + size += 16 + // field[1] m.EndPsp + size += 1 + // field[1] m.Behavior + size += 1 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.VlanIndex + size += 4 + // field[1] m.FibTable + size += 4 + // field[1] m.NhAddr6 + size += 16 + // field[1] m.NhAddr4 + size += 4 + return size +} +func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsDel + buf[pos] = uint8(m.IsDel) + pos += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Localsid.Addr) { + x = uint8(m.Localsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.EndPsp + buf[pos] = uint8(m.EndPsp) + pos += 1 + // field[1] m.Behavior + buf[pos] = uint8(m.Behavior) + pos += 1 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.VlanIndex + o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) + pos += 4 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.NhAddr6 + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.NhAddr6) { + x = uint8(m.NhAddr6[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NhAddr4 + for i := 0; i < 4; i++ { + var x uint8 + if i < len(m.NhAddr4) { + x = uint8(m.NhAddr4[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrLocalsidAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsDel + m.IsDel = uint8(tmp[pos]) + pos += 1 + // field[1] m.Localsid + // field[2] m.Localsid.Addr + m.Localsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Localsid.Addr); i++ { + m.Localsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.EndPsp + m.EndPsp = uint8(tmp[pos]) + pos += 1 + // field[1] m.Behavior + m.Behavior = uint8(tmp[pos]) + pos += 1 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanIndex + m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NhAddr6 + m.NhAddr6 = make([]uint8, 16) + for i := 0; i < len(m.NhAddr6); i++ { + m.NhAddr6[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NhAddr4 + m.NhAddr4 = make([]uint8, 4) + for i := 0; i < len(m.NhAddr4); i++ { + m.NhAddr4[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. +type SrLocalsidAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrLocalsidAddDelReply) Reset() { *m = SrLocalsidAddDelReply{} } +func (*SrLocalsidAddDelReply) GetMessageName() string { return "sr_localsid_add_del_reply" } +func (*SrLocalsidAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrLocalsidAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrLocalsidAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrLocalsidAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. +type SrLocalsidsDetails struct { + Addr Srv6Sid `binapi:"srv6_sid,name=addr" json:"addr,omitempty"` + EndPsp uint8 `binapi:"u8,name=end_psp" json:"end_psp,omitempty"` + Behavior uint16 `binapi:"u16,name=behavior" json:"behavior,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"` + XconnectNhAddr6 []byte `binapi:"u8[16],name=xconnect_nh_addr6" json:"xconnect_nh_addr6,omitempty" struc:"[16]byte"` + XconnectNhAddr4 []byte `binapi:"u8[4],name=xconnect_nh_addr4" json:"xconnect_nh_addr4,omitempty" struc:"[4]byte"` + XconnectIfaceOrVrfTable uint32 `binapi:"u32,name=xconnect_iface_or_vrf_table" json:"xconnect_iface_or_vrf_table,omitempty"` +} + +func (m *SrLocalsidsDetails) Reset() { *m = SrLocalsidsDetails{} } +func (*SrLocalsidsDetails) GetMessageName() string { return "sr_localsids_details" } +func (*SrLocalsidsDetails) GetCrcString() string { return "0791babc" } +func (*SrLocalsidsDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrLocalsidsDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Addr + // field[2] m.Addr.Addr + size += 16 + // field[1] m.EndPsp + size += 1 + // field[1] m.Behavior + size += 2 + // field[1] m.FibTable + size += 4 + // field[1] m.VlanIndex + size += 4 + // field[1] m.XconnectNhAddr6 + size += 16 + // field[1] m.XconnectNhAddr4 + size += 4 + // field[1] m.XconnectIfaceOrVrfTable + size += 4 + return size +} +func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Addr + // field[2] m.Addr.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Addr.Addr) { + x = uint8(m.Addr.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.EndPsp + buf[pos] = uint8(m.EndPsp) + pos += 1 + // field[1] m.Behavior + o.PutUint16(buf[pos:pos+2], uint16(m.Behavior)) + pos += 2 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.VlanIndex + o.PutUint32(buf[pos:pos+4], uint32(m.VlanIndex)) + pos += 4 + // field[1] m.XconnectNhAddr6 + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.XconnectNhAddr6) { + x = uint8(m.XconnectNhAddr6[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.XconnectNhAddr4 + for i := 0; i < 4; i++ { + var x uint8 + if i < len(m.XconnectNhAddr4) { + x = uint8(m.XconnectNhAddr4[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.XconnectIfaceOrVrfTable + o.PutUint32(buf[pos:pos+4], uint32(m.XconnectIfaceOrVrfTable)) + pos += 4 + return buf, nil +} +func (m *SrLocalsidsDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Addr + // field[2] m.Addr.Addr + m.Addr.Addr = make([]uint8, 16) + for i := 0; i < len(m.Addr.Addr); i++ { + m.Addr.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.EndPsp + m.EndPsp = uint8(tmp[pos]) + pos += 1 + // field[1] m.Behavior + m.Behavior = uint16(o.Uint16(tmp[pos : pos+2])) + pos += 2 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VlanIndex + m.VlanIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.XconnectNhAddr6 + m.XconnectNhAddr6 = make([]uint8, 16) + for i := 0; i < len(m.XconnectNhAddr6); i++ { + m.XconnectNhAddr6[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.XconnectNhAddr4 + m.XconnectNhAddr4 = make([]uint8, 4) + for i := 0; i < len(m.XconnectNhAddr4); i++ { + m.XconnectNhAddr4[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.XconnectIfaceOrVrfTable + m.XconnectIfaceOrVrfTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. +type SrLocalsidsDump struct{} + +func (m *SrLocalsidsDump) Reset() { *m = SrLocalsidsDump{} } +func (*SrLocalsidsDump) GetMessageName() string { return "sr_localsids_dump" } +func (*SrLocalsidsDump) GetCrcString() string { return "51077d14" } +func (*SrLocalsidsDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrLocalsidsDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrLocalsidsDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrLocalsidsDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. +type SrPoliciesDetails struct { + Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` + Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"num_sid_lists,omitempty" struc:"sizeof=SidLists"` + SidLists []Srv6SidList `binapi:"srv6_sid_list[num_sid_lists],name=sid_lists" json:"sid_lists,omitempty"` +} + +func (m *SrPoliciesDetails) Reset() { *m = SrPoliciesDetails{} } +func (*SrPoliciesDetails) GetMessageName() string { return "sr_policies_details" } +func (*SrPoliciesDetails) GetCrcString() string { return "5087f460" } +func (*SrPoliciesDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPoliciesDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Bsid + // field[2] m.Bsid.Addr + size += 16 + // field[1] m.Type + size += 1 + // field[1] m.IsEncap + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.NumSidLists + size += 1 + // field[1] m.SidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var s1 Srv6SidList + _ = s1 + if j1 < len(m.SidLists) { + s1 = m.SidLists[j1] + } + // field[2] s1.NumSids + size += 1 + // field[2] s1.Weight + size += 4 + // field[2] s1.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(s1.Sids) { + s2 = s1.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + } + return size +} +func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Bsid + // field[2] m.Bsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Bsid.Addr) { + x = uint8(m.Bsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Type + buf[pos] = uint8(m.Type) + pos += 1 + // field[1] m.IsEncap + buf[pos] = uint8(m.IsEncap) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.NumSidLists + buf[pos] = uint8(len(m.SidLists)) + pos += 1 + // field[1] m.SidLists + for j1 := 0; j1 < len(m.SidLists); j1++ { + var v1 Srv6SidList + if j1 < len(m.SidLists) { + v1 = m.SidLists[j1] + } + // field[2] v1.NumSids + buf[pos] = uint8(v1.NumSids) + pos += 1 + // field[2] v1.Weight + o.PutUint32(buf[pos:pos+4], uint32(v1.Weight)) + pos += 4 + // field[2] v1.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(v1.Sids) { + v2 = v1.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + } + return buf, nil +} +func (m *SrPoliciesDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Bsid + // field[2] m.Bsid.Addr + m.Bsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Bsid.Addr); i++ { + m.Bsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Type + m.Type = uint8(tmp[pos]) + pos += 1 + // field[1] m.IsEncap + m.IsEncap = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NumSidLists + m.NumSidLists = uint8(tmp[pos]) + pos += 1 + // field[1] m.SidLists + m.SidLists = make([]Srv6SidList, int(m.NumSidLists)) + for j1 := 0; j1 < int(m.NumSidLists); j1++ { + // field[2] m.SidLists[j1].NumSids + m.SidLists[j1].NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.SidLists[j1].Weight + m.SidLists[j1].Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.SidLists[j1].Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.SidLists[j1].Sids[j2].Addr + m.SidLists[j1].Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.SidLists[j1].Sids[j2].Addr); i++ { + m.SidLists[j1].Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + } + return nil +} + +// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. +type SrPoliciesDump struct{} + +func (m *SrPoliciesDump) Reset() { *m = SrPoliciesDump{} } +func (*SrPoliciesDump) GetMessageName() string { return "sr_policies_dump" } +func (*SrPoliciesDump) GetCrcString() string { return "51077d14" } +func (*SrPoliciesDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPoliciesDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrPoliciesDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrPoliciesDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. +type SrPolicyAdd struct { + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + IsEncap uint8 `binapi:"u8,name=is_encap" json:"is_encap,omitempty"` + Type uint8 `binapi:"u8,name=type" json:"type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyAdd) Reset() { *m = SrPolicyAdd{} } +func (*SrPolicyAdd) GetMessageName() string { return "sr_policy_add" } +func (*SrPolicyAdd) GetCrcString() string { return "4b6e2484" } +func (*SrPolicyAdd) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyAdd) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + size += 16 + // field[1] m.Weight + size += 4 + // field[1] m.IsEncap + size += 1 + // field[1] m.Type + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + size += 1 + // field[2] m.Sids.Weight + size += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + return size +} +func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) + pos += 4 + // field[1] m.IsEncap + buf[pos] = uint8(m.IsEncap) + pos += 1 + // field[1] m.Type + buf[pos] = uint8(m.Type) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + buf[pos] = uint8(m.Sids.NumSids) + pos += 1 + // field[2] m.Sids.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(m.Sids.Sids) { + v2 = m.Sids.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + return buf, nil +} +func (m *SrPolicyAdd) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.Weight + m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.IsEncap + m.IsEncap = uint8(tmp[pos]) + pos += 1 + // field[1] m.Type + m.Type = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + m.Sids.NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.Sids.Weight + m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.Sids.Sids[j2].Addr + m.Sids.Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { + m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. +type SrPolicyAddReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyAddReply) Reset() { *m = SrPolicyAddReply{} } +func (*SrPolicyAddReply) GetMessageName() string { return "sr_policy_add_reply" } +func (*SrPolicyAddReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyAddReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyAddReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyAddReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyAddReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyDel represents VPP binary API message 'sr_policy_del'. +type SrPolicyDel struct { + BsidAddr Srv6Sid `binapi:"srv6_sid,name=bsid_addr" json:"bsid_addr,omitempty"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` +} + +func (m *SrPolicyDel) Reset() { *m = SrPolicyDel{} } +func (*SrPolicyDel) GetMessageName() string { return "sr_policy_del" } +func (*SrPolicyDel) GetCrcString() string { return "e4133171" } +func (*SrPolicyDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + return size +} +func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr.Addr) { + x = uint8(m.BsidAddr.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + return buf, nil +} +func (m *SrPolicyDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + // field[2] m.BsidAddr.Addr + m.BsidAddr.Addr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr.Addr); i++ { + m.BsidAddr.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. +type SrPolicyDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyDelReply) Reset() { *m = SrPolicyDelReply{} } +func (*SrPolicyDelReply) GetMessageName() string { return "sr_policy_del_reply" } +func (*SrPolicyDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. +type SrPolicyMod struct { + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + Operation uint8 `binapi:"u8,name=operation" json:"operation,omitempty"` + SlIndex uint32 `binapi:"u32,name=sl_index" json:"sl_index,omitempty"` + Weight uint32 `binapi:"u32,name=weight" json:"weight,omitempty"` + Sids Srv6SidList `binapi:"srv6_sid_list,name=sids" json:"sids,omitempty"` +} + +func (m *SrPolicyMod) Reset() { *m = SrPolicyMod{} } +func (*SrPolicyMod) GetMessageName() string { return "sr_policy_mod" } +func (*SrPolicyMod) GetCrcString() string { return "c1dfaee0" } +func (*SrPolicyMod) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrPolicyMod) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.BsidAddr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + // field[1] m.FibTable + size += 4 + // field[1] m.Operation + size += 1 + // field[1] m.SlIndex + size += 4 + // field[1] m.Weight + size += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + size += 1 + // field[2] m.Sids.Weight + size += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var s2 Srv6Sid + _ = s2 + if j2 < len(m.Sids.Sids) { + s2 = m.Sids.Sids[j2] + } + // field[3] s2.Addr + size += 16 + } + return size +} +func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.Operation + buf[pos] = uint8(m.Operation) + pos += 1 + // field[1] m.SlIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SlIndex)) + pos += 4 + // field[1] m.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Weight)) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + buf[pos] = uint8(m.Sids.NumSids) + pos += 1 + // field[2] m.Sids.Weight + o.PutUint32(buf[pos:pos+4], uint32(m.Sids.Weight)) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + var v2 Srv6Sid + if j2 < len(m.Sids.Sids) { + v2 = m.Sids.Sids[j2] + } + // field[3] v2.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(v2.Addr) { + x = uint8(v2.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + } + return buf, nil +} +func (m *SrPolicyMod) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Operation + m.Operation = uint8(tmp[pos]) + pos += 1 + // field[1] m.SlIndex + m.SlIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Weight + m.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Sids + // field[2] m.Sids.NumSids + m.Sids.NumSids = uint8(tmp[pos]) + pos += 1 + // field[2] m.Sids.Weight + m.Sids.Weight = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.Sids.Sids + for j2 := 0; j2 < 16; j2++ { + // field[3] m.Sids.Sids[j2].Addr + m.Sids.Sids[j2].Addr = make([]uint8, 16) + for i := 0; i < len(m.Sids.Sids[j2].Addr); i++ { + m.Sids.Sids[j2].Addr[i] = uint8(tmp[pos]) + pos += 1 + } + } + return nil +} + +// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. +type SrPolicyModReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrPolicyModReply) Reset() { *m = SrPolicyModReply{} } +func (*SrPolicyModReply) GetMessageName() string { return "sr_policy_mod_reply" } +func (*SrPolicyModReply) GetCrcString() string { return "e8d4e804" } +func (*SrPolicyModReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrPolicyModReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrPolicyModReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrPolicyModReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSetEncapHopLimit represents VPP binary API message 'sr_set_encap_hop_limit'. +type SrSetEncapHopLimit struct { + HopLimit uint8 `binapi:"u8,name=hop_limit" json:"hop_limit,omitempty"` +} + +func (m *SrSetEncapHopLimit) Reset() { *m = SrSetEncapHopLimit{} } +func (*SrSetEncapHopLimit) GetMessageName() string { return "sr_set_encap_hop_limit" } +func (*SrSetEncapHopLimit) GetCrcString() string { return "aa75d7d0" } +func (*SrSetEncapHopLimit) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSetEncapHopLimit) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.HopLimit + size += 1 + return size +} +func (m *SrSetEncapHopLimit) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.HopLimit + buf[pos] = uint8(m.HopLimit) + pos += 1 + return buf, nil +} +func (m *SrSetEncapHopLimit) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.HopLimit + m.HopLimit = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SrSetEncapHopLimitReply represents VPP binary API message 'sr_set_encap_hop_limit_reply'. +type SrSetEncapHopLimitReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapHopLimitReply) Reset() { *m = SrSetEncapHopLimitReply{} } +func (*SrSetEncapHopLimitReply) GetMessageName() string { return "sr_set_encap_hop_limit_reply" } +func (*SrSetEncapHopLimitReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapHopLimitReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSetEncapHopLimitReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSetEncapHopLimitReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSetEncapHopLimitReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. +type SrSetEncapSource struct { + EncapsSource []byte `binapi:"u8[16],name=encaps_source" json:"encaps_source,omitempty" struc:"[16]byte"` +} + +func (m *SrSetEncapSource) Reset() { *m = SrSetEncapSource{} } +func (*SrSetEncapSource) GetMessageName() string { return "sr_set_encap_source" } +func (*SrSetEncapSource) GetCrcString() string { return "d05bb4de" } +func (*SrSetEncapSource) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSetEncapSource) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.EncapsSource + size += 16 + return size +} +func (m *SrSetEncapSource) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.EncapsSource + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.EncapsSource) { + x = uint8(m.EncapsSource[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrSetEncapSource) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.EncapsSource + m.EncapsSource = make([]uint8, 16) + for i := 0; i < len(m.EncapsSource); i++ { + m.EncapsSource[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. +type SrSetEncapSourceReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSetEncapSourceReply) Reset() { *m = SrSetEncapSourceReply{} } +func (*SrSetEncapSourceReply) GetMessageName() string { return "sr_set_encap_source_reply" } +func (*SrSetEncapSourceReply) GetCrcString() string { return "e8d4e804" } +func (*SrSetEncapSourceReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSetEncapSourceReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSetEncapSourceReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSetEncapSourceReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. +type SrSteeringAddDel struct { + IsDel uint8 `binapi:"u8,name=is_del" json:"is_del,omitempty"` + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"` + TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` + MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` +} + +func (m *SrSteeringAddDel) Reset() { *m = SrSteeringAddDel{} } +func (*SrSteeringAddDel) GetMessageName() string { return "sr_steering_add_del" } +func (*SrSteeringAddDel) GetCrcString() string { return "28b5dcab" } +func (*SrSteeringAddDel) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSteeringAddDel) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.IsDel + size += 1 + // field[1] m.BsidAddr + size += 16 + // field[1] m.SrPolicyIndex + size += 4 + // field[1] m.TableID + size += 4 + // field[1] m.PrefixAddr + size += 16 + // field[1] m.MaskWidth + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.TrafficType + size += 1 + return size +} +func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.IsDel + buf[pos] = uint8(m.IsDel) + pos += 1 + // field[1] m.BsidAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.BsidAddr) { + x = uint8(m.BsidAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.SrPolicyIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SrPolicyIndex)) + pos += 4 + // field[1] m.TableID + o.PutUint32(buf[pos:pos+4], uint32(m.TableID)) + pos += 4 + // field[1] m.PrefixAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.PrefixAddr) { + x = uint8(m.PrefixAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.MaskWidth + o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.TrafficType + buf[pos] = uint8(m.TrafficType) + pos += 1 + return buf, nil +} +func (m *SrSteeringAddDel) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.IsDel + m.IsDel = uint8(tmp[pos]) + pos += 1 + // field[1] m.BsidAddr + m.BsidAddr = make([]uint8, 16) + for i := 0; i < len(m.BsidAddr); i++ { + m.BsidAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.SrPolicyIndex + m.SrPolicyIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TableID + m.TableID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PrefixAddr + m.PrefixAddr = make([]uint8, 16) + for i := 0; i < len(m.PrefixAddr); i++ { + m.PrefixAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.MaskWidth + m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.TrafficType + m.TrafficType = uint8(tmp[pos]) + pos += 1 + return nil +} + +// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. +type SrSteeringAddDelReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` +} + +func (m *SrSteeringAddDelReply) Reset() { *m = SrSteeringAddDelReply{} } +func (*SrSteeringAddDelReply) GetMessageName() string { return "sr_steering_add_del_reply" } +func (*SrSteeringAddDelReply) GetCrcString() string { return "e8d4e804" } +func (*SrSteeringAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSteeringAddDelReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + return size +} +func (m *SrSteeringAddDelReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + return buf, nil +} +func (m *SrSteeringAddDelReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + +// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. +type SrSteeringPolDetails struct { + TrafficType uint8 `binapi:"u8,name=traffic_type" json:"traffic_type,omitempty"` + FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty" struc:"[16]byte"` + MaskWidth uint32 `binapi:"u32,name=mask_width" json:"mask_width,omitempty"` + SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + Bsid Srv6Sid `binapi:"srv6_sid,name=bsid" json:"bsid,omitempty"` +} + +func (m *SrSteeringPolDetails) Reset() { *m = SrSteeringPolDetails{} } +func (*SrSteeringPolDetails) GetMessageName() string { return "sr_steering_pol_details" } +func (*SrSteeringPolDetails) GetCrcString() string { return "5627d483" } +func (*SrSteeringPolDetails) GetMessageType() api.MessageType { return api.ReplyMessage } + +func (m *SrSteeringPolDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.TrafficType + size += 1 + // field[1] m.FibTable + size += 4 + // field[1] m.PrefixAddr + size += 16 + // field[1] m.MaskWidth + size += 4 + // field[1] m.SwIfIndex + size += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + size += 16 + return size +} +func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.TrafficType + buf[pos] = uint8(m.TrafficType) + pos += 1 + // field[1] m.FibTable + o.PutUint32(buf[pos:pos+4], uint32(m.FibTable)) + pos += 4 + // field[1] m.PrefixAddr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.PrefixAddr) { + x = uint8(m.PrefixAddr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.MaskWidth + o.PutUint32(buf[pos:pos+4], uint32(m.MaskWidth)) + pos += 4 + // field[1] m.SwIfIndex + o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) + pos += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + for i := 0; i < 16; i++ { + var x uint8 + if i < len(m.Bsid.Addr) { + x = uint8(m.Bsid.Addr[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *SrSteeringPolDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.TrafficType + m.TrafficType = uint8(tmp[pos]) + pos += 1 + // field[1] m.FibTable + m.FibTable = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.PrefixAddr + m.PrefixAddr = make([]uint8, 16) + for i := 0; i < len(m.PrefixAddr); i++ { + m.PrefixAddr[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.MaskWidth + m.MaskWidth = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.SwIfIndex + m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Bsid + // field[2] m.Bsid.Addr + m.Bsid.Addr = make([]uint8, 16) + for i := 0; i < len(m.Bsid.Addr); i++ { + m.Bsid.Addr[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + +// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. +type SrSteeringPolDump struct{} + +func (m *SrSteeringPolDump) Reset() { *m = SrSteeringPolDump{} } +func (*SrSteeringPolDump) GetMessageName() string { return "sr_steering_pol_dump" } +func (*SrSteeringPolDump) GetCrcString() string { return "51077d14" } +func (*SrSteeringPolDump) GetMessageType() api.MessageType { return api.RequestMessage } + +func (m *SrSteeringPolDump) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *SrSteeringPolDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *SrSteeringPolDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + +func init() { file_sr_binapi_init() } +func file_sr_binapi_init() { + api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr.SrLocalsidAddDel") + api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr.SrLocalsidAddDelReply") + api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr.SrLocalsidsDetails") + api.RegisterMessage((*SrLocalsidsDump)(nil), "sr.SrLocalsidsDump") + api.RegisterMessage((*SrPoliciesDetails)(nil), "sr.SrPoliciesDetails") + api.RegisterMessage((*SrPoliciesDump)(nil), "sr.SrPoliciesDump") + api.RegisterMessage((*SrPolicyAdd)(nil), "sr.SrPolicyAdd") + api.RegisterMessage((*SrPolicyAddReply)(nil), "sr.SrPolicyAddReply") + api.RegisterMessage((*SrPolicyDel)(nil), "sr.SrPolicyDel") + api.RegisterMessage((*SrPolicyDelReply)(nil), "sr.SrPolicyDelReply") + api.RegisterMessage((*SrPolicyMod)(nil), "sr.SrPolicyMod") + api.RegisterMessage((*SrPolicyModReply)(nil), "sr.SrPolicyModReply") + api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr.SrSetEncapHopLimit") + api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr.SrSetEncapHopLimitReply") + api.RegisterMessage((*SrSetEncapSource)(nil), "sr.SrSetEncapSource") + api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr.SrSetEncapSourceReply") + api.RegisterMessage((*SrSteeringAddDel)(nil), "sr.SrSteeringAddDel") + api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr.SrSteeringAddDelReply") + api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr.SrSteeringPolDetails") + api.RegisterMessage((*SrSteeringPolDump)(nil), "sr.SrSteeringPolDump") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*SrLocalsidAddDel)(nil), + (*SrLocalsidAddDelReply)(nil), + (*SrLocalsidsDetails)(nil), + (*SrLocalsidsDump)(nil), + (*SrPoliciesDetails)(nil), + (*SrPoliciesDump)(nil), + (*SrPolicyAdd)(nil), + (*SrPolicyAddReply)(nil), + (*SrPolicyDel)(nil), + (*SrPolicyDelReply)(nil), + (*SrPolicyMod)(nil), + (*SrPolicyModReply)(nil), + (*SrSetEncapHopLimit)(nil), + (*SrSetEncapHopLimitReply)(nil), + (*SrSetEncapSource)(nil), + (*SrSetEncapSourceReply)(nil), + (*SrSteeringAddDel)(nil), + (*SrSteeringAddDelReply)(nil), + (*SrSteeringPolDetails)(nil), + (*SrSteeringPolDump)(nil), + } +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = codec.DecodeString +var _ = bytes.NewBuffer +var _ = context.Background +var _ = io.Copy +var _ = strconv.Itoa +var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/sr/sr_rpc.ba.go b/examples/binapi/sr/sr_rpc.ba.go new file mode 100644 index 0000000..aeb3cde --- /dev/null +++ b/examples/binapi/sr/sr_rpc.ba.go @@ -0,0 +1,178 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package sr + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for sr module. +type RPCService interface { + DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) + DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) + DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) + SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) + SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) + SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) + SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) + SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) + SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) + SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpSrLocalsids(ctx context.Context, in *SrLocalsidsDump) (RPCService_DumpSrLocalsidsClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrLocalsidsClient{stream} + return x, nil +} + +type RPCService_DumpSrLocalsidsClient interface { + Recv() (*SrLocalsidsDetails, error) +} + +type serviceClient_DumpSrLocalsidsClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrLocalsidsClient) Recv() (*SrLocalsidsDetails, error) { + m := new(SrLocalsidsDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrPolicies(ctx context.Context, in *SrPoliciesDump) (RPCService_DumpSrPoliciesClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrPoliciesClient{stream} + return x, nil +} + +type RPCService_DumpSrPoliciesClient interface { + Recv() (*SrPoliciesDetails, error) +} + +type serviceClient_DumpSrPoliciesClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrPoliciesClient) Recv() (*SrPoliciesDetails, error) { + m := new(SrPoliciesDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) DumpSrSteeringPol(ctx context.Context, in *SrSteeringPolDump) (RPCService_DumpSrSteeringPolClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpSrSteeringPolClient{stream} + return x, nil +} + +type RPCService_DumpSrSteeringPolClient interface { + Recv() (*SrSteeringPolDetails, error) +} + +type serviceClient_DumpSrSteeringPolClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpSrSteeringPolClient) Recv() (*SrSteeringPolDetails, error) { + m := new(SrSteeringPolDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) SrLocalsidAddDel(ctx context.Context, in *SrLocalsidAddDel) (*SrLocalsidAddDelReply, error) { + out := new(SrLocalsidAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyAdd(ctx context.Context, in *SrPolicyAdd) (*SrPolicyAddReply, error) { + out := new(SrPolicyAddReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyDel(ctx context.Context, in *SrPolicyDel) (*SrPolicyDelReply, error) { + out := new(SrPolicyDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrPolicyMod(ctx context.Context, in *SrPolicyMod) (*SrPolicyModReply, error) { + out := new(SrPolicyModReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapHopLimit(ctx context.Context, in *SrSetEncapHopLimit) (*SrSetEncapHopLimitReply, error) { + out := new(SrSetEncapHopLimitReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSetEncapSource(ctx context.Context, in *SrSetEncapSource) (*SrSetEncapSourceReply, error) { + out := new(SrSetEncapSourceReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) SrSteeringAddDel(ctx context.Context, in *SrSteeringAddDel) (*SrSteeringAddDelReply, error) { + out := new(SrSteeringAddDelReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/examples/binapi/vpe/vpe.ba.go b/examples/binapi/vpe/vpe.ba.go index 48b6389..4c00c86 100644 --- a/examples/binapi/vpe/vpe.ba.go +++ b/examples/binapi/vpe/vpe.ba.go @@ -1,30 +1,39 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty +// VPP: 20.01-45~g7a071e370~b63 // source: /usr/share/vpp/api/core/vpe.api.json /* -Package vpe is a generated VPP binary API for 'vpe' module. +Package vpe contains generated code for VPP binary API defined by vpe.api (version 1.6.0). It consists of: - 1 enum 2 aliases - 2 types + 1 enum 26 messages - 13 services + 2 types */ package vpe import ( "bytes" "context" + "encoding/binary" "io" + "math" "strconv" api "git.fd.io/govpp.git/api" + codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" - - vpe_types "git.fd.io/govpp.git/examples/binapi/vpe_types" ) +// 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 // please upgrade the GoVPP api package + const ( // ModuleName is the name of this module. ModuleName = "vpe" @@ -34,31 +43,88 @@ const ( VersionCrc = 0xc6c0bcf6 ) -type LogLevel = vpe_types.LogLevel +// LogLevel represents VPP binary API enum 'log_level'. +type LogLevel uint32 + +const ( + VPE_API_LOG_LEVEL_EMERG LogLevel = 0 + VPE_API_LOG_LEVEL_ALERT LogLevel = 1 + VPE_API_LOG_LEVEL_CRIT LogLevel = 2 + VPE_API_LOG_LEVEL_ERR LogLevel = 3 + VPE_API_LOG_LEVEL_WARNING LogLevel = 4 + VPE_API_LOG_LEVEL_NOTICE LogLevel = 5 + VPE_API_LOG_LEVEL_INFO LogLevel = 6 + VPE_API_LOG_LEVEL_DEBUG LogLevel = 7 + VPE_API_LOG_LEVEL_DISABLED LogLevel = 8 +) + +var ( + LogLevel_name = map[uint32]string{ + 0: "VPE_API_LOG_LEVEL_EMERG", + 1: "VPE_API_LOG_LEVEL_ALERT", + 2: "VPE_API_LOG_LEVEL_CRIT", + 3: "VPE_API_LOG_LEVEL_ERR", + 4: "VPE_API_LOG_LEVEL_WARNING", + 5: "VPE_API_LOG_LEVEL_NOTICE", + 6: "VPE_API_LOG_LEVEL_INFO", + 7: "VPE_API_LOG_LEVEL_DEBUG", + 8: "VPE_API_LOG_LEVEL_DISABLED", + } + LogLevel_value = map[string]uint32{ + "VPE_API_LOG_LEVEL_EMERG": 0, + "VPE_API_LOG_LEVEL_ALERT": 1, + "VPE_API_LOG_LEVEL_CRIT": 2, + "VPE_API_LOG_LEVEL_ERR": 3, + "VPE_API_LOG_LEVEL_WARNING": 4, + "VPE_API_LOG_LEVEL_NOTICE": 5, + "VPE_API_LOG_LEVEL_INFO": 6, + "VPE_API_LOG_LEVEL_DEBUG": 7, + "VPE_API_LOG_LEVEL_DISABLED": 8, + } +) + +func (x LogLevel) String() string { + s, ok := LogLevel_name[uint32(x)] + if ok { + return s + } + return "LogLevel(" + strconv.Itoa(int(x)) + ")" +} -type Timedelta = vpe_types.Timedelta +// Timedelta represents VPP binary API alias 'timedelta'. +type Timedelta float64 -type Timestamp = vpe_types.Timestamp +// Timestamp represents VPP binary API alias 'timestamp'. +type Timestamp float64 // ThreadData represents VPP binary API type 'thread_data'. type ThreadData struct { - ID uint32 - Name []byte `struc:"[64]byte"` - Type []byte `struc:"[64]byte"` - PID uint32 - CPUID uint32 - Core uint32 - CPUSocket uint32 + ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` + Name []byte `binapi:"u8[64],name=name" json:"name,omitempty" struc:"[64]byte"` + Type []byte `binapi:"u8[64],name=type" json:"type,omitempty" struc:"[64]byte"` + PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"` + CPUID uint32 `binapi:"u32,name=cpu_id" json:"cpu_id,omitempty"` + Core uint32 `binapi:"u32,name=core" json:"core,omitempty"` + CPUSocket uint32 `binapi:"u32,name=cpu_socket" json:"cpu_socket,omitempty"` } func (*ThreadData) GetTypeName() string { return "thread_data" } -type Version = vpe_types.Version +// Version represents VPP binary API type 'version'. +type Version struct { + Major uint32 `binapi:"u32,name=major" json:"major,omitempty"` + Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"` + Patch uint32 `binapi:"u32,name=patch" json:"patch,omitempty"` + PreRelease []byte `binapi:"u8[17],name=pre_release" json:"pre_release,omitempty" struc:"[17]byte"` + BuildMetadata []byte `binapi:"u8[17],name=build_metadata" json:"build_metadata,omitempty" struc:"[17]byte"` +} + +func (*Version) GetTypeName() string { return "version" } // AddNodeNext represents VPP binary API message 'add_node_next'. type AddNodeNext struct { - NodeName []byte `struc:"[64]byte"` - NextName []byte `struc:"[64]byte"` + NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` + NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` } func (m *AddNodeNext) Reset() { *m = AddNodeNext{} } @@ -66,10 +132,72 @@ func (*AddNodeNext) GetMessageName() string { return "add_node_next" } func (*AddNodeNext) GetCrcString() string { return "9ab92f7a" } func (*AddNodeNext) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *AddNodeNext) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.NodeName + size += 64 + // field[1] m.NextName + size += 64 + return size +} +func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.NodeName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NodeName) { + x = uint8(m.NodeName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NextName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NextName) { + x = uint8(m.NextName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *AddNodeNext) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.NodeName + m.NodeName = make([]uint8, 64) + for i := 0; i < len(m.NodeName); i++ { + m.NodeName[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NextName + m.NextName = make([]uint8, 64) + for i := 0; i < len(m.NextName); i++ { + m.NextName[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + // AddNodeNextReply represents VPP binary API message 'add_node_next_reply'. type AddNodeNextReply struct { - Retval int32 - NextIndex uint32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` } func (m *AddNodeNextReply) Reset() { *m = AddNodeNextReply{} } @@ -77,9 +205,53 @@ func (*AddNodeNextReply) GetMessageName() string { return "add_node_nex func (*AddNodeNextReply) GetCrcString() string { return "2ed75f32" } func (*AddNodeNextReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *AddNodeNextReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.NextIndex + size += 4 + return size +} +func (m *AddNodeNextReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.NextIndex + o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) + pos += 4 + return buf, nil +} +func (m *AddNodeNextReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NextIndex + m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // Cli represents VPP binary API message 'cli'. type Cli struct { - CmdInShmem uint64 + CmdInShmem uint64 `binapi:"u64,name=cmd_in_shmem" json:"cmd_in_shmem,omitempty"` } func (m *Cli) Reset() { *m = Cli{} } @@ -87,10 +259,46 @@ func (*Cli) GetMessageName() string { return "cli" } func (*Cli) GetCrcString() string { return "23bfbfff" } func (*Cli) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *Cli) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.CmdInShmem + size += 8 + return size +} +func (m *Cli) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.CmdInShmem + o.PutUint64(buf[pos:pos+8], uint64(m.CmdInShmem)) + pos += 8 + return buf, nil +} +func (m *Cli) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.CmdInShmem + m.CmdInShmem = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + // CliInband represents VPP binary API message 'cli_inband'. type CliInband struct { XXX_CmdLen uint32 `struc:"sizeof=Cmd"` - Cmd string + Cmd string `json:"cmd,omitempty"` } func (m *CliInband) Reset() { *m = CliInband{} } @@ -98,11 +306,53 @@ func (*CliInband) GetMessageName() string { return "cli_inband" } func (*CliInband) GetCrcString() string { return "f8377302" } func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *CliInband) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Cmd + size += 4 + len(m.Cmd) + return size +} +func (m *CliInband) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Cmd + o.PutUint32(buf[pos:pos+4], uint32(len(m.Cmd))) + pos += 4 + copy(buf[pos:pos+len(m.Cmd)], m.Cmd[:]) + pos += len(m.Cmd) + return buf, nil +} +func (m *CliInband) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Cmd + { + siz := o.Uint32(tmp[pos : pos+4]) + pos += 4 + m.Cmd = codec.DecodeString(tmp[pos : pos+int(siz)]) + pos += len(m.Cmd) + } + return nil +} + // CliInbandReply represents VPP binary API message 'cli_inband_reply'. type CliInbandReply struct { - Retval int32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` XXX_ReplyLen uint32 `struc:"sizeof=Reply"` - Reply string + Reply string `json:"reply,omitempty"` } func (m *CliInbandReply) Reset() { *m = CliInbandReply{} } @@ -110,10 +360,60 @@ func (*CliInbandReply) GetMessageName() string { return "cli_inband_rep func (*CliInbandReply) GetCrcString() string { return "05879051" } func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *CliInbandReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Reply + size += 4 + len(m.Reply) + return size +} +func (m *CliInbandReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Reply + o.PutUint32(buf[pos:pos+4], uint32(len(m.Reply))) + pos += 4 + copy(buf[pos:pos+len(m.Reply)], m.Reply[:]) + pos += len(m.Reply) + return buf, nil +} +func (m *CliInbandReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Reply + { + siz := o.Uint32(tmp[pos : pos+4]) + pos += 4 + m.Reply = codec.DecodeString(tmp[pos : pos+int(siz)]) + pos += len(m.Reply) + } + return nil +} + // CliReply represents VPP binary API message 'cli_reply'. type CliReply struct { - Retval int32 - ReplyInShmem uint64 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` } func (m *CliReply) Reset() { *m = CliReply{} } @@ -121,6 +421,50 @@ func (*CliReply) GetMessageName() string { return "cli_reply" } func (*CliReply) GetCrcString() string { return "06d68297" } func (*CliReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *CliReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ReplyInShmem + size += 8 + return size +} +func (m *CliReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ReplyInShmem + o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) + pos += 8 + return buf, nil +} +func (m *CliReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ReplyInShmem + m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + // ControlPing represents VPP binary API message 'control_ping'. type ControlPing struct{} @@ -129,11 +473,39 @@ func (*ControlPing) GetMessageName() string { return "control_ping" } func (*ControlPing) GetCrcString() string { return "51077d14" } func (*ControlPing) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *ControlPing) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ControlPing) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ControlPing) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // ControlPingReply represents VPP binary API message 'control_ping_reply'. type ControlPingReply struct { - Retval int32 - ClientIndex uint32 - VpePID uint32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ClientIndex uint32 `binapi:"u32,name=client_index" json:"client_index,omitempty"` + VpePID uint32 `binapi:"u32,name=vpe_pid" json:"vpe_pid,omitempty"` } func (m *ControlPingReply) Reset() { *m = ControlPingReply{} } @@ -141,9 +513,61 @@ func (*ControlPingReply) GetMessageName() string { return "control_ping func (*ControlPingReply) GetCrcString() string { return "f6b0b8ca" } func (*ControlPingReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *ControlPingReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ClientIndex + size += 4 + // field[1] m.VpePID + size += 4 + return size +} +func (m *ControlPingReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ClientIndex + o.PutUint32(buf[pos:pos+4], uint32(m.ClientIndex)) + pos += 4 + // field[1] m.VpePID + o.PutUint32(buf[pos:pos+4], uint32(m.VpePID)) + pos += 4 + return buf, nil +} +func (m *ControlPingReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ClientIndex + m.ClientIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VpePID + m.VpePID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // GetF64EndianValue represents VPP binary API message 'get_f64_endian_value'. type GetF64EndianValue struct { - F64One float64 + F64One float64 `binapi:"f64,name=f64_one,default=1" json:"f64_one,omitempty"` } func (m *GetF64EndianValue) Reset() { *m = GetF64EndianValue{} } @@ -151,10 +575,46 @@ func (*GetF64EndianValue) GetMessageName() string { return "get_f64_end func (*GetF64EndianValue) GetCrcString() string { return "809fcd44" } func (*GetF64EndianValue) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *GetF64EndianValue) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.F64One + size += 8 + return size +} +func (m *GetF64EndianValue) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.F64One + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64One))) + pos += 8 + return buf, nil +} +func (m *GetF64EndianValue) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.F64One + m.F64One = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + // GetF64EndianValueReply represents VPP binary API message 'get_f64_endian_value_reply'. type GetF64EndianValueReply struct { - Retval uint32 - F64OneResult float64 + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64OneResult float64 `binapi:"f64,name=f64_one_result" json:"f64_one_result,omitempty"` } func (m *GetF64EndianValueReply) Reset() { *m = GetF64EndianValueReply{} } @@ -162,9 +622,53 @@ func (*GetF64EndianValueReply) GetMessageName() string { return "get_f6 func (*GetF64EndianValueReply) GetCrcString() string { return "7e02e404" } func (*GetF64EndianValueReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *GetF64EndianValueReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.F64OneResult + size += 8 + return size +} +func (m *GetF64EndianValueReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.F64OneResult + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64OneResult))) + pos += 8 + return buf, nil +} +func (m *GetF64EndianValueReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.F64OneResult + m.F64OneResult = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + // GetF64IncrementByOne represents VPP binary API message 'get_f64_increment_by_one'. type GetF64IncrementByOne struct { - F64Value float64 + F64Value float64 `binapi:"f64,name=f64_value,default=1" json:"f64_value,omitempty"` } func (m *GetF64IncrementByOne) Reset() { *m = GetF64IncrementByOne{} } @@ -172,10 +676,46 @@ func (*GetF64IncrementByOne) GetMessageName() string { return "get_f64_ func (*GetF64IncrementByOne) GetCrcString() string { return "b64f027e" } func (*GetF64IncrementByOne) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *GetF64IncrementByOne) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.F64Value + size += 8 + return size +} +func (m *GetF64IncrementByOne) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.F64Value + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) + pos += 8 + return buf, nil +} +func (m *GetF64IncrementByOne) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.F64Value + m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + // GetF64IncrementByOneReply represents VPP binary API message 'get_f64_increment_by_one_reply'. type GetF64IncrementByOneReply struct { - Retval uint32 - F64Value float64 + Retval uint32 `binapi:"u32,name=retval" json:"retval,omitempty"` + F64Value float64 `binapi:"f64,name=f64_value" json:"f64_value,omitempty"` } func (m *GetF64IncrementByOneReply) Reset() { *m = GetF64IncrementByOneReply{} } @@ -183,10 +723,54 @@ func (*GetF64IncrementByOneReply) GetMessageName() string { return "get func (*GetF64IncrementByOneReply) GetCrcString() string { return "d25dbaa3" } func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *GetF64IncrementByOneReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.F64Value + size += 8 + return size +} +func (m *GetF64IncrementByOneReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.F64Value + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.F64Value))) + pos += 8 + return buf, nil +} +func (m *GetF64IncrementByOneReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.F64Value + m.F64Value = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + // GetNextIndex represents VPP binary API message 'get_next_index'. type GetNextIndex struct { - NodeName []byte `struc:"[64]byte"` - NextName []byte `struc:"[64]byte"` + NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` + NextName []byte `binapi:"u8[64],name=next_name" json:"next_name,omitempty" struc:"[64]byte"` } func (m *GetNextIndex) Reset() { *m = GetNextIndex{} } @@ -194,10 +778,72 @@ func (*GetNextIndex) GetMessageName() string { return "get_next_index" func (*GetNextIndex) GetCrcString() string { return "9ab92f7a" } func (*GetNextIndex) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *GetNextIndex) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.NodeName + size += 64 + // field[1] m.NextName + size += 64 + return size +} +func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.NodeName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NodeName) { + x = uint8(m.NodeName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[1] m.NextName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NextName) { + x = uint8(m.NextName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *GetNextIndex) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.NodeName + m.NodeName = make([]uint8, 64) + for i := 0; i < len(m.NodeName); i++ { + m.NodeName[i] = uint8(tmp[pos]) + pos += 1 + } + // field[1] m.NextName + m.NextName = make([]uint8, 64) + for i := 0; i < len(m.NextName); i++ { + m.NextName[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + // GetNextIndexReply represents VPP binary API message 'get_next_index_reply'. type GetNextIndexReply struct { - Retval int32 - NextIndex uint32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NextIndex uint32 `binapi:"u32,name=next_index" json:"next_index,omitempty"` } func (m *GetNextIndexReply) Reset() { *m = GetNextIndexReply{} } @@ -205,6 +851,50 @@ func (*GetNextIndexReply) GetMessageName() string { return "get_next_in func (*GetNextIndexReply) GetCrcString() string { return "2ed75f32" } func (*GetNextIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *GetNextIndexReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.NextIndex + size += 4 + return size +} +func (m *GetNextIndexReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.NextIndex + o.PutUint32(buf[pos:pos+4], uint32(m.NextIndex)) + pos += 4 + return buf, nil +} +func (m *GetNextIndexReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NextIndex + m.NextIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // GetNodeGraph represents VPP binary API message 'get_node_graph'. type GetNodeGraph struct{} @@ -213,10 +903,38 @@ func (*GetNodeGraph) GetMessageName() string { return "get_node_graph" func (*GetNodeGraph) GetCrcString() string { return "51077d14" } func (*GetNodeGraph) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *GetNodeGraph) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *GetNodeGraph) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *GetNodeGraph) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // GetNodeGraphReply represents VPP binary API message 'get_node_graph_reply'. type GetNodeGraphReply struct { - Retval int32 - ReplyInShmem uint64 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + ReplyInShmem uint64 `binapi:"u64,name=reply_in_shmem" json:"reply_in_shmem,omitempty"` } func (m *GetNodeGraphReply) Reset() { *m = GetNodeGraphReply{} } @@ -224,9 +942,53 @@ func (*GetNodeGraphReply) GetMessageName() string { return "get_node_gr func (*GetNodeGraphReply) GetCrcString() string { return "06d68297" } func (*GetNodeGraphReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *GetNodeGraphReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.ReplyInShmem + size += 8 + return size +} +func (m *GetNodeGraphReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.ReplyInShmem + o.PutUint64(buf[pos:pos+8], uint64(m.ReplyInShmem)) + pos += 8 + return buf, nil +} +func (m *GetNodeGraphReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ReplyInShmem + m.ReplyInShmem = uint64(o.Uint64(tmp[pos : pos+8])) + pos += 8 + return nil +} + // GetNodeIndex represents VPP binary API message 'get_node_index'. type GetNodeIndex struct { - NodeName []byte `struc:"[64]byte"` + NodeName []byte `binapi:"u8[64],name=node_name" json:"node_name,omitempty" struc:"[64]byte"` } func (m *GetNodeIndex) Reset() { *m = GetNodeIndex{} } @@ -234,10 +996,55 @@ func (*GetNodeIndex) GetMessageName() string { return "get_node_index" func (*GetNodeIndex) GetCrcString() string { return "6c9a495d" } func (*GetNodeIndex) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *GetNodeIndex) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.NodeName + size += 64 + return size +} +func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.NodeName + for i := 0; i < 64; i++ { + var x uint8 + if i < len(m.NodeName) { + x = uint8(m.NodeName[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + return buf, nil +} +func (m *GetNodeIndex) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.NodeName + m.NodeName = make([]uint8, 64) + for i := 0; i < len(m.NodeName); i++ { + m.NodeName[i] = uint8(tmp[pos]) + pos += 1 + } + return nil +} + // GetNodeIndexReply represents VPP binary API message 'get_node_index_reply'. type GetNodeIndexReply struct { - Retval int32 - NodeIndex uint32 + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + NodeIndex uint32 `binapi:"u32,name=node_index" json:"node_index,omitempty"` } func (m *GetNodeIndexReply) Reset() { *m = GetNodeIndexReply{} } @@ -245,12 +1052,56 @@ func (*GetNodeIndexReply) GetMessageName() string { return "get_node_in func (*GetNodeIndexReply) GetCrcString() string { return "a8600b89" } func (*GetNodeIndexReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *GetNodeIndexReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.NodeIndex + size += 4 + return size +} +func (m *GetNodeIndexReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.NodeIndex + o.PutUint32(buf[pos:pos+4], uint32(m.NodeIndex)) + pos += 4 + return buf, nil +} +func (m *GetNodeIndexReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.NodeIndex + m.NodeIndex = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + return nil +} + // LogDetails represents VPP binary API message 'log_details'. type LogDetails struct { - Timestamp Timestamp - Level LogLevel - MsgClass string `struc:"[32]byte"` - Message string `struc:"[256]byte"` + Timestamp Timestamp `binapi:"timestamp,name=timestamp" json:"timestamp,omitempty"` + Level LogLevel `binapi:"log_level,name=level" json:"level,omitempty"` + MsgClass string `binapi:"string[32],name=msg_class" json:"msg_class,omitempty" struc:"[32]byte"` + Message string `binapi:"string[256],name=message" json:"message,omitempty" struc:"[256]byte"` } func (m *LogDetails) Reset() { *m = LogDetails{} } @@ -258,9 +1109,75 @@ func (*LogDetails) GetMessageName() string { return "log_details" } func (*LogDetails) GetCrcString() string { return "255827a1" } func (*LogDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *LogDetails) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Timestamp + size += 8 + // field[1] m.Level + size += 4 + // field[1] m.MsgClass + size += 32 + // field[1] m.Message + size += 256 + return size +} +func (m *LogDetails) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Timestamp + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.Timestamp))) + pos += 8 + // field[1] m.Level + o.PutUint32(buf[pos:pos+4], uint32(m.Level)) + pos += 4 + // field[1] m.MsgClass + copy(buf[pos:pos+32], m.MsgClass) + pos += 32 + // field[1] m.Message + copy(buf[pos:pos+256], m.Message) + pos += 256 + return buf, nil +} +func (m *LogDetails) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Timestamp + m.Timestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + // field[1] m.Level + m.Level = LogLevel(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.MsgClass + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.MsgClass = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.Message + { + nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) + m.Message = codec.DecodeString(tmp[pos : pos+nul]) + pos += 256 + } + return nil +} + // LogDump represents VPP binary API message 'log_dump'. type LogDump struct { - StartTimestamp Timestamp + StartTimestamp Timestamp `binapi:"timestamp,name=start_timestamp" json:"start_timestamp,omitempty"` } func (m *LogDump) Reset() { *m = LogDump{} } @@ -268,6 +1185,42 @@ func (*LogDump) GetMessageName() string { return "log_dump" } func (*LogDump) GetCrcString() string { return "6ab31753" } func (*LogDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *LogDump) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.StartTimestamp + size += 8 + return size +} +func (m *LogDump) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.StartTimestamp + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.StartTimestamp))) + pos += 8 + return buf, nil +} +func (m *LogDump) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.StartTimestamp + m.StartTimestamp = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + // ShowThreads represents VPP binary API message 'show_threads'. type ShowThreads struct{} @@ -276,11 +1229,39 @@ func (*ShowThreads) GetMessageName() string { return "show_threads" } func (*ShowThreads) GetCrcString() string { return "51077d14" } func (*ShowThreads) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *ShowThreads) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowThreads) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ShowThreads) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // ShowThreadsReply represents VPP binary API message 'show_threads_reply'. type ShowThreadsReply struct { - Retval int32 - Count uint32 `struc:"sizeof=ThreadData"` - ThreadData []ThreadData + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=ThreadData"` + ThreadData []ThreadData `binapi:"thread_data[count],name=thread_data" json:"thread_data,omitempty"` } func (m *ShowThreadsReply) Reset() { *m = ShowThreadsReply{} } @@ -288,6 +1269,143 @@ func (*ShowThreadsReply) GetMessageName() string { return "show_threads func (*ShowThreadsReply) GetCrcString() string { return "f5e0b66f" } func (*ShowThreadsReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *ShowThreadsReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Count + size += 4 + // field[1] m.ThreadData + for j1 := 0; j1 < len(m.ThreadData); j1++ { + var s1 ThreadData + _ = s1 + if j1 < len(m.ThreadData) { + s1 = m.ThreadData[j1] + } + // field[2] s1.ID + size += 4 + // field[2] s1.Name + size += 64 + // field[2] s1.Type + size += 64 + // field[2] s1.PID + size += 4 + // field[2] s1.CPUID + size += 4 + // field[2] s1.Core + size += 4 + // field[2] s1.CPUSocket + size += 4 + } + return size +} +func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Count + o.PutUint32(buf[pos:pos+4], uint32(len(m.ThreadData))) + pos += 4 + // field[1] m.ThreadData + for j1 := 0; j1 < len(m.ThreadData); j1++ { + var v1 ThreadData + if j1 < len(m.ThreadData) { + v1 = m.ThreadData[j1] + } + // field[2] v1.ID + o.PutUint32(buf[pos:pos+4], uint32(v1.ID)) + pos += 4 + // field[2] v1.Name + for i := 0; i < 64; i++ { + var x uint8 + if i < len(v1.Name) { + x = uint8(v1.Name[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.Type + for i := 0; i < 64; i++ { + var x uint8 + if i < len(v1.Type) { + x = uint8(v1.Type[i]) + } + buf[pos] = uint8(x) + pos += 1 + } + // field[2] v1.PID + o.PutUint32(buf[pos:pos+4], uint32(v1.PID)) + pos += 4 + // field[2] v1.CPUID + o.PutUint32(buf[pos:pos+4], uint32(v1.CPUID)) + pos += 4 + // field[2] v1.Core + o.PutUint32(buf[pos:pos+4], uint32(v1.Core)) + pos += 4 + // field[2] v1.CPUSocket + o.PutUint32(buf[pos:pos+4], uint32(v1.CPUSocket)) + pos += 4 + } + return buf, nil +} +func (m *ShowThreadsReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Count + m.Count = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.ThreadData + m.ThreadData = make([]ThreadData, int(m.Count)) + for j1 := 0; j1 < int(m.Count); j1++ { + // field[2] m.ThreadData[j1].ID + m.ThreadData[j1].ID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].Name + m.ThreadData[j1].Name = make([]uint8, 64) + for i := 0; i < len(m.ThreadData[j1].Name); i++ { + m.ThreadData[j1].Name[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.ThreadData[j1].Type + m.ThreadData[j1].Type = make([]uint8, 64) + for i := 0; i < len(m.ThreadData[j1].Type); i++ { + m.ThreadData[j1].Type[i] = uint8(tmp[pos]) + pos += 1 + } + // field[2] m.ThreadData[j1].PID + m.ThreadData[j1].PID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].CPUID + m.ThreadData[j1].CPUID = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].Core + m.ThreadData[j1].Core = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[2] m.ThreadData[j1].CPUSocket + m.ThreadData[j1].CPUSocket = uint32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + } + return nil +} + // ShowVersion represents VPP binary API message 'show_version'. type ShowVersion struct{} @@ -296,13 +1414,41 @@ func (*ShowVersion) GetMessageName() string { return "show_version" } func (*ShowVersion) GetCrcString() string { return "51077d14" } func (*ShowVersion) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *ShowVersion) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowVersion) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ShowVersion) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // ShowVersionReply represents VPP binary API message 'show_version_reply'. type ShowVersionReply struct { - Retval int32 - Program string `struc:"[32]byte"` - Version string `struc:"[32]byte"` - BuildDate string `struc:"[32]byte"` - BuildDirectory string `struc:"[256]byte"` + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + Program string `binapi:"string[32],name=program" json:"program,omitempty" struc:"[32]byte"` + Version string `binapi:"string[32],name=version" json:"version,omitempty" struc:"[32]byte"` + BuildDate string `binapi:"string[32],name=build_date" json:"build_date,omitempty" struc:"[32]byte"` + BuildDirectory string `binapi:"string[256],name=build_directory" json:"build_directory,omitempty" struc:"[256]byte"` } func (m *ShowVersionReply) Reset() { *m = ShowVersionReply{} } @@ -310,6 +1456,86 @@ func (*ShowVersionReply) GetMessageName() string { return "show_version func (*ShowVersionReply) GetCrcString() string { return "c919bde1" } func (*ShowVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *ShowVersionReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.Program + size += 32 + // field[1] m.Version + size += 32 + // field[1] m.BuildDate + size += 32 + // field[1] m.BuildDirectory + size += 256 + return size +} +func (m *ShowVersionReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.Program + copy(buf[pos:pos+32], m.Program) + pos += 32 + // field[1] m.Version + copy(buf[pos:pos+32], m.Version) + pos += 32 + // field[1] m.BuildDate + copy(buf[pos:pos+32], m.BuildDate) + pos += 32 + // field[1] m.BuildDirectory + copy(buf[pos:pos+256], m.BuildDirectory) + pos += 256 + return buf, nil +} +func (m *ShowVersionReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.Program + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.Program = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.Version + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.Version = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.BuildDate + { + nul := bytes.Index(tmp[pos:pos+32], []byte{0x00}) + m.BuildDate = codec.DecodeString(tmp[pos : pos+nul]) + pos += 32 + } + // field[1] m.BuildDirectory + { + nul := bytes.Index(tmp[pos:pos+256], []byte{0x00}) + m.BuildDirectory = codec.DecodeString(tmp[pos : pos+nul]) + pos += 256 + } + return nil +} + // ShowVpeSystemTime represents VPP binary API message 'show_vpe_system_time'. type ShowVpeSystemTime struct{} @@ -318,10 +1544,38 @@ func (*ShowVpeSystemTime) GetMessageName() string { return "show_vpe_sy func (*ShowVpeSystemTime) GetCrcString() string { return "51077d14" } func (*ShowVpeSystemTime) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *ShowVpeSystemTime) Size() int { + if m == nil { + return 0 + } + var size int + return size +} +func (m *ShowVpeSystemTime) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + return buf, nil +} +func (m *ShowVpeSystemTime) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + return nil +} + // ShowVpeSystemTimeReply represents VPP binary API message 'show_vpe_system_time_reply'. type ShowVpeSystemTimeReply struct { - Retval int32 - VpeSystemTime Timestamp + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + VpeSystemTime Timestamp `binapi:"timestamp,name=vpe_system_time" json:"vpe_system_time,omitempty"` } func (m *ShowVpeSystemTimeReply) Reset() { *m = ShowVpeSystemTimeReply{} } @@ -329,7 +1583,52 @@ func (*ShowVpeSystemTimeReply) GetMessageName() string { return "show_v func (*ShowVpeSystemTimeReply) GetCrcString() string { return "7ffd8193" } func (*ShowVpeSystemTimeReply) GetMessageType() api.MessageType { return api.ReplyMessage } -func init() { +func (m *ShowVpeSystemTimeReply) Size() int { + if m == nil { + return 0 + } + var size int + // field[1] m.Retval + size += 4 + // field[1] m.VpeSystemTime + size += 8 + return size +} +func (m *ShowVpeSystemTimeReply) Marshal(b []byte) ([]byte, error) { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + var buf []byte + if b == nil { + buf = make([]byte, m.Size()) + } else { + buf = b + } + // field[1] m.Retval + o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) + pos += 4 + // field[1] m.VpeSystemTime + o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(m.VpeSystemTime))) + pos += 8 + return buf, nil +} +func (m *ShowVpeSystemTimeReply) Unmarshal(tmp []byte) error { + o := binary.BigEndian + _ = o + pos := 0 + _ = pos + // field[1] m.Retval + m.Retval = int32(o.Uint32(tmp[pos : pos+4])) + pos += 4 + // field[1] m.VpeSystemTime + m.VpeSystemTime = Timestamp(math.Float64frombits(o.Uint64(tmp[pos : pos+8]))) + pos += 8 + return nil +} + +func init() { file_vpe_binapi_init() } +func file_vpe_binapi_init() { api.RegisterMessage((*AddNodeNext)(nil), "vpe.AddNodeNext") api.RegisterMessage((*AddNodeNextReply)(nil), "vpe.AddNodeNextReply") api.RegisterMessage((*Cli)(nil), "vpe.Cli") @@ -390,175 +1689,13 @@ func AllMessages() []api.Message { } } -// RPCService represents RPC service API for vpe module. -type RPCService interface { - DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) - AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) - Cli(ctx context.Context, in *Cli) (*CliReply, error) - CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) - ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) - GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) - GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) - GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) - GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) - GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) - ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) - ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) - ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) -} - -type serviceClient struct { - ch api.Channel -} - -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} -} - -func (c *serviceClient) DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpLogClient{stream} - return x, nil -} - -type RPCService_DumpLogClient interface { - Recv() (*LogDetails, error) -} - -type serviceClient_DumpLogClient struct { - api.MultiRequestCtx -} - -func (c *serviceClient_DumpLogClient) Recv() (*LogDetails, error) { - m := new(LogDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) - if err != nil { - return nil, err - } - if stop { - return nil, io.EOF - } - return m, nil -} - -func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { - out := new(AddNodeNextReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { - out := new(CliReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { - out := new(CliInbandReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { - out := new(ControlPingReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { - out := new(GetF64EndianValueReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { - out := new(GetF64IncrementByOneReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { - out := new(GetNextIndexReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { - out := new(GetNodeGraphReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { - out := new(GetNodeIndexReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { - out := new(ShowThreadsReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { - out := new(ShowVersionReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { - out := new(ShowVpeSystemTimeReply) - err := c.ch.SendRequest(in).ReceiveReply(out) - if err != nil { - return nil, err - } - return out, nil -} - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - // Reference imports to suppress errors if they are not otherwise used. var _ = api.RegisterMessage +var _ = codec.DecodeString var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa var _ = struc.Pack +var _ = binary.BigEndian +var _ = math.Float32bits diff --git a/examples/binapi/vpe/vpe_rpc.ba.go b/examples/binapi/vpe/vpe_rpc.ba.go new file mode 100644 index 0000000..e81fb91 --- /dev/null +++ b/examples/binapi/vpe/vpe_rpc.ba.go @@ -0,0 +1,174 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package vpe + +import ( + "context" + "io" + + api "git.fd.io/govpp.git/api" +) + +// RPCService represents RPC service API for vpe module. +type RPCService interface { + DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) + AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) + Cli(ctx context.Context, in *Cli) (*CliReply, error) + CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) + ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) + GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) + GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) + GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) + GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) + GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) + ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) + ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) + ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) +} + +type serviceClient struct { + ch api.Channel +} + +func NewServiceClient(ch api.Channel) RPCService { + return &serviceClient{ch} +} + +func (c *serviceClient) DumpLog(ctx context.Context, in *LogDump) (RPCService_DumpLogClient, error) { + stream := c.ch.SendMultiRequest(in) + x := &serviceClient_DumpLogClient{stream} + return x, nil +} + +type RPCService_DumpLogClient interface { + Recv() (*LogDetails, error) +} + +type serviceClient_DumpLogClient struct { + api.MultiRequestCtx +} + +func (c *serviceClient_DumpLogClient) Recv() (*LogDetails, error) { + m := new(LogDetails) + stop, err := c.MultiRequestCtx.ReceiveReply(m) + if err != nil { + return nil, err + } + if stop { + return nil, io.EOF + } + return m, nil +} + +func (c *serviceClient) AddNodeNext(ctx context.Context, in *AddNodeNext) (*AddNodeNextReply, error) { + out := new(AddNodeNextReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) Cli(ctx context.Context, in *Cli) (*CliReply, error) { + out := new(CliReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) CliInband(ctx context.Context, in *CliInband) (*CliInbandReply, error) { + out := new(CliInbandReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ControlPing(ctx context.Context, in *ControlPing) (*ControlPingReply, error) { + out := new(ControlPingReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64EndianValue(ctx context.Context, in *GetF64EndianValue) (*GetF64EndianValueReply, error) { + out := new(GetF64EndianValueReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetF64IncrementByOne(ctx context.Context, in *GetF64IncrementByOne) (*GetF64IncrementByOneReply, error) { + out := new(GetF64IncrementByOneReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNextIndex(ctx context.Context, in *GetNextIndex) (*GetNextIndexReply, error) { + out := new(GetNextIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeGraph(ctx context.Context, in *GetNodeGraph) (*GetNodeGraphReply, error) { + out := new(GetNodeGraphReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) GetNodeIndex(ctx context.Context, in *GetNodeIndex) (*GetNodeIndexReply, error) { + out := new(GetNodeIndexReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowThreads(ctx context.Context, in *ShowThreads) (*ShowThreadsReply, error) { + out := new(ShowThreadsReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVersion(ctx context.Context, in *ShowVersion) (*ShowVersionReply, error) { + out := new(ShowVersionReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serviceClient) ShowVpeSystemTime(ctx context.Context, in *ShowVpeSystemTime) (*ShowVpeSystemTimeReply, error) { + out := new(ShowVpeSystemTimeReply) + err := c.ch.SendRequest(in).ReceiveReply(out) + if err != nil { + return nil, err + } + return out, nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ = api.RegisterMessage +var _ = context.Background +var _ = io.Copy diff --git a/examples/binapi/vpe_types/vpe_types.ba.go b/examples/binapi/vpe_types/vpe_types.ba.go deleted file mode 100644 index dbe81e0..0000000 --- a/examples/binapi/vpe_types/vpe_types.ba.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. -// source: /usr/share/vpp/api/core/vpe_types.api.json - -/* -Package vpe_types is a generated VPP binary API for 'vpe_types' module. - -It consists of: - 1 enum - 2 aliases - 1 type -*/ -package vpe_types - -import ( - "bytes" - "context" - "io" - "strconv" - - api "git.fd.io/govpp.git/api" - struc "github.com/lunixbochs/struc" -) - -const ( - // ModuleName is the name of this module. - ModuleName = "vpe_types" - // VersionCrc is the CRC of this module. - VersionCrc = 0x3369988d -) - -// LogLevel represents VPP binary API enum 'log_level'. -type LogLevel uint32 - -const ( - VPE_API_LOG_LEVEL_EMERG LogLevel = 0 - VPE_API_LOG_LEVEL_ALERT LogLevel = 1 - VPE_API_LOG_LEVEL_CRIT LogLevel = 2 - VPE_API_LOG_LEVEL_ERR LogLevel = 3 - VPE_API_LOG_LEVEL_WARNING LogLevel = 4 - VPE_API_LOG_LEVEL_NOTICE LogLevel = 5 - VPE_API_LOG_LEVEL_INFO LogLevel = 6 - VPE_API_LOG_LEVEL_DEBUG LogLevel = 7 - VPE_API_LOG_LEVEL_DISABLED LogLevel = 8 -) - -var LogLevel_name = map[uint32]string{ - 0: "VPE_API_LOG_LEVEL_EMERG", - 1: "VPE_API_LOG_LEVEL_ALERT", - 2: "VPE_API_LOG_LEVEL_CRIT", - 3: "VPE_API_LOG_LEVEL_ERR", - 4: "VPE_API_LOG_LEVEL_WARNING", - 5: "VPE_API_LOG_LEVEL_NOTICE", - 6: "VPE_API_LOG_LEVEL_INFO", - 7: "VPE_API_LOG_LEVEL_DEBUG", - 8: "VPE_API_LOG_LEVEL_DISABLED", -} - -var LogLevel_value = map[string]uint32{ - "VPE_API_LOG_LEVEL_EMERG": 0, - "VPE_API_LOG_LEVEL_ALERT": 1, - "VPE_API_LOG_LEVEL_CRIT": 2, - "VPE_API_LOG_LEVEL_ERR": 3, - "VPE_API_LOG_LEVEL_WARNING": 4, - "VPE_API_LOG_LEVEL_NOTICE": 5, - "VPE_API_LOG_LEVEL_INFO": 6, - "VPE_API_LOG_LEVEL_DEBUG": 7, - "VPE_API_LOG_LEVEL_DISABLED": 8, -} - -func (x LogLevel) String() string { - s, ok := LogLevel_name[uint32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} - -// Timedelta represents VPP binary API alias 'timedelta'. -type Timedelta float64 - -// Timestamp represents VPP binary API alias 'timestamp'. -type Timestamp float64 - -// Version represents VPP binary API type 'version'. -type Version struct { - Major uint32 - Minor uint32 - Patch uint32 - PreRelease []byte `struc:"[17]byte"` - BuildMetadata []byte `struc:"[17]byte"` -} - -func (*Version) GetTypeName() string { return "version" } - -// 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.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack |