diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2020-06-23 14:10:53 +0200 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2020-06-24 08:17:33 +0200 |
commit | ceed73403bdb61387d04be8b47183e9c4a970749 (patch) | |
tree | 3f48a49051672efb44945b279b9f69693bc48540 /examples/binapi/acl/acl.ba.go | |
parent | 94620e85f0bdbb054af07ce3670fadc1f76cfdf0 (diff) |
Fix codec fallback and generate type imports
Change-Id: Idd76c7f19d952939caf153928ac60175845078ff
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'examples/binapi/acl/acl.ba.go')
-rw-r--r-- | examples/binapi/acl/acl.ba.go | 737 |
1 files changed, 391 insertions, 346 deletions
diff --git a/examples/binapi/acl/acl.ba.go b/examples/binapi/acl/acl.ba.go index b42fb5f..604b352 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 @@ -24,6 +27,9 @@ import ( 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,53 +42,127 @@ 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)) + ")" +} + +type AddressFamily = ip_types.AddressFamily + +type IfStatusFlags = interface_types.IfStatusFlags + +type IfType = interface_types.IfType + +type IPDscp = ip_types.IPDscp + +type IPEcn = ip_types.IPEcn + +type IPProto = ip_types.IPProto + +type LinkDuplex = interface_types.LinkDuplex + +type MtuProto = interface_types.MtuProto + +type RxMode = interface_types.RxMode + +type SubIfFlags = interface_types.SubIfFlags + +type AddressWithPrefix = ip_types.AddressWithPrefix + +type InterfaceIndex = interface_types.InterfaceIndex + +type IP4Address = ip_types.IP4Address + +type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix + +type IP6Address = ip_types.IP6Address + +type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix + +// MacAddress represents VPP binary API alias 'mac_address'. +type MacAddress [6]uint8 + // 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 Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` + DstPrefix Prefix `binapi:"prefix,name=dst_prefix" json:"dst_prefix,omitempty"` + Proto 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" } +type Address = ip_types.Address + +type IP4Prefix = ip_types.IP4Prefix + +type IP6Prefix = ip_types.IP6Prefix + // 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 Prefix `binapi:"prefix,name=src_prefix" json:"src_prefix,omitempty"` } func (*MacipACLRule) GetTypeName() string { return "macip_acl_rule" } +type Mprefix = ip_types.Mprefix + +type Prefix = ip_types.Prefix + +type PrefixMatcher = ip_types.PrefixMatcher + +type AddressUnion = ip_types.AddressUnion + // 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 +185,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 +233,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 +247,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 +302,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 +314,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 = 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 = 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 = IPProto(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcportOrIcmptypeFirst m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) @@ -437,14 +513,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 +543,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.DstIPAddr + // field[2] s1.DstPrefix + // field[3] s1.DstPrefix.Address + // field[4] s1.DstPrefix.Address.Af + size += 1 + // 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 +591,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 +605,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 +660,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 +672,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 = 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 = 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 = IPProto(tmp[pos]) pos += 1 // field[2] m.R[j1].SrcportOrIcmptypeFirst m.R[j1].SrcportOrIcmptypeFirst = uint16(o.Uint16(tmp[pos : pos+2])) @@ -697,15 +769,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 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 +807,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 +830,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 = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.ACLIndex m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -816,17 +892,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 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 +957,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 = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -900,14 +976,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 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 +1017,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 = 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 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 +1087,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 = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1030,12 +1106,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 InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" 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 +1145,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 = 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 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 +1215,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 = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1206,17 +1282,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 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 +1347,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 = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -1713,14 +1789,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 +1817,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 +1844,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 +1858,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 +1876,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 +1896,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 +1908,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 = 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 +1937,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 +1968,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 +1998,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 +2012,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 +2030,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 +2053,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 +2065,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 = 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 +2297,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 +2327,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 +2357,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 +2371,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 +2389,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 +2412,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 +2424,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 = 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 +2453,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 +2499,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 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 +2534,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 +2552,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 = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.ACLIndex m.ACLIndex = uint32(o.Uint32(tmp[pos : pos+4])) @@ -2668,16 +2713,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 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 +2772,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 = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 // field[1] m.Count m.Count = uint8(tmp[pos]) @@ -2743,12 +2788,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 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 +2827,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 = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) pos += 4 return nil } |