X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=examples%2Fbinapi%2Facl%2Facl.ba.go;h=f191c7830cca86755a7dedfcef21d8a4ccddec43;hb=c7ae74a95d1bd6fefcbb061f5f045c60c11e32fc;hp=b42fb5f0db251769b3eceacc08808163c175f850;hpb=94620e85f0bdbb054af07ce3670fadc1f76cfdf0;p=govpp.git diff --git a/examples/binapi/acl/acl.ba.go b/examples/binapi/acl/acl.ba.go index b42fb5f..f191c78 100644 --- a/examples/binapi/acl/acl.ba.go +++ b/examples/binapi/acl/acl.ba.go @@ -1,15 +1,18 @@ // 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 +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release // source: /usr/share/vpp/api/plugins/acl.api.json /* -Package acl contains generated code for VPP binary API defined by acl.api (version 1.0.1). +Package acl contains generated code for VPP API file acl.api (2.0.0). It consists of: + 7 aliases + 11 enums 38 messages - 2 types + 8 types + 1 union */ package acl @@ -17,13 +20,19 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "io" "math" + "net" "strconv" + "strings" api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" struc "github.com/lunixbochs/struc" + + 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 @@ -36,38 +45,79 @@ const ( // ModuleName is the name of this module. ModuleName = "acl" // APIVersion is the API version of this module. - APIVersion = "1.0.1" + APIVersion = "2.0.0" // VersionCrc is the CRC of this module. - VersionCrc = 0x11c5c1e5 + VersionCrc = 0x68c4cb37 +) + +// ACLAction represents VPP binary API enum 'acl_action'. +type ACLAction uint8 + +const ( + ACL_ACTION_API_DENY ACLAction = 0 + ACL_ACTION_API_PERMIT ACLAction = 1 + ACL_ACTION_API_PERMIT_REFLECT ACLAction = 2 ) +var ( + ACLAction_name = map[uint8]string{ + 0: "ACL_ACTION_API_DENY", + 1: "ACL_ACTION_API_PERMIT", + 2: "ACL_ACTION_API_PERMIT_REFLECT", + } + ACLAction_value = map[string]uint8{ + "ACL_ACTION_API_DENY": 0, + "ACL_ACTION_API_PERMIT": 1, + "ACL_ACTION_API_PERMIT_REFLECT": 2, + } +) + +func (x ACLAction) String() string { + s, ok := ACLAction_name[uint8(x)] + if ok { + return s + } + return "ACLAction(" + strconv.Itoa(int(x)) + ")" +} + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + +func ParseMAC(mac string) (parsed MacAddress, err error) { + var hw net.HardwareAddr + if hw, err = net.ParseMAC(mac); err != nil { + return + } + copy(parsed[:], hw[:]) + return +} + +func (m *MacAddress) ToString() string { + return net.HardwareAddr(m[:]).String() +} + // ACLRule represents VPP binary API type 'acl_rule'. type ACLRule struct { - 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"` + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` + DstPrefix ip_types.Prefix `binapi:"prefix,name=dst_prefix" json:"dst_prefix,omitempty"` + Proto ip_types.IPProto `binapi:"ip_proto,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 `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"` + IsPermit ACLAction `binapi:"acl_action,name=is_permit" json:"is_permit,omitempty"` + SrcMac MacAddress `binapi:"mac_address,name=src_mac" json:"src_mac,omitempty"` + SrcMacMask MacAddress `binapi:"mac_address,name=src_mac_mask" json:"src_mac_mask,omitempty"` + SrcPrefix ip_types.Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` } func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } @@ -75,14 +125,14 @@ func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } // ACLAddReplace represents VPP binary API message 'acl_add_replace'. type ACLAddReplace struct { ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[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 (m *ACLAddReplace) Reset() { *m = ACLAddReplace{} } func (*ACLAddReplace) GetMessageName() string { return "acl_add_replace" } -func (*ACLAddReplace) GetCrcString() string { return "13bc8539" } +func (*ACLAddReplace) GetCrcString() string { return "1cabdeab" } func (*ACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLAddReplace) Size() int { @@ -105,15 +155,21 @@ func (m *ACLAddReplace) Size() int { } // field[2] s1.IsPermit size += 1 - // field[2] s1.IsIPv6 + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af size += 1 - // field[2] s1.SrcIPAddr + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len + size += 1 + // field[2] s1.DstPrefix + // field[3] s1.DstPrefix.Address + // field[4] s1.DstPrefix.Address.Af size += 1 - // field[2] s1.DstIPAddr + // field[4] s1.DstPrefix.Address.Un size += 16 - // field[2] s1.DstIPPrefixLen + // field[3] s1.DstPrefix.Len size += 1 // field[2] s1.Proto size += 1 @@ -147,14 +203,8 @@ func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { 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 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -167,32 +217,27 @@ func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) { // field[2] v1.IsPermit buf[pos] = uint8(v1.IsPermit) pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) 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) + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) 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) + // field[2] v1.DstPrefix + // field[3] v1.DstPrefix.Address + // field[4] v1.DstPrefix.Address.Af + buf[pos] = uint8(v1.DstPrefix.Address.Af) + pos += 1 + // field[4] v1.DstPrefix.Address.Un + copy(buf[pos:pos+16], v1.DstPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.DstPrefix.Len + buf[pos] = uint8(v1.DstPrefix.Len) pos += 1 // field[2] v1.Proto buf[pos] = uint8(v1.Proto) @@ -227,10 +272,10 @@ func (m *ACLAddReplace) Unmarshal(tmp []byte) error { 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 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -239,31 +284,32 @@ func (m *ACLAddReplace) Unmarshal(tmp []byte) error { 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]) + m.R[j1].IsPermit = ACLAction(tmp[pos]) pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(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]) + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = 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]) + // field[2] m.R[j1].DstPrefix + // field[3] m.R[j1].DstPrefix.Address + // field[4] m.R[j1].DstPrefix.Address.Af + m.R[j1].DstPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].DstPrefix.Address.Un + copy(m.R[j1].DstPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].DstPrefix.Len + m.R[j1].DstPrefix.Len = uint8(tmp[pos]) pos += 1 // field[2] m.R[j1].Proto - m.R[j1].Proto = uint8(tmp[pos]) + m.R[j1].Proto = ip_types.IPProto(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcportOrIcmptypeFirst m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) @@ -437,14 +483,14 @@ func (m *ACLDelReply) Unmarshal(tmp []byte) error { // ACLDetails represents VPP binary API message 'acl_details'. type ACLDetails struct { ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[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 (m *ACLDetails) Reset() { *m = ACLDetails{} } func (*ACLDetails) GetMessageName() string { return "acl_details" } -func (*ACLDetails) GetCrcString() string { return "f89d7a88" } +func (*ACLDetails) GetCrcString() string { return "7a97f21c" } func (*ACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *ACLDetails) Size() int { @@ -467,15 +513,21 @@ func (m *ACLDetails) Size() int { } // field[2] s1.IsPermit size += 1 - // field[2] s1.IsIPv6 + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af size += 1 - // field[2] s1.SrcIPAddr + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len + size += 1 + // field[2] s1.DstPrefix + // field[3] s1.DstPrefix.Address + // field[4] s1.DstPrefix.Address.Af size += 1 - // field[2] s1.DstIPAddr + // field[4] s1.DstPrefix.Address.Un size += 16 - // field[2] s1.DstIPPrefixLen + // field[3] s1.DstPrefix.Len size += 1 // field[2] s1.Proto size += 1 @@ -509,14 +561,8 @@ func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { 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 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -529,32 +575,27 @@ func (m *ACLDetails) Marshal(b []byte) ([]byte, error) { // field[2] v1.IsPermit buf[pos] = uint8(v1.IsPermit) pos += 1 - // field[2] v1.IsIPv6 - buf[pos] = uint8(v1.IsIPv6) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) 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) + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) 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) + // field[2] v1.DstPrefix + // field[3] v1.DstPrefix.Address + // field[4] v1.DstPrefix.Address.Af + buf[pos] = uint8(v1.DstPrefix.Address.Af) + pos += 1 + // field[4] v1.DstPrefix.Address.Un + copy(buf[pos:pos+16], v1.DstPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.DstPrefix.Len + buf[pos] = uint8(v1.DstPrefix.Len) pos += 1 // field[2] v1.Proto buf[pos] = uint8(v1.Proto) @@ -589,10 +630,10 @@ func (m *ACLDetails) Unmarshal(tmp []byte) error { 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 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -601,31 +642,32 @@ func (m *ACLDetails) Unmarshal(tmp []byte) error { 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]) + m.R[j1].IsPermit = ACLAction(tmp[pos]) pos += 1 - // field[2] m.R[j1].IsIPv6 - m.R[j1].IsIPv6 = uint8(tmp[pos]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(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]) + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = 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]) + // field[2] m.R[j1].DstPrefix + // field[3] m.R[j1].DstPrefix.Address + // field[4] m.R[j1].DstPrefix.Address.Af + m.R[j1].DstPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].DstPrefix.Address.Un + copy(m.R[j1].DstPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].DstPrefix.Len + m.R[j1].DstPrefix.Len = uint8(tmp[pos]) pos += 1 // field[2] m.R[j1].Proto - m.R[j1].Proto = uint8(tmp[pos]) + m.R[j1].Proto = ip_types.IPProto(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcportOrIcmptypeFirst m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) @@ -697,15 +739,15 @@ func (m *ACLDump) Unmarshal(tmp []byte) error { // ACLInterfaceAddDel represents VPP binary API message 'acl_interface_add_del'. type ACLInterfaceAddDel struct { - 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"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + IsInput bool `binapi:"bool,name=is_input" json:"is_input,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } func (m *ACLInterfaceAddDel) Reset() { *m = ACLInterfaceAddDel{} } func (*ACLInterfaceAddDel) GetMessageName() string { return "acl_interface_add_del" } -func (*ACLInterfaceAddDel) GetCrcString() string { return "0b2aedd1" } +func (*ACLInterfaceAddDel) GetCrcString() string { return "4b54bebd" } func (*ACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceAddDel) Size() int { @@ -735,10 +777,14 @@ func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.IsAdd - buf[pos] = uint8(m.IsAdd) + if m.IsAdd { + buf[pos] = 1 + } pos += 1 // field[1] m.IsInput - buf[pos] = uint8(m.IsInput) + if m.IsInput { + buf[pos] = 1 + } pos += 1 // field[1] m.SwIfIndex o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) @@ -754,13 +800,13 @@ func (m *ACLInterfaceAddDel) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.IsAdd - m.IsAdd = uint8(tmp[pos]) + m.IsAdd = tmp[pos] != 0 pos += 1 // field[1] m.IsInput - m.IsInput = uint8(tmp[pos]) + m.IsInput = tmp[pos] != 0 pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.ACLIndex m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -816,17 +862,17 @@ func (m *ACLInterfaceAddDelReply) Unmarshal(tmp []byte) error { // ACLInterfaceEtypeWhitelistDetails represents VPP binary API message 'acl_interface_etype_whitelist_details'. type ACLInterfaceEtypeWhitelistDetails struct { - 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"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,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) GetCrcString() string { return "cc2bfded" } func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *ACLInterfaceEtypeWhitelistDetails) Size() int { @@ -881,7 +927,7 @@ func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -900,14 +946,14 @@ func (m *ACLInterfaceEtypeWhitelistDetails) Unmarshal(tmp []byte) error { // ACLInterfaceEtypeWhitelistDump represents VPP binary API message 'acl_interface_etype_whitelist_dump'. type ACLInterfaceEtypeWhitelistDump struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,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) GetCrcString() string { return "f9e6675e" } func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceEtypeWhitelistDump) Size() int { @@ -941,22 +987,22 @@ func (m *ACLInterfaceEtypeWhitelistDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(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 `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"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,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 (m *ACLInterfaceListDetails) Reset() { *m = ACLInterfaceListDetails{} } func (*ACLInterfaceListDetails) GetMessageName() string { return "acl_interface_list_details" } -func (*ACLInterfaceListDetails) GetCrcString() string { return "d5e80809" } +func (*ACLInterfaceListDetails) GetCrcString() string { return "e695d256" } func (*ACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *ACLInterfaceListDetails) Size() int { @@ -1011,7 +1057,7 @@ func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1030,12 +1076,12 @@ func (m *ACLInterfaceListDetails) Unmarshal(tmp []byte) error { // ACLInterfaceListDump represents VPP binary API message 'acl_interface_list_dump'. type ACLInterfaceListDump struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4.294967295e+09" json:"sw_if_index,omitempty"` } func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} } func (*ACLInterfaceListDump) GetMessageName() string { return "acl_interface_list_dump" } -func (*ACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*ACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } func (*ACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceListDump) Size() int { @@ -1069,22 +1115,22 @@ func (m *ACLInterfaceListDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(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 `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"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,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 (m *ACLInterfaceSetACLList) Reset() { *m = ACLInterfaceSetACLList{} } func (*ACLInterfaceSetACLList) GetMessageName() string { return "acl_interface_set_acl_list" } -func (*ACLInterfaceSetACLList) GetCrcString() string { return "8baece38" } +func (*ACLInterfaceSetACLList) GetCrcString() string { return "473982bd" } func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceSetACLList) Size() int { @@ -1139,7 +1185,7 @@ func (m *ACLInterfaceSetACLList) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1206,17 +1252,17 @@ func (m *ACLInterfaceSetACLListReply) Unmarshal(tmp []byte) error { // ACLInterfaceSetEtypeWhitelist represents VPP binary API message 'acl_interface_set_etype_whitelist'. type ACLInterfaceSetEtypeWhitelist struct { - 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"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,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) GetCrcString() string { return "3f5c2d2d" } func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType { return api.RequestMessage } func (m *ACLInterfaceSetEtypeWhitelist) Size() int { @@ -1271,7 +1317,7 @@ func (m *ACLInterfaceSetEtypeWhitelist) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1713,14 +1759,14 @@ func (m *ACLStatsIntfCountersEnableReply) Unmarshal(tmp []byte) error { // 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"` + Tag string `binapi:"string[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 (m *MacipACLAdd) Reset() { *m = MacipACLAdd{} } func (*MacipACLAdd) GetMessageName() string { return "macip_acl_add" } -func (*MacipACLAdd) GetCrcString() string { return "0c680ca5" } +func (*MacipACLAdd) GetCrcString() string { return "d648fd0a" } func (*MacipACLAdd) GetMessageType() api.MessageType { return api.RequestMessage } func (m *MacipACLAdd) Size() int { @@ -1741,15 +1787,17 @@ func (m *MacipACLAdd) Size() int { } // 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 + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af + size += 1 + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len size += 1 } return size @@ -1766,14 +1814,8 @@ func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { 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 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -1786,9 +1828,6 @@ func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { // 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 @@ -1807,17 +1846,16 @@ func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) { 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) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) + pos += 1 + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) pos += 1 } return buf, nil @@ -1828,10 +1866,10 @@ func (m *MacipACLAdd) Unmarshal(tmp []byte) error { 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 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -1840,31 +1878,28 @@ func (m *MacipACLAdd) Unmarshal(tmp []byte) error { 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]) + m.R[j1].IsPermit = ACLAction(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]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) pos += 1 } return nil @@ -1872,15 +1907,15 @@ func (m *MacipACLAdd) Unmarshal(tmp []byte) error { // MacipACLAddReplace represents VPP binary API message 'macip_acl_add_replace'. type MacipACLAddReplace struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + ACLIndex uint32 `binapi:"u32,name=acl_index,default=4.294967295e+09" json:"acl_index,omitempty"` + Tag string `binapi:"string[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 (m *MacipACLAddReplace) Reset() { *m = MacipACLAddReplace{} } func (*MacipACLAddReplace) GetMessageName() string { return "macip_acl_add_replace" } -func (*MacipACLAddReplace) GetCrcString() string { return "d3d313e7" } +func (*MacipACLAddReplace) GetCrcString() string { return "e34402a7" } func (*MacipACLAddReplace) GetMessageType() api.MessageType { return api.RequestMessage } func (m *MacipACLAddReplace) Size() int { @@ -1903,15 +1938,17 @@ func (m *MacipACLAddReplace) Size() int { } // 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 + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af + size += 1 + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len size += 1 } return size @@ -1931,14 +1968,8 @@ func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { 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 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -1951,9 +1982,6 @@ func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { // 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 @@ -1972,17 +2000,16 @@ func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) { 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) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) + pos += 1 + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) pos += 1 } return buf, nil @@ -1996,10 +2023,10 @@ func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { 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 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2008,31 +2035,28 @@ func (m *MacipACLAddReplace) Unmarshal(tmp []byte) error { 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]) + m.R[j1].IsPermit = ACLAction(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]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) pos += 1 } return nil @@ -2243,14 +2267,14 @@ func (m *MacipACLDelReply) Unmarshal(tmp []byte) error { // MacipACLDetails represents VPP binary API message 'macip_acl_details'. type MacipACLDetails struct { ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` - Tag []byte `binapi:"u8[64],name=tag" json:"tag,omitempty" struc:"[64]byte"` + Tag string `binapi:"string[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 (m *MacipACLDetails) Reset() { *m = MacipACLDetails{} } func (*MacipACLDetails) GetMessageName() string { return "macip_acl_details" } -func (*MacipACLDetails) GetCrcString() string { return "e164e69a" } +func (*MacipACLDetails) GetCrcString() string { return "57c7482f" } func (*MacipACLDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *MacipACLDetails) Size() int { @@ -2273,15 +2297,17 @@ func (m *MacipACLDetails) Size() int { } // 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 + // field[2] s1.SrcPrefix + // field[3] s1.SrcPrefix.Address + // field[4] s1.SrcPrefix.Address.Af + size += 1 + // field[4] s1.SrcPrefix.Address.Un size += 16 - // field[2] s1.SrcIPPrefixLen + // field[3] s1.SrcPrefix.Len size += 1 } return size @@ -2301,14 +2327,8 @@ func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { 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 - } + copy(buf[pos:pos+64], m.Tag) + pos += 64 // field[1] m.Count o.PutUint32(buf[pos:pos+4], uint32(len(m.R))) pos += 4 @@ -2321,9 +2341,6 @@ func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { // 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 @@ -2342,17 +2359,16 @@ func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) { 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) + // field[2] v1.SrcPrefix + // field[3] v1.SrcPrefix.Address + // field[4] v1.SrcPrefix.Address.Af + buf[pos] = uint8(v1.SrcPrefix.Address.Af) + pos += 1 + // field[4] v1.SrcPrefix.Address.Un + copy(buf[pos:pos+16], v1.SrcPrefix.Address.Un.XXX_UnionData[:]) + pos += 16 + // field[3] v1.SrcPrefix.Len + buf[pos] = uint8(v1.SrcPrefix.Len) pos += 1 } return buf, nil @@ -2366,10 +2382,10 @@ func (m *MacipACLDetails) Unmarshal(tmp []byte) error { 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 + { + nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) + m.Tag = codec.DecodeString(tmp[pos : pos+nul]) + pos += 64 } // field[1] m.Count m.Count = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2378,31 +2394,28 @@ func (m *MacipACLDetails) Unmarshal(tmp []byte) error { 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]) + m.R[j1].IsPermit = ACLAction(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]) + // field[2] m.R[j1].SrcPrefix + // field[3] m.R[j1].SrcPrefix.Address + // field[4] m.R[j1].SrcPrefix.Address.Af + m.R[j1].SrcPrefix.Address.Af = ip_types.AddressFamily(tmp[pos]) + pos += 1 + // field[4] m.R[j1].SrcPrefix.Address.Un + copy(m.R[j1].SrcPrefix.Address.Un.XXX_UnionData[:], tmp[pos:pos+16]) + pos += 16 + // field[3] m.R[j1].SrcPrefix.Len + m.R[j1].SrcPrefix.Len = uint8(tmp[pos]) pos += 1 } return nil @@ -2410,7 +2423,7 @@ func (m *MacipACLDetails) Unmarshal(tmp []byte) error { // MacipACLDump represents VPP binary API message 'macip_acl_dump'. type MacipACLDump struct { - ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index,default=4.294967295e+09" json:"acl_index,omitempty"` } func (m *MacipACLDump) Reset() { *m = MacipACLDump{} } @@ -2456,14 +2469,14 @@ func (m *MacipACLDump) Unmarshal(tmp []byte) error { // MacipACLInterfaceAddDel represents VPP binary API message 'macip_acl_interface_add_del'. type MacipACLInterfaceAddDel struct { - 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"` + IsAdd bool `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + ACLIndex uint32 `binapi:"u32,name=acl_index" json:"acl_index,omitempty"` } func (m *MacipACLInterfaceAddDel) Reset() { *m = MacipACLInterfaceAddDel{} } func (*MacipACLInterfaceAddDel) GetMessageName() string { return "macip_acl_interface_add_del" } -func (*MacipACLInterfaceAddDel) GetCrcString() string { return "6a6be97c" } +func (*MacipACLInterfaceAddDel) GetCrcString() string { return "4b8690b1" } func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType { return api.RequestMessage } func (m *MacipACLInterfaceAddDel) Size() int { @@ -2491,7 +2504,9 @@ func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) { buf = b } // field[1] m.IsAdd - buf[pos] = uint8(m.IsAdd) + if m.IsAdd { + buf[pos] = 1 + } pos += 1 // field[1] m.SwIfIndex o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) @@ -2507,10 +2522,10 @@ func (m *MacipACLInterfaceAddDel) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.IsAdd - m.IsAdd = uint8(tmp[pos]) + m.IsAdd = tmp[pos] != 0 pos += 1 // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.ACLIndex m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2668,16 +2683,16 @@ func (m *MacipACLInterfaceGetReply) Unmarshal(tmp []byte) error { // MacipACLInterfaceListDetails represents VPP binary API message 'macip_acl_interface_list_details'. type MacipACLInterfaceListDetails struct { - 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"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,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) GetCrcString() string { return "a0c5d56d" } func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType { return api.ReplyMessage } func (m *MacipACLInterfaceListDetails) Size() int { @@ -2727,7 +2742,7 @@ func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -2743,12 +2758,12 @@ func (m *MacipACLInterfaceListDetails) Unmarshal(tmp []byte) error { // MacipACLInterfaceListDump represents VPP binary API message 'macip_acl_interface_list_dump'. type MacipACLInterfaceListDump struct { - SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } func (m *MacipACLInterfaceListDump) Reset() { *m = MacipACLInterfaceListDump{} } func (*MacipACLInterfaceListDump) GetMessageName() string { return "macip_acl_interface_list_dump" } -func (*MacipACLInterfaceListDump) GetCrcString() string { return "529cb13f" } +func (*MacipACLInterfaceListDump) GetCrcString() string { return "f9e6675e" } func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType { return api.RequestMessage } func (m *MacipACLInterfaceListDump) Size() int { @@ -2782,7 +2797,7 @@ func (m *MacipACLInterfaceListDump) Unmarshal(tmp []byte) error { pos := 0 _ = pos // field[1] m.SwIfIndex - m.SwIfIndex = uint32(o.Uint32(tmp[pos : pos+4])) + m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } @@ -2880,6 +2895,9 @@ var _ = bytes.NewBuffer var _ = context.Background var _ = io.Copy var _ = strconv.Itoa +var _ = strings.Contains var _ = struc.Pack var _ = binary.BigEndian var _ = math.Float32bits +var _ = net.ParseIP +var _ = fmt.Errorf