X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=internal%2Ftestbinapi%2Fbinapi2001%2Fsr%2Fsr.ba.go;h=1a13b5a64cb47286a58c99e0e67bf6a01c160300;hb=58da9ac6e691a8c660eb8ca838a154e11da0db68;hp=b0e423b0bb47853554feafd331a75356212842c3;hpb=a155cd438c6558da266c1c5931361ea088b35653;p=govpp.git diff --git a/internal/testbinapi/binapi2001/sr/sr.ba.go b/internal/testbinapi/binapi2001/sr/sr.ba.go index b0e423b..1a13b5a 100644 --- a/internal/testbinapi/binapi2001/sr/sr.ba.go +++ b/internal/testbinapi/binapi2001/sr/sr.ba.go @@ -1,70 +1,52 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: // binapi-generator: v0.4.0-dev -// 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 -*/ +// VPP: 20.01 +// source: .vppapi/core/sr.api.json + +// Package sr contains generated bindings for API file sr.api. +// +// Contents: +// 3 structs +// 20 messages +// 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 _ = api.GoVppAPIPackageIsVersion2 const ( - // ModuleName is the name of this module. - ModuleName = "sr" - // APIVersion is the API version of this module. + APIFile = "sr" APIVersion = "1.2.0" - // VersionCrc is the CRC of this module. VersionCrc = 0xbf277f96 ) -// SrIP6Address represents VPP binary API type 'sr_ip6_address'. +// SrIP6Address defines type 'sr_ip6_address'. type SrIP6Address struct { - Data []byte `binapi:"u8[16],name=data" json:"data,omitempty" struc:"[16]byte"` + Data []byte `binapi:"u8[16],name=data" json:"data,omitempty"` } -func (*SrIP6Address) GetTypeName() string { return "sr_ip6_address" } - -// Srv6Sid represents VPP binary API type 'srv6_sid'. +// Srv6Sid defines type 'srv6_sid'. type Srv6Sid struct { - Addr []byte `binapi:"u8[16],name=addr" json:"addr,omitempty" struc:"[16]byte"` + Addr []byte `binapi:"u8[16],name=addr" json:"addr,omitempty"` } -func (*Srv6Sid) GetTypeName() string { return "srv6_sid" } - -// Srv6SidList represents VPP binary API type 'srv6_sid_list'. +// Srv6SidList defines 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"` + Sids [16]Srv6Sid `binapi:"srv6_sid[16],name=sids" json:"sids,omitempty"` } -func (*Srv6SidList) GetTypeName() string { return "srv6_sid_list" } - -// SrLocalsidAddDel represents VPP binary API message 'sr_localsid_add_del'. +// SrLocalsidAddDel defines 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"` @@ -73,570 +55,302 @@ type SrLocalsidAddDel struct { 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"` + NhAddr6 []byte `binapi:"u8[16],name=nh_addr6" json:"nh_addr6,omitempty"` + NhAddr4 []byte `binapi:"u8[4],name=nh_addr4" json:"nh_addr4,omitempty"` } -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) 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 { +func (m *SrLocalsidAddDel) Size() (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 + size += 1 // m.IsDel + size += 1 * 16 // m.Localsid.Addr + size += 1 // m.EndPsp + size += 1 // m.Behavior + size += 4 // m.SwIfIndex + size += 4 // m.VlanIndex + size += 4 // m.FibTable + size += 1 * 16 // m.NhAddr6 + size += 1 * 4 // m.NhAddr4 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 - } + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.IsDel) + buf.EncodeBytes(m.Localsid.Addr, 16) + buf.EncodeUint8(m.EndPsp) + buf.EncodeUint8(m.Behavior) + buf.EncodeUint32(m.SwIfIndex) + buf.EncodeUint32(m.VlanIndex) + buf.EncodeUint32(m.FibTable) + buf.EncodeBytes(m.NhAddr6, 16) + buf.EncodeBytes(m.NhAddr4, 4) + return buf.Bytes(), nil +} +func (m *SrLocalsidAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsDel = buf.DecodeUint8() + m.Localsid.Addr = make([]byte, 16) + copy(m.Localsid.Addr, buf.DecodeBytes(len(m.Localsid.Addr))) + m.EndPsp = buf.DecodeUint8() + m.Behavior = buf.DecodeUint8() + m.SwIfIndex = buf.DecodeUint32() + m.VlanIndex = buf.DecodeUint32() + m.FibTable = buf.DecodeUint32() + m.NhAddr6 = make([]byte, 16) + copy(m.NhAddr6, buf.DecodeBytes(len(m.NhAddr6))) + m.NhAddr4 = make([]byte, 4) + copy(m.NhAddr4, buf.DecodeBytes(len(m.NhAddr4))) return nil } -// SrLocalsidAddDelReply represents VPP binary API message 'sr_localsid_add_del_reply'. +// SrLocalsidAddDelReply defines 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) 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 { +func (m *SrLocalsidAddDelReply) Size() (size int) { if m == nil { return 0 } - var size int - // field[1] m.Retval - size += 4 + size += 4 // m.Retval 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 + b = make([]byte, m.Size()) } - // 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 + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SrLocalsidAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() return nil } -// SrLocalsidsDetails represents VPP binary API message 'sr_localsids_details'. +// SrLocalsidsDetails defines 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"` + XconnectNhAddr6 []byte `binapi:"u8[16],name=xconnect_nh_addr6" json:"xconnect_nh_addr6,omitempty"` + XconnectNhAddr4 []byte `binapi:"u8[4],name=xconnect_nh_addr4" json:"xconnect_nh_addr4,omitempty"` 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) 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 { +func (m *SrLocalsidsDetails) Size() (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 + size += 1 * 16 // m.Addr.Addr + size += 1 // m.EndPsp + size += 2 // m.Behavior + size += 4 // m.FibTable + size += 4 // m.VlanIndex + size += 1 * 16 // m.XconnectNhAddr6 + size += 1 * 4 // m.XconnectNhAddr4 + size += 4 // m.XconnectIfaceOrVrfTable 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 + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Addr.Addr, 16) + buf.EncodeUint8(m.EndPsp) + buf.EncodeUint16(m.Behavior) + buf.EncodeUint32(m.FibTable) + buf.EncodeUint32(m.VlanIndex) + buf.EncodeBytes(m.XconnectNhAddr6, 16) + buf.EncodeBytes(m.XconnectNhAddr4, 4) + buf.EncodeUint32(m.XconnectIfaceOrVrfTable) + return buf.Bytes(), nil +} +func (m *SrLocalsidsDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Addr.Addr = make([]byte, 16) + copy(m.Addr.Addr, buf.DecodeBytes(len(m.Addr.Addr))) + m.EndPsp = buf.DecodeUint8() + m.Behavior = buf.DecodeUint16() + m.FibTable = buf.DecodeUint32() + m.VlanIndex = buf.DecodeUint32() + m.XconnectNhAddr6 = make([]byte, 16) + copy(m.XconnectNhAddr6, buf.DecodeBytes(len(m.XconnectNhAddr6))) + m.XconnectNhAddr4 = make([]byte, 4) + copy(m.XconnectNhAddr4, buf.DecodeBytes(len(m.XconnectNhAddr4))) + m.XconnectIfaceOrVrfTable = buf.DecodeUint32() return nil } -// SrLocalsidsDump represents VPP binary API message 'sr_localsids_dump'. +// SrLocalsidsDump defines 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) 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 { +func (m *SrLocalsidsDump) Size() (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 + b = make([]byte, m.Size()) } - return buf, nil + buf := codec.NewBuffer(b) + return buf.Bytes(), nil } -func (m *SrLocalsidsDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos +func (m *SrLocalsidsDump) Unmarshal(b []byte) error { return nil } -// SrPoliciesDetails represents VPP binary API message 'sr_policies_details'. +// SrPoliciesDetails defines 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"` + NumSidLists uint8 `binapi:"u8,name=num_sid_lists" json:"-"` 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) 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 { +func (m *SrPoliciesDetails) Size() (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 + size += 1 * 16 // m.Bsid.Addr + size += 1 // m.Type + size += 1 // m.IsEncap + size += 4 // m.FibTable + size += 1 // m.NumSidLists 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 + size += 1 // s1.NumSids + size += 4 // s1.Weight 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 + size += 1 * 16 // s1.Sids[j2].Addr } } 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] + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.Bsid.Addr, 16) + buf.EncodeUint8(m.Type) + buf.EncodeUint8(m.IsEncap) + buf.EncodeUint32(m.FibTable) + buf.EncodeUint8(uint8(len(m.SidLists))) + for j0 := 0; j0 < len(m.SidLists); j0++ { + var v0 Srv6SidList // SidLists + if j0 < len(m.SidLists) { + v0 = m.SidLists[j0] } - // 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 - } + buf.EncodeUint8(v0.NumSids) + buf.EncodeUint32(v0.Weight) + for j1 := 0; j1 < 16; j1++ { + buf.EncodeBytes(v0.Sids[j1].Addr, 16) } } - 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 buf.Bytes(), nil +} +func (m *SrPoliciesDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Bsid.Addr = make([]byte, 16) + copy(m.Bsid.Addr, buf.DecodeBytes(len(m.Bsid.Addr))) + m.Type = buf.DecodeUint8() + m.IsEncap = buf.DecodeUint8() + m.FibTable = buf.DecodeUint32() + m.NumSidLists = buf.DecodeUint8() + m.SidLists = make([]Srv6SidList, m.NumSidLists) + for j0 := 0; j0 < len(m.SidLists); j0++ { + m.SidLists[j0].NumSids = buf.DecodeUint8() + m.SidLists[j0].Weight = buf.DecodeUint32() + for j1 := 0; j1 < 16; j1++ { + m.SidLists[j0].Sids[j1].Addr = make([]byte, 16) + copy(m.SidLists[j0].Sids[j1].Addr, buf.DecodeBytes(len(m.SidLists[j0].Sids[j1].Addr))) } } return nil } -// SrPoliciesDump represents VPP binary API message 'sr_policies_dump'. +// SrPoliciesDump defines 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) 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 { +func (m *SrPoliciesDump) Size() (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 + b = make([]byte, m.Size()) } - return buf, nil + buf := codec.NewBuffer(b) + return buf.Bytes(), nil } -func (m *SrPoliciesDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos +func (m *SrPoliciesDump) Unmarshal(b []byte) error { return nil } -// SrPolicyAdd represents VPP binary API message 'sr_policy_add'. +// SrPolicyAdd defines message 'sr_policy_add'. type SrPolicyAdd struct { - BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty"` 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"` @@ -644,304 +358,170 @@ type SrPolicyAdd struct { 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) 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 { +func (m *SrPolicyAdd) Size() (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 + size += 1 * 16 // m.BsidAddr + size += 4 // m.Weight + size += 1 // m.IsEncap + size += 1 // m.Type + size += 4 // m.FibTable + size += 1 // m.Sids.NumSids + size += 4 // m.Sids.Weight 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 + size += 1 * 16 // m.Sids.Sids[j2].Addr } 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 - } + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.BsidAddr, 16) + buf.EncodeUint32(m.Weight) + buf.EncodeUint8(m.IsEncap) + buf.EncodeUint8(m.Type) + buf.EncodeUint32(m.FibTable) + buf.EncodeUint8(m.Sids.NumSids) + buf.EncodeUint32(m.Sids.Weight) + for j1 := 0; j1 < 16; j1++ { + buf.EncodeBytes(m.Sids.Sids[j1].Addr, 16) + } + return buf.Bytes(), nil +} +func (m *SrPolicyAdd) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BsidAddr = make([]byte, 16) + copy(m.BsidAddr, buf.DecodeBytes(len(m.BsidAddr))) + m.Weight = buf.DecodeUint32() + m.IsEncap = buf.DecodeUint8() + m.Type = buf.DecodeUint8() + m.FibTable = buf.DecodeUint32() + m.Sids.NumSids = buf.DecodeUint8() + m.Sids.Weight = buf.DecodeUint32() + for j1 := 0; j1 < 16; j1++ { + m.Sids.Sids[j1].Addr = make([]byte, 16) + copy(m.Sids.Sids[j1].Addr, buf.DecodeBytes(len(m.Sids.Sids[j1].Addr))) } return nil } -// SrPolicyAddReply represents VPP binary API message 'sr_policy_add_reply'. +// SrPolicyAddReply defines 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) 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 { +func (m *SrPolicyAddReply) Size() (size int) { if m == nil { return 0 } - var size int - // field[1] m.Retval - size += 4 + size += 4 // m.Retval 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 + b = make([]byte, m.Size()) } - // 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 + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SrPolicyAddReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() return nil } -// SrPolicyDel represents VPP binary API message 'sr_policy_del'. +// SrPolicyDel defines 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) 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 { +func (m *SrPolicyDel) Size() (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 + size += 1 * 16 // m.BsidAddr.Addr + size += 4 // m.SrPolicyIndex 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 + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.BsidAddr.Addr, 16) + buf.EncodeUint32(m.SrPolicyIndex) + return buf.Bytes(), nil +} +func (m *SrPolicyDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BsidAddr.Addr = make([]byte, 16) + copy(m.BsidAddr.Addr, buf.DecodeBytes(len(m.BsidAddr.Addr))) + m.SrPolicyIndex = buf.DecodeUint32() return nil } -// SrPolicyDelReply represents VPP binary API message 'sr_policy_del_reply'. +// SrPolicyDelReply defines 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) 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 { +func (m *SrPolicyDelReply) Size() (size int) { if m == nil { return 0 } - var size int - // field[1] m.Retval - size += 4 + size += 4 // m.Retval 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 + b = make([]byte, m.Size()) } - // 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 + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SrPolicyDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() return nil } -// SrPolicyMod represents VPP binary API message 'sr_policy_mod'. +// SrPolicyMod defines message 'sr_policy_mod'. type SrPolicyMod struct { - BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty" struc:"[16]byte"` + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty"` 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"` @@ -950,732 +530,432 @@ type SrPolicyMod struct { 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) 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 { +func (m *SrPolicyMod) Size() (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 + size += 1 * 16 // m.BsidAddr + size += 4 // m.SrPolicyIndex + size += 4 // m.FibTable + size += 1 // m.Operation + size += 4 // m.SlIndex + size += 4 // m.Weight + size += 1 // m.Sids.NumSids + size += 4 // m.Sids.Weight 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 + size += 1 * 16 // m.Sids.Sids[j2].Addr } 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 - } + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.BsidAddr, 16) + buf.EncodeUint32(m.SrPolicyIndex) + buf.EncodeUint32(m.FibTable) + buf.EncodeUint8(m.Operation) + buf.EncodeUint32(m.SlIndex) + buf.EncodeUint32(m.Weight) + buf.EncodeUint8(m.Sids.NumSids) + buf.EncodeUint32(m.Sids.Weight) + for j1 := 0; j1 < 16; j1++ { + buf.EncodeBytes(m.Sids.Sids[j1].Addr, 16) + } + return buf.Bytes(), nil +} +func (m *SrPolicyMod) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.BsidAddr = make([]byte, 16) + copy(m.BsidAddr, buf.DecodeBytes(len(m.BsidAddr))) + m.SrPolicyIndex = buf.DecodeUint32() + m.FibTable = buf.DecodeUint32() + m.Operation = buf.DecodeUint8() + m.SlIndex = buf.DecodeUint32() + m.Weight = buf.DecodeUint32() + m.Sids.NumSids = buf.DecodeUint8() + m.Sids.Weight = buf.DecodeUint32() + for j1 := 0; j1 < 16; j1++ { + m.Sids.Sids[j1].Addr = make([]byte, 16) + copy(m.Sids.Sids[j1].Addr, buf.DecodeBytes(len(m.Sids.Sids[j1].Addr))) } return nil } -// SrPolicyModReply represents VPP binary API message 'sr_policy_mod_reply'. +// SrPolicyModReply defines 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) 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 { +func (m *SrPolicyModReply) Size() (size int) { if m == nil { return 0 } - var size int - // field[1] m.Retval - size += 4 + size += 4 // m.Retval 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 + b = make([]byte, m.Size()) } - // 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 + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SrPolicyModReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() return nil } -// SrSetEncapHopLimit represents VPP binary API message 'sr_set_encap_hop_limit'. +// SrSetEncapHopLimit defines 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) 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 { +func (m *SrSetEncapHopLimit) Size() (size int) { if m == nil { return 0 } - var size int - // field[1] m.HopLimit - size += 1 + size += 1 // m.HopLimit 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 + b = make([]byte, m.Size()) } - // 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 + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.HopLimit) + return buf.Bytes(), nil +} +func (m *SrSetEncapHopLimit) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.HopLimit = buf.DecodeUint8() return nil } -// SrSetEncapHopLimitReply represents VPP binary API message 'sr_set_encap_hop_limit_reply'. +// SrSetEncapHopLimitReply defines 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) 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 { +func (m *SrSetEncapHopLimitReply) Size() (size int) { if m == nil { return 0 } - var size int - // field[1] m.Retval - size += 4 + size += 4 // m.Retval 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 + b = make([]byte, m.Size()) } - // 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 + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SrSetEncapHopLimitReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() return nil } -// SrSetEncapSource represents VPP binary API message 'sr_set_encap_source'. +// SrSetEncapSource defines message 'sr_set_encap_source'. type SrSetEncapSource struct { - EncapsSource []byte `binapi:"u8[16],name=encaps_source" json:"encaps_source,omitempty" struc:"[16]byte"` + EncapsSource []byte `binapi:"u8[16],name=encaps_source" json:"encaps_source,omitempty"` } -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) 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 { +func (m *SrSetEncapSource) Size() (size int) { if m == nil { return 0 } - var size int - // field[1] m.EncapsSource - size += 16 + size += 1 * 16 // m.EncapsSource 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 + b = make([]byte, m.Size()) } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.EncapsSource, 16) + return buf.Bytes(), nil +} +func (m *SrSetEncapSource) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.EncapsSource = make([]byte, 16) + copy(m.EncapsSource, buf.DecodeBytes(len(m.EncapsSource))) return nil } -// SrSetEncapSourceReply represents VPP binary API message 'sr_set_encap_source_reply'. +// SrSetEncapSourceReply defines 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) 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 { +func (m *SrSetEncapSourceReply) Size() (size int) { if m == nil { return 0 } - var size int - // field[1] m.Retval - size += 4 + size += 4 // m.Retval 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 + b = make([]byte, m.Size()) } - // 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 + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SrSetEncapSourceReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() return nil } -// SrSteeringAddDel represents VPP binary API message 'sr_steering_add_del'. +// SrSteeringAddDel defines 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"` + BsidAddr []byte `binapi:"u8[16],name=bsid_addr" json:"bsid_addr,omitempty"` 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"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty"` 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) 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 { +func (m *SrSteeringAddDel) Size() (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 + size += 1 // m.IsDel + size += 1 * 16 // m.BsidAddr + size += 4 // m.SrPolicyIndex + size += 4 // m.TableID + size += 1 * 16 // m.PrefixAddr + size += 4 // m.MaskWidth + size += 4 // m.SwIfIndex + size += 1 // m.TrafficType 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 + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.IsDel) + buf.EncodeBytes(m.BsidAddr, 16) + buf.EncodeUint32(m.SrPolicyIndex) + buf.EncodeUint32(m.TableID) + buf.EncodeBytes(m.PrefixAddr, 16) + buf.EncodeUint32(m.MaskWidth) + buf.EncodeUint32(m.SwIfIndex) + buf.EncodeUint8(m.TrafficType) + return buf.Bytes(), nil +} +func (m *SrSteeringAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsDel = buf.DecodeUint8() + m.BsidAddr = make([]byte, 16) + copy(m.BsidAddr, buf.DecodeBytes(len(m.BsidAddr))) + m.SrPolicyIndex = buf.DecodeUint32() + m.TableID = buf.DecodeUint32() + m.PrefixAddr = make([]byte, 16) + copy(m.PrefixAddr, buf.DecodeBytes(len(m.PrefixAddr))) + m.MaskWidth = buf.DecodeUint32() + m.SwIfIndex = buf.DecodeUint32() + m.TrafficType = buf.DecodeUint8() return nil } -// SrSteeringAddDelReply represents VPP binary API message 'sr_steering_add_del_reply'. +// SrSteeringAddDelReply defines 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) 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 { +func (m *SrSteeringAddDelReply) Size() (size int) { if m == nil { return 0 } - var size int - // field[1] m.Retval - size += 4 + size += 4 // m.Retval 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 + b = make([]byte, m.Size()) } - // 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 + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) + return buf.Bytes(), nil +} +func (m *SrSteeringAddDelReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() return nil } -// SrSteeringPolDetails represents VPP binary API message 'sr_steering_pol_details'. +// SrSteeringPolDetails defines 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"` + PrefixAddr []byte `binapi:"u8[16],name=prefix_addr" json:"prefix_addr,omitempty"` 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) 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 { +func (m *SrSteeringPolDetails) Size() (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 + size += 1 // m.TrafficType + size += 4 // m.FibTable + size += 1 * 16 // m.PrefixAddr + size += 4 // m.MaskWidth + size += 4 // m.SwIfIndex + size += 1 * 16 // m.Bsid.Addr 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 - } + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint8(m.TrafficType) + buf.EncodeUint32(m.FibTable) + buf.EncodeBytes(m.PrefixAddr, 16) + buf.EncodeUint32(m.MaskWidth) + buf.EncodeUint32(m.SwIfIndex) + buf.EncodeBytes(m.Bsid.Addr, 16) + return buf.Bytes(), nil +} +func (m *SrSteeringPolDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.TrafficType = buf.DecodeUint8() + m.FibTable = buf.DecodeUint32() + m.PrefixAddr = make([]byte, 16) + copy(m.PrefixAddr, buf.DecodeBytes(len(m.PrefixAddr))) + m.MaskWidth = buf.DecodeUint32() + m.SwIfIndex = buf.DecodeUint32() + m.Bsid.Addr = make([]byte, 16) + copy(m.Bsid.Addr, buf.DecodeBytes(len(m.Bsid.Addr))) return nil } -// SrSteeringPolDump represents VPP binary API message 'sr_steering_pol_dump'. +// SrSteeringPolDump defines 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) 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 { +func (m *SrSteeringPolDump) Size() (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 + b = make([]byte, m.Size()) } - return buf, nil + buf := codec.NewBuffer(b) + return buf.Bytes(), nil } -func (m *SrSteeringPolDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos +func (m *SrSteeringPolDump) Unmarshal(b []byte) error { 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") + api.RegisterMessage((*SrLocalsidAddDel)(nil), "sr_localsid_add_del_b30489eb") + api.RegisterMessage((*SrLocalsidAddDelReply)(nil), "sr_localsid_add_del_reply_e8d4e804") + api.RegisterMessage((*SrLocalsidsDetails)(nil), "sr_localsids_details_0791babc") + api.RegisterMessage((*SrLocalsidsDump)(nil), "sr_localsids_dump_51077d14") + api.RegisterMessage((*SrPoliciesDetails)(nil), "sr_policies_details_5087f460") + api.RegisterMessage((*SrPoliciesDump)(nil), "sr_policies_dump_51077d14") + api.RegisterMessage((*SrPolicyAdd)(nil), "sr_policy_add_4b6e2484") + api.RegisterMessage((*SrPolicyAddReply)(nil), "sr_policy_add_reply_e8d4e804") + api.RegisterMessage((*SrPolicyDel)(nil), "sr_policy_del_e4133171") + api.RegisterMessage((*SrPolicyDelReply)(nil), "sr_policy_del_reply_e8d4e804") + api.RegisterMessage((*SrPolicyMod)(nil), "sr_policy_mod_c1dfaee0") + api.RegisterMessage((*SrPolicyModReply)(nil), "sr_policy_mod_reply_e8d4e804") + api.RegisterMessage((*SrSetEncapHopLimit)(nil), "sr_set_encap_hop_limit_aa75d7d0") + api.RegisterMessage((*SrSetEncapHopLimitReply)(nil), "sr_set_encap_hop_limit_reply_e8d4e804") + api.RegisterMessage((*SrSetEncapSource)(nil), "sr_set_encap_source_d05bb4de") + api.RegisterMessage((*SrSetEncapSourceReply)(nil), "sr_set_encap_source_reply_e8d4e804") + api.RegisterMessage((*SrSteeringAddDel)(nil), "sr_steering_add_del_28b5dcab") + api.RegisterMessage((*SrSteeringAddDelReply)(nil), "sr_steering_add_del_reply_e8d4e804") + api.RegisterMessage((*SrSteeringPolDetails)(nil), "sr_steering_pol_details_5627d483") + api.RegisterMessage((*SrSteeringPolDump)(nil), "sr_steering_pol_dump_51077d14") } // Messages returns list of all messages in this module. @@ -1703,14 +983,3 @@ func AllMessages() []api.Message { (*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