aboutsummaryrefslogtreecommitdiffstats
path: root/binapi
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2020-07-22 04:40:55 +0200
committerOndrej Fabry <ofabry@cisco.com>2020-07-22 04:40:55 +0200
commit58da9ac6e691a8c660eb8ca838a154e11da0db68 (patch)
treea1bbda04c6d0621ce0fc20779276620f1820190b /binapi
parenta155cd438c6558da266c1c5931361ea088b35653 (diff)
Fix binapigen decoding and minor improvements
- fixed allocating byte slices before copying decoded data - simplified encoding functions - several minor improvements Change-Id: I6669424b89eb86333805cb1b57e4551169980cc2 Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'binapi')
-rw-r--r--binapi/abf/abf.ba.go216
-rw-r--r--binapi/acl/acl.ba.go520
-rw-r--r--binapi/af_packet/af_packet.ba.go84
-rw-r--r--binapi/arp/arp.ba.go86
-rw-r--r--binapi/avf/avf.ba.go56
-rw-r--r--binapi/bfd/bfd.ba.go379
-rw-r--r--binapi/bier/bier.ba.go504
-rw-r--r--binapi/bond/bond.ba.go160
-rw-r--r--binapi/builtinurl/builtinurl.ba.go22
-rw-r--r--binapi/cdp/cdp.ba.go22
-rw-r--r--binapi/classify/classify.ba.go462
-rw-r--r--binapi/cop/cop.ba.go46
-rw-r--r--binapi/ct6/ct6.ba.go22
-rw-r--r--binapi/dhcp/dhcp.ba.go482
-rw-r--r--binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go22
-rw-r--r--binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go46
-rw-r--r--binapi/dns/dns.ba.go130
-rw-r--r--binapi/dslite/dslite.ba.go128
-rw-r--r--binapi/feature/feature.ba.go22
-rw-r--r--binapi/flowprobe/flowprobe.ba.go48
-rw-r--r--binapi/gbp/gbp.ba.go710
-rw-r--r--binapi/gen.go21
-rw-r--r--binapi/geneve/geneve.ba.go82
-rw-r--r--binapi/gre/gre.ba.go60
-rw-r--r--binapi/gso/gso.ba.go22
-rw-r--r--binapi/gtpu/gtpu.ba.go110
-rw-r--r--binapi/http_static/http_static.ba.go30
-rw-r--r--binapi/igmp/igmp.ba.go223
-rw-r--r--binapi/ikev2/ikev2.ba.go458
-rw-r--r--binapi/interface/interface.ba.go693
-rw-r--r--binapi/ioam_cache/ioam_cache.ba.go22
-rw-r--r--binapi/ioam_export/ioam_export.ba.go22
-rw-r--r--binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go158
-rw-r--r--binapi/ip/ip.ba.go1024
-rw-r--r--binapi/ip6_nd/ip6_nd.ba.go205
-rw-r--r--binapi/ip_neighbor/ip_neighbor.ba.go187
-rw-r--r--binapi/ip_types/ip_types.ba.go8
-rw-r--r--binapi/ipfix_export/ipfix_export.ba.go178
-rw-r--r--binapi/ipip/ipip.ba.go132
-rw-r--r--binapi/ipsec/ipsec.ba.go520
-rw-r--r--binapi/ipsec_types/ipsec_types.ba.go4
-rw-r--r--binapi/l2/l2.ba.go682
-rw-r--r--binapi/l2e/l2e.ba.go22
-rw-r--r--binapi/l2tp/l2tp.ba.go136
-rw-r--r--binapi/l3xc/l3xc.ba.go184
-rw-r--r--binapi/lacp/lacp.ba.go46
-rw-r--r--binapi/lb/lb.ba.go260
-rw-r--r--binapi/lisp/lisp.ba.go752
-rw-r--r--binapi/lisp_gpe/lisp_gpe.ba.go284
-rw-r--r--binapi/lisp_types/lisp_types.ba.go20
-rw-r--r--binapi/lldp/lldp.ba.go53
-rw-r--r--binapi/mactime/mactime.ba.go115
-rw-r--r--binapi/map/map.ba.go398
-rw-r--r--binapi/mdata/mdata.ba.go22
-rw-r--r--binapi/memclnt/memclnt.ba.go303
-rw-r--r--binapi/memif/memif.ba.go126
-rw-r--r--binapi/mpls/mpls.ba.go402
-rw-r--r--binapi/nat/nat.ba.go1607
-rw-r--r--binapi/nsh/nsh.ba.go162
-rw-r--r--binapi/nsim/nsim.ba.go74
-rw-r--r--binapi/oddbuf/oddbuf.ba.go22
-rw-r--r--binapi/one/one.ba.go1318
-rw-r--r--binapi/p2p_ethernet/p2p_ethernet.ba.go46
-rw-r--r--binapi/pg/pg.ba.go70
-rw-r--r--binapi/pipe/pipe.ba.go92
-rw-r--r--binapi/policer/policer.ba.go86
-rw-r--r--binapi/pot/pot.ba.go124
-rw-r--r--binapi/pppoe/pppoe.ba.go52
-rw-r--r--binapi/punt/punt.ba.go132
-rw-r--r--binapi/qos/qos.ba.go245
-rw-r--r--binapi/rd_cp/rd_cp.ba.go22
-rw-r--r--binapi/rdma/rdma.ba.go58
-rw-r--r--binapi/session/session.ba.go337
-rw-r--r--binapi/span/span.ba.go40
-rw-r--r--binapi/sr/sr.ba.go315
-rw-r--r--binapi/sr_mpls/sr_mpls.ba.go152
-rw-r--r--binapi/stn/stn.ba.go44
-rw-r--r--binapi/svs/svs.ba.go120
-rw-r--r--binapi/syslog/syslog.ba.go104
-rw-r--r--binapi/tapv2/tapv2.ba.go100
-rw-r--r--binapi/tcp/tcp.ba.go28
-rw-r--r--binapi/teib/teib.ba.go54
-rw-r--r--binapi/tls_openssl/tls_openssl.ba.go39
-rw-r--r--binapi/trace/trace.ba.go86
-rw-r--r--binapi/udp/udp.ba.go90
-rw-r--r--binapi/udp_ping/udp_ping.ba.go67
-rw-r--r--binapi/urpf/urpf.ba.go22
-rw-r--r--binapi/vhost_user/vhost_user.ba.go98
-rw-r--r--binapi/virtio/virtio.ba.go86
-rw-r--r--binapi/vmxnet3/vmxnet3.ba.go152
-rw-r--r--binapi/vpe/vpe.ba.go328
-rw-r--r--binapi/vrrp/vrrp.ba.go236
-rw-r--r--binapi/vxlan/vxlan.ba.go108
-rw-r--r--binapi/vxlan_gbp/vxlan_gbp.ba.go84
-rw-r--r--binapi/vxlan_gpe/vxlan_gpe.ba.go82
-rw-r--r--binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go22
96 files changed, 7411 insertions, 11624 deletions
diff --git a/binapi/abf/abf.ba.go b/binapi/abf/abf.ba.go
index 2cea604..2b28afe 100644
--- a/binapi/abf/abf.ba.go
+++ b/binapi/abf/abf.ba.go
@@ -61,11 +61,10 @@ func (*AbfItfAttachAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AbfItfAttachAddDel) Size() int {
+func (m *AbfItfAttachAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Attach.PolicyID
size += 4 // m.Attach.SwIfIndex
@@ -74,16 +73,14 @@ func (m *AbfItfAttachAddDel) Size() int {
return size
}
func (m *AbfItfAttachAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Attach.PolicyID))
+ buf.EncodeUint32(m.Attach.PolicyID)
buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
- buf.EncodeUint32(uint32(m.Attach.Priority))
+ buf.EncodeUint32(m.Attach.Priority)
buf.EncodeBool(m.Attach.IsIPv6)
return buf.Bytes(), nil
}
@@ -109,27 +106,24 @@ func (*AbfItfAttachAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AbfItfAttachAddDelReply) Size() int {
+func (m *AbfItfAttachAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *AbfItfAttachAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *AbfItfAttachAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -145,11 +139,10 @@ func (*AbfItfAttachDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AbfItfAttachDetails) Size() int {
+func (m *AbfItfAttachDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Attach.PolicyID
size += 4 // m.Attach.SwIfIndex
size += 4 // m.Attach.Priority
@@ -157,15 +150,13 @@ func (m *AbfItfAttachDetails) Size() int {
return size
}
func (m *AbfItfAttachDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Attach.PolicyID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Attach.PolicyID)
buf.EncodeUint32(uint32(m.Attach.SwIfIndex))
- buf.EncodeUint32(uint32(m.Attach.Priority))
+ buf.EncodeUint32(m.Attach.Priority)
buf.EncodeBool(m.Attach.IsIPv6)
return buf.Bytes(), nil
}
@@ -188,20 +179,17 @@ func (*AbfItfAttachDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AbfItfAttachDump) Size() int {
+func (m *AbfItfAttachDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *AbfItfAttachDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *AbfItfAttachDump) Unmarshal(b []byte) error {
@@ -218,20 +206,17 @@ func (*AbfPluginGetVersion) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AbfPluginGetVersion) Size() int {
+func (m *AbfPluginGetVersion) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *AbfPluginGetVersion) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *AbfPluginGetVersion) Unmarshal(b []byte) error {
@@ -251,24 +236,21 @@ func (*AbfPluginGetVersionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AbfPluginGetVersionReply) Size() int {
+func (m *AbfPluginGetVersionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Major
size += 4 // m.Minor
return size
}
func (m *AbfPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Major))
- buf.EncodeUint32(uint32(m.Minor))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Major)
+ buf.EncodeUint32(m.Minor)
return buf.Bytes(), nil
}
func (m *AbfPluginGetVersionReply) Unmarshal(b []byte) error {
@@ -291,11 +273,10 @@ func (*AbfPolicyAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AbfPolicyAddDel) Size() int {
+func (m *AbfPolicyAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Policy.PolicyID
size += 4 // m.Policy.ACLIndex
@@ -320,57 +301,46 @@ func (m *AbfPolicyAddDel) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *AbfPolicyAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Policy.PolicyID))
- buf.EncodeUint32(uint32(m.Policy.ACLIndex))
+ buf.EncodeUint32(m.Policy.PolicyID)
+ buf.EncodeUint32(m.Policy.ACLIndex)
buf.EncodeUint8(uint8(len(m.Policy.Paths)))
for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // Paths
if j1 < len(m.Policy.Paths) {
v1 = m.Policy.Paths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -381,7 +351,7 @@ func (m *AbfPolicyAddDel) Unmarshal(b []byte) error {
m.Policy.PolicyID = buf.DecodeUint32()
m.Policy.ACLIndex = buf.DecodeUint32()
m.Policy.NPaths = buf.DecodeUint8()
- m.Policy.Paths = make([]fib_types.FibPath, int(m.Policy.NPaths))
+ m.Policy.Paths = make([]fib_types.FibPath, m.Policy.NPaths)
for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
m.Policy.Paths[j1].TableID = buf.DecodeUint32()
@@ -418,27 +388,24 @@ func (*AbfPolicyAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AbfPolicyAddDelReply) Size() int {
+func (m *AbfPolicyAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *AbfPolicyAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *AbfPolicyAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -454,11 +421,10 @@ func (*AbfPolicyDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AbfPolicyDetails) Size() int {
+func (m *AbfPolicyDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Policy.PolicyID
size += 4 // m.Policy.ACLIndex
size += 1 // m.Policy.NPaths
@@ -482,56 +448,45 @@ func (m *AbfPolicyDetails) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *AbfPolicyDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Policy.PolicyID))
- buf.EncodeUint32(uint32(m.Policy.ACLIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Policy.PolicyID)
+ buf.EncodeUint32(m.Policy.ACLIndex)
buf.EncodeUint8(uint8(len(m.Policy.Paths)))
for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // Paths
if j1 < len(m.Policy.Paths) {
v1 = m.Policy.Paths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -541,7 +496,7 @@ func (m *AbfPolicyDetails) Unmarshal(b []byte) error {
m.Policy.PolicyID = buf.DecodeUint32()
m.Policy.ACLIndex = buf.DecodeUint32()
m.Policy.NPaths = buf.DecodeUint8()
- m.Policy.Paths = make([]fib_types.FibPath, int(m.Policy.NPaths))
+ m.Policy.Paths = make([]fib_types.FibPath, m.Policy.NPaths)
for j1 := 0; j1 < len(m.Policy.Paths); j1++ {
m.Policy.Paths[j1].SwIfIndex = buf.DecodeUint32()
m.Policy.Paths[j1].TableID = buf.DecodeUint32()
@@ -576,20 +531,17 @@ func (*AbfPolicyDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AbfPolicyDump) Size() int {
+func (m *AbfPolicyDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *AbfPolicyDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *AbfPolicyDump) Unmarshal(b []byte) error {
diff --git a/binapi/acl/acl.ba.go b/binapi/acl/acl.ba.go
index 3fac5ee..1f47a01 100644
--- a/binapi/acl/acl.ba.go
+++ b/binapi/acl/acl.ba.go
@@ -47,11 +47,10 @@ func (*ACLAddReplace) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLAddReplace) Size() int {
+func (m *ACLAddReplace) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
size += 64 // m.Tag
size += 4 // m.Count
@@ -79,34 +78,32 @@ func (m *ACLAddReplace) Size() int {
return size
}
func (m *ACLAddReplace) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
buf.EncodeString(m.Tag, 64)
buf.EncodeUint32(uint32(len(m.R)))
for j0 := 0; j0 < len(m.R); j0++ {
- var v0 acl_types.ACLRule
+ var v0 acl_types.ACLRule // R
if j0 < len(m.R) {
v0 = m.R[j0]
}
buf.EncodeUint8(uint8(v0.IsPermit))
buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af))
- buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(v0.SrcPrefix.Len))
+ buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(v0.SrcPrefix.Len)
buf.EncodeUint8(uint8(v0.DstPrefix.Address.Af))
- buf.EncodeBytes(v0.DstPrefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(v0.DstPrefix.Len))
+ buf.EncodeBytes(v0.DstPrefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(v0.DstPrefix.Len)
buf.EncodeUint8(uint8(v0.Proto))
- buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeFirst))
- buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeLast))
- buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeFirst))
- buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeLast))
- buf.EncodeUint8(uint8(v0.TCPFlagsMask))
- buf.EncodeUint8(uint8(v0.TCPFlagsValue))
+ buf.EncodeUint16(v0.SrcportOrIcmptypeFirst)
+ buf.EncodeUint16(v0.SrcportOrIcmptypeLast)
+ buf.EncodeUint16(v0.DstportOrIcmpcodeFirst)
+ buf.EncodeUint16(v0.DstportOrIcmpcodeLast)
+ buf.EncodeUint8(v0.TCPFlagsMask)
+ buf.EncodeUint8(v0.TCPFlagsValue)
}
return buf.Bytes(), nil
}
@@ -115,7 +112,7 @@ func (m *ACLAddReplace) Unmarshal(b []byte) error {
m.ACLIndex = buf.DecodeUint32()
m.Tag = buf.DecodeString(64)
m.Count = buf.DecodeUint32()
- m.R = make([]acl_types.ACLRule, int(m.Count))
+ m.R = make([]acl_types.ACLRule, m.Count)
for j0 := 0; j0 < len(m.R); j0++ {
m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8())
m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
@@ -148,30 +145,27 @@ func (*ACLAddReplaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLAddReplaceReply) Size() int {
+func (m *ACLAddReplaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
size += 4 // m.Retval
return size
}
func (m *ACLAddReplaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ACLAddReplaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.ACLIndex = buf.DecodeUint32()
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -187,22 +181,19 @@ func (*ACLDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLDel) Size() int {
+func (m *ACLDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
return size
}
func (m *ACLDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
return buf.Bytes(), nil
}
func (m *ACLDel) Unmarshal(b []byte) error {
@@ -223,27 +214,24 @@ func (*ACLDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLDelReply) Size() int {
+func (m *ACLDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ACLDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ACLDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -262,11 +250,10 @@ func (*ACLDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLDetails) Size() int {
+func (m *ACLDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
size += 64 // m.Tag
size += 4 // m.Count
@@ -294,34 +281,32 @@ func (m *ACLDetails) Size() int {
return size
}
func (m *ACLDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
buf.EncodeString(m.Tag, 64)
buf.EncodeUint32(uint32(len(m.R)))
for j0 := 0; j0 < len(m.R); j0++ {
- var v0 acl_types.ACLRule
+ var v0 acl_types.ACLRule // R
if j0 < len(m.R) {
v0 = m.R[j0]
}
buf.EncodeUint8(uint8(v0.IsPermit))
buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af))
- buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(v0.SrcPrefix.Len))
+ buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(v0.SrcPrefix.Len)
buf.EncodeUint8(uint8(v0.DstPrefix.Address.Af))
- buf.EncodeBytes(v0.DstPrefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(v0.DstPrefix.Len))
+ buf.EncodeBytes(v0.DstPrefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(v0.DstPrefix.Len)
buf.EncodeUint8(uint8(v0.Proto))
- buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeFirst))
- buf.EncodeUint16(uint16(v0.SrcportOrIcmptypeLast))
- buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeFirst))
- buf.EncodeUint16(uint16(v0.DstportOrIcmpcodeLast))
- buf.EncodeUint8(uint8(v0.TCPFlagsMask))
- buf.EncodeUint8(uint8(v0.TCPFlagsValue))
+ buf.EncodeUint16(v0.SrcportOrIcmptypeFirst)
+ buf.EncodeUint16(v0.SrcportOrIcmptypeLast)
+ buf.EncodeUint16(v0.DstportOrIcmpcodeFirst)
+ buf.EncodeUint16(v0.DstportOrIcmpcodeLast)
+ buf.EncodeUint8(v0.TCPFlagsMask)
+ buf.EncodeUint8(v0.TCPFlagsValue)
}
return buf.Bytes(), nil
}
@@ -330,7 +315,7 @@ func (m *ACLDetails) Unmarshal(b []byte) error {
m.ACLIndex = buf.DecodeUint32()
m.Tag = buf.DecodeString(64)
m.Count = buf.DecodeUint32()
- m.R = make([]acl_types.ACLRule, int(m.Count))
+ m.R = make([]acl_types.ACLRule, m.Count)
for j0 := 0; j0 < len(m.R); j0++ {
m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8())
m.R[j0].SrcPrefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
@@ -362,22 +347,19 @@ func (*ACLDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLDump) Size() int {
+func (m *ACLDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
return size
}
func (m *ACLDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
return buf.Bytes(), nil
}
func (m *ACLDump) Unmarshal(b []byte) error {
@@ -401,11 +383,10 @@ func (*ACLInterfaceAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLInterfaceAddDel) Size() int {
+func (m *ACLInterfaceAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IsInput
size += 4 // m.SwIfIndex
@@ -413,16 +394,14 @@ func (m *ACLInterfaceAddDel) Size() int {
return size
}
func (m *ACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.IsInput)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf.EncodeUint32(m.ACLIndex)
return buf.Bytes(), nil
}
func (m *ACLInterfaceAddDel) Unmarshal(b []byte) error {
@@ -446,27 +425,24 @@ func (*ACLInterfaceAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLInterfaceAddDelReply) Size() int {
+func (m *ACLInterfaceAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ACLInterfaceAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -487,11 +463,10 @@ func (*ACLInterfaceEtypeWhitelistDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLInterfaceEtypeWhitelistDetails) Size() int {
+func (m *ACLInterfaceEtypeWhitelistDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Count
size += 1 // m.NInput
@@ -499,21 +474,19 @@ func (m *ACLInterfaceEtypeWhitelistDetails) Size() int {
return size
}
func (m *ACLInterfaceEtypeWhitelistDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(len(m.Whitelist)))
- buf.EncodeUint8(uint8(m.NInput))
+ buf.EncodeUint8(m.NInput)
for i := 0; i < len(m.Whitelist); i++ {
var x uint16
if i < len(m.Whitelist) {
x = uint16(m.Whitelist[i])
}
- buf.EncodeUint16(uint16(x))
+ buf.EncodeUint16(x)
}
return buf.Bytes(), nil
}
@@ -543,21 +516,18 @@ func (*ACLInterfaceEtypeWhitelistDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLInterfaceEtypeWhitelistDump) Size() int {
+func (m *ACLInterfaceEtypeWhitelistDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *ACLInterfaceEtypeWhitelistDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -582,11 +552,10 @@ func (*ACLInterfaceListDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLInterfaceListDetails) Size() int {
+func (m *ACLInterfaceListDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Count
size += 1 // m.NInput
@@ -594,21 +563,19 @@ func (m *ACLInterfaceListDetails) Size() int {
return size
}
func (m *ACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(len(m.Acls)))
- buf.EncodeUint8(uint8(m.NInput))
+ buf.EncodeUint8(m.NInput)
for i := 0; i < len(m.Acls); i++ {
var x uint32
if i < len(m.Acls) {
x = uint32(m.Acls[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
@@ -626,7 +593,7 @@ func (m *ACLInterfaceListDetails) Unmarshal(b []byte) error {
// ACLInterfaceListDump defines message 'acl_interface_list_dump'.
type ACLInterfaceListDump struct {
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *ACLInterfaceListDump) Reset() { *m = ACLInterfaceListDump{} }
@@ -636,21 +603,18 @@ func (*ACLInterfaceListDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLInterfaceListDump) Size() int {
+func (m *ACLInterfaceListDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *ACLInterfaceListDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -675,11 +639,10 @@ func (*ACLInterfaceSetACLList) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLInterfaceSetACLList) Size() int {
+func (m *ACLInterfaceSetACLList) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Count
size += 1 // m.NInput
@@ -687,21 +650,19 @@ func (m *ACLInterfaceSetACLList) Size() int {
return size
}
func (m *ACLInterfaceSetACLList) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(len(m.Acls)))
- buf.EncodeUint8(uint8(m.NInput))
+ buf.EncodeUint8(m.NInput)
for i := 0; i < len(m.Acls); i++ {
var x uint32
if i < len(m.Acls) {
x = uint32(m.Acls[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
@@ -731,27 +692,24 @@ func (*ACLInterfaceSetACLListReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLInterfaceSetACLListReply) Size() int {
+func (m *ACLInterfaceSetACLListReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ACLInterfaceSetACLListReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ACLInterfaceSetACLListReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -772,11 +730,10 @@ func (*ACLInterfaceSetEtypeWhitelist) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLInterfaceSetEtypeWhitelist) Size() int {
+func (m *ACLInterfaceSetEtypeWhitelist) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Count
size += 1 // m.NInput
@@ -784,21 +741,19 @@ func (m *ACLInterfaceSetEtypeWhitelist) Size() int {
return size
}
func (m *ACLInterfaceSetEtypeWhitelist) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(len(m.Whitelist)))
- buf.EncodeUint8(uint8(m.NInput))
+ buf.EncodeUint8(m.NInput)
for i := 0; i < len(m.Whitelist); i++ {
var x uint16
if i < len(m.Whitelist) {
x = uint16(m.Whitelist[i])
}
- buf.EncodeUint16(uint16(x))
+ buf.EncodeUint16(x)
}
return buf.Bytes(), nil
}
@@ -828,27 +783,24 @@ func (*ACLInterfaceSetEtypeWhitelistReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLInterfaceSetEtypeWhitelistReply) Size() int {
+func (m *ACLInterfaceSetEtypeWhitelistReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ACLInterfaceSetEtypeWhitelistReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ACLInterfaceSetEtypeWhitelistReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -862,20 +814,17 @@ func (*ACLPluginControlPing) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLPluginControlPing) Size() int {
+func (m *ACLPluginControlPing) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ACLPluginControlPing) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ACLPluginControlPing) Unmarshal(b []byte) error {
@@ -896,31 +845,28 @@ func (*ACLPluginControlPingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLPluginControlPingReply) Size() int {
+func (m *ACLPluginControlPingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.ClientIndex
size += 4 // m.VpePID
return size
}
func (m *ACLPluginControlPingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.ClientIndex))
- buf.EncodeUint32(uint32(m.VpePID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.ClientIndex)
+ buf.EncodeUint32(m.VpePID)
return buf.Bytes(), nil
}
func (m *ACLPluginControlPingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ClientIndex = buf.DecodeUint32()
m.VpePID = buf.DecodeUint32()
return nil
@@ -938,20 +884,17 @@ func (*ACLPluginGetConnTableMaxEntries) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLPluginGetConnTableMaxEntries) Size() int {
+func (m *ACLPluginGetConnTableMaxEntries) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ACLPluginGetConnTableMaxEntries) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ACLPluginGetConnTableMaxEntries) Unmarshal(b []byte) error {
@@ -972,22 +915,19 @@ func (*ACLPluginGetConnTableMaxEntriesReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLPluginGetConnTableMaxEntriesReply) Size() int {
+func (m *ACLPluginGetConnTableMaxEntriesReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.ConnTableMaxEntries
return size
}
func (m *ACLPluginGetConnTableMaxEntriesReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint64(uint64(m.ConnTableMaxEntries))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint64(m.ConnTableMaxEntries)
return buf.Bytes(), nil
}
func (m *ACLPluginGetConnTableMaxEntriesReply) Unmarshal(b []byte) error {
@@ -1006,20 +946,17 @@ func (*ACLPluginGetVersion) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLPluginGetVersion) Size() int {
+func (m *ACLPluginGetVersion) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ACLPluginGetVersion) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ACLPluginGetVersion) Unmarshal(b []byte) error {
@@ -1039,24 +976,21 @@ func (*ACLPluginGetVersionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLPluginGetVersionReply) Size() int {
+func (m *ACLPluginGetVersionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Major
size += 4 // m.Minor
return size
}
func (m *ACLPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Major))
- buf.EncodeUint32(uint32(m.Minor))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Major)
+ buf.EncodeUint32(m.Minor)
return buf.Bytes(), nil
}
func (m *ACLPluginGetVersionReply) Unmarshal(b []byte) error {
@@ -1078,21 +1012,18 @@ func (*ACLStatsIntfCountersEnable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ACLStatsIntfCountersEnable) Size() int {
+func (m *ACLStatsIntfCountersEnable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
return size
}
func (m *ACLStatsIntfCountersEnable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
}
@@ -1116,27 +1047,24 @@ func (*ACLStatsIntfCountersEnableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ACLStatsIntfCountersEnableReply) Size() int {
+func (m *ACLStatsIntfCountersEnableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ACLStatsIntfCountersEnableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ACLStatsIntfCountersEnableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1154,11 +1082,10 @@ func (*MacipACLAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MacipACLAdd) Size() int {
+func (m *MacipACLAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Tag
size += 4 // m.Count
for j1 := 0; j1 < len(m.R); j1++ {
@@ -1177,16 +1104,14 @@ func (m *MacipACLAdd) Size() int {
return size
}
func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Tag, 64)
buf.EncodeUint32(uint32(len(m.R)))
for j0 := 0; j0 < len(m.R); j0++ {
- var v0 acl_types.MacipACLRule
+ var v0 acl_types.MacipACLRule // R
if j0 < len(m.R) {
v0 = m.R[j0]
}
@@ -1194,8 +1119,8 @@ func (m *MacipACLAdd) Marshal(b []byte) ([]byte, error) {
buf.EncodeBytes(v0.SrcMac[:], 6)
buf.EncodeBytes(v0.SrcMacMask[:], 6)
buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af))
- buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(v0.SrcPrefix.Len))
+ buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(v0.SrcPrefix.Len)
}
return buf.Bytes(), nil
}
@@ -1203,7 +1128,7 @@ func (m *MacipACLAdd) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Tag = buf.DecodeString(64)
m.Count = buf.DecodeUint32()
- m.R = make([]acl_types.MacipACLRule, int(m.Count))
+ m.R = make([]acl_types.MacipACLRule, m.Count)
for j0 := 0; j0 < len(m.R); j0++ {
m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8())
copy(m.R[j0].SrcMac[:], buf.DecodeBytes(6))
@@ -1217,7 +1142,7 @@ func (m *MacipACLAdd) Unmarshal(b []byte) error {
// MacipACLAddReplace defines message 'macip_acl_add_replace'.
type MacipACLAddReplace struct {
- ACLIndex uint32 `binapi:"u32,name=acl_index,default=%!s(float64=4.294967295e+09)" json:"acl_index,omitempty"`
+ ACLIndex uint32 `binapi:"u32,name=acl_index,default=4294967295" json:"acl_index,omitempty"`
Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"`
Count uint32 `binapi:"u32,name=count" json:"-"`
R []acl_types.MacipACLRule `binapi:"macip_acl_rule[count],name=r" json:"r,omitempty"`
@@ -1230,11 +1155,10 @@ func (*MacipACLAddReplace) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MacipACLAddReplace) Size() int {
+func (m *MacipACLAddReplace) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
size += 64 // m.Tag
size += 4 // m.Count
@@ -1254,17 +1178,15 @@ func (m *MacipACLAddReplace) Size() int {
return size
}
func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
buf.EncodeString(m.Tag, 64)
buf.EncodeUint32(uint32(len(m.R)))
for j0 := 0; j0 < len(m.R); j0++ {
- var v0 acl_types.MacipACLRule
+ var v0 acl_types.MacipACLRule // R
if j0 < len(m.R) {
v0 = m.R[j0]
}
@@ -1272,8 +1194,8 @@ func (m *MacipACLAddReplace) Marshal(b []byte) ([]byte, error) {
buf.EncodeBytes(v0.SrcMac[:], 6)
buf.EncodeBytes(v0.SrcMacMask[:], 6)
buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af))
- buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(v0.SrcPrefix.Len))
+ buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(v0.SrcPrefix.Len)
}
return buf.Bytes(), nil
}
@@ -1282,7 +1204,7 @@ func (m *MacipACLAddReplace) Unmarshal(b []byte) error {
m.ACLIndex = buf.DecodeUint32()
m.Tag = buf.DecodeString(64)
m.Count = buf.DecodeUint32()
- m.R = make([]acl_types.MacipACLRule, int(m.Count))
+ m.R = make([]acl_types.MacipACLRule, m.Count)
for j0 := 0; j0 < len(m.R); j0++ {
m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8())
copy(m.R[j0].SrcMac[:], buf.DecodeBytes(6))
@@ -1307,30 +1229,27 @@ func (*MacipACLAddReplaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MacipACLAddReplaceReply) Size() int {
+func (m *MacipACLAddReplaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
size += 4 // m.Retval
return size
}
func (m *MacipACLAddReplaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MacipACLAddReplaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.ACLIndex = buf.DecodeUint32()
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1347,30 +1266,27 @@ func (*MacipACLAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MacipACLAddReply) Size() int {
+func (m *MacipACLAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
size += 4 // m.Retval
return size
}
func (m *MacipACLAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MacipACLAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.ACLIndex = buf.DecodeUint32()
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1386,22 +1302,19 @@ func (*MacipACLDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MacipACLDel) Size() int {
+func (m *MacipACLDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
return size
}
func (m *MacipACLDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
return buf.Bytes(), nil
}
func (m *MacipACLDel) Unmarshal(b []byte) error {
@@ -1422,27 +1335,24 @@ func (*MacipACLDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MacipACLDelReply) Size() int {
+func (m *MacipACLDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MacipACLDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MacipACLDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1461,11 +1371,10 @@ func (*MacipACLDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MacipACLDetails) Size() int {
+func (m *MacipACLDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
size += 64 // m.Tag
size += 4 // m.Count
@@ -1485,17 +1394,15 @@ func (m *MacipACLDetails) Size() int {
return size
}
func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
buf.EncodeString(m.Tag, 64)
buf.EncodeUint32(uint32(len(m.R)))
for j0 := 0; j0 < len(m.R); j0++ {
- var v0 acl_types.MacipACLRule
+ var v0 acl_types.MacipACLRule // R
if j0 < len(m.R) {
v0 = m.R[j0]
}
@@ -1503,8 +1410,8 @@ func (m *MacipACLDetails) Marshal(b []byte) ([]byte, error) {
buf.EncodeBytes(v0.SrcMac[:], 6)
buf.EncodeBytes(v0.SrcMacMask[:], 6)
buf.EncodeUint8(uint8(v0.SrcPrefix.Address.Af))
- buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(v0.SrcPrefix.Len))
+ buf.EncodeBytes(v0.SrcPrefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(v0.SrcPrefix.Len)
}
return buf.Bytes(), nil
}
@@ -1513,7 +1420,7 @@ func (m *MacipACLDetails) Unmarshal(b []byte) error {
m.ACLIndex = buf.DecodeUint32()
m.Tag = buf.DecodeString(64)
m.Count = buf.DecodeUint32()
- m.R = make([]acl_types.MacipACLRule, int(m.Count))
+ m.R = make([]acl_types.MacipACLRule, m.Count)
for j0 := 0; j0 < len(m.R); j0++ {
m.R[j0].IsPermit = acl_types.ACLAction(buf.DecodeUint8())
copy(m.R[j0].SrcMac[:], buf.DecodeBytes(6))
@@ -1527,7 +1434,7 @@ func (m *MacipACLDetails) Unmarshal(b []byte) error {
// MacipACLDump defines message 'macip_acl_dump'.
type MacipACLDump struct {
- ACLIndex uint32 `binapi:"u32,name=acl_index,default=%!s(float64=4.294967295e+09)" json:"acl_index,omitempty"`
+ ACLIndex uint32 `binapi:"u32,name=acl_index,default=4294967295" json:"acl_index,omitempty"`
}
func (m *MacipACLDump) Reset() { *m = MacipACLDump{} }
@@ -1537,22 +1444,19 @@ func (*MacipACLDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MacipACLDump) Size() int {
+func (m *MacipACLDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ACLIndex
return size
}
func (m *MacipACLDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ACLIndex)
return buf.Bytes(), nil
}
func (m *MacipACLDump) Unmarshal(b []byte) error {
@@ -1575,26 +1479,23 @@ func (*MacipACLInterfaceAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MacipACLInterfaceAddDel) Size() int {
+func (m *MacipACLInterfaceAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SwIfIndex
size += 4 // m.ACLIndex
return size
}
func (m *MacipACLInterfaceAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.ACLIndex))
+ buf.EncodeUint32(m.ACLIndex)
return buf.Bytes(), nil
}
func (m *MacipACLInterfaceAddDel) Unmarshal(b []byte) error {
@@ -1619,27 +1520,24 @@ func (*MacipACLInterfaceAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MacipACLInterfaceAddDelReply) Size() int {
+func (m *MacipACLInterfaceAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MacipACLInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MacipACLInterfaceAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1653,20 +1551,17 @@ func (*MacipACLInterfaceGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MacipACLInterfaceGet) Size() int {
+func (m *MacipACLInterfaceGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *MacipACLInterfaceGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *MacipACLInterfaceGet) Unmarshal(b []byte) error {
@@ -1686,29 +1581,26 @@ func (*MacipACLInterfaceGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MacipACLInterfaceGetReply) Size() int {
+func (m *MacipACLInterfaceGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Count
size += 4 * len(m.Acls) // m.Acls
return size
}
func (m *MacipACLInterfaceGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(len(m.Acls)))
for i := 0; i < len(m.Acls); i++ {
var x uint32
if i < len(m.Acls) {
x = uint32(m.Acls[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
@@ -1738,23 +1630,20 @@ func (*MacipACLInterfaceListDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MacipACLInterfaceListDetails) Size() int {
+func (m *MacipACLInterfaceListDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Count
size += 4 * len(m.Acls) // m.Acls
return size
}
func (m *MacipACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(len(m.Acls)))
for i := 0; i < len(m.Acls); i++ {
@@ -1762,7 +1651,7 @@ func (m *MacipACLInterfaceListDetails) Marshal(b []byte) ([]byte, error) {
if i < len(m.Acls) {
x = uint32(m.Acls[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
@@ -1789,21 +1678,18 @@ func (*MacipACLInterfaceListDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MacipACLInterfaceListDump) Size() int {
+func (m *MacipACLInterfaceListDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *MacipACLInterfaceListDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
diff --git a/binapi/af_packet/af_packet.ba.go b/binapi/af_packet/af_packet.ba.go
index 646636e..750e2ce 100644
--- a/binapi/af_packet/af_packet.ba.go
+++ b/binapi/af_packet/af_packet.ba.go
@@ -44,23 +44,20 @@ func (*AfPacketCreate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AfPacketCreate) Size() int {
+func (m *AfPacketCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 6 // m.HwAddr
size += 1 // m.UseRandomHwAddr
size += 64 // m.HostIfName
return size
}
func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.HwAddr[:], 6)
buf.EncodeBool(m.UseRandomHwAddr)
buf.EncodeString(m.HostIfName, 64)
@@ -87,29 +84,26 @@ func (*AfPacketCreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AfPacketCreateReply) Size() int {
+func (m *AfPacketCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *AfPacketCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -126,21 +120,18 @@ func (*AfPacketDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AfPacketDelete) Size() int {
+func (m *AfPacketDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.HostIfName
return size
}
func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.HostIfName, 64)
return buf.Bytes(), nil
}
@@ -162,27 +153,24 @@ func (*AfPacketDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AfPacketDeleteReply) Size() int {
+func (m *AfPacketDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *AfPacketDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -199,22 +187,19 @@ func (*AfPacketDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AfPacketDetails) Size() int {
+func (m *AfPacketDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 64 // m.HostIfName
return size
}
func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeString(m.HostIfName, 64)
return buf.Bytes(), nil
@@ -236,20 +221,17 @@ func (*AfPacketDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AfPacketDump) Size() int {
+func (m *AfPacketDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *AfPacketDump) Unmarshal(b []byte) error {
@@ -269,22 +251,19 @@ func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AfPacketSetL4CksumOffload) Size() int {
+func (m *AfPacketSetL4CksumOffload) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Set
return size
}
func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Set)
return buf.Bytes(), nil
@@ -310,27 +289,24 @@ func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AfPacketSetL4CksumOffloadReply) Size() int {
+func (m *AfPacketSetL4CksumOffloadReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/arp/arp.ba.go b/binapi/arp/arp.ba.go
index deb5180..90ff55b 100644
--- a/binapi/arp/arp.ba.go
+++ b/binapi/arp/arp.ba.go
@@ -52,11 +52,10 @@ func (*ProxyArpAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ProxyArpAddDel) Size() int {
+func (m *ProxyArpAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Proxy.TableID
size += 1 * 4 // m.Proxy.Low
@@ -64,14 +63,12 @@ func (m *ProxyArpAddDel) Size() int {
return size
}
func (m *ProxyArpAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Proxy.TableID))
+ buf.EncodeUint32(m.Proxy.TableID)
buf.EncodeBytes(m.Proxy.Low[:], 4)
buf.EncodeBytes(m.Proxy.Hi[:], 4)
return buf.Bytes(), nil
@@ -97,27 +94,24 @@ func (*ProxyArpAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ProxyArpAddDelReply) Size() int {
+func (m *ProxyArpAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ProxyArpAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ProxyArpAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -133,24 +127,21 @@ func (*ProxyArpDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ProxyArpDetails) Size() int {
+func (m *ProxyArpDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Proxy.TableID
size += 1 * 4 // m.Proxy.Low
size += 1 * 4 // m.Proxy.Hi
return size
}
func (m *ProxyArpDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Proxy.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Proxy.TableID)
buf.EncodeBytes(m.Proxy.Low[:], 4)
buf.EncodeBytes(m.Proxy.Hi[:], 4)
return buf.Bytes(), nil
@@ -173,20 +164,17 @@ func (*ProxyArpDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ProxyArpDump) Size() int {
+func (m *ProxyArpDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ProxyArpDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ProxyArpDump) Unmarshal(b []byte) error {
@@ -205,22 +193,19 @@ func (*ProxyArpIntfcDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ProxyArpIntfcDetails) Size() int {
+func (m *ProxyArpIntfcDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *ProxyArpIntfcDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SwIfIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SwIfIndex)
return buf.Bytes(), nil
}
func (m *ProxyArpIntfcDetails) Unmarshal(b []byte) error {
@@ -239,20 +224,17 @@ func (*ProxyArpIntfcDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ProxyArpIntfcDump) Size() int {
+func (m *ProxyArpIntfcDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ProxyArpIntfcDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ProxyArpIntfcDump) Unmarshal(b []byte) error {
@@ -272,22 +254,19 @@ func (*ProxyArpIntfcEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ProxyArpIntfcEnableDisable) Size() int {
+func (m *ProxyArpIntfcEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Enable
return size
}
func (m *ProxyArpIntfcEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
@@ -313,27 +292,24 @@ func (*ProxyArpIntfcEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ProxyArpIntfcEnableDisableReply) Size() int {
+func (m *ProxyArpIntfcEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ProxyArpIntfcEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ProxyArpIntfcEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/avf/avf.ba.go b/binapi/avf/avf.ba.go
index 436223b..edfa26e 100644
--- a/binapi/avf/avf.ba.go
+++ b/binapi/avf/avf.ba.go
@@ -45,11 +45,10 @@ func (*AvfCreate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AvfCreate) Size() int {
+func (m *AvfCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PciAddr
size += 4 // m.EnableElog
size += 2 // m.RxqNum
@@ -58,23 +57,21 @@ func (m *AvfCreate) Size() int {
return size
}
func (m *AvfCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PciAddr))
- buf.EncodeUint32(uint32(m.EnableElog))
- buf.EncodeUint16(uint16(m.RxqNum))
- buf.EncodeUint16(uint16(m.RxqSize))
- buf.EncodeUint16(uint16(m.TxqSize))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PciAddr)
+ buf.EncodeInt32(m.EnableElog)
+ buf.EncodeUint16(m.RxqNum)
+ buf.EncodeUint16(m.RxqSize)
+ buf.EncodeUint16(m.TxqSize)
return buf.Bytes(), nil
}
func (m *AvfCreate) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.PciAddr = buf.DecodeUint32()
- m.EnableElog = int32(buf.DecodeUint32())
+ m.EnableElog = buf.DecodeInt32()
m.RxqNum = buf.DecodeUint16()
m.RxqSize = buf.DecodeUint16()
m.TxqSize = buf.DecodeUint16()
@@ -94,29 +91,26 @@ func (*AvfCreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AvfCreateReply) Size() int {
+func (m *AvfCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *AvfCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *AvfCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -133,21 +127,18 @@ func (*AvfDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AvfDelete) Size() int {
+func (m *AvfDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *AvfDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -169,27 +160,24 @@ func (*AvfDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AvfDeleteReply) Size() int {
+func (m *AvfDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *AvfDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *AvfDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/bfd/bfd.ba.go b/binapi/bfd/bfd.ba.go
index 2b4f5f0..b8b2820 100644
--- a/binapi/bfd/bfd.ba.go
+++ b/binapi/bfd/bfd.ba.go
@@ -77,22 +77,19 @@ func (*BfdAuthDelKey) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdAuthDelKey) Size() int {
+func (m *BfdAuthDelKey) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ConfKeyID
return size
}
func (m *BfdAuthDelKey) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ConfKeyID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ConfKeyID)
return buf.Bytes(), nil
}
func (m *BfdAuthDelKey) Unmarshal(b []byte) error {
@@ -113,27 +110,24 @@ func (*BfdAuthDelKeyReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdAuthDelKeyReply) Size() int {
+func (m *BfdAuthDelKeyReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdAuthDelKeyReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdAuthDelKeyReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -151,26 +145,23 @@ func (*BfdAuthKeysDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdAuthKeysDetails) Size() int {
+func (m *BfdAuthKeysDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ConfKeyID
size += 4 // m.UseCount
size += 1 // m.AuthType
return size
}
func (m *BfdAuthKeysDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ConfKeyID))
- buf.EncodeUint32(uint32(m.UseCount))
- buf.EncodeUint8(uint8(m.AuthType))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ConfKeyID)
+ buf.EncodeUint32(m.UseCount)
+ buf.EncodeUint8(m.AuthType)
return buf.Bytes(), nil
}
func (m *BfdAuthKeysDetails) Unmarshal(b []byte) error {
@@ -191,20 +182,17 @@ func (*BfdAuthKeysDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdAuthKeysDump) Size() int {
+func (m *BfdAuthKeysDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *BfdAuthKeysDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *BfdAuthKeysDump) Unmarshal(b []byte) error {
@@ -226,11 +214,10 @@ func (*BfdAuthSetKey) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdAuthSetKey) Size() int {
+func (m *BfdAuthSetKey) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ConfKeyID
size += 1 // m.KeyLen
size += 1 // m.AuthType
@@ -238,16 +225,14 @@ func (m *BfdAuthSetKey) Size() int {
return size
}
func (m *BfdAuthSetKey) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ConfKeyID))
- buf.EncodeUint8(uint8(m.KeyLen))
- buf.EncodeUint8(uint8(m.AuthType))
- buf.EncodeBytes(m.Key[:], 20)
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ConfKeyID)
+ buf.EncodeUint8(m.KeyLen)
+ buf.EncodeUint8(m.AuthType)
+ buf.EncodeBytes(m.Key, 20)
return buf.Bytes(), nil
}
func (m *BfdAuthSetKey) Unmarshal(b []byte) error {
@@ -255,7 +240,8 @@ func (m *BfdAuthSetKey) Unmarshal(b []byte) error {
m.ConfKeyID = buf.DecodeUint32()
m.KeyLen = buf.DecodeUint8()
m.AuthType = buf.DecodeUint8()
- copy(m.Key[:], buf.DecodeBytes(20))
+ m.Key = make([]byte, 20)
+ copy(m.Key, buf.DecodeBytes(len(m.Key)))
return nil
}
@@ -271,27 +257,24 @@ func (*BfdAuthSetKeyReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdAuthSetKeyReply) Size() int {
+func (m *BfdAuthSetKeyReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdAuthSetKeyReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdAuthSetKeyReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -315,11 +298,10 @@ func (*BfdUDPAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPAdd) Size() int {
+func (m *BfdUDPAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.DesiredMinTx
size += 4 // m.RequiredMinRx
@@ -334,23 +316,21 @@ func (m *BfdUDPAdd) Size() int {
return size
}
func (m *BfdUDPAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.DesiredMinTx))
- buf.EncodeUint32(uint32(m.RequiredMinRx))
+ buf.EncodeUint32(m.DesiredMinTx)
+ buf.EncodeUint32(m.RequiredMinRx)
buf.EncodeUint8(uint8(m.LocalAddr.Af))
- buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.PeerAddr.Af))
- buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.DetectMult))
+ buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.DetectMult)
buf.EncodeBool(m.IsAuthenticated)
- buf.EncodeUint8(uint8(m.BfdKeyID))
- buf.EncodeUint32(uint32(m.ConfKeyID))
+ buf.EncodeUint8(m.BfdKeyID)
+ buf.EncodeUint32(m.ConfKeyID)
return buf.Bytes(), nil
}
func (m *BfdUDPAdd) Unmarshal(b []byte) error {
@@ -381,27 +361,24 @@ func (*BfdUDPAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPAddReply) Size() int {
+func (m *BfdUDPAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdUDPAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdUDPAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -422,11 +399,10 @@ func (*BfdUDPAuthActivate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPAuthActivate) Size() int {
+func (m *BfdUDPAuthActivate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.LocalAddr.Af
size += 1 * 16 // m.LocalAddr.Un
@@ -438,20 +414,18 @@ func (m *BfdUDPAuthActivate) Size() int {
return size
}
func (m *BfdUDPAuthActivate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.LocalAddr.Af))
- buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.PeerAddr.Af))
- buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16)
buf.EncodeBool(m.IsDelayed)
- buf.EncodeUint8(uint8(m.BfdKeyID))
- buf.EncodeUint32(uint32(m.ConfKeyID))
+ buf.EncodeUint8(m.BfdKeyID)
+ buf.EncodeUint32(m.ConfKeyID)
return buf.Bytes(), nil
}
func (m *BfdUDPAuthActivate) Unmarshal(b []byte) error {
@@ -479,27 +453,24 @@ func (*BfdUDPAuthActivateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPAuthActivateReply) Size() int {
+func (m *BfdUDPAuthActivateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdUDPAuthActivateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdUDPAuthActivateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -518,11 +489,10 @@ func (*BfdUDPAuthDeactivate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPAuthDeactivate) Size() int {
+func (m *BfdUDPAuthDeactivate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.LocalAddr.Af
size += 1 * 16 // m.LocalAddr.Un
@@ -532,17 +502,15 @@ func (m *BfdUDPAuthDeactivate) Size() int {
return size
}
func (m *BfdUDPAuthDeactivate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.LocalAddr.Af))
- buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.PeerAddr.Af))
- buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16)
buf.EncodeBool(m.IsDelayed)
return buf.Bytes(), nil
}
@@ -569,27 +537,24 @@ func (*BfdUDPAuthDeactivateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPAuthDeactivateReply) Size() int {
+func (m *BfdUDPAuthDeactivateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdUDPAuthDeactivateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdUDPAuthDeactivateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -607,11 +572,10 @@ func (*BfdUDPDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPDel) Size() int {
+func (m *BfdUDPDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.LocalAddr.Af
size += 1 * 16 // m.LocalAddr.Un
@@ -620,17 +584,15 @@ func (m *BfdUDPDel) Size() int {
return size
}
func (m *BfdUDPDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.LocalAddr.Af))
- buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.PeerAddr.Af))
- buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *BfdUDPDel) Unmarshal(b []byte) error {
@@ -653,20 +615,17 @@ func (*BfdUDPDelEchoSource) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPDelEchoSource) Size() int {
+func (m *BfdUDPDelEchoSource) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *BfdUDPDelEchoSource) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *BfdUDPDelEchoSource) Unmarshal(b []byte) error {
@@ -685,27 +644,24 @@ func (*BfdUDPDelEchoSourceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPDelEchoSourceReply) Size() int {
+func (m *BfdUDPDelEchoSourceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdUDPDelEchoSourceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdUDPDelEchoSourceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -721,27 +677,24 @@ func (*BfdUDPDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPDelReply) Size() int {
+func (m *BfdUDPDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdUDPDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdUDPDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -755,20 +708,17 @@ func (*BfdUDPGetEchoSource) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPGetEchoSource) Size() int {
+func (m *BfdUDPGetEchoSource) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *BfdUDPGetEchoSource) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *BfdUDPGetEchoSource) Unmarshal(b []byte) error {
@@ -793,11 +743,10 @@ func (*BfdUDPGetEchoSourceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPGetEchoSourceReply) Size() int {
+func (m *BfdUDPGetEchoSourceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
size += 1 // m.IsSet
@@ -808,13 +757,11 @@ func (m *BfdUDPGetEchoSourceReply) Size() int {
return size
}
func (m *BfdUDPGetEchoSourceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsSet)
buf.EncodeBool(m.HaveUsableIP4)
@@ -825,7 +772,7 @@ func (m *BfdUDPGetEchoSourceReply) Marshal(b []byte) ([]byte, error) {
}
func (m *BfdUDPGetEchoSourceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.IsSet = buf.DecodeBool()
m.HaveUsableIP4 = buf.DecodeBool()
@@ -852,11 +799,10 @@ func (*BfdUDPMod) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPMod) Size() int {
+func (m *BfdUDPMod) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.DesiredMinTx
size += 4 // m.RequiredMinRx
@@ -868,20 +814,18 @@ func (m *BfdUDPMod) Size() int {
return size
}
func (m *BfdUDPMod) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.DesiredMinTx))
- buf.EncodeUint32(uint32(m.RequiredMinRx))
+ buf.EncodeUint32(m.DesiredMinTx)
+ buf.EncodeUint32(m.RequiredMinRx)
buf.EncodeUint8(uint8(m.LocalAddr.Af))
- buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.PeerAddr.Af))
- buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.DetectMult))
+ buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.DetectMult)
return buf.Bytes(), nil
}
func (m *BfdUDPMod) Unmarshal(b []byte) error {
@@ -909,27 +853,24 @@ func (*BfdUDPModReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPModReply) Size() int {
+func (m *BfdUDPModReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdUDPModReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdUDPModReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -954,11 +895,10 @@ func (*BfdUDPSessionDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPSessionDetails) Size() int {
+func (m *BfdUDPSessionDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.LocalAddr.Af
size += 1 * 16 // m.LocalAddr.Un
@@ -974,24 +914,22 @@ func (m *BfdUDPSessionDetails) Size() int {
return size
}
func (m *BfdUDPSessionDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.LocalAddr.Af))
- buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.PeerAddr.Af))
- buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.State))
buf.EncodeBool(m.IsAuthenticated)
- buf.EncodeUint8(uint8(m.BfdKeyID))
- buf.EncodeUint32(uint32(m.ConfKeyID))
- buf.EncodeUint32(uint32(m.RequiredMinRx))
- buf.EncodeUint32(uint32(m.DesiredMinTx))
- buf.EncodeUint8(uint8(m.DetectMult))
+ buf.EncodeUint8(m.BfdKeyID)
+ buf.EncodeUint32(m.ConfKeyID)
+ buf.EncodeUint32(m.RequiredMinRx)
+ buf.EncodeUint32(m.DesiredMinTx)
+ buf.EncodeUint8(m.DetectMult)
return buf.Bytes(), nil
}
func (m *BfdUDPSessionDetails) Unmarshal(b []byte) error {
@@ -1021,20 +959,17 @@ func (*BfdUDPSessionDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPSessionDump) Size() int {
+func (m *BfdUDPSessionDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *BfdUDPSessionDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *BfdUDPSessionDump) Unmarshal(b []byte) error {
@@ -1056,11 +991,10 @@ func (*BfdUDPSessionSetFlags) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPSessionSetFlags) Size() int {
+func (m *BfdUDPSessionSetFlags) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.LocalAddr.Af
size += 1 * 16 // m.LocalAddr.Un
@@ -1070,17 +1004,15 @@ func (m *BfdUDPSessionSetFlags) Size() int {
return size
}
func (m *BfdUDPSessionSetFlags) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.LocalAddr.Af))
- buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LocalAddr.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.PeerAddr.Af))
- buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.PeerAddr.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.Flags))
return buf.Bytes(), nil
}
@@ -1107,27 +1039,24 @@ func (*BfdUDPSessionSetFlagsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPSessionSetFlagsReply) Size() int {
+func (m *BfdUDPSessionSetFlagsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdUDPSessionSetFlagsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdUDPSessionSetFlagsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1143,21 +1072,18 @@ func (*BfdUDPSetEchoSource) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BfdUDPSetEchoSource) Size() int {
+func (m *BfdUDPSetEchoSource) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *BfdUDPSetEchoSource) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -1179,27 +1105,24 @@ func (*BfdUDPSetEchoSourceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BfdUDPSetEchoSourceReply) Size() int {
+func (m *BfdUDPSetEchoSourceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BfdUDPSetEchoSourceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BfdUDPSetEchoSourceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1216,24 +1139,21 @@ func (*WantBfdEvents) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *WantBfdEvents) Size() int {
+func (m *WantBfdEvents) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
size += 4 // m.PID
return size
}
func (m *WantBfdEvents) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
- buf.EncodeUint32(uint32(m.PID))
+ buf.EncodeUint32(m.PID)
return buf.Bytes(), nil
}
func (m *WantBfdEvents) Unmarshal(b []byte) error {
@@ -1255,27 +1175,24 @@ func (*WantBfdEventsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *WantBfdEventsReply) Size() int {
+func (m *WantBfdEventsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *WantBfdEventsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *WantBfdEventsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/bier/bier.ba.go b/binapi/bier/bier.ba.go
index 456e25c..f024d80 100644
--- a/binapi/bier/bier.ba.go
+++ b/binapi/bier/bier.ba.go
@@ -63,11 +63,10 @@ func (*BierDispEntryAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierDispEntryAddDel) Size() int {
+func (m *BierDispEntryAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.BdeBp
size += 4 // m.BdeTblID
size += 1 // m.BdeIsAdd
@@ -93,58 +92,47 @@ func (m *BierDispEntryAddDel) Size() int {
size += 4 // s1.Nh.ClassifyTableIndex
size += 1 // s1.NLabels
for j2 := 0; j2 < 16; j2++ {
- var s2 fib_types.FibMplsLabel
- _ = s2
- if j2 < len(s1.LabelStack) {
- s2 = s1.LabelStack[j2]
- }
- size += 1 // s2.IsUniform
- size += 4 // s2.Label
- size += 1 // s2.TTL
- size += 1 // s2.Exp
+ size += 1 // s1.LabelStack[j2].IsUniform
+ size += 4 // s1.LabelStack[j2].Label
+ size += 1 // s1.LabelStack[j2].TTL
+ size += 1 // s1.LabelStack[j2].Exp
}
}
return size
}
func (m *BierDispEntryAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.BdeBp))
- buf.EncodeUint32(uint32(m.BdeTblID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.BdeBp)
+ buf.EncodeUint32(m.BdeTblID)
buf.EncodeBool(m.BdeIsAdd)
- buf.EncodeUint8(uint8(m.BdePayloadProto))
+ buf.EncodeUint8(m.BdePayloadProto)
buf.EncodeUint8(uint8(len(m.BdePaths)))
for j0 := 0; j0 < len(m.BdePaths); j0++ {
- var v0 fib_types.FibPath
+ var v0 fib_types.FibPath // BdePaths
if j0 < len(m.BdePaths) {
v0 = m.BdePaths[j0]
}
- buf.EncodeUint32(uint32(v0.SwIfIndex))
- buf.EncodeUint32(uint32(v0.TableID))
- buf.EncodeUint32(uint32(v0.RpfID))
- buf.EncodeUint8(uint8(v0.Weight))
- buf.EncodeUint8(uint8(v0.Preference))
+ buf.EncodeUint32(v0.SwIfIndex)
+ buf.EncodeUint32(v0.TableID)
+ buf.EncodeUint32(v0.RpfID)
+ buf.EncodeUint8(v0.Weight)
+ buf.EncodeUint8(v0.Preference)
buf.EncodeUint32(uint32(v0.Type))
buf.EncodeUint32(uint32(v0.Flags))
buf.EncodeUint32(uint32(v0.Proto))
- buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v0.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v0.Nh.ObjID))
- buf.EncodeUint32(uint32(v0.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v0.NLabels))
+ buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v0.Nh.ViaLabel)
+ buf.EncodeUint32(v0.Nh.ObjID)
+ buf.EncodeUint32(v0.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v0.NLabels)
for j1 := 0; j1 < 16; j1++ {
- var v1 fib_types.FibMplsLabel
- if j1 < len(v0.LabelStack) {
- v1 = v0.LabelStack[j1]
- }
- buf.EncodeUint8(uint8(v1.IsUniform))
- buf.EncodeUint32(uint32(v1.Label))
- buf.EncodeUint8(uint8(v1.TTL))
- buf.EncodeUint8(uint8(v1.Exp))
+ buf.EncodeUint8(v0.LabelStack[j1].IsUniform)
+ buf.EncodeUint32(v0.LabelStack[j1].Label)
+ buf.EncodeUint8(v0.LabelStack[j1].TTL)
+ buf.EncodeUint8(v0.LabelStack[j1].Exp)
}
}
return buf.Bytes(), nil
@@ -156,7 +144,7 @@ func (m *BierDispEntryAddDel) Unmarshal(b []byte) error {
m.BdeIsAdd = buf.DecodeBool()
m.BdePayloadProto = buf.DecodeUint8()
m.BdeNPaths = buf.DecodeUint8()
- m.BdePaths = make([]fib_types.FibPath, int(m.BdeNPaths))
+ m.BdePaths = make([]fib_types.FibPath, m.BdeNPaths)
for j0 := 0; j0 < len(m.BdePaths); j0++ {
m.BdePaths[j0].SwIfIndex = buf.DecodeUint32()
m.BdePaths[j0].TableID = buf.DecodeUint32()
@@ -193,27 +181,24 @@ func (*BierDispEntryAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierDispEntryAddDelReply) Size() int {
+func (m *BierDispEntryAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BierDispEntryAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BierDispEntryAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -234,11 +219,10 @@ func (*BierDispEntryDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierDispEntryDetails) Size() int {
+func (m *BierDispEntryDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.BdeBp
size += 4 // m.BdeTblID
size += 1 // m.BdeIsAdd
@@ -264,58 +248,47 @@ func (m *BierDispEntryDetails) Size() int {
size += 4 // s1.Nh.ClassifyTableIndex
size += 1 // s1.NLabels
for j2 := 0; j2 < 16; j2++ {
- var s2 fib_types.FibMplsLabel
- _ = s2
- if j2 < len(s1.LabelStack) {
- s2 = s1.LabelStack[j2]
- }
- size += 1 // s2.IsUniform
- size += 4 // s2.Label
- size += 1 // s2.TTL
- size += 1 // s2.Exp
+ size += 1 // s1.LabelStack[j2].IsUniform
+ size += 4 // s1.LabelStack[j2].Label
+ size += 1 // s1.LabelStack[j2].TTL
+ size += 1 // s1.LabelStack[j2].Exp
}
}
return size
}
func (m *BierDispEntryDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.BdeBp))
- buf.EncodeUint32(uint32(m.BdeTblID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.BdeBp)
+ buf.EncodeUint32(m.BdeTblID)
buf.EncodeBool(m.BdeIsAdd)
- buf.EncodeUint8(uint8(m.BdePayloadProto))
+ buf.EncodeUint8(m.BdePayloadProto)
buf.EncodeUint8(uint8(len(m.BdePaths)))
for j0 := 0; j0 < len(m.BdePaths); j0++ {
- var v0 fib_types.FibPath
+ var v0 fib_types.FibPath // BdePaths
if j0 < len(m.BdePaths) {
v0 = m.BdePaths[j0]
}
- buf.EncodeUint32(uint32(v0.SwIfIndex))
- buf.EncodeUint32(uint32(v0.TableID))
- buf.EncodeUint32(uint32(v0.RpfID))
- buf.EncodeUint8(uint8(v0.Weight))
- buf.EncodeUint8(uint8(v0.Preference))
+ buf.EncodeUint32(v0.SwIfIndex)
+ buf.EncodeUint32(v0.TableID)
+ buf.EncodeUint32(v0.RpfID)
+ buf.EncodeUint8(v0.Weight)
+ buf.EncodeUint8(v0.Preference)
buf.EncodeUint32(uint32(v0.Type))
buf.EncodeUint32(uint32(v0.Flags))
buf.EncodeUint32(uint32(v0.Proto))
- buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v0.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v0.Nh.ObjID))
- buf.EncodeUint32(uint32(v0.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v0.NLabels))
+ buf.EncodeBytes(v0.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v0.Nh.ViaLabel)
+ buf.EncodeUint32(v0.Nh.ObjID)
+ buf.EncodeUint32(v0.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v0.NLabels)
for j1 := 0; j1 < 16; j1++ {
- var v1 fib_types.FibMplsLabel
- if j1 < len(v0.LabelStack) {
- v1 = v0.LabelStack[j1]
- }
- buf.EncodeUint8(uint8(v1.IsUniform))
- buf.EncodeUint32(uint32(v1.Label))
- buf.EncodeUint8(uint8(v1.TTL))
- buf.EncodeUint8(uint8(v1.Exp))
+ buf.EncodeUint8(v0.LabelStack[j1].IsUniform)
+ buf.EncodeUint32(v0.LabelStack[j1].Label)
+ buf.EncodeUint8(v0.LabelStack[j1].TTL)
+ buf.EncodeUint8(v0.LabelStack[j1].Exp)
}
}
return buf.Bytes(), nil
@@ -327,7 +300,7 @@ func (m *BierDispEntryDetails) Unmarshal(b []byte) error {
m.BdeIsAdd = buf.DecodeBool()
m.BdePayloadProto = buf.DecodeUint8()
m.BdeNPaths = buf.DecodeUint8()
- m.BdePaths = make([]fib_types.FibPath, int(m.BdeNPaths))
+ m.BdePaths = make([]fib_types.FibPath, m.BdeNPaths)
for j0 := 0; j0 < len(m.BdePaths); j0++ {
m.BdePaths[j0].SwIfIndex = buf.DecodeUint32()
m.BdePaths[j0].TableID = buf.DecodeUint32()
@@ -364,22 +337,19 @@ func (*BierDispEntryDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierDispEntryDump) Size() int {
+func (m *BierDispEntryDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdeTblID
return size
}
func (m *BierDispEntryDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdeTblID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdeTblID)
return buf.Bytes(), nil
}
func (m *BierDispEntryDump) Unmarshal(b []byte) error {
@@ -401,23 +371,20 @@ func (*BierDispTableAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierDispTableAddDel) Size() int {
+func (m *BierDispTableAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdtTblID
size += 1 // m.BdtIsAdd
return size
}
func (m *BierDispTableAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdtTblID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdtTblID)
buf.EncodeBool(m.BdtIsAdd)
return buf.Bytes(), nil
}
@@ -440,27 +407,24 @@ func (*BierDispTableAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierDispTableAddDelReply) Size() int {
+func (m *BierDispTableAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BierDispTableAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BierDispTableAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -476,22 +440,19 @@ func (*BierDispTableDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierDispTableDetails) Size() int {
+func (m *BierDispTableDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdtTblID
return size
}
func (m *BierDispTableDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdtTblID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdtTblID)
return buf.Bytes(), nil
}
func (m *BierDispTableDetails) Unmarshal(b []byte) error {
@@ -510,20 +471,17 @@ func (*BierDispTableDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierDispTableDump) Size() int {
+func (m *BierDispTableDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *BierDispTableDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *BierDispTableDump) Unmarshal(b []byte) error {
@@ -545,11 +503,10 @@ func (*BierImpAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierImpAdd) Size() int {
+func (m *BierImpAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.BiTblID.BtSet
size += 1 // m.BiTblID.BtSubDomain
size += 1 // m.BiTblID.BtHdrLenID
@@ -559,18 +516,16 @@ func (m *BierImpAdd) Size() int {
return size
}
func (m *BierImpAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.BiTblID.BtSet))
- buf.EncodeUint8(uint8(m.BiTblID.BtSubDomain))
- buf.EncodeUint8(uint8(m.BiTblID.BtHdrLenID))
- buf.EncodeUint16(uint16(m.BiSrc))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.BiTblID.BtSet)
+ buf.EncodeUint8(m.BiTblID.BtSubDomain)
+ buf.EncodeUint8(m.BiTblID.BtHdrLenID)
+ buf.EncodeUint16(m.BiSrc)
buf.EncodeUint8(uint8(len(m.BiBytes)))
- buf.EncodeBytes(m.BiBytes[:], 0)
+ buf.EncodeBytes(m.BiBytes, 0)
return buf.Bytes(), nil
}
func (m *BierImpAdd) Unmarshal(b []byte) error {
@@ -580,7 +535,8 @@ func (m *BierImpAdd) Unmarshal(b []byte) error {
m.BiTblID.BtHdrLenID = buf.DecodeUint8()
m.BiSrc = buf.DecodeUint16()
m.BiNBytes = buf.DecodeUint8()
- copy(m.BiBytes[:], buf.DecodeBytes(0))
+ m.BiBytes = make([]byte, m.BiNBytes)
+ copy(m.BiBytes, buf.DecodeBytes(len(m.BiBytes)))
return nil
}
@@ -597,29 +553,26 @@ func (*BierImpAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierImpAddReply) Size() int {
+func (m *BierImpAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.BiIndex
return size
}
func (m *BierImpAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.BiIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.BiIndex)
return buf.Bytes(), nil
}
func (m *BierImpAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.BiIndex = buf.DecodeUint32()
return nil
}
@@ -636,22 +589,19 @@ func (*BierImpDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierImpDel) Size() int {
+func (m *BierImpDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BiIndex
return size
}
func (m *BierImpDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BiIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BiIndex)
return buf.Bytes(), nil
}
func (m *BierImpDel) Unmarshal(b []byte) error {
@@ -672,27 +622,24 @@ func (*BierImpDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierImpDelReply) Size() int {
+func (m *BierImpDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BierImpDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BierImpDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -711,11 +658,10 @@ func (*BierImpDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierImpDetails) Size() int {
+func (m *BierImpDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.BiTblID.BtSet
size += 1 // m.BiTblID.BtSubDomain
size += 1 // m.BiTblID.BtHdrLenID
@@ -725,18 +671,16 @@ func (m *BierImpDetails) Size() int {
return size
}
func (m *BierImpDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.BiTblID.BtSet))
- buf.EncodeUint8(uint8(m.BiTblID.BtSubDomain))
- buf.EncodeUint8(uint8(m.BiTblID.BtHdrLenID))
- buf.EncodeUint16(uint16(m.BiSrc))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.BiTblID.BtSet)
+ buf.EncodeUint8(m.BiTblID.BtSubDomain)
+ buf.EncodeUint8(m.BiTblID.BtHdrLenID)
+ buf.EncodeUint16(m.BiSrc)
buf.EncodeUint8(uint8(len(m.BiBytes)))
- buf.EncodeBytes(m.BiBytes[:], 0)
+ buf.EncodeBytes(m.BiBytes, 0)
return buf.Bytes(), nil
}
func (m *BierImpDetails) Unmarshal(b []byte) error {
@@ -746,7 +690,8 @@ func (m *BierImpDetails) Unmarshal(b []byte) error {
m.BiTblID.BtHdrLenID = buf.DecodeUint8()
m.BiSrc = buf.DecodeUint16()
m.BiNBytes = buf.DecodeUint8()
- copy(m.BiBytes[:], buf.DecodeBytes(0))
+ m.BiBytes = make([]byte, m.BiNBytes)
+ copy(m.BiBytes, buf.DecodeBytes(len(m.BiBytes)))
return nil
}
@@ -760,20 +705,17 @@ func (*BierImpDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierImpDump) Size() int {
+func (m *BierImpDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *BierImpDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *BierImpDump) Unmarshal(b []byte) error {
@@ -794,11 +736,10 @@ func (*BierRouteAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierRouteAddDel) Size() int {
+func (m *BierRouteAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.BrIsAdd
size += 1 // m.BrIsReplace
size += 4 // m.BrRoute.BrBp
@@ -826,60 +767,49 @@ func (m *BierRouteAddDel) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *BierRouteAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.BrIsAdd)
buf.EncodeBool(m.BrIsReplace)
- buf.EncodeUint32(uint32(m.BrRoute.BrBp))
- buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSet))
- buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSubDomain))
- buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtHdrLenID))
+ buf.EncodeUint32(m.BrRoute.BrBp)
+ buf.EncodeUint8(m.BrRoute.BrTblID.BtSet)
+ buf.EncodeUint8(m.BrRoute.BrTblID.BtSubDomain)
+ buf.EncodeUint8(m.BrRoute.BrTblID.BtHdrLenID)
buf.EncodeUint8(uint8(len(m.BrRoute.BrPaths)))
for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // BrPaths
if j1 < len(m.BrRoute.BrPaths) {
v1 = m.BrRoute.BrPaths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -893,7 +823,7 @@ func (m *BierRouteAddDel) Unmarshal(b []byte) error {
m.BrRoute.BrTblID.BtSubDomain = buf.DecodeUint8()
m.BrRoute.BrTblID.BtHdrLenID = buf.DecodeUint8()
m.BrRoute.BrNPaths = buf.DecodeUint8()
- m.BrRoute.BrPaths = make([]fib_types.FibPath, int(m.BrRoute.BrNPaths))
+ m.BrRoute.BrPaths = make([]fib_types.FibPath, m.BrRoute.BrNPaths)
for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ {
m.BrRoute.BrPaths[j1].SwIfIndex = buf.DecodeUint32()
m.BrRoute.BrPaths[j1].TableID = buf.DecodeUint32()
@@ -930,27 +860,24 @@ func (*BierRouteAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierRouteAddDelReply) Size() int {
+func (m *BierRouteAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BierRouteAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BierRouteAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -966,11 +893,10 @@ func (*BierRouteDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierRouteDetails) Size() int {
+func (m *BierRouteDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BrRoute.BrBp
size += 1 // m.BrRoute.BrTblID.BtSet
size += 1 // m.BrRoute.BrTblID.BtSubDomain
@@ -996,58 +922,47 @@ func (m *BierRouteDetails) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *BierRouteDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BrRoute.BrBp))
- buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSet))
- buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtSubDomain))
- buf.EncodeUint8(uint8(m.BrRoute.BrTblID.BtHdrLenID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BrRoute.BrBp)
+ buf.EncodeUint8(m.BrRoute.BrTblID.BtSet)
+ buf.EncodeUint8(m.BrRoute.BrTblID.BtSubDomain)
+ buf.EncodeUint8(m.BrRoute.BrTblID.BtHdrLenID)
buf.EncodeUint8(uint8(len(m.BrRoute.BrPaths)))
for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // BrPaths
if j1 < len(m.BrRoute.BrPaths) {
v1 = m.BrRoute.BrPaths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -1059,7 +974,7 @@ func (m *BierRouteDetails) Unmarshal(b []byte) error {
m.BrRoute.BrTblID.BtSubDomain = buf.DecodeUint8()
m.BrRoute.BrTblID.BtHdrLenID = buf.DecodeUint8()
m.BrRoute.BrNPaths = buf.DecodeUint8()
- m.BrRoute.BrPaths = make([]fib_types.FibPath, int(m.BrRoute.BrNPaths))
+ m.BrRoute.BrPaths = make([]fib_types.FibPath, m.BrRoute.BrNPaths)
for j1 := 0; j1 < len(m.BrRoute.BrPaths); j1++ {
m.BrRoute.BrPaths[j1].SwIfIndex = buf.DecodeUint32()
m.BrRoute.BrPaths[j1].TableID = buf.DecodeUint32()
@@ -1096,26 +1011,23 @@ func (*BierRouteDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierRouteDump) Size() int {
+func (m *BierRouteDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.BrTblID.BtSet
size += 1 // m.BrTblID.BtSubDomain
size += 1 // m.BrTblID.BtHdrLenID
return size
}
func (m *BierRouteDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.BrTblID.BtSet))
- buf.EncodeUint8(uint8(m.BrTblID.BtSubDomain))
- buf.EncodeUint8(uint8(m.BrTblID.BtHdrLenID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.BrTblID.BtSet)
+ buf.EncodeUint8(m.BrTblID.BtSubDomain)
+ buf.EncodeUint8(m.BrTblID.BtHdrLenID)
return buf.Bytes(), nil
}
func (m *BierRouteDump) Unmarshal(b []byte) error {
@@ -1140,11 +1052,10 @@ func (*BierTableAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierTableAddDel) Size() int {
+func (m *BierTableAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.BtTblID.BtSet
size += 1 // m.BtTblID.BtSubDomain
size += 1 // m.BtTblID.BtHdrLenID
@@ -1153,16 +1064,14 @@ func (m *BierTableAddDel) Size() int {
return size
}
func (m *BierTableAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.BtTblID.BtSet))
- buf.EncodeUint8(uint8(m.BtTblID.BtSubDomain))
- buf.EncodeUint8(uint8(m.BtTblID.BtHdrLenID))
- buf.EncodeUint32(uint32(m.BtLabel))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.BtTblID.BtSet)
+ buf.EncodeUint8(m.BtTblID.BtSubDomain)
+ buf.EncodeUint8(m.BtTblID.BtHdrLenID)
+ buf.EncodeUint32(m.BtLabel)
buf.EncodeBool(m.BtIsAdd)
return buf.Bytes(), nil
}
@@ -1188,27 +1097,24 @@ func (*BierTableAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierTableAddDelReply) Size() int {
+func (m *BierTableAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BierTableAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BierTableAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1225,11 +1131,10 @@ func (*BierTableDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BierTableDetails) Size() int {
+func (m *BierTableDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BtLabel
size += 1 // m.BtTblID.BtSet
size += 1 // m.BtTblID.BtSubDomain
@@ -1237,16 +1142,14 @@ func (m *BierTableDetails) Size() int {
return size
}
func (m *BierTableDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BtLabel))
- buf.EncodeUint8(uint8(m.BtTblID.BtSet))
- buf.EncodeUint8(uint8(m.BtTblID.BtSubDomain))
- buf.EncodeUint8(uint8(m.BtTblID.BtHdrLenID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BtLabel)
+ buf.EncodeUint8(m.BtTblID.BtSet)
+ buf.EncodeUint8(m.BtTblID.BtSubDomain)
+ buf.EncodeUint8(m.BtTblID.BtHdrLenID)
return buf.Bytes(), nil
}
func (m *BierTableDetails) Unmarshal(b []byte) error {
@@ -1268,20 +1171,17 @@ func (*BierTableDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BierTableDump) Size() int {
+func (m *BierTableDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *BierTableDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *BierTableDump) Unmarshal(b []byte) error {
diff --git a/binapi/bond/bond.ba.go b/binapi/bond/bond.ba.go
index 378a8f3..a734200 100644
--- a/binapi/bond/bond.ba.go
+++ b/binapi/bond/bond.ba.go
@@ -109,7 +109,7 @@ func (x BondMode) String() string {
// BondCreate defines message 'bond_create'.
type BondCreate struct {
- ID uint32 `binapi:"u32,name=id,default=%!s(float64=4.294967295e+09)" json:"id,omitempty"`
+ ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"`
UseCustomMac bool `binapi:"bool,name=use_custom_mac" json:"use_custom_mac,omitempty"`
MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
Mode BondMode `binapi:"bond_mode,name=mode" json:"mode,omitempty"`
@@ -124,11 +124,10 @@ func (*BondCreate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BondCreate) Size() int {
+func (m *BondCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ID
size += 1 // m.UseCustomMac
size += 1 * 6 // m.MacAddress
@@ -138,13 +137,11 @@ func (m *BondCreate) Size() int {
return size
}
func (m *BondCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ID)
buf.EncodeBool(m.UseCustomMac)
buf.EncodeBytes(m.MacAddress[:], 6)
buf.EncodeUint32(uint32(m.Mode))
@@ -176,29 +173,26 @@ func (*BondCreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BondCreateReply) Size() int {
+func (m *BondCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *BondCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *BondCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -215,21 +209,18 @@ func (*BondDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BondDelete) Size() int {
+func (m *BondDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *BondDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -251,27 +242,24 @@ func (*BondDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BondDeleteReply) Size() int {
+func (m *BondDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BondDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BondDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -287,21 +275,18 @@ func (*BondDetachSlave) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BondDetachSlave) Size() int {
+func (m *BondDetachSlave) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *BondDetachSlave) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -323,27 +308,24 @@ func (*BondDetachSlaveReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BondDetachSlaveReply) Size() int {
+func (m *BondDetachSlaveReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BondDetachSlaveReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BondDetachSlaveReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -362,11 +344,10 @@ func (*BondEnslave) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BondEnslave) Size() int {
+func (m *BondEnslave) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.BondSwIfIndex
size += 1 // m.IsPassive
@@ -374,12 +355,10 @@ func (m *BondEnslave) Size() int {
return size
}
func (m *BondEnslave) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint32(uint32(m.BondSwIfIndex))
buf.EncodeBool(m.IsPassive)
@@ -407,27 +386,24 @@ func (*BondEnslaveReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BondEnslaveReply) Size() int {
+func (m *BondEnslaveReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BondEnslaveReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BondEnslaveReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -450,11 +426,10 @@ func (*SwInterfaceBondDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceBondDetails) Size() int {
+func (m *SwInterfaceBondDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.ID
size += 4 // m.Mode
@@ -466,19 +441,17 @@ func (m *SwInterfaceBondDetails) Size() int {
return size
}
func (m *SwInterfaceBondDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.ID))
+ buf.EncodeUint32(m.ID)
buf.EncodeUint32(uint32(m.Mode))
buf.EncodeUint32(uint32(m.Lb))
buf.EncodeBool(m.NumaOnly)
- buf.EncodeUint32(uint32(m.ActiveSlaves))
- buf.EncodeUint32(uint32(m.Slaves))
+ buf.EncodeUint32(m.ActiveSlaves)
+ buf.EncodeUint32(m.Slaves)
buf.EncodeString(m.InterfaceName, 64)
return buf.Bytes(), nil
}
@@ -505,20 +478,17 @@ func (*SwInterfaceBondDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceBondDump) Size() int {
+func (m *SwInterfaceBondDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SwInterfaceBondDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SwInterfaceBondDump) Unmarshal(b []byte) error {
@@ -538,24 +508,21 @@ func (*SwInterfaceSetBondWeight) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetBondWeight) Size() int {
+func (m *SwInterfaceSetBondWeight) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.Weight
return size
}
func (m *SwInterfaceSetBondWeight) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.Weight))
+ buf.EncodeUint32(m.Weight)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetBondWeight) Unmarshal(b []byte) error {
@@ -579,27 +546,24 @@ func (*SwInterfaceSetBondWeightReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetBondWeightReply) Size() int {
+func (m *SwInterfaceSetBondWeightReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetBondWeightReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetBondWeightReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -620,11 +584,10 @@ func (*SwInterfaceSlaveDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSlaveDetails) Size() int {
+func (m *SwInterfaceSlaveDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 64 // m.InterfaceName
size += 1 // m.IsPassive
@@ -634,18 +597,16 @@ func (m *SwInterfaceSlaveDetails) Size() int {
return size
}
func (m *SwInterfaceSlaveDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeString(m.InterfaceName, 64)
buf.EncodeBool(m.IsPassive)
buf.EncodeBool(m.IsLongTimeout)
buf.EncodeBool(m.IsLocalNuma)
- buf.EncodeUint32(uint32(m.Weight))
+ buf.EncodeUint32(m.Weight)
return buf.Bytes(), nil
}
func (m *SwInterfaceSlaveDetails) Unmarshal(b []byte) error {
@@ -671,21 +632,18 @@ func (*SwInterfaceSlaveDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSlaveDump) Size() int {
+func (m *SwInterfaceSlaveDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *SwInterfaceSlaveDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
diff --git a/binapi/builtinurl/builtinurl.ba.go b/binapi/builtinurl/builtinurl.ba.go
index bfc593f..6b0350d 100644
--- a/binapi/builtinurl/builtinurl.ba.go
+++ b/binapi/builtinurl/builtinurl.ba.go
@@ -38,20 +38,17 @@ func (*BuiltinurlEnable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BuiltinurlEnable) Size() int {
+func (m *BuiltinurlEnable) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *BuiltinurlEnable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *BuiltinurlEnable) Unmarshal(b []byte) error {
@@ -70,27 +67,24 @@ func (*BuiltinurlEnableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BuiltinurlEnableReply) Size() int {
+func (m *BuiltinurlEnableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BuiltinurlEnableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BuiltinurlEnableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/cdp/cdp.ba.go b/binapi/cdp/cdp.ba.go
index afd8c46..5430d74 100644
--- a/binapi/cdp/cdp.ba.go
+++ b/binapi/cdp/cdp.ba.go
@@ -40,21 +40,18 @@ func (*CdpEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CdpEnableDisable) Size() int {
+func (m *CdpEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
return size
}
func (m *CdpEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
return buf.Bytes(), nil
}
@@ -76,27 +73,24 @@ func (*CdpEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CdpEnableDisableReply) Size() int {
+func (m *CdpEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *CdpEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *CdpEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/classify/classify.ba.go b/binapi/classify/classify.ba.go
index f1696aa..942c59c 100644
--- a/binapi/classify/classify.ba.go
+++ b/binapi/classify/classify.ba.go
@@ -125,11 +125,11 @@ func (x PolicerClassifyTable) String() string {
type ClassifyAddDelSession struct {
IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
TableIndex uint32 `binapi:"u32,name=table_index" json:"table_index,omitempty"`
- HitNextIndex uint32 `binapi:"u32,name=hit_next_index,default=%!s(float64=4.294967295e+09)" json:"hit_next_index,omitempty"`
- OpaqueIndex uint32 `binapi:"u32,name=opaque_index,default=%!s(float64=4.294967295e+09)" json:"opaque_index,omitempty"`
- Advance int32 `binapi:"i32,name=advance,default=%!s(float64=0)" json:"advance,omitempty"`
- Action ClassifyAction `binapi:"classify_action,name=action,default=%!s(float64=0)" json:"action,omitempty"`
- Metadata uint32 `binapi:"u32,name=metadata,default=%!s(float64=0)" json:"metadata,omitempty"`
+ HitNextIndex uint32 `binapi:"u32,name=hit_next_index,default=4294967295" json:"hit_next_index,omitempty"`
+ OpaqueIndex uint32 `binapi:"u32,name=opaque_index,default=4294967295" json:"opaque_index,omitempty"`
+ Advance int32 `binapi:"i32,name=advance,default=0" json:"advance,omitempty"`
+ Action ClassifyAction `binapi:"classify_action,name=action,default=0" json:"action,omitempty"`
+ Metadata uint32 `binapi:"u32,name=metadata,default=0" json:"metadata,omitempty"`
MatchLen uint32 `binapi:"u32,name=match_len" json:"-"`
Match []byte `binapi:"u8[match_len],name=match" json:"match,omitempty"`
}
@@ -141,11 +141,10 @@ func (*ClassifyAddDelSession) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ClassifyAddDelSession) Size() int {
+func (m *ClassifyAddDelSession) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.TableIndex
size += 4 // m.HitNextIndex
@@ -158,21 +157,19 @@ func (m *ClassifyAddDelSession) Size() int {
return size
}
func (m *ClassifyAddDelSession) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.TableIndex))
- buf.EncodeUint32(uint32(m.HitNextIndex))
- buf.EncodeUint32(uint32(m.OpaqueIndex))
- buf.EncodeUint32(uint32(m.Advance))
+ buf.EncodeUint32(m.TableIndex)
+ buf.EncodeUint32(m.HitNextIndex)
+ buf.EncodeUint32(m.OpaqueIndex)
+ buf.EncodeInt32(m.Advance)
buf.EncodeUint8(uint8(m.Action))
- buf.EncodeUint32(uint32(m.Metadata))
+ buf.EncodeUint32(m.Metadata)
buf.EncodeUint32(uint32(len(m.Match)))
- buf.EncodeBytes(m.Match[:], 0)
+ buf.EncodeBytes(m.Match, 0)
return buf.Bytes(), nil
}
func (m *ClassifyAddDelSession) Unmarshal(b []byte) error {
@@ -181,11 +178,12 @@ func (m *ClassifyAddDelSession) Unmarshal(b []byte) error {
m.TableIndex = buf.DecodeUint32()
m.HitNextIndex = buf.DecodeUint32()
m.OpaqueIndex = buf.DecodeUint32()
- m.Advance = int32(buf.DecodeUint32())
+ m.Advance = buf.DecodeInt32()
m.Action = ClassifyAction(buf.DecodeUint8())
m.Metadata = buf.DecodeUint32()
m.MatchLen = buf.DecodeUint32()
- copy(m.Match[:], buf.DecodeBytes(0))
+ m.Match = make([]byte, m.MatchLen)
+ copy(m.Match, buf.DecodeBytes(len(m.Match)))
return nil
}
@@ -201,27 +199,24 @@ func (*ClassifyAddDelSessionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ClassifyAddDelSessionReply) Size() int {
+func (m *ClassifyAddDelSessionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ClassifyAddDelSessionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ClassifyAddDelSessionReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -229,15 +224,15 @@ func (m *ClassifyAddDelSessionReply) Unmarshal(b []byte) error {
type ClassifyAddDelTable struct {
IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
DelChain bool `binapi:"bool,name=del_chain" json:"del_chain,omitempty"`
- TableIndex uint32 `binapi:"u32,name=table_index,default=%!s(float64=4.294967295e+09)" json:"table_index,omitempty"`
- Nbuckets uint32 `binapi:"u32,name=nbuckets,default=%!s(float64=2)" json:"nbuckets,omitempty"`
- MemorySize uint32 `binapi:"u32,name=memory_size,default=%!s(float64=2.097152e+06)" json:"memory_size,omitempty"`
- SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors,default=%!s(float64=0)" json:"skip_n_vectors,omitempty"`
- MatchNVectors uint32 `binapi:"u32,name=match_n_vectors,default=%!s(float64=1)" json:"match_n_vectors,omitempty"`
- NextTableIndex uint32 `binapi:"u32,name=next_table_index,default=%!s(float64=4.294967295e+09)" json:"next_table_index,omitempty"`
- MissNextIndex uint32 `binapi:"u32,name=miss_next_index,default=%!s(float64=4.294967295e+09)" json:"miss_next_index,omitempty"`
- CurrentDataFlag uint8 `binapi:"u8,name=current_data_flag,default=%!s(float64=0)" json:"current_data_flag,omitempty"`
- CurrentDataOffset int16 `binapi:"i16,name=current_data_offset,default=%!s(float64=0)" json:"current_data_offset,omitempty"`
+ TableIndex uint32 `binapi:"u32,name=table_index,default=4294967295" json:"table_index,omitempty"`
+ Nbuckets uint32 `binapi:"u32,name=nbuckets,default=2" json:"nbuckets,omitempty"`
+ MemorySize uint32 `binapi:"u32,name=memory_size,default=2097152" json:"memory_size,omitempty"`
+ SkipNVectors uint32 `binapi:"u32,name=skip_n_vectors,default=0" json:"skip_n_vectors,omitempty"`
+ MatchNVectors uint32 `binapi:"u32,name=match_n_vectors,default=1" json:"match_n_vectors,omitempty"`
+ NextTableIndex uint32 `binapi:"u32,name=next_table_index,default=4294967295" json:"next_table_index,omitempty"`
+ MissNextIndex uint32 `binapi:"u32,name=miss_next_index,default=4294967295" json:"miss_next_index,omitempty"`
+ CurrentDataFlag uint8 `binapi:"u8,name=current_data_flag,default=0" json:"current_data_flag,omitempty"`
+ CurrentDataOffset int16 `binapi:"i16,name=current_data_offset,default=0" json:"current_data_offset,omitempty"`
MaskLen uint32 `binapi:"u32,name=mask_len" json:"-"`
Mask []byte `binapi:"u8[mask_len],name=mask" json:"mask,omitempty"`
}
@@ -249,11 +244,10 @@ func (*ClassifyAddDelTable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ClassifyAddDelTable) Size() int {
+func (m *ClassifyAddDelTable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.DelChain
size += 4 // m.TableIndex
@@ -270,25 +264,23 @@ func (m *ClassifyAddDelTable) Size() int {
return size
}
func (m *ClassifyAddDelTable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.DelChain)
- buf.EncodeUint32(uint32(m.TableIndex))
- buf.EncodeUint32(uint32(m.Nbuckets))
- buf.EncodeUint32(uint32(m.MemorySize))
- buf.EncodeUint32(uint32(m.SkipNVectors))
- buf.EncodeUint32(uint32(m.MatchNVectors))
- buf.EncodeUint32(uint32(m.NextTableIndex))
- buf.EncodeUint32(uint32(m.MissNextIndex))
- buf.EncodeUint8(uint8(m.CurrentDataFlag))
- buf.EncodeUint16(uint16(m.CurrentDataOffset))
+ buf.EncodeUint32(m.TableIndex)
+ buf.EncodeUint32(m.Nbuckets)
+ buf.EncodeUint32(m.MemorySize)
+ buf.EncodeUint32(m.SkipNVectors)
+ buf.EncodeUint32(m.MatchNVectors)
+ buf.EncodeUint32(m.NextTableIndex)
+ buf.EncodeUint32(m.MissNextIndex)
+ buf.EncodeUint8(m.CurrentDataFlag)
+ buf.EncodeInt16(m.CurrentDataOffset)
buf.EncodeUint32(uint32(len(m.Mask)))
- buf.EncodeBytes(m.Mask[:], 0)
+ buf.EncodeBytes(m.Mask, 0)
return buf.Bytes(), nil
}
func (m *ClassifyAddDelTable) Unmarshal(b []byte) error {
@@ -303,9 +295,10 @@ func (m *ClassifyAddDelTable) Unmarshal(b []byte) error {
m.NextTableIndex = buf.DecodeUint32()
m.MissNextIndex = buf.DecodeUint32()
m.CurrentDataFlag = buf.DecodeUint8()
- m.CurrentDataOffset = int16(buf.DecodeUint16())
+ m.CurrentDataOffset = buf.DecodeInt16()
m.MaskLen = buf.DecodeUint32()
- copy(m.Mask[:], buf.DecodeBytes(0))
+ m.Mask = make([]byte, m.MaskLen)
+ copy(m.Mask, buf.DecodeBytes(len(m.Mask)))
return nil
}
@@ -324,11 +317,10 @@ func (*ClassifyAddDelTableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ClassifyAddDelTableReply) Size() int {
+func (m *ClassifyAddDelTableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.NewTableIndex
size += 4 // m.SkipNVectors
@@ -336,21 +328,19 @@ func (m *ClassifyAddDelTableReply) Size() int {
return size
}
func (m *ClassifyAddDelTableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.NewTableIndex))
- buf.EncodeUint32(uint32(m.SkipNVectors))
- buf.EncodeUint32(uint32(m.MatchNVectors))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.NewTableIndex)
+ buf.EncodeUint32(m.SkipNVectors)
+ buf.EncodeUint32(m.MatchNVectors)
return buf.Bytes(), nil
}
func (m *ClassifyAddDelTableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.NewTableIndex = buf.DecodeUint32()
m.SkipNVectors = buf.DecodeUint32()
m.MatchNVectors = buf.DecodeUint32()
@@ -375,11 +365,10 @@ func (*ClassifySessionDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ClassifySessionDetails) Size() int {
+func (m *ClassifySessionDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.TableID
size += 4 // m.HitNextIndex
@@ -390,30 +379,29 @@ func (m *ClassifySessionDetails) Size() int {
return size
}
func (m *ClassifySessionDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.TableID))
- buf.EncodeUint32(uint32(m.HitNextIndex))
- buf.EncodeUint32(uint32(m.Advance))
- buf.EncodeUint32(uint32(m.OpaqueIndex))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.TableID)
+ buf.EncodeUint32(m.HitNextIndex)
+ buf.EncodeInt32(m.Advance)
+ buf.EncodeUint32(m.OpaqueIndex)
buf.EncodeUint32(uint32(len(m.Match)))
- buf.EncodeBytes(m.Match[:], 0)
+ buf.EncodeBytes(m.Match, 0)
return buf.Bytes(), nil
}
func (m *ClassifySessionDetails) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.TableID = buf.DecodeUint32()
m.HitNextIndex = buf.DecodeUint32()
- m.Advance = int32(buf.DecodeUint32())
+ m.Advance = buf.DecodeInt32()
m.OpaqueIndex = buf.DecodeUint32()
m.MatchLength = buf.DecodeUint32()
- copy(m.Match[:], buf.DecodeBytes(0))
+ m.Match = make([]byte, m.MatchLength)
+ copy(m.Match, buf.DecodeBytes(len(m.Match)))
return nil
}
@@ -429,22 +417,19 @@ func (*ClassifySessionDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ClassifySessionDump) Size() int {
+func (m *ClassifySessionDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TableID
return size
}
func (m *ClassifySessionDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TableID)
return buf.Bytes(), nil
}
func (m *ClassifySessionDump) Unmarshal(b []byte) error {
@@ -467,26 +452,23 @@ func (*ClassifySetInterfaceIPTable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ClassifySetInterfaceIPTable) Size() int {
+func (m *ClassifySetInterfaceIPTable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsIPv6
size += 4 // m.SwIfIndex
size += 4 // m.TableIndex
return size
}
func (m *ClassifySetInterfaceIPTable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsIPv6)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.TableIndex))
+ buf.EncodeUint32(m.TableIndex)
return buf.Bytes(), nil
}
func (m *ClassifySetInterfaceIPTable) Unmarshal(b []byte) error {
@@ -511,27 +493,24 @@ func (*ClassifySetInterfaceIPTableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ClassifySetInterfaceIPTableReply) Size() int {
+func (m *ClassifySetInterfaceIPTableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ClassifySetInterfaceIPTableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ClassifySetInterfaceIPTableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -553,11 +532,10 @@ func (*ClassifySetInterfaceL2Tables) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ClassifySetInterfaceL2Tables) Size() int {
+func (m *ClassifySetInterfaceL2Tables) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.IP4TableIndex
size += 4 // m.IP6TableIndex
@@ -566,16 +544,14 @@ func (m *ClassifySetInterfaceL2Tables) Size() int {
return size
}
func (m *ClassifySetInterfaceL2Tables) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.IP4TableIndex))
- buf.EncodeUint32(uint32(m.IP6TableIndex))
- buf.EncodeUint32(uint32(m.OtherTableIndex))
+ buf.EncodeUint32(m.IP4TableIndex)
+ buf.EncodeUint32(m.IP6TableIndex)
+ buf.EncodeUint32(m.OtherTableIndex)
buf.EncodeBool(m.IsInput)
return buf.Bytes(), nil
}
@@ -603,27 +579,24 @@ func (*ClassifySetInterfaceL2TablesReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ClassifySetInterfaceL2TablesReply) Size() int {
+func (m *ClassifySetInterfaceL2TablesReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ClassifySetInterfaceL2TablesReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ClassifySetInterfaceL2TablesReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -639,21 +612,18 @@ func (*ClassifyTableByInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ClassifyTableByInterface) Size() int {
+func (m *ClassifyTableByInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *ClassifyTableByInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -681,11 +651,10 @@ func (*ClassifyTableByInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ClassifyTableByInterfaceReply) Size() int {
+func (m *ClassifyTableByInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
size += 4 // m.L2TableID
@@ -694,22 +663,20 @@ func (m *ClassifyTableByInterfaceReply) Size() int {
return size
}
func (m *ClassifyTableByInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.L2TableID))
- buf.EncodeUint32(uint32(m.IP4TableID))
- buf.EncodeUint32(uint32(m.IP6TableID))
+ buf.EncodeUint32(m.L2TableID)
+ buf.EncodeUint32(m.IP4TableID)
+ buf.EncodeUint32(m.IP6TableID)
return buf.Bytes(), nil
}
func (m *ClassifyTableByInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.L2TableID = buf.DecodeUint32()
m.IP4TableID = buf.DecodeUint32()
@@ -727,20 +694,17 @@ func (*ClassifyTableIds) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ClassifyTableIds) Size() int {
+func (m *ClassifyTableIds) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ClassifyTableIds) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ClassifyTableIds) Unmarshal(b []byte) error {
@@ -761,37 +725,34 @@ func (*ClassifyTableIdsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ClassifyTableIdsReply) Size() int {
+func (m *ClassifyTableIdsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
size += 4 * len(m.Ids) // m.Ids
return size
}
func (m *ClassifyTableIdsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.Ids)))
for i := 0; i < len(m.Ids); i++ {
var x uint32
if i < len(m.Ids) {
x = uint32(m.Ids[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
func (m *ClassifyTableIdsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
m.Ids = make([]uint32, m.Count)
for i := 0; i < len(m.Ids); i++ {
@@ -812,22 +773,19 @@ func (*ClassifyTableInfo) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ClassifyTableInfo) Size() int {
+func (m *ClassifyTableInfo) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TableID
return size
}
func (m *ClassifyTableInfo) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TableID)
return buf.Bytes(), nil
}
func (m *ClassifyTableInfo) Unmarshal(b []byte) error {
@@ -857,11 +815,10 @@ func (*ClassifyTableInfoReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ClassifyTableInfoReply) Size() int {
+func (m *ClassifyTableInfoReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.TableID
size += 4 // m.Nbuckets
@@ -875,27 +832,25 @@ func (m *ClassifyTableInfoReply) Size() int {
return size
}
func (m *ClassifyTableInfoReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.TableID))
- buf.EncodeUint32(uint32(m.Nbuckets))
- buf.EncodeUint32(uint32(m.MatchNVectors))
- buf.EncodeUint32(uint32(m.SkipNVectors))
- buf.EncodeUint32(uint32(m.ActiveSessions))
- buf.EncodeUint32(uint32(m.NextTableIndex))
- buf.EncodeUint32(uint32(m.MissNextIndex))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.TableID)
+ buf.EncodeUint32(m.Nbuckets)
+ buf.EncodeUint32(m.MatchNVectors)
+ buf.EncodeUint32(m.SkipNVectors)
+ buf.EncodeUint32(m.ActiveSessions)
+ buf.EncodeUint32(m.NextTableIndex)
+ buf.EncodeUint32(m.MissNextIndex)
buf.EncodeUint32(uint32(len(m.Mask)))
- buf.EncodeBytes(m.Mask[:], 0)
+ buf.EncodeBytes(m.Mask, 0)
return buf.Bytes(), nil
}
func (m *ClassifyTableInfoReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.TableID = buf.DecodeUint32()
m.Nbuckets = buf.DecodeUint32()
m.MatchNVectors = buf.DecodeUint32()
@@ -904,7 +859,8 @@ func (m *ClassifyTableInfoReply) Unmarshal(b []byte) error {
m.NextTableIndex = buf.DecodeUint32()
m.MissNextIndex = buf.DecodeUint32()
m.MaskLength = buf.DecodeUint32()
- copy(m.Mask[:], buf.DecodeBytes(0))
+ m.Mask = make([]byte, m.MaskLength)
+ copy(m.Mask, buf.DecodeBytes(len(m.Mask)))
return nil
}
@@ -921,24 +877,21 @@ func (*FlowClassifyDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *FlowClassifyDetails) Size() int {
+func (m *FlowClassifyDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.TableIndex
return size
}
func (m *FlowClassifyDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.TableIndex))
+ buf.EncodeUint32(m.TableIndex)
return buf.Bytes(), nil
}
func (m *FlowClassifyDetails) Unmarshal(b []byte) error {
@@ -961,22 +914,19 @@ func (*FlowClassifyDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *FlowClassifyDump) Size() int {
+func (m *FlowClassifyDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Type
size += 4 // m.SwIfIndex
return size
}
func (m *FlowClassifyDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Type))
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -1003,11 +953,10 @@ func (*FlowClassifySetInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *FlowClassifySetInterface) Size() int {
+func (m *FlowClassifySetInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.IP4TableIndex
size += 4 // m.IP6TableIndex
@@ -1015,15 +964,13 @@ func (m *FlowClassifySetInterface) Size() int {
return size
}
func (m *FlowClassifySetInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.IP4TableIndex))
- buf.EncodeUint32(uint32(m.IP6TableIndex))
+ buf.EncodeUint32(m.IP4TableIndex)
+ buf.EncodeUint32(m.IP6TableIndex)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -1050,27 +997,24 @@ func (*FlowClassifySetInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *FlowClassifySetInterfaceReply) Size() int {
+func (m *FlowClassifySetInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *FlowClassifySetInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *FlowClassifySetInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1090,11 +1034,10 @@ func (*InputACLSetInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *InputACLSetInterface) Size() int {
+func (m *InputACLSetInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.IP4TableIndex
size += 4 // m.IP6TableIndex
@@ -1103,16 +1046,14 @@ func (m *InputACLSetInterface) Size() int {
return size
}
func (m *InputACLSetInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.IP4TableIndex))
- buf.EncodeUint32(uint32(m.IP6TableIndex))
- buf.EncodeUint32(uint32(m.L2TableIndex))
+ buf.EncodeUint32(m.IP4TableIndex)
+ buf.EncodeUint32(m.IP6TableIndex)
+ buf.EncodeUint32(m.L2TableIndex)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -1138,27 +1079,24 @@ func (*InputACLSetInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *InputACLSetInterfaceReply) Size() int {
+func (m *InputACLSetInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *InputACLSetInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *InputACLSetInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1178,11 +1116,10 @@ func (*OutputACLSetInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OutputACLSetInterface) Size() int {
+func (m *OutputACLSetInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.IP4TableIndex
size += 4 // m.IP6TableIndex
@@ -1191,16 +1128,14 @@ func (m *OutputACLSetInterface) Size() int {
return size
}
func (m *OutputACLSetInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.IP4TableIndex))
- buf.EncodeUint32(uint32(m.IP6TableIndex))
- buf.EncodeUint32(uint32(m.L2TableIndex))
+ buf.EncodeUint32(m.IP4TableIndex)
+ buf.EncodeUint32(m.IP6TableIndex)
+ buf.EncodeUint32(m.L2TableIndex)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -1226,27 +1161,24 @@ func (*OutputACLSetInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OutputACLSetInterfaceReply) Size() int {
+func (m *OutputACLSetInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OutputACLSetInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OutputACLSetInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1263,24 +1195,21 @@ func (*PolicerClassifyDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PolicerClassifyDetails) Size() int {
+func (m *PolicerClassifyDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.TableIndex
return size
}
func (m *PolicerClassifyDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.TableIndex))
+ buf.EncodeUint32(m.TableIndex)
return buf.Bytes(), nil
}
func (m *PolicerClassifyDetails) Unmarshal(b []byte) error {
@@ -1303,22 +1232,19 @@ func (*PolicerClassifyDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PolicerClassifyDump) Size() int {
+func (m *PolicerClassifyDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Type
size += 4 // m.SwIfIndex
return size
}
func (m *PolicerClassifyDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Type))
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -1346,11 +1272,10 @@ func (*PolicerClassifySetInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PolicerClassifySetInterface) Size() int {
+func (m *PolicerClassifySetInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.IP4TableIndex
size += 4 // m.IP6TableIndex
@@ -1359,16 +1284,14 @@ func (m *PolicerClassifySetInterface) Size() int {
return size
}
func (m *PolicerClassifySetInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.IP4TableIndex))
- buf.EncodeUint32(uint32(m.IP6TableIndex))
- buf.EncodeUint32(uint32(m.L2TableIndex))
+ buf.EncodeUint32(m.IP4TableIndex)
+ buf.EncodeUint32(m.IP6TableIndex)
+ buf.EncodeUint32(m.L2TableIndex)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -1396,27 +1319,24 @@ func (*PolicerClassifySetInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PolicerClassifySetInterfaceReply) Size() int {
+func (m *PolicerClassifySetInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *PolicerClassifySetInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *PolicerClassifySetInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/cop/cop.ba.go b/binapi/cop/cop.ba.go
index a252c9a..14f0b11 100644
--- a/binapi/cop/cop.ba.go
+++ b/binapi/cop/cop.ba.go
@@ -42,22 +42,19 @@ func (*CopInterfaceEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CopInterfaceEnableDisable) Size() int {
+func (m *CopInterfaceEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.EnableDisable
return size
}
func (m *CopInterfaceEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.EnableDisable)
return buf.Bytes(), nil
@@ -83,27 +80,24 @@ func (*CopInterfaceEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CopInterfaceEnableDisableReply) Size() int {
+func (m *CopInterfaceEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *CopInterfaceEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *CopInterfaceEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -123,11 +117,10 @@ func (*CopWhitelistEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CopWhitelistEnableDisable) Size() int {
+func (m *CopWhitelistEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.FibID
size += 1 // m.IP4
@@ -136,14 +129,12 @@ func (m *CopWhitelistEnableDisable) Size() int {
return size
}
func (m *CopWhitelistEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.FibID))
+ buf.EncodeUint32(m.FibID)
buf.EncodeBool(m.IP4)
buf.EncodeBool(m.IP6)
buf.EncodeBool(m.DefaultCop)
@@ -173,27 +164,24 @@ func (*CopWhitelistEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CopWhitelistEnableDisableReply) Size() int {
+func (m *CopWhitelistEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *CopWhitelistEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *CopWhitelistEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ct6/ct6.ba.go b/binapi/ct6/ct6.ba.go
index fbcc0bc..5dc6097 100644
--- a/binapi/ct6/ct6.ba.go
+++ b/binapi/ct6/ct6.ba.go
@@ -43,23 +43,20 @@ func (*Ct6EnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ct6EnableDisable) Size() int {
+func (m *Ct6EnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
size += 1 // m.IsInside
size += 4 // m.SwIfIndex
return size
}
func (m *Ct6EnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
buf.EncodeBool(m.IsInside)
buf.EncodeUint32(uint32(m.SwIfIndex))
@@ -85,27 +82,24 @@ func (*Ct6EnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ct6EnableDisableReply) Size() int {
+func (m *Ct6EnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ct6EnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ct6EnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/dhcp/dhcp.ba.go b/binapi/dhcp/dhcp.ba.go
index cb18b48..7e0fd0b 100644
--- a/binapi/dhcp/dhcp.ba.go
+++ b/binapi/dhcp/dhcp.ba.go
@@ -219,21 +219,18 @@ func (*DHCP6ClientsEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCP6ClientsEnableDisable) Size() int {
+func (m *DHCP6ClientsEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
return size
}
func (m *DHCP6ClientsEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
}
@@ -257,27 +254,24 @@ func (*DHCP6ClientsEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCP6ClientsEnableDisableReply) Size() int {
+func (m *DHCP6ClientsEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DHCP6ClientsEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DHCP6ClientsEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -293,27 +287,25 @@ func (*DHCP6DuidLlSet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCP6DuidLlSet) Size() int {
+func (m *DHCP6DuidLlSet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 10 // m.DuidLl
return size
}
func (m *DHCP6DuidLlSet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeBytes(m.DuidLl[:], 10)
+ buf := codec.NewBuffer(b)
+ buf.EncodeBytes(m.DuidLl, 10)
return buf.Bytes(), nil
}
func (m *DHCP6DuidLlSet) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- copy(m.DuidLl[:], buf.DecodeBytes(10))
+ m.DuidLl = make([]byte, 10)
+ copy(m.DuidLl, buf.DecodeBytes(len(m.DuidLl)))
return nil
}
@@ -329,27 +321,24 @@ func (*DHCP6DuidLlSetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCP6DuidLlSetReply) Size() int {
+func (m *DHCP6DuidLlSetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DHCP6DuidLlSetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DHCP6DuidLlSetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -375,11 +364,10 @@ func (*DHCP6PdReplyEvent) GetMessageType() api.MessageType {
return api.EventMessage
}
-func (m *DHCP6PdReplyEvent) Size() int {
+func (m *DHCP6PdReplyEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PID
size += 4 // m.SwIfIndex
size += 4 // m.ServerIndex
@@ -404,31 +392,29 @@ func (m *DHCP6PdReplyEvent) Size() int {
return size
}
func (m *DHCP6PdReplyEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PID)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.ServerIndex))
+ buf.EncodeUint32(m.ServerIndex)
buf.EncodeUint32(uint32(m.MsgType))
- buf.EncodeUint32(uint32(m.T1))
- buf.EncodeUint32(uint32(m.T2))
- buf.EncodeUint16(uint16(m.InnerStatusCode))
- buf.EncodeUint16(uint16(m.StatusCode))
- buf.EncodeUint8(uint8(m.Preference))
+ buf.EncodeUint32(m.T1)
+ buf.EncodeUint32(m.T2)
+ buf.EncodeUint16(m.InnerStatusCode)
+ buf.EncodeUint16(m.StatusCode)
+ buf.EncodeUint8(m.Preference)
buf.EncodeUint32(uint32(len(m.Prefixes)))
for j0 := 0; j0 < len(m.Prefixes); j0++ {
- var v0 DHCP6PdPrefixInfo
+ var v0 DHCP6PdPrefixInfo // Prefixes
if j0 < len(m.Prefixes) {
v0 = m.Prefixes[j0]
}
buf.EncodeBytes(v0.Prefix.Address[:], 16)
- buf.EncodeUint8(uint8(v0.Prefix.Len))
- buf.EncodeUint32(uint32(v0.ValidTime))
- buf.EncodeUint32(uint32(v0.PreferredTime))
+ buf.EncodeUint8(v0.Prefix.Len)
+ buf.EncodeUint32(v0.ValidTime)
+ buf.EncodeUint32(v0.PreferredTime)
}
return buf.Bytes(), nil
}
@@ -444,7 +430,7 @@ func (m *DHCP6PdReplyEvent) Unmarshal(b []byte) error {
m.StatusCode = buf.DecodeUint16()
m.Preference = buf.DecodeUint8()
m.NPrefixes = buf.DecodeUint32()
- m.Prefixes = make([]DHCP6PdPrefixInfo, int(m.NPrefixes))
+ m.Prefixes = make([]DHCP6PdPrefixInfo, m.NPrefixes)
for j0 := 0; j0 < len(m.Prefixes); j0++ {
copy(m.Prefixes[j0].Prefix.Address[:], buf.DecodeBytes(16))
m.Prefixes[j0].Prefix.Len = buf.DecodeUint8()
@@ -477,11 +463,10 @@ func (*DHCP6PdSendClientMessage) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCP6PdSendClientMessage) Size() int {
+func (m *DHCP6PdSendClientMessage) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.ServerIndex
size += 4 // m.Irt
@@ -507,32 +492,30 @@ func (m *DHCP6PdSendClientMessage) Size() int {
return size
}
func (m *DHCP6PdSendClientMessage) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.ServerIndex))
- buf.EncodeUint32(uint32(m.Irt))
- buf.EncodeUint32(uint32(m.Mrt))
- buf.EncodeUint32(uint32(m.Mrc))
- buf.EncodeUint32(uint32(m.Mrd))
+ buf.EncodeUint32(m.ServerIndex)
+ buf.EncodeUint32(m.Irt)
+ buf.EncodeUint32(m.Mrt)
+ buf.EncodeUint32(m.Mrc)
+ buf.EncodeUint32(m.Mrd)
buf.EncodeBool(m.Stop)
buf.EncodeUint32(uint32(m.MsgType))
- buf.EncodeUint32(uint32(m.T1))
- buf.EncodeUint32(uint32(m.T2))
+ buf.EncodeUint32(m.T1)
+ buf.EncodeUint32(m.T2)
buf.EncodeUint32(uint32(len(m.Prefixes)))
for j0 := 0; j0 < len(m.Prefixes); j0++ {
- var v0 DHCP6PdPrefixInfo
+ var v0 DHCP6PdPrefixInfo // Prefixes
if j0 < len(m.Prefixes) {
v0 = m.Prefixes[j0]
}
buf.EncodeBytes(v0.Prefix.Address[:], 16)
- buf.EncodeUint8(uint8(v0.Prefix.Len))
- buf.EncodeUint32(uint32(v0.ValidTime))
- buf.EncodeUint32(uint32(v0.PreferredTime))
+ buf.EncodeUint8(v0.Prefix.Len)
+ buf.EncodeUint32(v0.ValidTime)
+ buf.EncodeUint32(v0.PreferredTime)
}
return buf.Bytes(), nil
}
@@ -549,7 +532,7 @@ func (m *DHCP6PdSendClientMessage) Unmarshal(b []byte) error {
m.T1 = buf.DecodeUint32()
m.T2 = buf.DecodeUint32()
m.NPrefixes = buf.DecodeUint32()
- m.Prefixes = make([]DHCP6PdPrefixInfo, int(m.NPrefixes))
+ m.Prefixes = make([]DHCP6PdPrefixInfo, m.NPrefixes)
for j0 := 0; j0 < len(m.Prefixes); j0++ {
copy(m.Prefixes[j0].Prefix.Address[:], buf.DecodeBytes(16))
m.Prefixes[j0].Prefix.Len = buf.DecodeUint8()
@@ -573,27 +556,24 @@ func (*DHCP6PdSendClientMessageReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCP6PdSendClientMessageReply) Size() int {
+func (m *DHCP6PdSendClientMessageReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DHCP6PdSendClientMessageReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DHCP6PdSendClientMessageReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -619,11 +599,10 @@ func (*DHCP6ReplyEvent) GetMessageType() api.MessageType {
return api.EventMessage
}
-func (m *DHCP6ReplyEvent) Size() int {
+func (m *DHCP6ReplyEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PID
size += 4 // m.SwIfIndex
size += 4 // m.ServerIndex
@@ -647,30 +626,28 @@ func (m *DHCP6ReplyEvent) Size() int {
return size
}
func (m *DHCP6ReplyEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PID)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.ServerIndex))
+ buf.EncodeUint32(m.ServerIndex)
buf.EncodeUint32(uint32(m.MsgType))
- buf.EncodeUint32(uint32(m.T1))
- buf.EncodeUint32(uint32(m.T2))
- buf.EncodeUint16(uint16(m.InnerStatusCode))
- buf.EncodeUint16(uint16(m.StatusCode))
- buf.EncodeUint8(uint8(m.Preference))
+ buf.EncodeUint32(m.T1)
+ buf.EncodeUint32(m.T2)
+ buf.EncodeUint16(m.InnerStatusCode)
+ buf.EncodeUint16(m.StatusCode)
+ buf.EncodeUint8(m.Preference)
buf.EncodeUint32(uint32(len(m.Addresses)))
for j0 := 0; j0 < len(m.Addresses); j0++ {
- var v0 DHCP6AddressInfo
+ var v0 DHCP6AddressInfo // Addresses
if j0 < len(m.Addresses) {
v0 = m.Addresses[j0]
}
buf.EncodeBytes(v0.Address[:], 16)
- buf.EncodeUint32(uint32(v0.ValidTime))
- buf.EncodeUint32(uint32(v0.PreferredTime))
+ buf.EncodeUint32(v0.ValidTime)
+ buf.EncodeUint32(v0.PreferredTime)
}
return buf.Bytes(), nil
}
@@ -686,7 +663,7 @@ func (m *DHCP6ReplyEvent) Unmarshal(b []byte) error {
m.StatusCode = buf.DecodeUint16()
m.Preference = buf.DecodeUint8()
m.NAddresses = buf.DecodeUint32()
- m.Addresses = make([]DHCP6AddressInfo, int(m.NAddresses))
+ m.Addresses = make([]DHCP6AddressInfo, m.NAddresses)
for j0 := 0; j0 < len(m.Addresses); j0++ {
copy(m.Addresses[j0].Address[:], buf.DecodeBytes(16))
m.Addresses[j0].ValidTime = buf.DecodeUint32()
@@ -718,11 +695,10 @@ func (*DHCP6SendClientMessage) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCP6SendClientMessage) Size() int {
+func (m *DHCP6SendClientMessage) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.ServerIndex
size += 4 // m.Irt
@@ -747,31 +723,29 @@ func (m *DHCP6SendClientMessage) Size() int {
return size
}
func (m *DHCP6SendClientMessage) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.ServerIndex))
- buf.EncodeUint32(uint32(m.Irt))
- buf.EncodeUint32(uint32(m.Mrt))
- buf.EncodeUint32(uint32(m.Mrc))
- buf.EncodeUint32(uint32(m.Mrd))
+ buf.EncodeUint32(m.ServerIndex)
+ buf.EncodeUint32(m.Irt)
+ buf.EncodeUint32(m.Mrt)
+ buf.EncodeUint32(m.Mrc)
+ buf.EncodeUint32(m.Mrd)
buf.EncodeBool(m.Stop)
buf.EncodeUint32(uint32(m.MsgType))
- buf.EncodeUint32(uint32(m.T1))
- buf.EncodeUint32(uint32(m.T2))
+ buf.EncodeUint32(m.T1)
+ buf.EncodeUint32(m.T2)
buf.EncodeUint32(uint32(len(m.Addresses)))
for j0 := 0; j0 < len(m.Addresses); j0++ {
- var v0 DHCP6AddressInfo
+ var v0 DHCP6AddressInfo // Addresses
if j0 < len(m.Addresses) {
v0 = m.Addresses[j0]
}
buf.EncodeBytes(v0.Address[:], 16)
- buf.EncodeUint32(uint32(v0.ValidTime))
- buf.EncodeUint32(uint32(v0.PreferredTime))
+ buf.EncodeUint32(v0.ValidTime)
+ buf.EncodeUint32(v0.PreferredTime)
}
return buf.Bytes(), nil
}
@@ -788,7 +762,7 @@ func (m *DHCP6SendClientMessage) Unmarshal(b []byte) error {
m.T1 = buf.DecodeUint32()
m.T2 = buf.DecodeUint32()
m.NAddresses = buf.DecodeUint32()
- m.Addresses = make([]DHCP6AddressInfo, int(m.NAddresses))
+ m.Addresses = make([]DHCP6AddressInfo, m.NAddresses)
for j0 := 0; j0 < len(m.Addresses); j0++ {
copy(m.Addresses[j0].Address[:], buf.DecodeBytes(16))
m.Addresses[j0].ValidTime = buf.DecodeUint32()
@@ -809,27 +783,24 @@ func (*DHCP6SendClientMessageReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCP6SendClientMessageReply) Size() int {
+func (m *DHCP6SendClientMessageReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DHCP6SendClientMessageReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DHCP6SendClientMessageReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -846,11 +817,10 @@ func (*DHCPClientConfig) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCPClientConfig) Size() int {
+func (m *DHCPClientConfig) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Client.SwIfIndex
size += 64 // m.Client.Hostname
@@ -862,20 +832,18 @@ func (m *DHCPClientConfig) Size() int {
return size
}
func (m *DHCPClientConfig) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.Client.SwIfIndex))
buf.EncodeString(m.Client.Hostname, 64)
- buf.EncodeBytes(m.Client.ID[:], 64)
+ buf.EncodeBytes(m.Client.ID, 64)
buf.EncodeBool(m.Client.WantDHCPEvent)
buf.EncodeBool(m.Client.SetBroadcastFlag)
buf.EncodeUint8(uint8(m.Client.Dscp))
- buf.EncodeUint32(uint32(m.Client.PID))
+ buf.EncodeUint32(m.Client.PID)
return buf.Bytes(), nil
}
func (m *DHCPClientConfig) Unmarshal(b []byte) error {
@@ -883,7 +851,8 @@ func (m *DHCPClientConfig) Unmarshal(b []byte) error {
m.IsAdd = buf.DecodeBool()
m.Client.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.Client.Hostname = buf.DecodeString(64)
- copy(m.Client.ID[:], buf.DecodeBytes(64))
+ m.Client.ID = make([]byte, 64)
+ copy(m.Client.ID, buf.DecodeBytes(len(m.Client.ID)))
m.Client.WantDHCPEvent = buf.DecodeBool()
m.Client.SetBroadcastFlag = buf.DecodeBool()
m.Client.Dscp = ip_types.IPDscp(buf.DecodeUint8())
@@ -903,27 +872,24 @@ func (*DHCPClientConfigReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCPClientConfigReply) Size() int {
+func (m *DHCPClientConfigReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DHCPClientConfigReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DHCPClientConfigReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -940,11 +906,10 @@ func (*DHCPClientDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCPClientDetails) Size() int {
+func (m *DHCPClientDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Client.SwIfIndex
size += 64 // m.Client.Hostname
size += 1 * 64 // m.Client.ID
@@ -975,37 +940,35 @@ func (m *DHCPClientDetails) Size() int {
return size
}
func (m *DHCPClientDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Client.SwIfIndex))
buf.EncodeString(m.Client.Hostname, 64)
- buf.EncodeBytes(m.Client.ID[:], 64)
+ buf.EncodeBytes(m.Client.ID, 64)
buf.EncodeBool(m.Client.WantDHCPEvent)
buf.EncodeBool(m.Client.SetBroadcastFlag)
buf.EncodeUint8(uint8(m.Client.Dscp))
- buf.EncodeUint32(uint32(m.Client.PID))
+ buf.EncodeUint32(m.Client.PID)
buf.EncodeUint32(uint32(m.Lease.SwIfIndex))
buf.EncodeUint32(uint32(m.Lease.State))
buf.EncodeBool(m.Lease.IsIPv6)
buf.EncodeString(m.Lease.Hostname, 64)
- buf.EncodeUint8(uint8(m.Lease.MaskWidth))
+ buf.EncodeUint8(m.Lease.MaskWidth)
buf.EncodeUint8(uint8(m.Lease.HostAddress.Af))
- buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Lease.RouterAddress.Af))
- buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 16)
buf.EncodeBytes(m.Lease.HostMac[:], 6)
buf.EncodeUint8(uint8(len(m.Lease.DomainServer)))
for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ {
- var v1 DomainServer
+ var v1 DomainServer // DomainServer
if j1 < len(m.Lease.DomainServer) {
v1 = m.Lease.DomainServer[j1]
}
buf.EncodeUint8(uint8(v1.Address.Af))
- buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -1013,7 +976,8 @@ func (m *DHCPClientDetails) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Client.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.Client.Hostname = buf.DecodeString(64)
- copy(m.Client.ID[:], buf.DecodeBytes(64))
+ m.Client.ID = make([]byte, 64)
+ copy(m.Client.ID, buf.DecodeBytes(len(m.Client.ID)))
m.Client.WantDHCPEvent = buf.DecodeBool()
m.Client.SetBroadcastFlag = buf.DecodeBool()
m.Client.Dscp = ip_types.IPDscp(buf.DecodeUint8())
@@ -1029,7 +993,7 @@ func (m *DHCPClientDetails) Unmarshal(b []byte) error {
copy(m.Lease.RouterAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
copy(m.Lease.HostMac[:], buf.DecodeBytes(6))
m.Lease.Count = buf.DecodeUint8()
- m.Lease.DomainServer = make([]DomainServer, int(m.Lease.Count))
+ m.Lease.DomainServer = make([]DomainServer, m.Lease.Count)
for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ {
m.Lease.DomainServer[j1].Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Lease.DomainServer[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -1047,20 +1011,17 @@ func (*DHCPClientDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCPClientDump) Size() int {
+func (m *DHCPClientDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *DHCPClientDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *DHCPClientDump) Unmarshal(b []byte) error {
@@ -1080,11 +1041,10 @@ func (*DHCPComplEvent) GetMessageType() api.MessageType {
return api.EventMessage
}
-func (m *DHCPComplEvent) Size() int {
+func (m *DHCPComplEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PID
size += 4 // m.Lease.SwIfIndex
size += 4 // m.Lease.State
@@ -1109,31 +1069,29 @@ func (m *DHCPComplEvent) Size() int {
return size
}
func (m *DHCPComplEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PID)
buf.EncodeUint32(uint32(m.Lease.SwIfIndex))
buf.EncodeUint32(uint32(m.Lease.State))
buf.EncodeBool(m.Lease.IsIPv6)
buf.EncodeString(m.Lease.Hostname, 64)
- buf.EncodeUint8(uint8(m.Lease.MaskWidth))
+ buf.EncodeUint8(m.Lease.MaskWidth)
buf.EncodeUint8(uint8(m.Lease.HostAddress.Af))
- buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Lease.HostAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Lease.RouterAddress.Af))
- buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Lease.RouterAddress.Un.XXX_UnionData[:], 16)
buf.EncodeBytes(m.Lease.HostMac[:], 6)
buf.EncodeUint8(uint8(len(m.Lease.DomainServer)))
for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ {
- var v1 DomainServer
+ var v1 DomainServer // DomainServer
if j1 < len(m.Lease.DomainServer) {
v1 = m.Lease.DomainServer[j1]
}
buf.EncodeUint8(uint8(v1.Address.Af))
- buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v1.Address.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -1151,7 +1109,7 @@ func (m *DHCPComplEvent) Unmarshal(b []byte) error {
copy(m.Lease.RouterAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
copy(m.Lease.HostMac[:], buf.DecodeBytes(6))
m.Lease.Count = buf.DecodeUint8()
- m.Lease.DomainServer = make([]DomainServer, int(m.Lease.Count))
+ m.Lease.DomainServer = make([]DomainServer, m.Lease.Count)
for j1 := 0; j1 < len(m.Lease.DomainServer); j1++ {
m.Lease.DomainServer[j1].Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Lease.DomainServer[j1].Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -1169,20 +1127,17 @@ func (*DHCPPluginControlPing) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCPPluginControlPing) Size() int {
+func (m *DHCPPluginControlPing) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *DHCPPluginControlPing) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *DHCPPluginControlPing) Unmarshal(b []byte) error {
@@ -1203,31 +1158,28 @@ func (*DHCPPluginControlPingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCPPluginControlPingReply) Size() int {
+func (m *DHCPPluginControlPingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.ClientIndex
size += 4 // m.VpePID
return size
}
func (m *DHCPPluginControlPingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.ClientIndex))
- buf.EncodeUint32(uint32(m.VpePID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.ClientIndex)
+ buf.EncodeUint32(m.VpePID)
return buf.Bytes(), nil
}
func (m *DHCPPluginControlPingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ClientIndex = buf.DecodeUint32()
m.VpePID = buf.DecodeUint32()
return nil
@@ -1243,20 +1195,17 @@ func (*DHCPPluginGetVersion) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCPPluginGetVersion) Size() int {
+func (m *DHCPPluginGetVersion) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *DHCPPluginGetVersion) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *DHCPPluginGetVersion) Unmarshal(b []byte) error {
@@ -1276,24 +1225,21 @@ func (*DHCPPluginGetVersionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCPPluginGetVersionReply) Size() int {
+func (m *DHCPPluginGetVersionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Major
size += 4 // m.Minor
return size
}
func (m *DHCPPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Major))
- buf.EncodeUint32(uint32(m.Minor))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Major)
+ buf.EncodeUint32(m.Minor)
return buf.Bytes(), nil
}
func (m *DHCPPluginGetVersionReply) Unmarshal(b []byte) error {
@@ -1319,11 +1265,10 @@ func (*DHCPProxyConfig) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCPProxyConfig) Size() int {
+func (m *DHCPProxyConfig) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.RxVrfID
size += 4 // m.ServerVrfID
size += 1 // m.IsAdd
@@ -1334,19 +1279,17 @@ func (m *DHCPProxyConfig) Size() int {
return size
}
func (m *DHCPProxyConfig) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.RxVrfID))
- buf.EncodeUint32(uint32(m.ServerVrfID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.RxVrfID)
+ buf.EncodeUint32(m.ServerVrfID)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.DHCPServer.Af))
- buf.EncodeBytes(m.DHCPServer.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DHCPServer.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.DHCPSrcAddress.Af))
- buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *DHCPProxyConfig) Unmarshal(b []byte) error {
@@ -1373,27 +1316,24 @@ func (*DHCPProxyConfigReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCPProxyConfigReply) Size() int {
+func (m *DHCPProxyConfigReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DHCPProxyConfigReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DHCPProxyConfigReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1417,11 +1357,10 @@ func (*DHCPProxyDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCPProxyDetails) Size() int {
+func (m *DHCPProxyDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.RxVrfID
size += 4 // m.VssOui
size += 4 // m.VssFibID
@@ -1444,29 +1383,27 @@ func (m *DHCPProxyDetails) Size() int {
return size
}
func (m *DHCPProxyDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.RxVrfID))
- buf.EncodeUint32(uint32(m.VssOui))
- buf.EncodeUint32(uint32(m.VssFibID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.RxVrfID)
+ buf.EncodeUint32(m.VssOui)
+ buf.EncodeUint32(m.VssFibID)
buf.EncodeUint32(uint32(m.VssType))
buf.EncodeBool(m.IsIPv6)
buf.EncodeString(m.VssVPNAsciiID, 129)
buf.EncodeUint8(uint8(m.DHCPSrcAddress.Af))
- buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DHCPSrcAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(len(m.Servers)))
for j0 := 0; j0 < len(m.Servers); j0++ {
- var v0 DHCPServer
+ var v0 DHCPServer // Servers
if j0 < len(m.Servers) {
v0 = m.Servers[j0]
}
- buf.EncodeUint32(uint32(v0.ServerVrfID))
+ buf.EncodeUint32(v0.ServerVrfID)
buf.EncodeUint8(uint8(v0.DHCPServer.Af))
- buf.EncodeBytes(v0.DHCPServer.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.DHCPServer.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -1481,7 +1418,7 @@ func (m *DHCPProxyDetails) Unmarshal(b []byte) error {
m.DHCPSrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.DHCPSrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
m.Count = buf.DecodeUint8()
- m.Servers = make([]DHCPServer, int(m.Count))
+ m.Servers = make([]DHCPServer, m.Count)
for j0 := 0; j0 < len(m.Servers); j0++ {
m.Servers[j0].ServerVrfID = buf.DecodeUint32()
m.Servers[j0].DHCPServer.Af = ip_types.AddressFamily(buf.DecodeUint8())
@@ -1502,21 +1439,18 @@ func (*DHCPProxyDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCPProxyDump) Size() int {
+func (m *DHCPProxyDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsIP6
return size
}
func (m *DHCPProxyDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsIP6)
return buf.Bytes(), nil
}
@@ -1544,11 +1478,10 @@ func (*DHCPProxySetVss) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCPProxySetVss) Size() int {
+func (m *DHCPProxySetVss) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TblID
size += 4 // m.VssType
size += 129 // m.VPNAsciiID
@@ -1559,17 +1492,15 @@ func (m *DHCPProxySetVss) Size() int {
return size
}
func (m *DHCPProxySetVss) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.TblID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TblID)
buf.EncodeUint32(uint32(m.VssType))
buf.EncodeString(m.VPNAsciiID, 129)
- buf.EncodeUint32(uint32(m.Oui))
- buf.EncodeUint32(uint32(m.VPNIndex))
+ buf.EncodeUint32(m.Oui)
+ buf.EncodeUint32(m.VPNIndex)
buf.EncodeBool(m.IsIPv6)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
@@ -1598,27 +1529,24 @@ func (*DHCPProxySetVssReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCPProxySetVssReply) Size() int {
+func (m *DHCPProxySetVssReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DHCPProxySetVssReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DHCPProxySetVssReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1635,24 +1563,21 @@ func (*WantDHCP6PdReplyEvents) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *WantDHCP6PdReplyEvents) Size() int {
+func (m *WantDHCP6PdReplyEvents) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
size += 4 // m.PID
return size
}
func (m *WantDHCP6PdReplyEvents) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
- buf.EncodeUint32(uint32(m.PID))
+ buf.EncodeUint32(m.PID)
return buf.Bytes(), nil
}
func (m *WantDHCP6PdReplyEvents) Unmarshal(b []byte) error {
@@ -1676,27 +1601,24 @@ func (*WantDHCP6PdReplyEventsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *WantDHCP6PdReplyEventsReply) Size() int {
+func (m *WantDHCP6PdReplyEventsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *WantDHCP6PdReplyEventsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *WantDHCP6PdReplyEventsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1713,24 +1635,21 @@ func (*WantDHCP6ReplyEvents) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *WantDHCP6ReplyEvents) Size() int {
+func (m *WantDHCP6ReplyEvents) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
size += 4 // m.PID
return size
}
func (m *WantDHCP6ReplyEvents) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.EnableDisable))
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.EnableDisable)
+ buf.EncodeUint32(m.PID)
return buf.Bytes(), nil
}
func (m *WantDHCP6ReplyEvents) Unmarshal(b []byte) error {
@@ -1752,27 +1671,24 @@ func (*WantDHCP6ReplyEventsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *WantDHCP6ReplyEventsReply) Size() int {
+func (m *WantDHCP6ReplyEventsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *WantDHCP6ReplyEventsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *WantDHCP6ReplyEventsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go
index 41ea756..4fcb012 100644
--- a/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go
+++ b/binapi/dhcp6_ia_na_client_cp/dhcp6_ia_na_client_cp.ba.go
@@ -42,22 +42,19 @@ func (*DHCP6ClientEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCP6ClientEnableDisable) Size() int {
+func (m *DHCP6ClientEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Enable
return size
}
func (m *DHCP6ClientEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
@@ -83,27 +80,24 @@ func (*DHCP6ClientEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCP6ClientEnableDisableReply) Size() int {
+func (m *DHCP6ClientEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DHCP6ClientEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DHCP6ClientEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go
index 73e7fad..7e4e2bb 100644
--- a/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go
+++ b/binapi/dhcp6_pd_client_cp/dhcp6_pd_client_cp.ba.go
@@ -44,23 +44,20 @@ func (*DHCP6PdClientEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DHCP6PdClientEnableDisable) Size() int {
+func (m *DHCP6PdClientEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 64 // m.PrefixGroup
size += 1 // m.Enable
return size
}
func (m *DHCP6PdClientEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeString(m.PrefixGroup, 64)
buf.EncodeBool(m.Enable)
@@ -88,27 +85,24 @@ func (*DHCP6PdClientEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DHCP6PdClientEnableDisableReply) Size() int {
+func (m *DHCP6PdClientEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DHCP6PdClientEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DHCP6PdClientEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -129,11 +123,10 @@ func (*IP6AddDelAddressUsingPrefix) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IP6AddDelAddressUsingPrefix) Size() int {
+func (m *IP6AddDelAddressUsingPrefix) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 64 // m.PrefixGroup
size += 1 * 16 // m.AddressWithPrefix.Address
@@ -142,16 +135,14 @@ func (m *IP6AddDelAddressUsingPrefix) Size() int {
return size
}
func (m *IP6AddDelAddressUsingPrefix) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeString(m.PrefixGroup, 64)
buf.EncodeBytes(m.AddressWithPrefix.Address[:], 16)
- buf.EncodeUint8(uint8(m.AddressWithPrefix.Len))
+ buf.EncodeUint8(m.AddressWithPrefix.Len)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -179,27 +170,24 @@ func (*IP6AddDelAddressUsingPrefixReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IP6AddDelAddressUsingPrefixReply) Size() int {
+func (m *IP6AddDelAddressUsingPrefixReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IP6AddDelAddressUsingPrefixReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IP6AddDelAddressUsingPrefixReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/dns/dns.ba.go b/binapi/dns/dns.ba.go
index 25c8ddf..fc2324c 100644
--- a/binapi/dns/dns.ba.go
+++ b/binapi/dns/dns.ba.go
@@ -40,22 +40,19 @@ func (*DNSEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DNSEnableDisable) Size() int {
+func (m *DNSEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
return size
}
func (m *DNSEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Enable))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Enable)
return buf.Bytes(), nil
}
func (m *DNSEnableDisable) Unmarshal(b []byte) error {
@@ -76,27 +73,24 @@ func (*DNSEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DNSEnableDisableReply) Size() int {
+func (m *DNSEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DNSEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DNSEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -114,33 +108,31 @@ func (*DNSNameServerAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DNSNameServerAddDel) Size() int {
+func (m *DNSNameServerAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsIP6
size += 1 // m.IsAdd
size += 1 * 16 // m.ServerAddress
return size
}
func (m *DNSNameServerAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.IsIP6))
- buf.EncodeUint8(uint8(m.IsAdd))
- buf.EncodeBytes(m.ServerAddress[:], 16)
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.IsIP6)
+ buf.EncodeUint8(m.IsAdd)
+ buf.EncodeBytes(m.ServerAddress, 16)
return buf.Bytes(), nil
}
func (m *DNSNameServerAddDel) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.IsIP6 = buf.DecodeUint8()
m.IsAdd = buf.DecodeUint8()
- copy(m.ServerAddress[:], buf.DecodeBytes(16))
+ m.ServerAddress = make([]byte, 16)
+ copy(m.ServerAddress, buf.DecodeBytes(len(m.ServerAddress)))
return nil
}
@@ -156,27 +148,24 @@ func (*DNSNameServerAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DNSNameServerAddDelReply) Size() int {
+func (m *DNSNameServerAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DNSNameServerAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DNSNameServerAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -193,30 +182,28 @@ func (*DNSResolveIP) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DNSResolveIP) Size() int {
+func (m *DNSResolveIP) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsIP6
size += 1 * 16 // m.Address
return size
}
func (m *DNSResolveIP) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.IsIP6))
- buf.EncodeBytes(m.Address[:], 16)
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.IsIP6)
+ buf.EncodeBytes(m.Address, 16)
return buf.Bytes(), nil
}
func (m *DNSResolveIP) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.IsIP6 = buf.DecodeUint8()
- copy(m.Address[:], buf.DecodeBytes(16))
+ m.Address = make([]byte, 16)
+ copy(m.Address, buf.DecodeBytes(len(m.Address)))
return nil
}
@@ -233,30 +220,28 @@ func (*DNSResolveIPReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DNSResolveIPReply) Size() int {
+func (m *DNSResolveIPReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 * 256 // m.Name
return size
}
func (m *DNSResolveIPReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeBytes(m.Name[:], 256)
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeBytes(m.Name, 256)
return buf.Bytes(), nil
}
func (m *DNSResolveIPReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
- copy(m.Name[:], buf.DecodeBytes(256))
+ m.Retval = buf.DecodeInt32()
+ m.Name = make([]byte, 256)
+ copy(m.Name, buf.DecodeBytes(len(m.Name)))
return nil
}
@@ -272,27 +257,25 @@ func (*DNSResolveName) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DNSResolveName) Size() int {
+func (m *DNSResolveName) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 256 // m.Name
return size
}
func (m *DNSResolveName) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeBytes(m.Name[:], 256)
+ buf := codec.NewBuffer(b)
+ buf.EncodeBytes(m.Name, 256)
return buf.Bytes(), nil
}
func (m *DNSResolveName) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- copy(m.Name[:], buf.DecodeBytes(256))
+ m.Name = make([]byte, 256)
+ copy(m.Name, buf.DecodeBytes(len(m.Name)))
return nil
}
@@ -312,11 +295,10 @@ func (*DNSResolveNameReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DNSResolveNameReply) Size() int {
+func (m *DNSResolveNameReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IP4Set
size += 1 // m.IP6Set
@@ -325,26 +307,26 @@ func (m *DNSResolveNameReply) Size() int {
return size
}
func (m *DNSResolveNameReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint8(uint8(m.IP4Set))
- buf.EncodeUint8(uint8(m.IP6Set))
- buf.EncodeBytes(m.IP4Address[:], 4)
- buf.EncodeBytes(m.IP6Address[:], 16)
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint8(m.IP4Set)
+ buf.EncodeUint8(m.IP6Set)
+ buf.EncodeBytes(m.IP4Address, 4)
+ buf.EncodeBytes(m.IP6Address, 16)
return buf.Bytes(), nil
}
func (m *DNSResolveNameReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IP4Set = buf.DecodeUint8()
m.IP6Set = buf.DecodeUint8()
- copy(m.IP4Address[:], buf.DecodeBytes(4))
- copy(m.IP6Address[:], buf.DecodeBytes(16))
+ m.IP4Address = make([]byte, 4)
+ copy(m.IP4Address, buf.DecodeBytes(len(m.IP4Address)))
+ m.IP6Address = make([]byte, 16)
+ copy(m.IP6Address, buf.DecodeBytes(len(m.IP6Address)))
return nil
}
diff --git a/binapi/dslite/dslite.ba.go b/binapi/dslite/dslite.ba.go
index b7aff21..efcf240 100644
--- a/binapi/dslite/dslite.ba.go
+++ b/binapi/dslite/dslite.ba.go
@@ -44,23 +44,20 @@ func (*DsliteAddDelPoolAddrRange) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DsliteAddDelPoolAddrRange) Size() int {
+func (m *DsliteAddDelPoolAddrRange) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.StartAddr
size += 1 * 4 // m.EndAddr
size += 1 // m.IsAdd
return size
}
func (m *DsliteAddDelPoolAddrRange) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.StartAddr[:], 4)
buf.EncodeBytes(m.EndAddr[:], 4)
buf.EncodeBool(m.IsAdd)
@@ -88,27 +85,24 @@ func (*DsliteAddDelPoolAddrRangeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DsliteAddDelPoolAddrRangeReply) Size() int {
+func (m *DsliteAddDelPoolAddrRangeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DsliteAddDelPoolAddrRangeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DsliteAddDelPoolAddrRangeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -124,21 +118,18 @@ func (*DsliteAddressDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DsliteAddressDetails) Size() int {
+func (m *DsliteAddressDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IPAddress
return size
}
func (m *DsliteAddressDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IPAddress[:], 4)
return buf.Bytes(), nil
}
@@ -158,20 +149,17 @@ func (*DsliteAddressDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DsliteAddressDump) Size() int {
+func (m *DsliteAddressDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *DsliteAddressDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *DsliteAddressDump) Unmarshal(b []byte) error {
@@ -188,20 +176,17 @@ func (*DsliteGetAftrAddr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DsliteGetAftrAddr) Size() int {
+func (m *DsliteGetAftrAddr) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *DsliteGetAftrAddr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *DsliteGetAftrAddr) Unmarshal(b []byte) error {
@@ -222,31 +207,28 @@ func (*DsliteGetAftrAddrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DsliteGetAftrAddrReply) Size() int {
+func (m *DsliteGetAftrAddrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 * 4 // m.IP4Addr
size += 1 * 16 // m.IP6Addr
return size
}
func (m *DsliteGetAftrAddrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBytes(m.IP4Addr[:], 4)
buf.EncodeBytes(m.IP6Addr[:], 16)
return buf.Bytes(), nil
}
func (m *DsliteGetAftrAddrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
copy(m.IP4Addr[:], buf.DecodeBytes(4))
copy(m.IP6Addr[:], buf.DecodeBytes(16))
return nil
@@ -262,20 +244,17 @@ func (*DsliteGetB4Addr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DsliteGetB4Addr) Size() int {
+func (m *DsliteGetB4Addr) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *DsliteGetB4Addr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *DsliteGetB4Addr) Unmarshal(b []byte) error {
@@ -296,31 +275,28 @@ func (*DsliteGetB4AddrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DsliteGetB4AddrReply) Size() int {
+func (m *DsliteGetB4AddrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 * 4 // m.IP4Addr
size += 1 * 16 // m.IP6Addr
return size
}
func (m *DsliteGetB4AddrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBytes(m.IP4Addr[:], 4)
buf.EncodeBytes(m.IP6Addr[:], 16)
return buf.Bytes(), nil
}
func (m *DsliteGetB4AddrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
copy(m.IP4Addr[:], buf.DecodeBytes(4))
copy(m.IP6Addr[:], buf.DecodeBytes(16))
return nil
@@ -339,22 +315,19 @@ func (*DsliteSetAftrAddr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DsliteSetAftrAddr) Size() int {
+func (m *DsliteSetAftrAddr) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IP4Addr
size += 1 * 16 // m.IP6Addr
return size
}
func (m *DsliteSetAftrAddr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IP4Addr[:], 4)
buf.EncodeBytes(m.IP6Addr[:], 16)
return buf.Bytes(), nil
@@ -378,27 +351,24 @@ func (*DsliteSetAftrAddrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DsliteSetAftrAddrReply) Size() int {
+func (m *DsliteSetAftrAddrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DsliteSetAftrAddrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DsliteSetAftrAddrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -415,22 +385,19 @@ func (*DsliteSetB4Addr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DsliteSetB4Addr) Size() int {
+func (m *DsliteSetB4Addr) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IP4Addr
size += 1 * 16 // m.IP6Addr
return size
}
func (m *DsliteSetB4Addr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IP4Addr[:], 4)
buf.EncodeBytes(m.IP6Addr[:], 16)
return buf.Bytes(), nil
@@ -454,27 +421,24 @@ func (*DsliteSetB4AddrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DsliteSetB4AddrReply) Size() int {
+func (m *DsliteSetB4AddrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DsliteSetB4AddrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DsliteSetB4AddrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/feature/feature.ba.go b/binapi/feature/feature.ba.go
index 4d16ce8..cc54364 100644
--- a/binapi/feature/feature.ba.go
+++ b/binapi/feature/feature.ba.go
@@ -44,11 +44,10 @@ func (*FeatureEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *FeatureEnableDisable) Size() int {
+func (m *FeatureEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Enable
size += 64 // m.ArcName
@@ -56,12 +55,10 @@ func (m *FeatureEnableDisable) Size() int {
return size
}
func (m *FeatureEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
buf.EncodeString(m.ArcName, 64)
@@ -89,27 +86,24 @@ func (*FeatureEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *FeatureEnableDisableReply) Size() int {
+func (m *FeatureEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *FeatureEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *FeatureEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/flowprobe/flowprobe.ba.go b/binapi/flowprobe/flowprobe.ba.go
index c7073f2..a08f7d0 100644
--- a/binapi/flowprobe/flowprobe.ba.go
+++ b/binapi/flowprobe/flowprobe.ba.go
@@ -143,26 +143,23 @@ func (*FlowprobeParams) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *FlowprobeParams) Size() int {
+func (m *FlowprobeParams) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.RecordFlags
size += 4 // m.ActiveTimer
size += 4 // m.PassiveTimer
return size
}
func (m *FlowprobeParams) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.RecordFlags))
- buf.EncodeUint32(uint32(m.ActiveTimer))
- buf.EncodeUint32(uint32(m.PassiveTimer))
+ buf.EncodeUint32(m.ActiveTimer)
+ buf.EncodeUint32(m.PassiveTimer)
return buf.Bytes(), nil
}
func (m *FlowprobeParams) Unmarshal(b []byte) error {
@@ -185,27 +182,24 @@ func (*FlowprobeParamsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *FlowprobeParamsReply) Size() int {
+func (m *FlowprobeParamsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *FlowprobeParamsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *FlowprobeParamsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -223,23 +217,20 @@ func (*FlowprobeTxInterfaceAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *FlowprobeTxInterfaceAddDel) Size() int {
+func (m *FlowprobeTxInterfaceAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Which
size += 4 // m.SwIfIndex
return size
}
func (m *FlowprobeTxInterfaceAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Which))
buf.EncodeUint32(uint32(m.SwIfIndex))
@@ -267,27 +258,24 @@ func (*FlowprobeTxInterfaceAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *FlowprobeTxInterfaceAddDelReply) Size() int {
+func (m *FlowprobeTxInterfaceAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *FlowprobeTxInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *FlowprobeTxInterfaceAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/gbp/gbp.ba.go b/binapi/gbp/gbp.ba.go
index 5baa4f5..a203527 100644
--- a/binapi/gbp/gbp.ba.go
+++ b/binapi/gbp/gbp.ba.go
@@ -446,11 +446,10 @@ func (*GbpBridgeDomainAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpBridgeDomainAdd) Size() int {
+func (m *GbpBridgeDomainAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Bd.BdID
size += 4 // m.Bd.RdID
size += 4 // m.Bd.Flags
@@ -460,14 +459,12 @@ func (m *GbpBridgeDomainAdd) Size() int {
return size
}
func (m *GbpBridgeDomainAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Bd.BdID))
- buf.EncodeUint32(uint32(m.Bd.RdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Bd.BdID)
+ buf.EncodeUint32(m.Bd.RdID)
buf.EncodeUint32(uint32(m.Bd.Flags))
buf.EncodeUint32(uint32(m.Bd.BviSwIfIndex))
buf.EncodeUint32(uint32(m.Bd.UuFwdSwIfIndex))
@@ -497,27 +494,24 @@ func (*GbpBridgeDomainAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpBridgeDomainAddReply) Size() int {
+func (m *GbpBridgeDomainAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpBridgeDomainAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpBridgeDomainAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -533,22 +527,19 @@ func (*GbpBridgeDomainDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpBridgeDomainDel) Size() int {
+func (m *GbpBridgeDomainDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
return size
}
func (m *GbpBridgeDomainDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
return buf.Bytes(), nil
}
func (m *GbpBridgeDomainDel) Unmarshal(b []byte) error {
@@ -569,27 +560,24 @@ func (*GbpBridgeDomainDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpBridgeDomainDelReply) Size() int {
+func (m *GbpBridgeDomainDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpBridgeDomainDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpBridgeDomainDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -605,11 +593,10 @@ func (*GbpBridgeDomainDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpBridgeDomainDetails) Size() int {
+func (m *GbpBridgeDomainDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Bd.BdID
size += 4 // m.Bd.RdID
size += 4 // m.Bd.Flags
@@ -619,14 +606,12 @@ func (m *GbpBridgeDomainDetails) Size() int {
return size
}
func (m *GbpBridgeDomainDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Bd.BdID))
- buf.EncodeUint32(uint32(m.Bd.RdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Bd.BdID)
+ buf.EncodeUint32(m.Bd.RdID)
buf.EncodeUint32(uint32(m.Bd.Flags))
buf.EncodeUint32(uint32(m.Bd.BviSwIfIndex))
buf.EncodeUint32(uint32(m.Bd.UuFwdSwIfIndex))
@@ -654,20 +639,17 @@ func (*GbpBridgeDomainDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpBridgeDomainDump) Size() int {
+func (m *GbpBridgeDomainDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GbpBridgeDomainDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GbpBridgeDomainDump) Unmarshal(b []byte) error {
@@ -686,27 +668,24 @@ func (*GbpBridgeDomainDumpReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpBridgeDomainDumpReply) Size() int {
+func (m *GbpBridgeDomainDumpReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpBridgeDomainDumpReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpBridgeDomainDumpReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -723,11 +702,10 @@ func (*GbpContractAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpContractAddDel) Size() int {
+func (m *GbpContractAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 2 // m.Contract.Scope
size += 2 // m.Contract.Sclass
@@ -746,59 +724,48 @@ func (m *GbpContractAddDel) Size() int {
size += 4 // s2.NhSet.HashMode
size += 1 // s2.NhSet.NNhs
for j4 := 0; j4 < 8; j4++ {
- var s4 GbpNextHop
- _ = s4
- if j4 < len(s2.NhSet.Nhs) {
- s4 = s2.NhSet.Nhs[j4]
- }
- size += 1 // s4.IP.Af
- size += 1 * 16 // s4.IP.Un
- size += 1 * 6 // s4.Mac
- size += 4 // s4.BdID
- size += 4 // s4.RdID
+ size += 1 // s2.NhSet.Nhs[j4].IP.Af
+ size += 1 * 16 // s2.NhSet.Nhs[j4].IP.Un
+ size += 1 * 6 // s2.NhSet.Nhs[j4].Mac
+ size += 4 // s2.NhSet.Nhs[j4].BdID
+ size += 4 // s2.NhSet.Nhs[j4].RdID
}
}
return size
}
func (m *GbpContractAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint16(uint16(m.Contract.Scope))
- buf.EncodeUint16(uint16(m.Contract.Sclass))
- buf.EncodeUint16(uint16(m.Contract.Dclass))
- buf.EncodeUint32(uint32(m.Contract.ACLIndex))
- buf.EncodeUint8(uint8(m.Contract.NEtherTypes))
+ buf.EncodeUint16(m.Contract.Sclass)
+ buf.EncodeUint16(m.Contract.Dclass)
+ buf.EncodeUint32(m.Contract.ACLIndex)
+ buf.EncodeUint8(m.Contract.NEtherTypes)
for i := 0; i < 16; i++ {
var x uint16
if i < len(m.Contract.AllowedEthertypes) {
x = uint16(m.Contract.AllowedEthertypes[i])
}
- buf.EncodeUint16(uint16(x))
+ buf.EncodeUint16(x)
}
buf.EncodeUint8(uint8(len(m.Contract.Rules)))
for j1 := 0; j1 < len(m.Contract.Rules); j1++ {
- var v1 GbpRule
+ var v1 GbpRule // Rules
if j1 < len(m.Contract.Rules) {
v1 = m.Contract.Rules[j1]
}
buf.EncodeUint32(uint32(v1.Action))
buf.EncodeUint32(uint32(v1.NhSet.HashMode))
- buf.EncodeUint8(uint8(v1.NhSet.NNhs))
+ buf.EncodeUint8(v1.NhSet.NNhs)
for j3 := 0; j3 < 8; j3++ {
- var v3 GbpNextHop
- if j3 < len(v1.NhSet.Nhs) {
- v3 = v1.NhSet.Nhs[j3]
- }
- buf.EncodeUint8(uint8(v3.IP.Af))
- buf.EncodeBytes(v3.IP.Un.XXX_UnionData[:], 0)
- buf.EncodeBytes(v3.Mac[:], 6)
- buf.EncodeUint32(uint32(v3.BdID))
- buf.EncodeUint32(uint32(v3.RdID))
+ buf.EncodeUint8(uint8(v1.NhSet.Nhs[j3].IP.Af))
+ buf.EncodeBytes(v1.NhSet.Nhs[j3].IP.Un.XXX_UnionData[:], 16)
+ buf.EncodeBytes(v1.NhSet.Nhs[j3].Mac[:], 6)
+ buf.EncodeUint32(v1.NhSet.Nhs[j3].BdID)
+ buf.EncodeUint32(v1.NhSet.Nhs[j3].RdID)
}
}
return buf.Bytes(), nil
@@ -816,7 +783,7 @@ func (m *GbpContractAddDel) Unmarshal(b []byte) error {
m.Contract.AllowedEthertypes[i] = buf.DecodeUint16()
}
m.Contract.NRules = buf.DecodeUint8()
- m.Contract.Rules = make([]GbpRule, int(m.Contract.NRules))
+ m.Contract.Rules = make([]GbpRule, m.Contract.NRules)
for j1 := 0; j1 < len(m.Contract.Rules); j1++ {
m.Contract.Rules[j1].Action = GbpRuleAction(buf.DecodeUint32())
m.Contract.Rules[j1].NhSet.HashMode = GbpHashMode(buf.DecodeUint32())
@@ -845,29 +812,26 @@ func (*GbpContractAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpContractAddDelReply) Size() int {
+func (m *GbpContractAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.StatsIndex
return size
}
func (m *GbpContractAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.StatsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.StatsIndex)
return buf.Bytes(), nil
}
func (m *GbpContractAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.StatsIndex = buf.DecodeUint32()
return nil
}
@@ -884,11 +848,10 @@ func (*GbpContractDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpContractDetails) Size() int {
+func (m *GbpContractDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.Contract.Scope
size += 2 // m.Contract.Sclass
size += 2 // m.Contract.Dclass
@@ -906,58 +869,47 @@ func (m *GbpContractDetails) Size() int {
size += 4 // s2.NhSet.HashMode
size += 1 // s2.NhSet.NNhs
for j4 := 0; j4 < 8; j4++ {
- var s4 GbpNextHop
- _ = s4
- if j4 < len(s2.NhSet.Nhs) {
- s4 = s2.NhSet.Nhs[j4]
- }
- size += 1 // s4.IP.Af
- size += 1 * 16 // s4.IP.Un
- size += 1 * 6 // s4.Mac
- size += 4 // s4.BdID
- size += 4 // s4.RdID
+ size += 1 // s2.NhSet.Nhs[j4].IP.Af
+ size += 1 * 16 // s2.NhSet.Nhs[j4].IP.Un
+ size += 1 * 6 // s2.NhSet.Nhs[j4].Mac
+ size += 4 // s2.NhSet.Nhs[j4].BdID
+ size += 4 // s2.NhSet.Nhs[j4].RdID
}
}
return size
}
func (m *GbpContractDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint16(uint16(m.Contract.Scope))
- buf.EncodeUint16(uint16(m.Contract.Sclass))
- buf.EncodeUint16(uint16(m.Contract.Dclass))
- buf.EncodeUint32(uint32(m.Contract.ACLIndex))
- buf.EncodeUint8(uint8(m.Contract.NEtherTypes))
+ buf.EncodeUint16(m.Contract.Sclass)
+ buf.EncodeUint16(m.Contract.Dclass)
+ buf.EncodeUint32(m.Contract.ACLIndex)
+ buf.EncodeUint8(m.Contract.NEtherTypes)
for i := 0; i < 16; i++ {
var x uint16
if i < len(m.Contract.AllowedEthertypes) {
x = uint16(m.Contract.AllowedEthertypes[i])
}
- buf.EncodeUint16(uint16(x))
+ buf.EncodeUint16(x)
}
buf.EncodeUint8(uint8(len(m.Contract.Rules)))
for j1 := 0; j1 < len(m.Contract.Rules); j1++ {
- var v1 GbpRule
+ var v1 GbpRule // Rules
if j1 < len(m.Contract.Rules) {
v1 = m.Contract.Rules[j1]
}
buf.EncodeUint32(uint32(v1.Action))
buf.EncodeUint32(uint32(v1.NhSet.HashMode))
- buf.EncodeUint8(uint8(v1.NhSet.NNhs))
+ buf.EncodeUint8(v1.NhSet.NNhs)
for j3 := 0; j3 < 8; j3++ {
- var v3 GbpNextHop
- if j3 < len(v1.NhSet.Nhs) {
- v3 = v1.NhSet.Nhs[j3]
- }
- buf.EncodeUint8(uint8(v3.IP.Af))
- buf.EncodeBytes(v3.IP.Un.XXX_UnionData[:], 0)
- buf.EncodeBytes(v3.Mac[:], 6)
- buf.EncodeUint32(uint32(v3.BdID))
- buf.EncodeUint32(uint32(v3.RdID))
+ buf.EncodeUint8(uint8(v1.NhSet.Nhs[j3].IP.Af))
+ buf.EncodeBytes(v1.NhSet.Nhs[j3].IP.Un.XXX_UnionData[:], 16)
+ buf.EncodeBytes(v1.NhSet.Nhs[j3].Mac[:], 6)
+ buf.EncodeUint32(v1.NhSet.Nhs[j3].BdID)
+ buf.EncodeUint32(v1.NhSet.Nhs[j3].RdID)
}
}
return buf.Bytes(), nil
@@ -974,7 +926,7 @@ func (m *GbpContractDetails) Unmarshal(b []byte) error {
m.Contract.AllowedEthertypes[i] = buf.DecodeUint16()
}
m.Contract.NRules = buf.DecodeUint8()
- m.Contract.Rules = make([]GbpRule, int(m.Contract.NRules))
+ m.Contract.Rules = make([]GbpRule, m.Contract.NRules)
for j1 := 0; j1 < len(m.Contract.Rules); j1++ {
m.Contract.Rules[j1].Action = GbpRuleAction(buf.DecodeUint32())
m.Contract.Rules[j1].NhSet.HashMode = GbpHashMode(buf.DecodeUint32())
@@ -1000,20 +952,17 @@ func (*GbpContractDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpContractDump) Size() int {
+func (m *GbpContractDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GbpContractDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GbpContractDump) Unmarshal(b []byte) error {
@@ -1032,11 +981,10 @@ func (*GbpEndpointAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpEndpointAdd) Size() int {
+func (m *GbpEndpointAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Endpoint.SwIfIndex
size += 2 // m.Endpoint.Sclass
size += 4 // m.Endpoint.Flags
@@ -1058,28 +1006,26 @@ func (m *GbpEndpointAdd) Size() int {
return size
}
func (m *GbpEndpointAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Endpoint.SwIfIndex))
- buf.EncodeUint16(uint16(m.Endpoint.Sclass))
+ buf.EncodeUint16(m.Endpoint.Sclass)
buf.EncodeUint32(uint32(m.Endpoint.Flags))
buf.EncodeBytes(m.Endpoint.Mac[:], 6)
buf.EncodeUint8(uint8(m.Endpoint.Tun.Src.Af))
- buf.EncodeBytes(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Endpoint.Tun.Dst.Af))
- buf.EncodeBytes(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(len(m.Endpoint.Ips)))
for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ {
- var v1 ip_types.Address
+ var v1 ip_types.Address // Ips
if j1 < len(m.Endpoint.Ips) {
v1 = m.Endpoint.Ips[j1]
}
buf.EncodeUint8(uint8(v1.Af))
- buf.EncodeBytes(v1.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v1.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -1094,7 +1040,7 @@ func (m *GbpEndpointAdd) Unmarshal(b []byte) error {
m.Endpoint.Tun.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
m.Endpoint.NIps = buf.DecodeUint8()
- m.Endpoint.Ips = make([]ip_types.Address, int(m.Endpoint.NIps))
+ m.Endpoint.Ips = make([]ip_types.Address, m.Endpoint.NIps)
for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ {
m.Endpoint.Ips[j1].Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Endpoint.Ips[j1].Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -1115,29 +1061,26 @@ func (*GbpEndpointAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpEndpointAddReply) Size() int {
+func (m *GbpEndpointAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Handle
return size
}
func (m *GbpEndpointAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.Handle))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.Handle)
return buf.Bytes(), nil
}
func (m *GbpEndpointAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Handle = buf.DecodeUint32()
return nil
}
@@ -1154,22 +1097,19 @@ func (*GbpEndpointDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpEndpointDel) Size() int {
+func (m *GbpEndpointDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Handle
return size
}
func (m *GbpEndpointDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Handle))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Handle)
return buf.Bytes(), nil
}
func (m *GbpEndpointDel) Unmarshal(b []byte) error {
@@ -1190,27 +1130,24 @@ func (*GbpEndpointDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpEndpointDelReply) Size() int {
+func (m *GbpEndpointDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpEndpointDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpEndpointDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1228,11 +1165,10 @@ func (*GbpEndpointDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpEndpointDetails) Size() int {
+func (m *GbpEndpointDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.Age
size += 4 // m.Handle
size += 4 // m.Endpoint.SwIfIndex
@@ -1256,36 +1192,34 @@ func (m *GbpEndpointDetails) Size() int {
return size
}
func (m *GbpEndpointDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeFloat64(float64(m.Age))
- buf.EncodeUint32(uint32(m.Handle))
+ buf := codec.NewBuffer(b)
+ buf.EncodeFloat64(m.Age)
+ buf.EncodeUint32(m.Handle)
buf.EncodeUint32(uint32(m.Endpoint.SwIfIndex))
- buf.EncodeUint16(uint16(m.Endpoint.Sclass))
+ buf.EncodeUint16(m.Endpoint.Sclass)
buf.EncodeUint32(uint32(m.Endpoint.Flags))
buf.EncodeBytes(m.Endpoint.Mac[:], 6)
buf.EncodeUint8(uint8(m.Endpoint.Tun.Src.Af))
- buf.EncodeBytes(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Endpoint.Tun.Src.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Endpoint.Tun.Dst.Af))
- buf.EncodeBytes(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(len(m.Endpoint.Ips)))
for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ {
- var v1 ip_types.Address
+ var v1 ip_types.Address // Ips
if j1 < len(m.Endpoint.Ips) {
v1 = m.Endpoint.Ips[j1]
}
buf.EncodeUint8(uint8(v1.Af))
- buf.EncodeBytes(v1.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v1.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
func (m *GbpEndpointDetails) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Age = float64(buf.DecodeFloat64())
+ m.Age = buf.DecodeFloat64()
m.Handle = buf.DecodeUint32()
m.Endpoint.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.Endpoint.Sclass = buf.DecodeUint16()
@@ -1296,7 +1230,7 @@ func (m *GbpEndpointDetails) Unmarshal(b []byte) error {
m.Endpoint.Tun.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Endpoint.Tun.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
m.Endpoint.NIps = buf.DecodeUint8()
- m.Endpoint.Ips = make([]ip_types.Address, int(m.Endpoint.NIps))
+ m.Endpoint.Ips = make([]ip_types.Address, m.Endpoint.NIps)
for j1 := 0; j1 < len(m.Endpoint.Ips); j1++ {
m.Endpoint.Ips[j1].Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Endpoint.Ips[j1].Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -1314,20 +1248,17 @@ func (*GbpEndpointDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpEndpointDump) Size() int {
+func (m *GbpEndpointDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GbpEndpointDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GbpEndpointDump) Unmarshal(b []byte) error {
@@ -1346,11 +1277,10 @@ func (*GbpEndpointGroupAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpEndpointGroupAdd) Size() int {
+func (m *GbpEndpointGroupAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Epg.Vnid
size += 2 // m.Epg.Sclass
size += 4 // m.Epg.BdID
@@ -1360,18 +1290,16 @@ func (m *GbpEndpointGroupAdd) Size() int {
return size
}
func (m *GbpEndpointGroupAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.Epg.Vnid))
- buf.EncodeUint16(uint16(m.Epg.Sclass))
- buf.EncodeUint32(uint32(m.Epg.BdID))
- buf.EncodeUint32(uint32(m.Epg.RdID))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Epg.Vnid)
+ buf.EncodeUint16(m.Epg.Sclass)
+ buf.EncodeUint32(m.Epg.BdID)
+ buf.EncodeUint32(m.Epg.RdID)
buf.EncodeUint32(uint32(m.Epg.UplinkSwIfIndex))
- buf.EncodeUint32(uint32(m.Epg.Retention.RemoteEpTimeout))
+ buf.EncodeUint32(m.Epg.Retention.RemoteEpTimeout)
return buf.Bytes(), nil
}
func (m *GbpEndpointGroupAdd) Unmarshal(b []byte) error {
@@ -1397,27 +1325,24 @@ func (*GbpEndpointGroupAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpEndpointGroupAddReply) Size() int {
+func (m *GbpEndpointGroupAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpEndpointGroupAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpEndpointGroupAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1433,22 +1358,19 @@ func (*GbpEndpointGroupDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpEndpointGroupDel) Size() int {
+func (m *GbpEndpointGroupDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.Sclass
return size
}
func (m *GbpEndpointGroupDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.Sclass))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.Sclass)
return buf.Bytes(), nil
}
func (m *GbpEndpointGroupDel) Unmarshal(b []byte) error {
@@ -1469,27 +1391,24 @@ func (*GbpEndpointGroupDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpEndpointGroupDelReply) Size() int {
+func (m *GbpEndpointGroupDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpEndpointGroupDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpEndpointGroupDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1505,11 +1424,10 @@ func (*GbpEndpointGroupDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpEndpointGroupDetails) Size() int {
+func (m *GbpEndpointGroupDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Epg.Vnid
size += 2 // m.Epg.Sclass
size += 4 // m.Epg.BdID
@@ -1519,18 +1437,16 @@ func (m *GbpEndpointGroupDetails) Size() int {
return size
}
func (m *GbpEndpointGroupDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.Epg.Vnid))
- buf.EncodeUint16(uint16(m.Epg.Sclass))
- buf.EncodeUint32(uint32(m.Epg.BdID))
- buf.EncodeUint32(uint32(m.Epg.RdID))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Epg.Vnid)
+ buf.EncodeUint16(m.Epg.Sclass)
+ buf.EncodeUint32(m.Epg.BdID)
+ buf.EncodeUint32(m.Epg.RdID)
buf.EncodeUint32(uint32(m.Epg.UplinkSwIfIndex))
- buf.EncodeUint32(uint32(m.Epg.Retention.RemoteEpTimeout))
+ buf.EncodeUint32(m.Epg.Retention.RemoteEpTimeout)
return buf.Bytes(), nil
}
func (m *GbpEndpointGroupDetails) Unmarshal(b []byte) error {
@@ -1554,20 +1470,17 @@ func (*GbpEndpointGroupDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpEndpointGroupDump) Size() int {
+func (m *GbpEndpointGroupDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GbpEndpointGroupDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GbpEndpointGroupDump) Unmarshal(b []byte) error {
@@ -1587,11 +1500,10 @@ func (*GbpExtItfAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpExtItfAddDel) Size() int {
+func (m *GbpExtItfAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.ExtItf.SwIfIndex
size += 4 // m.ExtItf.BdID
@@ -1600,16 +1512,14 @@ func (m *GbpExtItfAddDel) Size() int {
return size
}
func (m *GbpExtItfAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.ExtItf.SwIfIndex))
- buf.EncodeUint32(uint32(m.ExtItf.BdID))
- buf.EncodeUint32(uint32(m.ExtItf.RdID))
+ buf.EncodeUint32(m.ExtItf.BdID)
+ buf.EncodeUint32(m.ExtItf.RdID)
buf.EncodeUint32(uint32(m.ExtItf.Flags))
return buf.Bytes(), nil
}
@@ -1635,27 +1545,24 @@ func (*GbpExtItfAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpExtItfAddDelReply) Size() int {
+func (m *GbpExtItfAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpExtItfAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpExtItfAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1671,11 +1578,10 @@ func (*GbpExtItfDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpExtItfDetails) Size() int {
+func (m *GbpExtItfDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ExtItf.SwIfIndex
size += 4 // m.ExtItf.BdID
size += 4 // m.ExtItf.RdID
@@ -1683,15 +1589,13 @@ func (m *GbpExtItfDetails) Size() int {
return size
}
func (m *GbpExtItfDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.ExtItf.SwIfIndex))
- buf.EncodeUint32(uint32(m.ExtItf.BdID))
- buf.EncodeUint32(uint32(m.ExtItf.RdID))
+ buf.EncodeUint32(m.ExtItf.BdID)
+ buf.EncodeUint32(m.ExtItf.RdID)
buf.EncodeUint32(uint32(m.ExtItf.Flags))
return buf.Bytes(), nil
}
@@ -1714,20 +1618,17 @@ func (*GbpExtItfDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpExtItfDump) Size() int {
+func (m *GbpExtItfDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GbpExtItfDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GbpExtItfDump) Unmarshal(b []byte) error {
@@ -1747,11 +1648,10 @@ func (*GbpRecircAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpRecircAddDel) Size() int {
+func (m *GbpRecircAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Recirc.SwIfIndex
size += 2 // m.Recirc.Sclass
@@ -1759,15 +1659,13 @@ func (m *GbpRecircAddDel) Size() int {
return size
}
func (m *GbpRecircAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.Recirc.SwIfIndex))
- buf.EncodeUint16(uint16(m.Recirc.Sclass))
+ buf.EncodeUint16(m.Recirc.Sclass)
buf.EncodeBool(m.Recirc.IsExt)
return buf.Bytes(), nil
}
@@ -1792,27 +1690,24 @@ func (*GbpRecircAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpRecircAddDelReply) Size() int {
+func (m *GbpRecircAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpRecircAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpRecircAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1828,25 +1723,22 @@ func (*GbpRecircDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpRecircDetails) Size() int {
+func (m *GbpRecircDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Recirc.SwIfIndex
size += 2 // m.Recirc.Sclass
size += 1 // m.Recirc.IsExt
return size
}
func (m *GbpRecircDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Recirc.SwIfIndex))
- buf.EncodeUint16(uint16(m.Recirc.Sclass))
+ buf.EncodeUint16(m.Recirc.Sclass)
buf.EncodeBool(m.Recirc.IsExt)
return buf.Bytes(), nil
}
@@ -1868,20 +1760,17 @@ func (*GbpRecircDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpRecircDump) Size() int {
+func (m *GbpRecircDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GbpRecircDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GbpRecircDump) Unmarshal(b []byte) error {
@@ -1900,11 +1789,10 @@ func (*GbpRouteDomainAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpRouteDomainAdd) Size() int {
+func (m *GbpRouteDomainAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Rd.RdID
size += 4 // m.Rd.IP4TableID
size += 4 // m.Rd.IP6TableID
@@ -1914,15 +1802,13 @@ func (m *GbpRouteDomainAdd) Size() int {
return size
}
func (m *GbpRouteDomainAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Rd.RdID))
- buf.EncodeUint32(uint32(m.Rd.IP4TableID))
- buf.EncodeUint32(uint32(m.Rd.IP6TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Rd.RdID)
+ buf.EncodeUint32(m.Rd.IP4TableID)
+ buf.EncodeUint32(m.Rd.IP6TableID)
buf.EncodeUint32(uint32(m.Rd.IP4UuSwIfIndex))
buf.EncodeUint32(uint32(m.Rd.IP6UuSwIfIndex))
buf.EncodeUint16(uint16(m.Rd.Scope))
@@ -1951,27 +1837,24 @@ func (*GbpRouteDomainAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpRouteDomainAddReply) Size() int {
+func (m *GbpRouteDomainAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpRouteDomainAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpRouteDomainAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1987,22 +1870,19 @@ func (*GbpRouteDomainDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpRouteDomainDel) Size() int {
+func (m *GbpRouteDomainDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.RdID
return size
}
func (m *GbpRouteDomainDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.RdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.RdID)
return buf.Bytes(), nil
}
func (m *GbpRouteDomainDel) Unmarshal(b []byte) error {
@@ -2023,27 +1903,24 @@ func (*GbpRouteDomainDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpRouteDomainDelReply) Size() int {
+func (m *GbpRouteDomainDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpRouteDomainDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpRouteDomainDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2059,11 +1936,10 @@ func (*GbpRouteDomainDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpRouteDomainDetails) Size() int {
+func (m *GbpRouteDomainDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Rd.RdID
size += 4 // m.Rd.IP4TableID
size += 4 // m.Rd.IP6TableID
@@ -2073,15 +1949,13 @@ func (m *GbpRouteDomainDetails) Size() int {
return size
}
func (m *GbpRouteDomainDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Rd.RdID))
- buf.EncodeUint32(uint32(m.Rd.IP4TableID))
- buf.EncodeUint32(uint32(m.Rd.IP6TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Rd.RdID)
+ buf.EncodeUint32(m.Rd.IP4TableID)
+ buf.EncodeUint32(m.Rd.IP6TableID)
buf.EncodeUint32(uint32(m.Rd.IP4UuSwIfIndex))
buf.EncodeUint32(uint32(m.Rd.IP6UuSwIfIndex))
buf.EncodeUint16(uint16(m.Rd.Scope))
@@ -2108,20 +1982,17 @@ func (*GbpRouteDomainDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpRouteDomainDump) Size() int {
+func (m *GbpRouteDomainDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GbpRouteDomainDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GbpRouteDomainDump) Unmarshal(b []byte) error {
@@ -2140,27 +2011,24 @@ func (*GbpRouteDomainDumpReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpRouteDomainDumpReply) Size() int {
+func (m *GbpRouteDomainDumpReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpRouteDomainDumpReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpRouteDomainDumpReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2177,11 +2045,10 @@ func (*GbpSubnetAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpSubnetAddDel) Size() int {
+func (m *GbpSubnetAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Subnet.RdID
size += 4 // m.Subnet.SwIfIndex
@@ -2193,20 +2060,18 @@ func (m *GbpSubnetAddDel) Size() int {
return size
}
func (m *GbpSubnetAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Subnet.RdID))
+ buf.EncodeUint32(m.Subnet.RdID)
buf.EncodeUint32(uint32(m.Subnet.SwIfIndex))
- buf.EncodeUint16(uint16(m.Subnet.Sclass))
+ buf.EncodeUint16(m.Subnet.Sclass)
buf.EncodeUint32(uint32(m.Subnet.Type))
buf.EncodeUint8(uint8(m.Subnet.Prefix.Address.Af))
- buf.EncodeBytes(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Subnet.Prefix.Len))
+ buf.EncodeBytes(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Subnet.Prefix.Len)
return buf.Bytes(), nil
}
func (m *GbpSubnetAddDel) Unmarshal(b []byte) error {
@@ -2234,27 +2099,24 @@ func (*GbpSubnetAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpSubnetAddDelReply) Size() int {
+func (m *GbpSubnetAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpSubnetAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpSubnetAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2270,11 +2132,10 @@ func (*GbpSubnetDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpSubnetDetails) Size() int {
+func (m *GbpSubnetDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Subnet.RdID
size += 4 // m.Subnet.SwIfIndex
size += 2 // m.Subnet.Sclass
@@ -2285,19 +2146,17 @@ func (m *GbpSubnetDetails) Size() int {
return size
}
func (m *GbpSubnetDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Subnet.RdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Subnet.RdID)
buf.EncodeUint32(uint32(m.Subnet.SwIfIndex))
- buf.EncodeUint16(uint16(m.Subnet.Sclass))
+ buf.EncodeUint16(m.Subnet.Sclass)
buf.EncodeUint32(uint32(m.Subnet.Type))
buf.EncodeUint8(uint8(m.Subnet.Prefix.Address.Af))
- buf.EncodeBytes(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Subnet.Prefix.Len))
+ buf.EncodeBytes(m.Subnet.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Subnet.Prefix.Len)
return buf.Bytes(), nil
}
func (m *GbpSubnetDetails) Unmarshal(b []byte) error {
@@ -2322,20 +2181,17 @@ func (*GbpSubnetDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpSubnetDump) Size() int {
+func (m *GbpSubnetDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GbpSubnetDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GbpSubnetDump) Unmarshal(b []byte) error {
@@ -2354,11 +2210,10 @@ func (*GbpVxlanTunnelAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpVxlanTunnelAdd) Size() int {
+func (m *GbpVxlanTunnelAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Tunnel.Vni
size += 4 // m.Tunnel.Mode
size += 4 // m.Tunnel.BdRdID
@@ -2366,15 +2221,13 @@ func (m *GbpVxlanTunnelAdd) Size() int {
return size
}
func (m *GbpVxlanTunnelAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Tunnel.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Tunnel.Vni)
buf.EncodeUint32(uint32(m.Tunnel.Mode))
- buf.EncodeUint32(uint32(m.Tunnel.BdRdID))
+ buf.EncodeUint32(m.Tunnel.BdRdID)
buf.EncodeBytes(m.Tunnel.Src[:], 4)
return buf.Bytes(), nil
}
@@ -2400,29 +2253,26 @@ func (*GbpVxlanTunnelAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpVxlanTunnelAddReply) Size() int {
+func (m *GbpVxlanTunnelAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *GbpVxlanTunnelAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *GbpVxlanTunnelAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -2439,22 +2289,19 @@ func (*GbpVxlanTunnelDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpVxlanTunnelDel) Size() int {
+func (m *GbpVxlanTunnelDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
return size
}
func (m *GbpVxlanTunnelDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *GbpVxlanTunnelDel) Unmarshal(b []byte) error {
@@ -2475,27 +2322,24 @@ func (*GbpVxlanTunnelDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpVxlanTunnelDelReply) Size() int {
+func (m *GbpVxlanTunnelDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GbpVxlanTunnelDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GbpVxlanTunnelDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2511,11 +2355,10 @@ func (*GbpVxlanTunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GbpVxlanTunnelDetails) Size() int {
+func (m *GbpVxlanTunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Tunnel.Vni
size += 4 // m.Tunnel.Mode
size += 4 // m.Tunnel.BdRdID
@@ -2523,15 +2366,13 @@ func (m *GbpVxlanTunnelDetails) Size() int {
return size
}
func (m *GbpVxlanTunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Tunnel.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Tunnel.Vni)
buf.EncodeUint32(uint32(m.Tunnel.Mode))
- buf.EncodeUint32(uint32(m.Tunnel.BdRdID))
+ buf.EncodeUint32(m.Tunnel.BdRdID)
buf.EncodeBytes(m.Tunnel.Src[:], 4)
return buf.Bytes(), nil
}
@@ -2554,20 +2395,17 @@ func (*GbpVxlanTunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GbpVxlanTunnelDump) Size() int {
+func (m *GbpVxlanTunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GbpVxlanTunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GbpVxlanTunnelDump) Unmarshal(b []byte) error {
diff --git a/binapi/gen.go b/binapi/gen.go
new file mode 100644
index 0000000..aefde2b
--- /dev/null
+++ b/binapi/gen.go
@@ -0,0 +1,21 @@
+// Copyright (c) 2020 Cisco and/or its affiliates.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package binapi
+
+// To generate bindings for VPP API files in the default system directory, run:
+//
+// go generate ./binapi
+//
+//go:generate binapi-generator -input-dir=/usr/share/vpp/api -output-dir=. -gen=rpc,rest
diff --git a/binapi/geneve/geneve.ba.go b/binapi/geneve/geneve.ba.go
index 154ce6a..fcd512d 100644
--- a/binapi/geneve/geneve.ba.go
+++ b/binapi/geneve/geneve.ba.go
@@ -49,11 +49,10 @@ func (*GeneveAddDelTunnel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GeneveAddDelTunnel) Size() int {
+func (m *GeneveAddDelTunnel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.LocalAddress.Af
size += 1 * 16 // m.LocalAddress.Un
@@ -66,21 +65,19 @@ func (m *GeneveAddDelTunnel) Size() int {
return size
}
func (m *GeneveAddDelTunnel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.LocalAddress.Af))
- buf.EncodeBytes(m.LocalAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LocalAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.RemoteAddress.Af))
- buf.EncodeBytes(m.RemoteAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.RemoteAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.EncapVrfID))
- buf.EncodeUint32(uint32(m.DecapNextIndex))
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.EncapVrfID)
+ buf.EncodeUint32(m.DecapNextIndex)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *GeneveAddDelTunnel) Unmarshal(b []byte) error {
@@ -110,29 +107,26 @@ func (*GeneveAddDelTunnelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GeneveAddDelTunnelReply) Size() int {
+func (m *GeneveAddDelTunnelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *GeneveAddDelTunnelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *GeneveAddDelTunnelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -155,11 +149,10 @@ func (*GeneveTunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GeneveTunnelDetails) Size() int {
+func (m *GeneveTunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.SrcAddress.Af
size += 1 * 16 // m.SrcAddress.Un
@@ -172,21 +165,19 @@ func (m *GeneveTunnelDetails) Size() int {
return size
}
func (m *GeneveTunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.SrcAddress.Af))
- buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.DstAddress.Af))
- buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.EncapVrfID))
- buf.EncodeUint32(uint32(m.DecapNextIndex))
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.EncapVrfID)
+ buf.EncodeUint32(m.DecapNextIndex)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *GeneveTunnelDetails) Unmarshal(b []byte) error {
@@ -215,21 +206,18 @@ func (*GeneveTunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GeneveTunnelDump) Size() int {
+func (m *GeneveTunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *GeneveTunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -253,23 +241,20 @@ func (*SwInterfaceSetGeneveBypass) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetGeneveBypass) Size() int {
+func (m *SwInterfaceSetGeneveBypass) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
size += 1 // m.Enable
return size
}
func (m *SwInterfaceSetGeneveBypass) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
buf.EncodeBool(m.Enable)
@@ -297,27 +282,24 @@ func (*SwInterfaceSetGeneveBypassReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetGeneveBypassReply) Size() int {
+func (m *SwInterfaceSetGeneveBypassReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetGeneveBypassReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetGeneveBypassReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/gre/gre.ba.go b/binapi/gre/gre.ba.go
index e87e88f..d14c51e 100644
--- a/binapi/gre/gre.ba.go
+++ b/binapi/gre/gre.ba.go
@@ -90,11 +90,10 @@ func (*GreTunnelAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GreTunnelAddDel) Size() int {
+func (m *GreTunnelAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Tunnel.Type
size += 1 // m.Tunnel.Mode
@@ -110,24 +109,22 @@ func (m *GreTunnelAddDel) Size() int {
return size
}
func (m *GreTunnelAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Tunnel.Type))
buf.EncodeUint8(uint8(m.Tunnel.Mode))
buf.EncodeUint8(uint8(m.Tunnel.Flags))
- buf.EncodeUint16(uint16(m.Tunnel.SessionID))
- buf.EncodeUint32(uint32(m.Tunnel.Instance))
- buf.EncodeUint32(uint32(m.Tunnel.OuterTableID))
+ buf.EncodeUint16(m.Tunnel.SessionID)
+ buf.EncodeUint32(m.Tunnel.Instance)
+ buf.EncodeUint32(m.Tunnel.OuterTableID)
buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
- buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
- buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *GreTunnelAddDel) Unmarshal(b []byte) error {
@@ -160,29 +157,26 @@ func (*GreTunnelAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GreTunnelAddDelReply) Size() int {
+func (m *GreTunnelAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *GreTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *GreTunnelAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -199,11 +193,10 @@ func (*GreTunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GreTunnelDetails) Size() int {
+func (m *GreTunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Tunnel.Type
size += 1 // m.Tunnel.Mode
size += 1 // m.Tunnel.Flags
@@ -218,23 +211,21 @@ func (m *GreTunnelDetails) Size() int {
return size
}
func (m *GreTunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Tunnel.Type))
buf.EncodeUint8(uint8(m.Tunnel.Mode))
buf.EncodeUint8(uint8(m.Tunnel.Flags))
- buf.EncodeUint16(uint16(m.Tunnel.SessionID))
- buf.EncodeUint32(uint32(m.Tunnel.Instance))
- buf.EncodeUint32(uint32(m.Tunnel.OuterTableID))
+ buf.EncodeUint16(m.Tunnel.SessionID)
+ buf.EncodeUint32(m.Tunnel.Instance)
+ buf.EncodeUint32(m.Tunnel.OuterTableID)
buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
- buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
- buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *GreTunnelDetails) Unmarshal(b []byte) error {
@@ -265,21 +256,18 @@ func (*GreTunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GreTunnelDump) Size() int {
+func (m *GreTunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *GreTunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
diff --git a/binapi/gso/gso.ba.go b/binapi/gso/gso.ba.go
index 2b2d45a..78e7536 100644
--- a/binapi/gso/gso.ba.go
+++ b/binapi/gso/gso.ba.go
@@ -42,22 +42,19 @@ func (*FeatureGsoEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *FeatureGsoEnableDisable) Size() int {
+func (m *FeatureGsoEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.EnableDisable
return size
}
func (m *FeatureGsoEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.EnableDisable)
return buf.Bytes(), nil
@@ -83,27 +80,24 @@ func (*FeatureGsoEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *FeatureGsoEnableDisableReply) Size() int {
+func (m *FeatureGsoEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *FeatureGsoEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *FeatureGsoEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/gtpu/gtpu.ba.go b/binapi/gtpu/gtpu.ba.go
index 02903a9..96ae51f 100644
--- a/binapi/gtpu/gtpu.ba.go
+++ b/binapi/gtpu/gtpu.ba.go
@@ -48,11 +48,10 @@ func (*GtpuAddDelTunnel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GtpuAddDelTunnel) Size() int {
+func (m *GtpuAddDelTunnel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.SrcAddress.Af
size += 1 * 16 // m.SrcAddress.Un
@@ -65,21 +64,19 @@ func (m *GtpuAddDelTunnel) Size() int {
return size
}
func (m *GtpuAddDelTunnel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.SrcAddress.Af))
- buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.DstAddress.Af))
- buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.EncapVrfID))
- buf.EncodeUint32(uint32(m.DecapNextIndex))
- buf.EncodeUint32(uint32(m.Teid))
+ buf.EncodeUint32(m.EncapVrfID)
+ buf.EncodeUint32(m.DecapNextIndex)
+ buf.EncodeUint32(m.Teid)
return buf.Bytes(), nil
}
func (m *GtpuAddDelTunnel) Unmarshal(b []byte) error {
@@ -109,29 +106,26 @@ func (*GtpuAddDelTunnelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GtpuAddDelTunnelReply) Size() int {
+func (m *GtpuAddDelTunnelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *GtpuAddDelTunnelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *GtpuAddDelTunnelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -150,26 +144,23 @@ func (*GtpuOffloadRx) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GtpuOffloadRx) Size() int {
+func (m *GtpuOffloadRx) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.HwIfIndex
size += 4 // m.SwIfIndex
size += 1 // m.Enable
return size
}
func (m *GtpuOffloadRx) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.HwIfIndex))
- buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.Enable))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.HwIfIndex)
+ buf.EncodeUint32(m.SwIfIndex)
+ buf.EncodeUint8(m.Enable)
return buf.Bytes(), nil
}
func (m *GtpuOffloadRx) Unmarshal(b []byte) error {
@@ -192,27 +183,24 @@ func (*GtpuOffloadRxReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GtpuOffloadRxReply) Size() int {
+func (m *GtpuOffloadRxReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GtpuOffloadRxReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GtpuOffloadRxReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -234,11 +222,10 @@ func (*GtpuTunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GtpuTunnelDetails) Size() int {
+func (m *GtpuTunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.SrcAddress.Af
size += 1 * 16 // m.SrcAddress.Un
@@ -251,21 +238,19 @@ func (m *GtpuTunnelDetails) Size() int {
return size
}
func (m *GtpuTunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.SrcAddress.Af))
- buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.DstAddress.Af))
- buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.EncapVrfID))
- buf.EncodeUint32(uint32(m.DecapNextIndex))
- buf.EncodeUint32(uint32(m.Teid))
+ buf.EncodeUint32(m.EncapVrfID)
+ buf.EncodeUint32(m.DecapNextIndex)
+ buf.EncodeUint32(m.Teid)
return buf.Bytes(), nil
}
func (m *GtpuTunnelDetails) Unmarshal(b []byte) error {
@@ -294,21 +279,18 @@ func (*GtpuTunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GtpuTunnelDump) Size() int {
+func (m *GtpuTunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *GtpuTunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -332,23 +314,20 @@ func (*SwInterfaceSetGtpuBypass) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetGtpuBypass) Size() int {
+func (m *SwInterfaceSetGtpuBypass) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
size += 1 // m.Enable
return size
}
func (m *SwInterfaceSetGtpuBypass) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
buf.EncodeBool(m.Enable)
@@ -376,27 +355,24 @@ func (*SwInterfaceSetGtpuBypassReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetGtpuBypassReply) Size() int {
+func (m *SwInterfaceSetGtpuBypassReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetGtpuBypassReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetGtpuBypassReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/http_static/http_static.ba.go b/binapi/http_static/http_static.ba.go
index c1338ed..2116a8b 100644
--- a/binapi/http_static/http_static.ba.go
+++ b/binapi/http_static/http_static.ba.go
@@ -45,11 +45,10 @@ func (*HTTPStaticEnable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *HTTPStaticEnable) Size() int {
+func (m *HTTPStaticEnable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.FifoSize
size += 4 // m.CacheSizeLimit
size += 4 // m.PreallocFifos
@@ -59,16 +58,14 @@ func (m *HTTPStaticEnable) Size() int {
return size
}
func (m *HTTPStaticEnable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.FifoSize))
- buf.EncodeUint32(uint32(m.CacheSizeLimit))
- buf.EncodeUint32(uint32(m.PreallocFifos))
- buf.EncodeUint32(uint32(m.PrivateSegmentSize))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.FifoSize)
+ buf.EncodeUint32(m.CacheSizeLimit)
+ buf.EncodeUint32(m.PreallocFifos)
+ buf.EncodeUint32(m.PrivateSegmentSize)
buf.EncodeString(m.WwwRoot, 256)
buf.EncodeString(m.URI, 256)
return buf.Bytes(), nil
@@ -96,27 +93,24 @@ func (*HTTPStaticEnableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *HTTPStaticEnableReply) Size() int {
+func (m *HTTPStaticEnableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *HTTPStaticEnableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *HTTPStaticEnableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/igmp/igmp.ba.go b/binapi/igmp/igmp.ba.go
index 5e520cc..5026657 100644
--- a/binapi/igmp/igmp.ba.go
+++ b/binapi/igmp/igmp.ba.go
@@ -114,21 +114,18 @@ func (*IgmpClearInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IgmpClearInterface) Size() int {
+func (m *IgmpClearInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *IgmpClearInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -150,27 +147,24 @@ func (*IgmpClearInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IgmpClearInterfaceReply) Size() int {
+func (m *IgmpClearInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IgmpClearInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IgmpClearInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -188,23 +182,20 @@ func (*IgmpDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IgmpDetails) Size() int {
+func (m *IgmpDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 * 4 // m.Saddr
size += 1 * 4 // m.Gaddr
return size
}
func (m *IgmpDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.Saddr[:], 4)
buf.EncodeBytes(m.Gaddr[:], 4)
@@ -230,21 +221,18 @@ func (*IgmpDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IgmpDump) Size() int {
+func (m *IgmpDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *IgmpDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -268,25 +256,22 @@ func (*IgmpEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IgmpEnableDisable) Size() int {
+func (m *IgmpEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
size += 1 // m.Mode
size += 4 // m.SwIfIndex
return size
}
func (m *IgmpEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
- buf.EncodeUint8(uint8(m.Mode))
+ buf.EncodeUint8(m.Mode)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -310,27 +295,24 @@ func (*IgmpEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IgmpEnableDisableReply) Size() int {
+func (m *IgmpEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IgmpEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IgmpEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -349,11 +331,10 @@ func (*IgmpEvent) GetMessageType() api.MessageType {
return api.OtherMessage
}
-func (m *IgmpEvent) Size() int {
+func (m *IgmpEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.Filter
size += 1 * 4 // m.Saddr
@@ -361,12 +342,10 @@ func (m *IgmpEvent) Size() int {
return size
}
func (m *IgmpEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint32(uint32(m.Filter))
buf.EncodeBytes(m.Saddr[:], 4)
@@ -394,11 +373,10 @@ func (*IgmpGroupPrefixDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IgmpGroupPrefixDetails) Size() int {
+func (m *IgmpGroupPrefixDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Gp.Type
size += 1 // m.Gp.Prefix.Address.Af
size += 1 * 16 // m.Gp.Prefix.Address.Un
@@ -406,16 +384,14 @@ func (m *IgmpGroupPrefixDetails) Size() int {
return size
}
func (m *IgmpGroupPrefixDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Gp.Type))
buf.EncodeUint8(uint8(m.Gp.Prefix.Address.Af))
- buf.EncodeBytes(m.Gp.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Gp.Prefix.Len))
+ buf.EncodeBytes(m.Gp.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Gp.Prefix.Len)
return buf.Bytes(), nil
}
func (m *IgmpGroupPrefixDetails) Unmarshal(b []byte) error {
@@ -437,20 +413,17 @@ func (*IgmpGroupPrefixDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IgmpGroupPrefixDump) Size() int {
+func (m *IgmpGroupPrefixDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IgmpGroupPrefixDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IgmpGroupPrefixDump) Unmarshal(b []byte) error {
@@ -469,11 +442,10 @@ func (*IgmpGroupPrefixSet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IgmpGroupPrefixSet) Size() int {
+func (m *IgmpGroupPrefixSet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Gp.Type
size += 1 // m.Gp.Prefix.Address.Af
size += 1 * 16 // m.Gp.Prefix.Address.Un
@@ -481,16 +453,14 @@ func (m *IgmpGroupPrefixSet) Size() int {
return size
}
func (m *IgmpGroupPrefixSet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Gp.Type))
buf.EncodeUint8(uint8(m.Gp.Prefix.Address.Af))
- buf.EncodeBytes(m.Gp.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Gp.Prefix.Len))
+ buf.EncodeBytes(m.Gp.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Gp.Prefix.Len)
return buf.Bytes(), nil
}
func (m *IgmpGroupPrefixSet) Unmarshal(b []byte) error {
@@ -514,27 +484,24 @@ func (*IgmpGroupPrefixSetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IgmpGroupPrefixSetReply) Size() int {
+func (m *IgmpGroupPrefixSetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IgmpGroupPrefixSetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IgmpGroupPrefixSetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -550,11 +517,10 @@ func (*IgmpListen) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IgmpListen) Size() int {
+func (m *IgmpListen) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Group.Filter
size += 1 // m.Group.NSrcs
size += 4 // m.Group.SwIfIndex
@@ -570,18 +536,16 @@ func (m *IgmpListen) Size() int {
return size
}
func (m *IgmpListen) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Group.Filter))
buf.EncodeUint8(uint8(len(m.Group.Saddrs)))
buf.EncodeUint32(uint32(m.Group.SwIfIndex))
buf.EncodeBytes(m.Group.Gaddr[:], 4)
for j1 := 0; j1 < len(m.Group.Saddrs); j1++ {
- var v1 ip_types.IP4Address
+ var v1 ip_types.IP4Address // Saddrs
if j1 < len(m.Group.Saddrs) {
v1 = m.Group.Saddrs[j1]
}
@@ -595,7 +559,7 @@ func (m *IgmpListen) Unmarshal(b []byte) error {
m.Group.NSrcs = buf.DecodeUint8()
m.Group.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
copy(m.Group.Gaddr[:], buf.DecodeBytes(4))
- m.Group.Saddrs = make([]ip_types.IP4Address, int(m.Group.NSrcs))
+ m.Group.Saddrs = make([]ip_types.IP4Address, m.Group.NSrcs)
for j1 := 0; j1 < len(m.Group.Saddrs); j1++ {
copy(m.Group.Saddrs[j1][:], buf.DecodeBytes(4))
}
@@ -614,27 +578,24 @@ func (*IgmpListenReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IgmpListenReply) Size() int {
+func (m *IgmpListenReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IgmpListenReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IgmpListenReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -652,25 +613,22 @@ func (*IgmpProxyDeviceAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IgmpProxyDeviceAddDel) Size() int {
+func (m *IgmpProxyDeviceAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Add
size += 4 // m.VrfID
size += 4 // m.SwIfIndex
return size
}
func (m *IgmpProxyDeviceAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Add))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Add)
+ buf.EncodeUint32(m.VrfID)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -698,25 +656,22 @@ func (*IgmpProxyDeviceAddDelInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IgmpProxyDeviceAddDelInterface) Size() int {
+func (m *IgmpProxyDeviceAddDelInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Add
size += 4 // m.VrfID
size += 4 // m.SwIfIndex
return size
}
func (m *IgmpProxyDeviceAddDelInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Add)
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -742,27 +697,24 @@ func (*IgmpProxyDeviceAddDelInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IgmpProxyDeviceAddDelInterfaceReply) Size() int {
+func (m *IgmpProxyDeviceAddDelInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IgmpProxyDeviceAddDelInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IgmpProxyDeviceAddDelInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -778,27 +730,24 @@ func (*IgmpProxyDeviceAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IgmpProxyDeviceAddDelReply) Size() int {
+func (m *IgmpProxyDeviceAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IgmpProxyDeviceAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IgmpProxyDeviceAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -815,24 +764,21 @@ func (*WantIgmpEvents) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *WantIgmpEvents) Size() int {
+func (m *WantIgmpEvents) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Enable
size += 4 // m.PID
return size
}
func (m *WantIgmpEvents) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Enable))
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Enable)
+ buf.EncodeUint32(m.PID)
return buf.Bytes(), nil
}
func (m *WantIgmpEvents) Unmarshal(b []byte) error {
@@ -854,27 +800,24 @@ func (*WantIgmpEventsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *WantIgmpEventsReply) Size() int {
+func (m *WantIgmpEventsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *WantIgmpEventsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *WantIgmpEventsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ikev2/ikev2.ba.go b/binapi/ikev2/ikev2.ba.go
index 4f06ed9..5fc68c3 100644
--- a/binapi/ikev2/ikev2.ba.go
+++ b/binapi/ikev2/ikev2.ba.go
@@ -42,22 +42,19 @@ func (*Ikev2InitiateDelChildSa) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2InitiateDelChildSa) Size() int {
+func (m *Ikev2InitiateDelChildSa) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Ispi
return size
}
func (m *Ikev2InitiateDelChildSa) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Ispi))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Ispi)
return buf.Bytes(), nil
}
func (m *Ikev2InitiateDelChildSa) Unmarshal(b []byte) error {
@@ -80,27 +77,24 @@ func (*Ikev2InitiateDelChildSaReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2InitiateDelChildSaReply) Size() int {
+func (m *Ikev2InitiateDelChildSaReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2InitiateDelChildSaReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2InitiateDelChildSaReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -116,22 +110,19 @@ func (*Ikev2InitiateDelIkeSa) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2InitiateDelIkeSa) Size() int {
+func (m *Ikev2InitiateDelIkeSa) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.Ispi
return size
}
func (m *Ikev2InitiateDelIkeSa) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint64(uint64(m.Ispi))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint64(m.Ispi)
return buf.Bytes(), nil
}
func (m *Ikev2InitiateDelIkeSa) Unmarshal(b []byte) error {
@@ -152,27 +143,24 @@ func (*Ikev2InitiateDelIkeSaReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2InitiateDelIkeSaReply) Size() int {
+func (m *Ikev2InitiateDelIkeSaReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2InitiateDelIkeSaReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2InitiateDelIkeSaReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -188,22 +176,19 @@ func (*Ikev2InitiateRekeyChildSa) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2InitiateRekeyChildSa) Size() int {
+func (m *Ikev2InitiateRekeyChildSa) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Ispi
return size
}
func (m *Ikev2InitiateRekeyChildSa) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Ispi))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Ispi)
return buf.Bytes(), nil
}
func (m *Ikev2InitiateRekeyChildSa) Unmarshal(b []byte) error {
@@ -226,27 +211,24 @@ func (*Ikev2InitiateRekeyChildSaReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2InitiateRekeyChildSaReply) Size() int {
+func (m *Ikev2InitiateRekeyChildSaReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2InitiateRekeyChildSaReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2InitiateRekeyChildSaReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -262,21 +244,18 @@ func (*Ikev2InitiateSaInit) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2InitiateSaInit) Size() int {
+func (m *Ikev2InitiateSaInit) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
return size
}
func (m *Ikev2InitiateSaInit) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
return buf.Bytes(), nil
}
@@ -298,27 +277,24 @@ func (*Ikev2InitiateSaInitReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2InitiateSaInitReply) Size() int {
+func (m *Ikev2InitiateSaInitReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2InitiateSaInitReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2InitiateSaInitReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -332,20 +308,17 @@ func (*Ikev2PluginGetVersion) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2PluginGetVersion) Size() int {
+func (m *Ikev2PluginGetVersion) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Ikev2PluginGetVersion) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Ikev2PluginGetVersion) Unmarshal(b []byte) error {
@@ -365,24 +338,21 @@ func (*Ikev2PluginGetVersionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2PluginGetVersionReply) Size() int {
+func (m *Ikev2PluginGetVersionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Major
size += 4 // m.Minor
return size
}
func (m *Ikev2PluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Major))
- buf.EncodeUint32(uint32(m.Minor))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Major)
+ buf.EncodeUint32(m.Minor)
return buf.Bytes(), nil
}
func (m *Ikev2PluginGetVersionReply) Unmarshal(b []byte) error {
@@ -405,22 +375,19 @@ func (*Ikev2ProfileAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2ProfileAddDel) Size() int {
+func (m *Ikev2ProfileAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 1 // m.IsAdd
return size
}
func (m *Ikev2ProfileAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
@@ -444,27 +411,24 @@ func (*Ikev2ProfileAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2ProfileAddDelReply) Size() int {
+func (m *Ikev2ProfileAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2ProfileAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -484,11 +448,10 @@ func (*Ikev2ProfileSetAuth) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2ProfileSetAuth) Size() int {
+func (m *Ikev2ProfileSetAuth) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 1 // m.AuthMethod
size += 1 // m.IsHex
@@ -497,17 +460,15 @@ func (m *Ikev2ProfileSetAuth) Size() int {
return size
}
func (m *Ikev2ProfileSetAuth) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
- buf.EncodeUint8(uint8(m.AuthMethod))
+ buf.EncodeUint8(m.AuthMethod)
buf.EncodeBool(m.IsHex)
buf.EncodeUint32(uint32(len(m.Data)))
- buf.EncodeBytes(m.Data[:], 0)
+ buf.EncodeBytes(m.Data, 0)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetAuth) Unmarshal(b []byte) error {
@@ -516,7 +477,8 @@ func (m *Ikev2ProfileSetAuth) Unmarshal(b []byte) error {
m.AuthMethod = buf.DecodeUint8()
m.IsHex = buf.DecodeBool()
m.DataLen = buf.DecodeUint32()
- copy(m.Data[:], buf.DecodeBytes(0))
+ m.Data = make([]byte, m.DataLen)
+ copy(m.Data, buf.DecodeBytes(len(m.Data)))
return nil
}
@@ -532,27 +494,24 @@ func (*Ikev2ProfileSetAuthReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2ProfileSetAuthReply) Size() int {
+func (m *Ikev2ProfileSetAuthReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2ProfileSetAuthReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetAuthReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -572,11 +531,10 @@ func (*Ikev2ProfileSetID) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2ProfileSetID) Size() int {
+func (m *Ikev2ProfileSetID) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 1 // m.IsLocal
size += 1 // m.IDType
@@ -585,17 +543,15 @@ func (m *Ikev2ProfileSetID) Size() int {
return size
}
func (m *Ikev2ProfileSetID) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
buf.EncodeBool(m.IsLocal)
- buf.EncodeUint8(uint8(m.IDType))
+ buf.EncodeUint8(m.IDType)
buf.EncodeUint32(uint32(len(m.Data)))
- buf.EncodeBytes(m.Data[:], 0)
+ buf.EncodeBytes(m.Data, 0)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetID) Unmarshal(b []byte) error {
@@ -604,7 +560,8 @@ func (m *Ikev2ProfileSetID) Unmarshal(b []byte) error {
m.IsLocal = buf.DecodeBool()
m.IDType = buf.DecodeUint8()
m.DataLen = buf.DecodeUint32()
- copy(m.Data[:], buf.DecodeBytes(0))
+ m.Data = make([]byte, m.DataLen)
+ copy(m.Data, buf.DecodeBytes(len(m.Data)))
return nil
}
@@ -620,27 +577,24 @@ func (*Ikev2ProfileSetIDReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2ProfileSetIDReply) Size() int {
+func (m *Ikev2ProfileSetIDReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2ProfileSetIDReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetIDReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -660,25 +614,22 @@ func (*Ikev2ProfileSetIpsecUDPPort) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2ProfileSetIpsecUDPPort) Size() int {
+func (m *Ikev2ProfileSetIpsecUDPPort) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsSet
size += 2 // m.Port
size += 64 // m.Name
return size
}
func (m *Ikev2ProfileSetIpsecUDPPort) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.IsSet))
- buf.EncodeUint16(uint16(m.Port))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.IsSet)
+ buf.EncodeUint16(m.Port)
buf.EncodeString(m.Name, 64)
return buf.Bytes(), nil
}
@@ -704,27 +655,24 @@ func (*Ikev2ProfileSetIpsecUDPPortReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2ProfileSetIpsecUDPPortReply) Size() int {
+func (m *Ikev2ProfileSetIpsecUDPPortReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2ProfileSetIpsecUDPPortReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetIpsecUDPPortReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -741,24 +689,21 @@ func (*Ikev2ProfileSetLiveness) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2ProfileSetLiveness) Size() int {
+func (m *Ikev2ProfileSetLiveness) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Period
size += 4 // m.MaxRetries
return size
}
func (m *Ikev2ProfileSetLiveness) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Period))
- buf.EncodeUint32(uint32(m.MaxRetries))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Period)
+ buf.EncodeUint32(m.MaxRetries)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetLiveness) Unmarshal(b []byte) error {
@@ -782,27 +727,24 @@ func (*Ikev2ProfileSetLivenessReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2ProfileSetLivenessReply) Size() int {
+func (m *Ikev2ProfileSetLivenessReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2ProfileSetLivenessReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetLivenessReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -824,11 +766,10 @@ func (*Ikev2ProfileSetTs) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2ProfileSetTs) Size() int {
+func (m *Ikev2ProfileSetTs) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 1 // m.IsLocal
size += 1 // m.Proto
@@ -839,19 +780,17 @@ func (m *Ikev2ProfileSetTs) Size() int {
return size
}
func (m *Ikev2ProfileSetTs) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
buf.EncodeBool(m.IsLocal)
- buf.EncodeUint8(uint8(m.Proto))
- buf.EncodeUint16(uint16(m.StartPort))
- buf.EncodeUint16(uint16(m.EndPort))
- buf.EncodeUint32(uint32(m.StartAddr))
- buf.EncodeUint32(uint32(m.EndAddr))
+ buf.EncodeUint8(m.Proto)
+ buf.EncodeUint16(m.StartPort)
+ buf.EncodeUint16(m.EndPort)
+ buf.EncodeUint32(m.StartAddr)
+ buf.EncodeUint32(m.EndAddr)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetTs) Unmarshal(b []byte) error {
@@ -878,27 +817,24 @@ func (*Ikev2ProfileSetTsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2ProfileSetTsReply) Size() int {
+func (m *Ikev2ProfileSetTsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2ProfileSetTsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetTsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -914,21 +850,18 @@ func (*Ikev2ProfileSetUDPEncap) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2ProfileSetUDPEncap) Size() int {
+func (m *Ikev2ProfileSetUDPEncap) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
return size
}
func (m *Ikev2ProfileSetUDPEncap) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
return buf.Bytes(), nil
}
@@ -952,27 +885,24 @@ func (*Ikev2ProfileSetUDPEncapReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2ProfileSetUDPEncapReply) Size() int {
+func (m *Ikev2ProfileSetUDPEncapReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2ProfileSetUDPEncapReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2ProfileSetUDPEncapReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -992,11 +922,10 @@ func (*Ikev2SetEspTransforms) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2SetEspTransforms) Size() int {
+func (m *Ikev2SetEspTransforms) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 4 // m.CryptoAlg
size += 4 // m.CryptoKeySize
@@ -1005,17 +934,15 @@ func (m *Ikev2SetEspTransforms) Size() int {
return size
}
func (m *Ikev2SetEspTransforms) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
- buf.EncodeUint32(uint32(m.CryptoAlg))
- buf.EncodeUint32(uint32(m.CryptoKeySize))
- buf.EncodeUint32(uint32(m.IntegAlg))
- buf.EncodeUint32(uint32(m.DhGroup))
+ buf.EncodeUint32(m.CryptoAlg)
+ buf.EncodeUint32(m.CryptoKeySize)
+ buf.EncodeUint32(m.IntegAlg)
+ buf.EncodeUint32(m.DhGroup)
return buf.Bytes(), nil
}
func (m *Ikev2SetEspTransforms) Unmarshal(b []byte) error {
@@ -1040,27 +967,24 @@ func (*Ikev2SetEspTransformsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2SetEspTransformsReply) Size() int {
+func (m *Ikev2SetEspTransformsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2SetEspTransformsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2SetEspTransformsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1080,11 +1004,10 @@ func (*Ikev2SetIkeTransforms) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2SetIkeTransforms) Size() int {
+func (m *Ikev2SetIkeTransforms) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 4 // m.CryptoAlg
size += 4 // m.CryptoKeySize
@@ -1093,17 +1016,15 @@ func (m *Ikev2SetIkeTransforms) Size() int {
return size
}
func (m *Ikev2SetIkeTransforms) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
- buf.EncodeUint32(uint32(m.CryptoAlg))
- buf.EncodeUint32(uint32(m.CryptoKeySize))
- buf.EncodeUint32(uint32(m.IntegAlg))
- buf.EncodeUint32(uint32(m.DhGroup))
+ buf.EncodeUint32(m.CryptoAlg)
+ buf.EncodeUint32(m.CryptoKeySize)
+ buf.EncodeUint32(m.IntegAlg)
+ buf.EncodeUint32(m.DhGroup)
return buf.Bytes(), nil
}
func (m *Ikev2SetIkeTransforms) Unmarshal(b []byte) error {
@@ -1128,27 +1049,24 @@ func (*Ikev2SetIkeTransformsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2SetIkeTransformsReply) Size() int {
+func (m *Ikev2SetIkeTransformsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2SetIkeTransformsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2SetIkeTransformsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1164,21 +1082,18 @@ func (*Ikev2SetLocalKey) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2SetLocalKey) Size() int {
+func (m *Ikev2SetLocalKey) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 256 // m.KeyFile
return size
}
func (m *Ikev2SetLocalKey) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.KeyFile, 256)
return buf.Bytes(), nil
}
@@ -1200,27 +1115,24 @@ func (*Ikev2SetLocalKeyReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2SetLocalKeyReply) Size() int {
+func (m *Ikev2SetLocalKeyReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2SetLocalKeyReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2SetLocalKeyReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1238,23 +1150,20 @@ func (*Ikev2SetResponder) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2SetResponder) Size() int {
+func (m *Ikev2SetResponder) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 4 // m.SwIfIndex
size += 1 * 4 // m.Address
return size
}
func (m *Ikev2SetResponder) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.Address[:], 4)
@@ -1280,27 +1189,24 @@ func (*Ikev2SetResponderReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2SetResponderReply) Size() int {
+func (m *Ikev2SetResponderReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2SetResponderReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2SetResponderReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1320,11 +1226,10 @@ func (*Ikev2SetSaLifetime) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2SetSaLifetime) Size() int {
+func (m *Ikev2SetSaLifetime) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 8 // m.Lifetime
size += 4 // m.LifetimeJitter
@@ -1333,17 +1238,15 @@ func (m *Ikev2SetSaLifetime) Size() int {
return size
}
func (m *Ikev2SetSaLifetime) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
- buf.EncodeUint64(uint64(m.Lifetime))
- buf.EncodeUint32(uint32(m.LifetimeJitter))
- buf.EncodeUint32(uint32(m.Handover))
- buf.EncodeUint64(uint64(m.LifetimeMaxdata))
+ buf.EncodeUint64(m.Lifetime)
+ buf.EncodeUint32(m.LifetimeJitter)
+ buf.EncodeUint32(m.Handover)
+ buf.EncodeUint64(m.LifetimeMaxdata)
return buf.Bytes(), nil
}
func (m *Ikev2SetSaLifetime) Unmarshal(b []byte) error {
@@ -1368,27 +1271,24 @@ func (*Ikev2SetSaLifetimeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2SetSaLifetimeReply) Size() int {
+func (m *Ikev2SetSaLifetimeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2SetSaLifetimeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2SetSaLifetimeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1405,22 +1305,19 @@ func (*Ikev2SetTunnelInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ikev2SetTunnelInterface) Size() int {
+func (m *Ikev2SetTunnelInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 4 // m.SwIfIndex
return size
}
func (m *Ikev2SetTunnelInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -1446,27 +1343,24 @@ func (*Ikev2SetTunnelInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ikev2SetTunnelInterfaceReply) Size() int {
+func (m *Ikev2SetTunnelInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ikev2SetTunnelInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ikev2SetTunnelInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/interface/interface.ba.go b/binapi/interface/interface.ba.go
index 9c2dd23..822c325 100644
--- a/binapi/interface/interface.ba.go
+++ b/binapi/interface/interface.ba.go
@@ -46,22 +46,19 @@ func (*CollectDetailedInterfaceStats) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CollectDetailedInterfaceStats) Size() int {
+func (m *CollectDetailedInterfaceStats) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.EnableDisable
return size
}
func (m *CollectDetailedInterfaceStats) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.EnableDisable)
return buf.Bytes(), nil
@@ -87,27 +84,24 @@ func (*CollectDetailedInterfaceStatsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CollectDetailedInterfaceStatsReply) Size() int {
+func (m *CollectDetailedInterfaceStatsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *CollectDetailedInterfaceStatsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *CollectDetailedInterfaceStatsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -123,21 +117,18 @@ func (*CreateLoopback) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CreateLoopback) Size() int {
+func (m *CreateLoopback) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 6 // m.MacAddress
return size
}
func (m *CreateLoopback) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.MacAddress[:], 6)
return buf.Bytes(), nil
}
@@ -161,26 +152,23 @@ func (*CreateLoopbackInstance) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CreateLoopbackInstance) Size() int {
+func (m *CreateLoopbackInstance) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 6 // m.MacAddress
size += 1 // m.IsSpecified
size += 4 // m.UserInstance
return size
}
func (m *CreateLoopbackInstance) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.MacAddress[:], 6)
buf.EncodeBool(m.IsSpecified)
- buf.EncodeUint32(uint32(m.UserInstance))
+ buf.EncodeUint32(m.UserInstance)
return buf.Bytes(), nil
}
func (m *CreateLoopbackInstance) Unmarshal(b []byte) error {
@@ -204,29 +192,26 @@ func (*CreateLoopbackInstanceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CreateLoopbackInstanceReply) Size() int {
+func (m *CreateLoopbackInstanceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *CreateLoopbackInstanceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *CreateLoopbackInstanceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -244,29 +229,26 @@ func (*CreateLoopbackReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CreateLoopbackReply) Size() int {
+func (m *CreateLoopbackReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *CreateLoopbackReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *CreateLoopbackReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -287,11 +269,10 @@ func (*CreateSubif) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CreateSubif) Size() int {
+func (m *CreateSubif) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.SubID
size += 4 // m.SubIfFlags
@@ -300,17 +281,15 @@ func (m *CreateSubif) Size() int {
return size
}
func (m *CreateSubif) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.SubID))
+ buf.EncodeUint32(m.SubID)
buf.EncodeUint32(uint32(m.SubIfFlags))
- buf.EncodeUint16(uint16(m.OuterVlanID))
- buf.EncodeUint16(uint16(m.InnerVlanID))
+ buf.EncodeUint16(m.OuterVlanID)
+ buf.EncodeUint16(m.InnerVlanID)
return buf.Bytes(), nil
}
func (m *CreateSubif) Unmarshal(b []byte) error {
@@ -336,29 +315,26 @@ func (*CreateSubifReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CreateSubifReply) Size() int {
+func (m *CreateSubifReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *CreateSubifReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *CreateSubifReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -376,24 +352,21 @@ func (*CreateVlanSubif) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CreateVlanSubif) Size() int {
+func (m *CreateVlanSubif) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.VlanID
return size
}
func (m *CreateVlanSubif) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.VlanID))
+ buf.EncodeUint32(m.VlanID)
return buf.Bytes(), nil
}
func (m *CreateVlanSubif) Unmarshal(b []byte) error {
@@ -416,29 +389,26 @@ func (*CreateVlanSubifReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CreateVlanSubifReply) Size() int {
+func (m *CreateVlanSubifReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *CreateVlanSubifReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *CreateVlanSubifReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -455,21 +425,18 @@ func (*DeleteLoopback) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DeleteLoopback) Size() int {
+func (m *DeleteLoopback) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *DeleteLoopback) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -491,27 +458,24 @@ func (*DeleteLoopbackReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DeleteLoopbackReply) Size() int {
+func (m *DeleteLoopbackReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DeleteLoopbackReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DeleteLoopbackReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -527,21 +491,18 @@ func (*DeleteSubif) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DeleteSubif) Size() int {
+func (m *DeleteSubif) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *DeleteSubif) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -563,27 +524,24 @@ func (*DeleteSubifReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DeleteSubifReply) Size() int {
+func (m *DeleteSubifReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DeleteSubifReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DeleteSubifReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -600,24 +558,21 @@ func (*HwInterfaceSetMtu) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *HwInterfaceSetMtu) Size() int {
+func (m *HwInterfaceSetMtu) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 2 // m.Mtu
return size
}
func (m *HwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint16(uint16(m.Mtu))
+ buf.EncodeUint16(m.Mtu)
return buf.Bytes(), nil
}
func (m *HwInterfaceSetMtu) Unmarshal(b []byte) error {
@@ -639,27 +594,24 @@ func (*HwInterfaceSetMtuReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *HwInterfaceSetMtuReply) Size() int {
+func (m *HwInterfaceSetMtuReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *HwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *HwInterfaceSetMtuReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -676,24 +628,21 @@ func (*InterfaceNameRenumber) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *InterfaceNameRenumber) Size() int {
+func (m *InterfaceNameRenumber) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.NewShowDevInstance
return size
}
func (m *InterfaceNameRenumber) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.NewShowDevInstance))
+ buf.EncodeUint32(m.NewShowDevInstance)
return buf.Bytes(), nil
}
func (m *InterfaceNameRenumber) Unmarshal(b []byte) error {
@@ -715,27 +664,24 @@ func (*InterfaceNameRenumberReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *InterfaceNameRenumberReply) Size() int {
+func (m *InterfaceNameRenumberReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *InterfaceNameRenumberReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *InterfaceNameRenumberReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -754,11 +700,10 @@ func (*SwInterfaceAddDelAddress) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceAddDelAddress) Size() int {
+func (m *SwInterfaceAddDelAddress) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsAdd
size += 1 // m.DelAll
@@ -768,18 +713,16 @@ func (m *SwInterfaceAddDelAddress) Size() int {
return size
}
func (m *SwInterfaceAddDelAddress) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.DelAll)
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
return buf.Bytes(), nil
}
func (m *SwInterfaceAddDelAddress) Unmarshal(b []byte) error {
@@ -807,27 +750,24 @@ func (*SwInterfaceAddDelAddressReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceAddDelAddressReply) Size() int {
+func (m *SwInterfaceAddDelAddressReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceAddDelAddressReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceAddDelAddressReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -847,26 +787,23 @@ func (*SwInterfaceAddDelMacAddress) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceAddDelMacAddress) Size() int {
+func (m *SwInterfaceAddDelMacAddress) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 * 6 // m.Addr
size += 1 // m.IsAdd
return size
}
func (m *SwInterfaceAddDelMacAddress) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SwIfIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SwIfIndex)
buf.EncodeBytes(m.Addr[:], 6)
- buf.EncodeUint8(uint8(m.IsAdd))
+ buf.EncodeUint8(m.IsAdd)
return buf.Bytes(), nil
}
func (m *SwInterfaceAddDelMacAddress) Unmarshal(b []byte) error {
@@ -891,27 +828,24 @@ func (*SwInterfaceAddDelMacAddressReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceAddDelMacAddressReply) Size() int {
+func (m *SwInterfaceAddDelMacAddressReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceAddDelMacAddressReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceAddDelMacAddressReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -927,20 +861,17 @@ func (*SwInterfaceAddressReplaceBegin) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceAddressReplaceBegin) Size() int {
+func (m *SwInterfaceAddressReplaceBegin) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SwInterfaceAddressReplaceBegin) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SwInterfaceAddressReplaceBegin) Unmarshal(b []byte) error {
@@ -961,27 +892,24 @@ func (*SwInterfaceAddressReplaceBeginReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceAddressReplaceBeginReply) Size() int {
+func (m *SwInterfaceAddressReplaceBeginReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceAddressReplaceBeginReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceAddressReplaceBeginReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -997,20 +925,17 @@ func (*SwInterfaceAddressReplaceEnd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceAddressReplaceEnd) Size() int {
+func (m *SwInterfaceAddressReplaceEnd) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SwInterfaceAddressReplaceEnd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SwInterfaceAddressReplaceEnd) Unmarshal(b []byte) error {
@@ -1031,27 +956,24 @@ func (*SwInterfaceAddressReplaceEndReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceAddressReplaceEndReply) Size() int {
+func (m *SwInterfaceAddressReplaceEndReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceAddressReplaceEndReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceAddressReplaceEndReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1067,21 +989,18 @@ func (*SwInterfaceClearStats) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceClearStats) Size() int {
+func (m *SwInterfaceClearStats) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *SwInterfaceClearStats) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -1103,27 +1022,24 @@ func (*SwInterfaceClearStatsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceClearStatsReply) Size() int {
+func (m *SwInterfaceClearStatsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceClearStatsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceClearStatsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1164,11 +1080,10 @@ func (*SwInterfaceDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceDetails) Size() int {
+func (m *SwInterfaceDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.SupSwIfIndex
size += 1 * 6 // m.L2Address
@@ -1198,41 +1113,39 @@ func (m *SwInterfaceDetails) Size() int {
return size
}
func (m *SwInterfaceDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.SupSwIfIndex))
+ buf.EncodeUint32(m.SupSwIfIndex)
buf.EncodeBytes(m.L2Address[:], 6)
buf.EncodeUint32(uint32(m.Flags))
buf.EncodeUint32(uint32(m.Type))
buf.EncodeUint32(uint32(m.LinkDuplex))
- buf.EncodeUint32(uint32(m.LinkSpeed))
- buf.EncodeUint16(uint16(m.LinkMtu))
+ buf.EncodeUint32(m.LinkSpeed)
+ buf.EncodeUint16(m.LinkMtu)
for i := 0; i < 4; i++ {
var x uint32
if i < len(m.Mtu) {
x = uint32(m.Mtu[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
- buf.EncodeUint32(uint32(m.SubID))
- buf.EncodeUint8(uint8(m.SubNumberOfTags))
- buf.EncodeUint16(uint16(m.SubOuterVlanID))
- buf.EncodeUint16(uint16(m.SubInnerVlanID))
+ buf.EncodeUint32(m.SubID)
+ buf.EncodeUint8(m.SubNumberOfTags)
+ buf.EncodeUint16(m.SubOuterVlanID)
+ buf.EncodeUint16(m.SubInnerVlanID)
buf.EncodeUint32(uint32(m.SubIfFlags))
- buf.EncodeUint32(uint32(m.VtrOp))
- buf.EncodeUint32(uint32(m.VtrPushDot1q))
- buf.EncodeUint32(uint32(m.VtrTag1))
- buf.EncodeUint32(uint32(m.VtrTag2))
- buf.EncodeUint16(uint16(m.OuterTag))
+ buf.EncodeUint32(m.VtrOp)
+ buf.EncodeUint32(m.VtrPushDot1q)
+ buf.EncodeUint32(m.VtrTag1)
+ buf.EncodeUint32(m.VtrTag2)
+ buf.EncodeUint16(m.OuterTag)
buf.EncodeBytes(m.BDmac[:], 6)
buf.EncodeBytes(m.BSmac[:], 6)
- buf.EncodeUint16(uint16(m.BVlanid))
- buf.EncodeUint32(uint32(m.ISid))
+ buf.EncodeUint16(m.BVlanid)
+ buf.EncodeUint32(m.ISid)
buf.EncodeString(m.InterfaceName, 64)
buf.EncodeString(m.InterfaceDevType, 64)
buf.EncodeString(m.Tag, 64)
@@ -1274,7 +1187,7 @@ func (m *SwInterfaceDetails) Unmarshal(b []byte) error {
// SwInterfaceDump defines message 'sw_interface_dump'.
type SwInterfaceDump struct {
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
NameFilterValid bool `binapi:"bool,name=name_filter_valid" json:"name_filter_valid,omitempty"`
NameFilter string `binapi:"string[],name=name_filter" json:"name_filter,omitempty"`
}
@@ -1286,23 +1199,20 @@ func (*SwInterfaceDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceDump) Size() int {
+func (m *SwInterfaceDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.NameFilterValid
size += 4 + len(m.NameFilter) // m.NameFilter
return size
}
func (m *SwInterfaceDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.NameFilterValid)
buf.EncodeString(m.NameFilter, 0)
@@ -1331,11 +1241,10 @@ func (*SwInterfaceEvent) GetMessageType() api.MessageType {
return api.EventMessage
}
-func (m *SwInterfaceEvent) Size() int {
+func (m *SwInterfaceEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PID
size += 4 // m.SwIfIndex
size += 4 // m.Flags
@@ -1343,13 +1252,11 @@ func (m *SwInterfaceEvent) Size() int {
return size
}
func (m *SwInterfaceEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PID)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint32(uint32(m.Flags))
buf.EncodeBool(m.Deleted)
@@ -1376,21 +1283,18 @@ func (*SwInterfaceGetMacAddress) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceGetMacAddress) Size() int {
+func (m *SwInterfaceGetMacAddress) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *SwInterfaceGetMacAddress) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -1415,29 +1319,26 @@ func (*SwInterfaceGetMacAddressReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceGetMacAddressReply) Size() int {
+func (m *SwInterfaceGetMacAddressReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 * 6 // m.MacAddress
return size
}
func (m *SwInterfaceGetMacAddressReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBytes(m.MacAddress[:], 6)
return buf.Bytes(), nil
}
func (m *SwInterfaceGetMacAddressReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
copy(m.MacAddress[:], buf.DecodeBytes(6))
return nil
}
@@ -1455,22 +1356,19 @@ func (*SwInterfaceGetTable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceGetTable) Size() int {
+func (m *SwInterfaceGetTable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
return size
}
func (m *SwInterfaceGetTable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
return buf.Bytes(), nil
@@ -1495,29 +1393,26 @@ func (*SwInterfaceGetTableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceGetTableReply) Size() int {
+func (m *SwInterfaceGetTableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.VrfID
return size
}
func (m *SwInterfaceGetTableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.VrfID)
return buf.Bytes(), nil
}
func (m *SwInterfaceGetTableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.VrfID = buf.DecodeUint32()
return nil
}
@@ -1539,11 +1434,10 @@ func (*SwInterfaceRxPlacementDetails) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceRxPlacementDetails) Size() int {
+func (m *SwInterfaceRxPlacementDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.QueueID
size += 4 // m.WorkerID
@@ -1551,15 +1445,13 @@ func (m *SwInterfaceRxPlacementDetails) Size() int {
return size
}
func (m *SwInterfaceRxPlacementDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.QueueID))
- buf.EncodeUint32(uint32(m.WorkerID))
+ buf.EncodeUint32(m.QueueID)
+ buf.EncodeUint32(m.WorkerID)
buf.EncodeUint32(uint32(m.Mode))
return buf.Bytes(), nil
}
@@ -1584,21 +1476,18 @@ func (*SwInterfaceRxPlacementDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceRxPlacementDump) Size() int {
+func (m *SwInterfaceRxPlacementDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *SwInterfaceRxPlacementDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -1621,22 +1510,19 @@ func (*SwInterfaceSetFlags) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetFlags) Size() int {
+func (m *SwInterfaceSetFlags) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.Flags
return size
}
func (m *SwInterfaceSetFlags) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint32(uint32(m.Flags))
return buf.Bytes(), nil
@@ -1660,27 +1546,24 @@ func (*SwInterfaceSetFlagsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetFlagsReply) Size() int {
+func (m *SwInterfaceSetFlagsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetFlagsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetFlagsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1699,22 +1582,19 @@ func (*SwInterfaceSetIPDirectedBroadcast) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetIPDirectedBroadcast) Size() int {
+func (m *SwInterfaceSetIPDirectedBroadcast) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Enable
return size
}
func (m *SwInterfaceSetIPDirectedBroadcast) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
@@ -1742,27 +1622,24 @@ func (*SwInterfaceSetIPDirectedBroadcastReply) GetMessageType() api.MessageType
return api.ReplyMessage
}
-func (m *SwInterfaceSetIPDirectedBroadcastReply) Size() int {
+func (m *SwInterfaceSetIPDirectedBroadcastReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetIPDirectedBroadcastReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetIPDirectedBroadcastReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1779,22 +1656,19 @@ func (*SwInterfaceSetMacAddress) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetMacAddress) Size() int {
+func (m *SwInterfaceSetMacAddress) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 * 6 // m.MacAddress
return size
}
func (m *SwInterfaceSetMacAddress) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.MacAddress[:], 6)
return buf.Bytes(), nil
@@ -1820,27 +1694,24 @@ func (*SwInterfaceSetMacAddressReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetMacAddressReply) Size() int {
+func (m *SwInterfaceSetMacAddressReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetMacAddressReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetMacAddressReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1857,29 +1728,26 @@ func (*SwInterfaceSetMtu) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetMtu) Size() int {
+func (m *SwInterfaceSetMtu) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 * 4 // m.Mtu
return size
}
func (m *SwInterfaceSetMtu) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
for i := 0; i < 4; i++ {
var x uint32
if i < len(m.Mtu) {
x = uint32(m.Mtu[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
@@ -1905,27 +1773,24 @@ func (*SwInterfaceSetMtuReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetMtuReply) Size() int {
+func (m *SwInterfaceSetMtuReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetMtuReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetMtuReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1944,11 +1809,10 @@ func (*SwInterfaceSetRxMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetRxMode) Size() int {
+func (m *SwInterfaceSetRxMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.QueueIDValid
size += 4 // m.QueueID
@@ -1956,15 +1820,13 @@ func (m *SwInterfaceSetRxMode) Size() int {
return size
}
func (m *SwInterfaceSetRxMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.QueueIDValid)
- buf.EncodeUint32(uint32(m.QueueID))
+ buf.EncodeUint32(m.QueueID)
buf.EncodeUint32(uint32(m.Mode))
return buf.Bytes(), nil
}
@@ -1989,27 +1851,24 @@ func (*SwInterfaceSetRxModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetRxModeReply) Size() int {
+func (m *SwInterfaceSetRxModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetRxModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetRxModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2028,11 +1887,10 @@ func (*SwInterfaceSetRxPlacement) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetRxPlacement) Size() int {
+func (m *SwInterfaceSetRxPlacement) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.QueueID
size += 4 // m.WorkerID
@@ -2040,15 +1898,13 @@ func (m *SwInterfaceSetRxPlacement) Size() int {
return size
}
func (m *SwInterfaceSetRxPlacement) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.QueueID))
- buf.EncodeUint32(uint32(m.WorkerID))
+ buf.EncodeUint32(m.QueueID)
+ buf.EncodeUint32(m.WorkerID)
buf.EncodeBool(m.IsMain)
return buf.Bytes(), nil
}
@@ -2075,27 +1931,24 @@ func (*SwInterfaceSetRxPlacementReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetRxPlacementReply) Size() int {
+func (m *SwInterfaceSetRxPlacementReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetRxPlacementReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetRxPlacementReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2113,26 +1966,23 @@ func (*SwInterfaceSetTable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetTable) Size() int {
+func (m *SwInterfaceSetTable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
size += 4 // m.VrfID
return size
}
func (m *SwInterfaceSetTable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetTable) Unmarshal(b []byte) error {
@@ -2155,27 +2005,24 @@ func (*SwInterfaceSetTableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetTableReply) Size() int {
+func (m *SwInterfaceSetTableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetTableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetTableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2193,23 +2040,20 @@ func (*SwInterfaceSetUnnumbered) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetUnnumbered) Size() int {
+func (m *SwInterfaceSetUnnumbered) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.UnnumberedSwIfIndex
size += 1 // m.IsAdd
return size
}
func (m *SwInterfaceSetUnnumbered) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint32(uint32(m.UnnumberedSwIfIndex))
buf.EncodeBool(m.IsAdd)
@@ -2237,27 +2081,24 @@ func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetUnnumberedReply) Size() int {
+func (m *SwInterfaceSetUnnumberedReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetUnnumberedReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetUnnumberedReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2275,23 +2116,20 @@ func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceTagAddDel) Size() int {
+func (m *SwInterfaceTagAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SwIfIndex
size += 64 // m.Tag
return size
}
func (m *SwInterfaceTagAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeString(m.Tag, 64)
@@ -2317,27 +2155,24 @@ func (*SwInterfaceTagAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceTagAddDelReply) Size() int {
+func (m *SwInterfaceTagAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceTagAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceTagAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2354,24 +2189,21 @@ func (*WantInterfaceEvents) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *WantInterfaceEvents) Size() int {
+func (m *WantInterfaceEvents) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.EnableDisable
size += 4 // m.PID
return size
}
func (m *WantInterfaceEvents) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.EnableDisable))
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.EnableDisable)
+ buf.EncodeUint32(m.PID)
return buf.Bytes(), nil
}
func (m *WantInterfaceEvents) Unmarshal(b []byte) error {
@@ -2393,27 +2225,24 @@ func (*WantInterfaceEventsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *WantInterfaceEventsReply) Size() int {
+func (m *WantInterfaceEventsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *WantInterfaceEventsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *WantInterfaceEventsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ioam_cache/ioam_cache.ba.go b/binapi/ioam_cache/ioam_cache.ba.go
index d48b15b..2f9f0ef 100644
--- a/binapi/ioam_cache/ioam_cache.ba.go
+++ b/binapi/ioam_cache/ioam_cache.ba.go
@@ -40,21 +40,18 @@ func (*IoamCacheIP6EnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IoamCacheIP6EnableDisable) Size() int {
+func (m *IoamCacheIP6EnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsDisable
return size
}
func (m *IoamCacheIP6EnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsDisable)
return buf.Bytes(), nil
}
@@ -78,27 +75,24 @@ func (*IoamCacheIP6EnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IoamCacheIP6EnableDisableReply) Size() int {
+func (m *IoamCacheIP6EnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IoamCacheIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IoamCacheIP6EnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ioam_export/ioam_export.ba.go b/binapi/ioam_export/ioam_export.ba.go
index b95f506..47dd4e2 100644
--- a/binapi/ioam_export/ioam_export.ba.go
+++ b/binapi/ioam_export/ioam_export.ba.go
@@ -43,23 +43,20 @@ func (*IoamExportIP6EnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IoamExportIP6EnableDisable) Size() int {
+func (m *IoamExportIP6EnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsDisable
size += 1 * 4 // m.CollectorAddress
size += 1 * 4 // m.SrcAddress
return size
}
func (m *IoamExportIP6EnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsDisable)
buf.EncodeBytes(m.CollectorAddress[:], 4)
buf.EncodeBytes(m.SrcAddress[:], 4)
@@ -87,27 +84,24 @@ func (*IoamExportIP6EnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IoamExportIP6EnableDisableReply) Size() int {
+func (m *IoamExportIP6EnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IoamExportIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IoamExportIP6EnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go
index 819b136..7d1bb35 100644
--- a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go
+++ b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe.ba.go
@@ -41,22 +41,19 @@ func (*VxlanGpeIoamDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGpeIoamDisable) Size() int {
+func (m *VxlanGpeIoamDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.ID
return size
}
func (m *VxlanGpeIoamDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.ID)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamDisable) Unmarshal(b []byte) error {
@@ -77,27 +74,24 @@ func (*VxlanGpeIoamDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGpeIoamDisableReply) Size() int {
+func (m *VxlanGpeIoamDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VxlanGpeIoamDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -116,11 +110,10 @@ func (*VxlanGpeIoamEnable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGpeIoamEnable) Size() int {
+func (m *VxlanGpeIoamEnable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.ID
size += 1 // m.TracePpc
size += 1 // m.PowEnable
@@ -128,14 +121,12 @@ func (m *VxlanGpeIoamEnable) Size() int {
return size
}
func (m *VxlanGpeIoamEnable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.ID))
- buf.EncodeUint8(uint8(m.TracePpc))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.ID)
+ buf.EncodeUint8(m.TracePpc)
buf.EncodeBool(m.PowEnable)
buf.EncodeBool(m.TraceEnable)
return buf.Bytes(), nil
@@ -161,27 +152,24 @@ func (*VxlanGpeIoamEnableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGpeIoamEnableReply) Size() int {
+func (m *VxlanGpeIoamEnableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VxlanGpeIoamEnableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamEnableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -198,26 +186,23 @@ func (*VxlanGpeIoamTransitDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGpeIoamTransitDisable) Size() int {
+func (m *VxlanGpeIoamTransitDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.OuterFibIndex
size += 1 // m.DstAddr.Af
size += 1 * 16 // m.DstAddr.Un
return size
}
func (m *VxlanGpeIoamTransitDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.OuterFibIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.OuterFibIndex)
buf.EncodeUint8(uint8(m.DstAddr.Af))
- buf.EncodeBytes(m.DstAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DstAddr.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamTransitDisable) Unmarshal(b []byte) error {
@@ -242,27 +227,24 @@ func (*VxlanGpeIoamTransitDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGpeIoamTransitDisableReply) Size() int {
+func (m *VxlanGpeIoamTransitDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VxlanGpeIoamTransitDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamTransitDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -279,26 +261,23 @@ func (*VxlanGpeIoamTransitEnable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGpeIoamTransitEnable) Size() int {
+func (m *VxlanGpeIoamTransitEnable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.OuterFibIndex
size += 1 // m.DstAddr.Af
size += 1 * 16 // m.DstAddr.Un
return size
}
func (m *VxlanGpeIoamTransitEnable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.OuterFibIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.OuterFibIndex)
buf.EncodeUint8(uint8(m.DstAddr.Af))
- buf.EncodeBytes(m.DstAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DstAddr.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamTransitEnable) Unmarshal(b []byte) error {
@@ -323,27 +302,24 @@ func (*VxlanGpeIoamTransitEnableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGpeIoamTransitEnableReply) Size() int {
+func (m *VxlanGpeIoamTransitEnableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VxlanGpeIoamTransitEnableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamTransitEnableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -361,11 +337,10 @@ func (*VxlanGpeIoamVniDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGpeIoamVniDisable) Size() int {
+func (m *VxlanGpeIoamVniDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
size += 1 // m.Local.Af
size += 1 * 16 // m.Local.Un
@@ -374,17 +349,15 @@ func (m *VxlanGpeIoamVniDisable) Size() int {
return size
}
func (m *VxlanGpeIoamVniDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Local.Af))
- buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Remote.Af))
- buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamVniDisable) Unmarshal(b []byte) error {
@@ -411,27 +384,24 @@ func (*VxlanGpeIoamVniDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGpeIoamVniDisableReply) Size() int {
+func (m *VxlanGpeIoamVniDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VxlanGpeIoamVniDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamVniDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -449,11 +419,10 @@ func (*VxlanGpeIoamVniEnable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGpeIoamVniEnable) Size() int {
+func (m *VxlanGpeIoamVniEnable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
size += 1 // m.Local.Af
size += 1 * 16 // m.Local.Un
@@ -462,17 +431,15 @@ func (m *VxlanGpeIoamVniEnable) Size() int {
return size
}
func (m *VxlanGpeIoamVniEnable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Local.Af))
- buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Remote.Af))
- buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamVniEnable) Unmarshal(b []byte) error {
@@ -497,27 +464,24 @@ func (*VxlanGpeIoamVniEnableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGpeIoamVniEnableReply) Size() int {
+func (m *VxlanGpeIoamVniEnableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VxlanGpeIoamVniEnableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamVniEnableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ip/ip.ba.go b/binapi/ip/ip.ba.go
index 7702c92..df5b593 100644
--- a/binapi/ip/ip.ba.go
+++ b/binapi/ip/ip.ba.go
@@ -108,22 +108,19 @@ func (*IoamDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IoamDisable) Size() int {
+func (m *IoamDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.ID
return size
}
func (m *IoamDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.ID)
return buf.Bytes(), nil
}
func (m *IoamDisable) Unmarshal(b []byte) error {
@@ -144,27 +141,24 @@ func (*IoamDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IoamDisableReply) Size() int {
+func (m *IoamDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IoamDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IoamDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -185,11 +179,10 @@ func (*IoamEnable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IoamEnable) Size() int {
+func (m *IoamEnable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.ID
size += 1 // m.Seqno
size += 1 // m.Analyse
@@ -199,18 +192,16 @@ func (m *IoamEnable) Size() int {
return size
}
func (m *IoamEnable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.ID)
buf.EncodeBool(m.Seqno)
buf.EncodeBool(m.Analyse)
buf.EncodeBool(m.PotEnable)
buf.EncodeBool(m.TraceEnable)
- buf.EncodeUint32(uint32(m.NodeID))
+ buf.EncodeUint32(m.NodeID)
return buf.Bytes(), nil
}
func (m *IoamEnable) Unmarshal(b []byte) error {
@@ -236,27 +227,24 @@ func (*IoamEnableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IoamEnableReply) Size() int {
+func (m *IoamEnableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IoamEnableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IoamEnableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -273,11 +261,10 @@ func (*IPAddressDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPAddressDetails) Size() int {
+func (m *IPAddressDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Prefix.Address.Af
size += 1 * 16 // m.Prefix.Address.Un
@@ -285,16 +272,14 @@ func (m *IPAddressDetails) Size() int {
return size
}
func (m *IPAddressDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
return buf.Bytes(), nil
}
func (m *IPAddressDetails) Unmarshal(b []byte) error {
@@ -319,22 +304,19 @@ func (*IPAddressDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPAddressDump) Size() int {
+func (m *IPAddressDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
return size
}
func (m *IPAddressDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
return buf.Bytes(), nil
@@ -360,11 +342,10 @@ func (*IPContainerProxyAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPContainerProxyAddDel) Size() int {
+func (m *IPContainerProxyAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Pfx.Address.Af
size += 1 * 16 // m.Pfx.Address.Un
size += 1 // m.Pfx.Len
@@ -373,15 +354,13 @@ func (m *IPContainerProxyAddDel) Size() int {
return size
}
func (m *IPContainerProxyAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Pfx.Address.Af))
- buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Pfx.Len))
+ buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Pfx.Len)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
@@ -410,27 +389,24 @@ func (*IPContainerProxyAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPContainerProxyAddDelReply) Size() int {
+func (m *IPContainerProxyAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPContainerProxyAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPContainerProxyAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -447,11 +423,10 @@ func (*IPContainerProxyDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPContainerProxyDetails) Size() int {
+func (m *IPContainerProxyDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Prefix.Address.Af
size += 1 * 16 // m.Prefix.Address.Un
@@ -459,16 +434,14 @@ func (m *IPContainerProxyDetails) Size() int {
return size
}
func (m *IPContainerProxyDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
return buf.Bytes(), nil
}
func (m *IPContainerProxyDetails) Unmarshal(b []byte) error {
@@ -490,20 +463,17 @@ func (*IPContainerProxyDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPContainerProxyDump) Size() int {
+func (m *IPContainerProxyDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IPContainerProxyDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IPContainerProxyDump) Unmarshal(b []byte) error {
@@ -523,22 +493,19 @@ func (*IPDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPDetails) Size() int {
+func (m *IPDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
return size
}
func (m *IPDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
return buf.Bytes(), nil
@@ -562,21 +529,18 @@ func (*IPDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPDump) Size() int {
+func (m *IPDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsIPv6
return size
}
func (m *IPDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsIPv6)
return buf.Bytes(), nil
}
@@ -600,11 +564,10 @@ func (*IPMrouteAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPMrouteAddDel) Size() int {
+func (m *IPMrouteAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IsMultipath
size += 4 // m.Route.TableID
@@ -636,64 +599,53 @@ func (m *IPMrouteAddDel) Size() int {
size += 4 // s2.Path.Nh.ClassifyTableIndex
size += 1 // s2.Path.NLabels
for j4 := 0; j4 < 16; j4++ {
- var s4 fib_types.FibMplsLabel
- _ = s4
- if j4 < len(s2.Path.LabelStack) {
- s4 = s2.Path.LabelStack[j4]
- }
- size += 1 // s4.IsUniform
- size += 4 // s4.Label
- size += 1 // s4.TTL
- size += 1 // s4.Exp
+ size += 1 // s2.Path.LabelStack[j4].IsUniform
+ size += 4 // s2.Path.LabelStack[j4].Label
+ size += 1 // s2.Path.LabelStack[j4].TTL
+ size += 1 // s2.Path.LabelStack[j4].Exp
}
}
return size
}
func (m *IPMrouteAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.IsMultipath)
- buf.EncodeUint32(uint32(m.Route.TableID))
- buf.EncodeUint32(uint32(m.Route.EntryFlags))
- buf.EncodeUint32(uint32(m.Route.RpfID))
+ buf.EncodeUint32(m.Route.TableID)
+ buf.EncodeUint32(m.Route.EntryFlags)
+ buf.EncodeUint32(m.Route.RpfID)
buf.EncodeUint8(uint8(m.Route.Prefix.Af))
- buf.EncodeUint16(uint16(m.Route.Prefix.GrpAddressLength))
- buf.EncodeBytes(m.Route.Prefix.GrpAddress.XXX_UnionData[:], 0)
- buf.EncodeBytes(m.Route.Prefix.SrcAddress.XXX_UnionData[:], 0)
+ buf.EncodeUint16(m.Route.Prefix.GrpAddressLength)
+ buf.EncodeBytes(m.Route.Prefix.GrpAddress.XXX_UnionData[:], 16)
+ buf.EncodeBytes(m.Route.Prefix.SrcAddress.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(len(m.Route.Paths)))
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
- var v1 mfib_types.MfibPath
+ var v1 mfib_types.MfibPath // Paths
if j1 < len(m.Route.Paths) {
v1 = m.Route.Paths[j1]
}
buf.EncodeUint32(uint32(v1.ItfFlags))
- buf.EncodeUint32(uint32(v1.Path.SwIfIndex))
- buf.EncodeUint32(uint32(v1.Path.TableID))
- buf.EncodeUint32(uint32(v1.Path.RpfID))
- buf.EncodeUint8(uint8(v1.Path.Weight))
- buf.EncodeUint8(uint8(v1.Path.Preference))
+ buf.EncodeUint32(v1.Path.SwIfIndex)
+ buf.EncodeUint32(v1.Path.TableID)
+ buf.EncodeUint32(v1.Path.RpfID)
+ buf.EncodeUint8(v1.Path.Weight)
+ buf.EncodeUint8(v1.Path.Preference)
buf.EncodeUint32(uint32(v1.Path.Type))
buf.EncodeUint32(uint32(v1.Path.Flags))
buf.EncodeUint32(uint32(v1.Path.Proto))
- buf.EncodeBytes(v1.Path.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Path.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Path.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Path.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.Path.NLabels))
+ buf.EncodeBytes(v1.Path.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Path.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Path.Nh.ObjID)
+ buf.EncodeUint32(v1.Path.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.Path.NLabels)
for j3 := 0; j3 < 16; j3++ {
- var v3 fib_types.FibMplsLabel
- if j3 < len(v1.Path.LabelStack) {
- v3 = v1.Path.LabelStack[j3]
- }
- buf.EncodeUint8(uint8(v3.IsUniform))
- buf.EncodeUint32(uint32(v3.Label))
- buf.EncodeUint8(uint8(v3.TTL))
- buf.EncodeUint8(uint8(v3.Exp))
+ buf.EncodeUint8(v1.Path.LabelStack[j3].IsUniform)
+ buf.EncodeUint32(v1.Path.LabelStack[j3].Label)
+ buf.EncodeUint8(v1.Path.LabelStack[j3].TTL)
+ buf.EncodeUint8(v1.Path.LabelStack[j3].Exp)
}
}
return buf.Bytes(), nil
@@ -710,7 +662,7 @@ func (m *IPMrouteAddDel) Unmarshal(b []byte) error {
copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], buf.DecodeBytes(16))
copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], buf.DecodeBytes(16))
m.Route.NPaths = buf.DecodeUint8()
- m.Route.Paths = make([]mfib_types.MfibPath, int(m.Route.NPaths))
+ m.Route.Paths = make([]mfib_types.MfibPath, m.Route.NPaths)
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
m.Route.Paths[j1].ItfFlags = mfib_types.MfibItfFlags(buf.DecodeUint32())
m.Route.Paths[j1].Path.SwIfIndex = buf.DecodeUint32()
@@ -749,29 +701,26 @@ func (*IPMrouteAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPMrouteAddDelReply) Size() int {
+func (m *IPMrouteAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.StatsIndex
return size
}
func (m *IPMrouteAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.StatsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.StatsIndex)
return buf.Bytes(), nil
}
func (m *IPMrouteAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.StatsIndex = buf.DecodeUint32()
return nil
}
@@ -788,11 +737,10 @@ func (*IPMrouteDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPMrouteDetails) Size() int {
+func (m *IPMrouteDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Route.TableID
size += 4 // m.Route.EntryFlags
size += 4 // m.Route.RpfID
@@ -822,62 +770,51 @@ func (m *IPMrouteDetails) Size() int {
size += 4 // s2.Path.Nh.ClassifyTableIndex
size += 1 // s2.Path.NLabels
for j4 := 0; j4 < 16; j4++ {
- var s4 fib_types.FibMplsLabel
- _ = s4
- if j4 < len(s2.Path.LabelStack) {
- s4 = s2.Path.LabelStack[j4]
- }
- size += 1 // s4.IsUniform
- size += 4 // s4.Label
- size += 1 // s4.TTL
- size += 1 // s4.Exp
+ size += 1 // s2.Path.LabelStack[j4].IsUniform
+ size += 4 // s2.Path.LabelStack[j4].Label
+ size += 1 // s2.Path.LabelStack[j4].TTL
+ size += 1 // s2.Path.LabelStack[j4].Exp
}
}
return size
}
func (m *IPMrouteDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Route.TableID))
- buf.EncodeUint32(uint32(m.Route.EntryFlags))
- buf.EncodeUint32(uint32(m.Route.RpfID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Route.TableID)
+ buf.EncodeUint32(m.Route.EntryFlags)
+ buf.EncodeUint32(m.Route.RpfID)
buf.EncodeUint8(uint8(m.Route.Prefix.Af))
- buf.EncodeUint16(uint16(m.Route.Prefix.GrpAddressLength))
- buf.EncodeBytes(m.Route.Prefix.GrpAddress.XXX_UnionData[:], 0)
- buf.EncodeBytes(m.Route.Prefix.SrcAddress.XXX_UnionData[:], 0)
+ buf.EncodeUint16(m.Route.Prefix.GrpAddressLength)
+ buf.EncodeBytes(m.Route.Prefix.GrpAddress.XXX_UnionData[:], 16)
+ buf.EncodeBytes(m.Route.Prefix.SrcAddress.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(len(m.Route.Paths)))
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
- var v1 mfib_types.MfibPath
+ var v1 mfib_types.MfibPath // Paths
if j1 < len(m.Route.Paths) {
v1 = m.Route.Paths[j1]
}
buf.EncodeUint32(uint32(v1.ItfFlags))
- buf.EncodeUint32(uint32(v1.Path.SwIfIndex))
- buf.EncodeUint32(uint32(v1.Path.TableID))
- buf.EncodeUint32(uint32(v1.Path.RpfID))
- buf.EncodeUint8(uint8(v1.Path.Weight))
- buf.EncodeUint8(uint8(v1.Path.Preference))
+ buf.EncodeUint32(v1.Path.SwIfIndex)
+ buf.EncodeUint32(v1.Path.TableID)
+ buf.EncodeUint32(v1.Path.RpfID)
+ buf.EncodeUint8(v1.Path.Weight)
+ buf.EncodeUint8(v1.Path.Preference)
buf.EncodeUint32(uint32(v1.Path.Type))
buf.EncodeUint32(uint32(v1.Path.Flags))
buf.EncodeUint32(uint32(v1.Path.Proto))
- buf.EncodeBytes(v1.Path.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Path.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Path.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Path.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.Path.NLabels))
+ buf.EncodeBytes(v1.Path.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Path.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Path.Nh.ObjID)
+ buf.EncodeUint32(v1.Path.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.Path.NLabels)
for j3 := 0; j3 < 16; j3++ {
- var v3 fib_types.FibMplsLabel
- if j3 < len(v1.Path.LabelStack) {
- v3 = v1.Path.LabelStack[j3]
- }
- buf.EncodeUint8(uint8(v3.IsUniform))
- buf.EncodeUint32(uint32(v3.Label))
- buf.EncodeUint8(uint8(v3.TTL))
- buf.EncodeUint8(uint8(v3.Exp))
+ buf.EncodeUint8(v1.Path.LabelStack[j3].IsUniform)
+ buf.EncodeUint32(v1.Path.LabelStack[j3].Label)
+ buf.EncodeUint8(v1.Path.LabelStack[j3].TTL)
+ buf.EncodeUint8(v1.Path.LabelStack[j3].Exp)
}
}
return buf.Bytes(), nil
@@ -892,7 +829,7 @@ func (m *IPMrouteDetails) Unmarshal(b []byte) error {
copy(m.Route.Prefix.GrpAddress.XXX_UnionData[:], buf.DecodeBytes(16))
copy(m.Route.Prefix.SrcAddress.XXX_UnionData[:], buf.DecodeBytes(16))
m.Route.NPaths = buf.DecodeUint8()
- m.Route.Paths = make([]mfib_types.MfibPath, int(m.Route.NPaths))
+ m.Route.Paths = make([]mfib_types.MfibPath, m.Route.NPaths)
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
m.Route.Paths[j1].ItfFlags = mfib_types.MfibItfFlags(buf.DecodeUint32())
m.Route.Paths[j1].Path.SwIfIndex = buf.DecodeUint32()
@@ -930,24 +867,21 @@ func (*IPMrouteDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPMrouteDump) Size() int {
+func (m *IPMrouteDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Table.TableID
size += 1 // m.Table.IsIP6
size += 64 // m.Table.Name
return size
}
func (m *IPMrouteDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Table.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Table.TableID)
buf.EncodeBool(m.Table.IsIP6)
buf.EncodeString(m.Table.Name, 64)
return buf.Bytes(), nil
@@ -972,24 +906,21 @@ func (*IPMtableDetails) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPMtableDetails) Size() int {
+func (m *IPMtableDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Table.TableID
size += 1 // m.Table.IsIP6
size += 64 // m.Table.Name
return size
}
func (m *IPMtableDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Table.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Table.TableID)
buf.EncodeBool(m.Table.IsIP6)
buf.EncodeString(m.Table.Name, 64)
return buf.Bytes(), nil
@@ -1012,20 +943,17 @@ func (*IPMtableDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPMtableDump) Size() int {
+func (m *IPMtableDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IPMtableDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IPMtableDump) Unmarshal(b []byte) error {
@@ -1046,24 +974,21 @@ func (*IPPuntPolice) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPPuntPolice) Size() int {
+func (m *IPPuntPolice) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PolicerIndex
size += 1 // m.IsAdd
size += 1 // m.IsIP6
return size
}
func (m *IPPuntPolice) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PolicerIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PolicerIndex)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.IsIP6)
return buf.Bytes(), nil
@@ -1088,27 +1013,24 @@ func (*IPPuntPoliceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPPuntPoliceReply) Size() int {
+func (m *IPPuntPoliceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPPuntPoliceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPPuntPoliceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1125,11 +1047,10 @@ func (*IPPuntRedirect) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPPuntRedirect) Size() int {
+func (m *IPPuntRedirect) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Punt.RxSwIfIndex
size += 4 // m.Punt.TxSwIfIndex
size += 1 // m.Punt.Nh.Af
@@ -1138,16 +1059,14 @@ func (m *IPPuntRedirect) Size() int {
return size
}
func (m *IPPuntRedirect) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Punt.RxSwIfIndex))
buf.EncodeUint32(uint32(m.Punt.TxSwIfIndex))
buf.EncodeUint8(uint8(m.Punt.Nh.Af))
- buf.EncodeBytes(m.Punt.Nh.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Punt.Nh.Un.XXX_UnionData[:], 16)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -1173,11 +1092,10 @@ func (*IPPuntRedirectDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPPuntRedirectDetails) Size() int {
+func (m *IPPuntRedirectDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Punt.RxSwIfIndex
size += 4 // m.Punt.TxSwIfIndex
size += 1 // m.Punt.Nh.Af
@@ -1185,16 +1103,14 @@ func (m *IPPuntRedirectDetails) Size() int {
return size
}
func (m *IPPuntRedirectDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Punt.RxSwIfIndex))
buf.EncodeUint32(uint32(m.Punt.TxSwIfIndex))
buf.EncodeUint8(uint8(m.Punt.Nh.Af))
- buf.EncodeBytes(m.Punt.Nh.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Punt.Nh.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *IPPuntRedirectDetails) Unmarshal(b []byte) error {
@@ -1219,22 +1135,19 @@ func (*IPPuntRedirectDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPPuntRedirectDump) Size() int {
+func (m *IPPuntRedirectDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
return size
}
func (m *IPPuntRedirectDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
return buf.Bytes(), nil
@@ -1258,27 +1171,24 @@ func (*IPPuntRedirectReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPPuntRedirectReply) Size() int {
+func (m *IPPuntRedirectReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPPuntRedirectReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPPuntRedirectReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1297,11 +1207,10 @@ func (*IPReassemblyEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPReassemblyEnableDisable) Size() int {
+func (m *IPReassemblyEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.EnableIP4
size += 1 // m.EnableIP6
@@ -1309,12 +1218,10 @@ func (m *IPReassemblyEnableDisable) Size() int {
return size
}
func (m *IPReassemblyEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.EnableIP4)
buf.EncodeBool(m.EnableIP6)
@@ -1344,27 +1251,24 @@ func (*IPReassemblyEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPReassemblyEnableDisableReply) Size() int {
+func (m *IPReassemblyEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPReassemblyEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPReassemblyEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1381,22 +1285,19 @@ func (*IPReassemblyGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPReassemblyGet) Size() int {
+func (m *IPReassemblyGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsIP6
size += 4 // m.Type
return size
}
func (m *IPReassemblyGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsIP6)
buf.EncodeUint32(uint32(m.Type))
return buf.Bytes(), nil
@@ -1425,11 +1326,10 @@ func (*IPReassemblyGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPReassemblyGetReply) Size() int {
+func (m *IPReassemblyGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.TimeoutMs
size += 4 // m.MaxReassemblies
@@ -1439,23 +1339,21 @@ func (m *IPReassemblyGetReply) Size() int {
return size
}
func (m *IPReassemblyGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.TimeoutMs))
- buf.EncodeUint32(uint32(m.MaxReassemblies))
- buf.EncodeUint32(uint32(m.MaxReassemblyLength))
- buf.EncodeUint32(uint32(m.ExpireWalkIntervalMs))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.TimeoutMs)
+ buf.EncodeUint32(m.MaxReassemblies)
+ buf.EncodeUint32(m.MaxReassemblyLength)
+ buf.EncodeUint32(m.ExpireWalkIntervalMs)
buf.EncodeBool(m.IsIP6)
return buf.Bytes(), nil
}
func (m *IPReassemblyGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.TimeoutMs = buf.DecodeUint32()
m.MaxReassemblies = buf.DecodeUint32()
m.MaxReassemblyLength = buf.DecodeUint32()
@@ -1481,11 +1379,10 @@ func (*IPReassemblySet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPReassemblySet) Size() int {
+func (m *IPReassemblySet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TimeoutMs
size += 4 // m.MaxReassemblies
size += 4 // m.MaxReassemblyLength
@@ -1495,16 +1392,14 @@ func (m *IPReassemblySet) Size() int {
return size
}
func (m *IPReassemblySet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.TimeoutMs))
- buf.EncodeUint32(uint32(m.MaxReassemblies))
- buf.EncodeUint32(uint32(m.MaxReassemblyLength))
- buf.EncodeUint32(uint32(m.ExpireWalkIntervalMs))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TimeoutMs)
+ buf.EncodeUint32(m.MaxReassemblies)
+ buf.EncodeUint32(m.MaxReassemblyLength)
+ buf.EncodeUint32(m.ExpireWalkIntervalMs)
buf.EncodeBool(m.IsIP6)
buf.EncodeUint32(uint32(m.Type))
return buf.Bytes(), nil
@@ -1532,27 +1427,24 @@ func (*IPReassemblySetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPReassemblySetReply) Size() int {
+func (m *IPReassemblySetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPReassemblySetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPReassemblySetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1570,11 +1462,10 @@ func (*IPRouteAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPRouteAddDel) Size() int {
+func (m *IPRouteAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IsMultipath
size += 4 // m.Route.TableID
@@ -1603,61 +1494,50 @@ func (m *IPRouteAddDel) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *IPRouteAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.IsMultipath)
- buf.EncodeUint32(uint32(m.Route.TableID))
- buf.EncodeUint32(uint32(m.Route.StatsIndex))
+ buf.EncodeUint32(m.Route.TableID)
+ buf.EncodeUint32(m.Route.StatsIndex)
buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af))
- buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Route.Prefix.Len))
+ buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Route.Prefix.Len)
buf.EncodeUint8(uint8(len(m.Route.Paths)))
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // Paths
if j1 < len(m.Route.Paths) {
v1 = m.Route.Paths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -1672,7 +1552,7 @@ func (m *IPRouteAddDel) Unmarshal(b []byte) error {
copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
m.Route.Prefix.Len = buf.DecodeUint8()
m.Route.NPaths = buf.DecodeUint8()
- m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths))
+ m.Route.Paths = make([]fib_types.FibPath, m.Route.NPaths)
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32()
m.Route.Paths[j1].TableID = buf.DecodeUint32()
@@ -1710,29 +1590,26 @@ func (*IPRouteAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPRouteAddDelReply) Size() int {
+func (m *IPRouteAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.StatsIndex
return size
}
func (m *IPRouteAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.StatsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.StatsIndex)
return buf.Bytes(), nil
}
func (m *IPRouteAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.StatsIndex = buf.DecodeUint32()
return nil
}
@@ -1749,11 +1626,10 @@ func (*IPRouteDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPRouteDetails) Size() int {
+func (m *IPRouteDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Route.TableID
size += 4 // m.Route.StatsIndex
size += 1 // m.Route.Prefix.Address.Af
@@ -1780,59 +1656,48 @@ func (m *IPRouteDetails) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *IPRouteDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Route.TableID))
- buf.EncodeUint32(uint32(m.Route.StatsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Route.TableID)
+ buf.EncodeUint32(m.Route.StatsIndex)
buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af))
- buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Route.Prefix.Len))
+ buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Route.Prefix.Len)
buf.EncodeUint8(uint8(len(m.Route.Paths)))
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // Paths
if j1 < len(m.Route.Paths) {
v1 = m.Route.Paths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -1845,7 +1710,7 @@ func (m *IPRouteDetails) Unmarshal(b []byte) error {
copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
m.Route.Prefix.Len = buf.DecodeUint8()
m.Route.NPaths = buf.DecodeUint8()
- m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths))
+ m.Route.Paths = make([]fib_types.FibPath, m.Route.NPaths)
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32()
m.Route.Paths[j1].TableID = buf.DecodeUint32()
@@ -1882,24 +1747,21 @@ func (*IPRouteDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPRouteDump) Size() int {
+func (m *IPRouteDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Table.TableID
size += 1 // m.Table.IsIP6
size += 64 // m.Table.Name
return size
}
func (m *IPRouteDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Table.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Table.TableID)
buf.EncodeBool(m.Table.IsIP6)
buf.EncodeString(m.Table.Name, 64)
return buf.Bytes(), nil
@@ -1926,11 +1788,10 @@ func (*IPRouteLookup) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPRouteLookup) Size() int {
+func (m *IPRouteLookup) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TableID
size += 1 // m.Exact
size += 1 // m.Prefix.Address.Af
@@ -1939,17 +1800,15 @@ func (m *IPRouteLookup) Size() int {
return size
}
func (m *IPRouteLookup) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.TableID))
- buf.EncodeUint8(uint8(m.Exact))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TableID)
+ buf.EncodeUint8(m.Exact)
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
return buf.Bytes(), nil
}
func (m *IPRouteLookup) Unmarshal(b []byte) error {
@@ -1975,11 +1834,10 @@ func (*IPRouteLookupReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPRouteLookupReply) Size() int {
+func (m *IPRouteLookupReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Route.TableID
size += 4 // m.Route.StatsIndex
@@ -2007,74 +1865,63 @@ func (m *IPRouteLookupReply) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *IPRouteLookupReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.Route.TableID))
- buf.EncodeUint32(uint32(m.Route.StatsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.Route.TableID)
+ buf.EncodeUint32(m.Route.StatsIndex)
buf.EncodeUint8(uint8(m.Route.Prefix.Address.Af))
- buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Route.Prefix.Len))
+ buf.EncodeBytes(m.Route.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Route.Prefix.Len)
buf.EncodeUint8(uint8(len(m.Route.Paths)))
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // Paths
if j1 < len(m.Route.Paths) {
v1 = m.Route.Paths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
}
func (m *IPRouteLookupReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Route.TableID = buf.DecodeUint32()
m.Route.StatsIndex = buf.DecodeUint32()
m.Route.Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Route.Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
m.Route.Prefix.Len = buf.DecodeUint8()
m.Route.NPaths = buf.DecodeUint8()
- m.Route.Paths = make([]fib_types.FibPath, int(m.Route.NPaths))
+ m.Route.Paths = make([]fib_types.FibPath, m.Route.NPaths)
for j1 := 0; j1 < len(m.Route.Paths); j1++ {
m.Route.Paths[j1].SwIfIndex = buf.DecodeUint32()
m.Route.Paths[j1].TableID = buf.DecodeUint32()
@@ -2118,11 +1965,10 @@ func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPSourceAndPortRangeCheckAddDel) Size() int {
+func (m *IPSourceAndPortRangeCheckAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Prefix.Address.Af
size += 1 * 16 // m.Prefix.Address.Un
@@ -2134,32 +1980,30 @@ func (m *IPSourceAndPortRangeCheckAddDel) Size() int {
return size
}
func (m *IPSourceAndPortRangeCheckAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
- buf.EncodeUint8(uint8(m.NumberOfRanges))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
+ buf.EncodeUint8(m.NumberOfRanges)
for i := 0; i < 32; i++ {
var x uint16
if i < len(m.LowPorts) {
x = uint16(m.LowPorts[i])
}
- buf.EncodeUint16(uint16(x))
+ buf.EncodeUint16(x)
}
for i := 0; i < 32; i++ {
var x uint16
if i < len(m.HighPorts) {
x = uint16(m.HighPorts[i])
}
- buf.EncodeUint16(uint16(x))
+ buf.EncodeUint16(x)
}
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
return buf.Bytes(), nil
}
func (m *IPSourceAndPortRangeCheckAddDel) Unmarshal(b []byte) error {
@@ -2195,27 +2039,24 @@ func (*IPSourceAndPortRangeCheckAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPSourceAndPortRangeCheckAddDelReply) Size() int {
+func (m *IPSourceAndPortRangeCheckAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPSourceAndPortRangeCheckAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPSourceAndPortRangeCheckAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2240,11 +2081,10 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDel) GetMessageType() api.MessageTyp
return api.RequestMessage
}
-func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Size() int {
+func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SwIfIndex
size += 4 // m.TCPInVrfID
@@ -2254,18 +2094,16 @@ func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Size() int {
return size
}
func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.TCPInVrfID))
- buf.EncodeUint32(uint32(m.TCPOutVrfID))
- buf.EncodeUint32(uint32(m.UDPInVrfID))
- buf.EncodeUint32(uint32(m.UDPOutVrfID))
+ buf.EncodeUint32(m.TCPInVrfID)
+ buf.EncodeUint32(m.TCPOutVrfID)
+ buf.EncodeUint32(m.UDPInVrfID)
+ buf.EncodeUint32(m.UDPOutVrfID)
return buf.Bytes(), nil
}
func (m *IPSourceAndPortRangeCheckInterfaceAddDel) Unmarshal(b []byte) error {
@@ -2295,27 +2133,24 @@ func (*IPSourceAndPortRangeCheckInterfaceAddDelReply) GetMessageType() api.Messa
return api.ReplyMessage
}
-func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Size() int {
+func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPSourceAndPortRangeCheckInterfaceAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2332,11 +2167,10 @@ func (*IPTableAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPTableAddDel) Size() int {
+func (m *IPTableAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Table.TableID
size += 1 // m.Table.IsIP6
@@ -2344,14 +2178,12 @@ func (m *IPTableAddDel) Size() int {
return size
}
func (m *IPTableAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Table.TableID))
+ buf.EncodeUint32(m.Table.TableID)
buf.EncodeBool(m.Table.IsIP6)
buf.EncodeString(m.Table.Name, 64)
return buf.Bytes(), nil
@@ -2377,27 +2209,24 @@ func (*IPTableAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPTableAddDelReply) Size() int {
+func (m *IPTableAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPTableAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPTableAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2413,24 +2242,21 @@ func (*IPTableDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPTableDetails) Size() int {
+func (m *IPTableDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Table.TableID
size += 1 // m.Table.IsIP6
size += 64 // m.Table.Name
return size
}
func (m *IPTableDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Table.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Table.TableID)
buf.EncodeBool(m.Table.IsIP6)
buf.EncodeString(m.Table.Name, 64)
return buf.Bytes(), nil
@@ -2453,20 +2279,17 @@ func (*IPTableDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPTableDump) Size() int {
+func (m *IPTableDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IPTableDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IPTableDump) Unmarshal(b []byte) error {
@@ -2485,24 +2308,21 @@ func (*IPTableFlush) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPTableFlush) Size() int {
+func (m *IPTableFlush) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Table.TableID
size += 1 // m.Table.IsIP6
size += 64 // m.Table.Name
return size
}
func (m *IPTableFlush) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Table.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Table.TableID)
buf.EncodeBool(m.Table.IsIP6)
buf.EncodeString(m.Table.Name, 64)
return buf.Bytes(), nil
@@ -2527,27 +2347,24 @@ func (*IPTableFlushReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPTableFlushReply) Size() int {
+func (m *IPTableFlushReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPTableFlushReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPTableFlushReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2563,24 +2380,21 @@ func (*IPTableReplaceBegin) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPTableReplaceBegin) Size() int {
+func (m *IPTableReplaceBegin) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Table.TableID
size += 1 // m.Table.IsIP6
size += 64 // m.Table.Name
return size
}
func (m *IPTableReplaceBegin) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Table.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Table.TableID)
buf.EncodeBool(m.Table.IsIP6)
buf.EncodeString(m.Table.Name, 64)
return buf.Bytes(), nil
@@ -2605,27 +2419,24 @@ func (*IPTableReplaceBeginReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPTableReplaceBeginReply) Size() int {
+func (m *IPTableReplaceBeginReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPTableReplaceBeginReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPTableReplaceBeginReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2641,24 +2452,21 @@ func (*IPTableReplaceEnd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPTableReplaceEnd) Size() int {
+func (m *IPTableReplaceEnd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Table.TableID
size += 1 // m.Table.IsIP6
size += 64 // m.Table.Name
return size
}
func (m *IPTableReplaceEnd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Table.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Table.TableID)
buf.EncodeBool(m.Table.IsIP6)
buf.EncodeString(m.Table.Name, 64)
return buf.Bytes(), nil
@@ -2683,27 +2491,24 @@ func (*IPTableReplaceEndReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPTableReplaceEndReply) Size() int {
+func (m *IPTableReplaceEndReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPTableReplaceEndReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPTableReplaceEndReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2720,22 +2525,19 @@ func (*IPUnnumberedDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPUnnumberedDetails) Size() int {
+func (m *IPUnnumberedDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.IPSwIfIndex
return size
}
func (m *IPUnnumberedDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint32(uint32(m.IPSwIfIndex))
return buf.Bytes(), nil
@@ -2749,7 +2551,7 @@ func (m *IPUnnumberedDetails) Unmarshal(b []byte) error {
// IPUnnumberedDump defines message 'ip_unnumbered_dump'.
type IPUnnumberedDump struct {
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *IPUnnumberedDump) Reset() { *m = IPUnnumberedDump{} }
@@ -2759,21 +2561,18 @@ func (*IPUnnumberedDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPUnnumberedDump) Size() int {
+func (m *IPUnnumberedDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *IPUnnumberedDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -2799,11 +2598,10 @@ func (*MfibSignalDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MfibSignalDetails) Size() int {
+func (m *MfibSignalDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.TableID
size += 1 // m.Prefix.Af
@@ -2815,20 +2613,18 @@ func (m *MfibSignalDetails) Size() int {
return size
}
func (m *MfibSignalDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.TableID))
+ buf.EncodeUint32(m.TableID)
buf.EncodeUint8(uint8(m.Prefix.Af))
- buf.EncodeUint16(uint16(m.Prefix.GrpAddressLength))
- buf.EncodeBytes(m.Prefix.GrpAddress.XXX_UnionData[:], 0)
- buf.EncodeBytes(m.Prefix.SrcAddress.XXX_UnionData[:], 0)
- buf.EncodeUint16(uint16(m.IPPacketLen))
- buf.EncodeBytes(m.IPPacketData[:], 256)
+ buf.EncodeUint16(m.Prefix.GrpAddressLength)
+ buf.EncodeBytes(m.Prefix.GrpAddress.XXX_UnionData[:], 16)
+ buf.EncodeBytes(m.Prefix.SrcAddress.XXX_UnionData[:], 16)
+ buf.EncodeUint16(m.IPPacketLen)
+ buf.EncodeBytes(m.IPPacketData, 256)
return buf.Bytes(), nil
}
func (m *MfibSignalDetails) Unmarshal(b []byte) error {
@@ -2840,7 +2636,8 @@ func (m *MfibSignalDetails) Unmarshal(b []byte) error {
copy(m.Prefix.GrpAddress.XXX_UnionData[:], buf.DecodeBytes(16))
copy(m.Prefix.SrcAddress.XXX_UnionData[:], buf.DecodeBytes(16))
m.IPPacketLen = buf.DecodeUint16()
- copy(m.IPPacketData[:], buf.DecodeBytes(256))
+ m.IPPacketData = make([]byte, 256)
+ copy(m.IPPacketData, buf.DecodeBytes(len(m.IPPacketData)))
return nil
}
@@ -2854,20 +2651,17 @@ func (*MfibSignalDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MfibSignalDump) Size() int {
+func (m *MfibSignalDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *MfibSignalDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *MfibSignalDump) Unmarshal(b []byte) error {
@@ -2894,11 +2688,10 @@ func (*SetIPFlowHash) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SetIPFlowHash) Size() int {
+func (m *SetIPFlowHash) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.VrfID
size += 1 // m.IsIPv6
size += 1 // m.Src
@@ -2911,13 +2704,11 @@ func (m *SetIPFlowHash) Size() int {
return size
}
func (m *SetIPFlowHash) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.VrfID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.VrfID)
buf.EncodeBool(m.IsIPv6)
buf.EncodeBool(m.Src)
buf.EncodeBool(m.Dst)
@@ -2954,27 +2745,24 @@ func (*SetIPFlowHashReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SetIPFlowHashReply) Size() int {
+func (m *SetIPFlowHashReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SetIPFlowHashReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SetIPFlowHashReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2991,22 +2779,19 @@ func (*SwInterfaceIP6EnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceIP6EnableDisable) Size() int {
+func (m *SwInterfaceIP6EnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Enable
return size
}
func (m *SwInterfaceIP6EnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
@@ -3032,27 +2817,24 @@ func (*SwInterfaceIP6EnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceIP6EnableDisableReply) Size() int {
+func (m *SwInterfaceIP6EnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceIP6EnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceIP6EnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3071,22 +2853,19 @@ func (*SwInterfaceIP6SetLinkLocalAddress) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceIP6SetLinkLocalAddress) Size() int {
+func (m *SwInterfaceIP6SetLinkLocalAddress) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 * 16 // m.IP
return size
}
func (m *SwInterfaceIP6SetLinkLocalAddress) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.IP[:], 16)
return buf.Bytes(), nil
@@ -3114,27 +2893,24 @@ func (*SwInterfaceIP6SetLinkLocalAddressReply) GetMessageType() api.MessageType
return api.ReplyMessage
}
-func (m *SwInterfaceIP6SetLinkLocalAddressReply) Size() int {
+func (m *SwInterfaceIP6SetLinkLocalAddressReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceIP6SetLinkLocalAddressReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceIP6SetLinkLocalAddressReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ip6_nd/ip6_nd.ba.go b/binapi/ip6_nd/ip6_nd.ba.go
index a6f35b4..a5f308e 100644
--- a/binapi/ip6_nd/ip6_nd.ba.go
+++ b/binapi/ip6_nd/ip6_nd.ba.go
@@ -60,11 +60,10 @@ func (*IP6RaEvent) GetMessageType() api.MessageType {
return api.EventMessage
}
-func (m *IP6RaEvent) Size() int {
+func (m *IP6RaEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PID
size += 4 // m.SwIfIndex
size += 1 * 16 // m.RouterAddr
@@ -90,32 +89,30 @@ func (m *IP6RaEvent) Size() int {
return size
}
func (m *IP6RaEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PID)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.RouterAddr[:], 16)
- buf.EncodeUint8(uint8(m.CurrentHopLimit))
- buf.EncodeUint8(uint8(m.Flags))
- buf.EncodeUint16(uint16(m.RouterLifetimeInSec))
- buf.EncodeUint32(uint32(m.NeighborReachableTimeInMsec))
- buf.EncodeUint32(uint32(m.TimeInMsecBetweenRetransmittedNeighborSolicitations))
+ buf.EncodeUint8(m.CurrentHopLimit)
+ buf.EncodeUint8(m.Flags)
+ buf.EncodeUint16(m.RouterLifetimeInSec)
+ buf.EncodeUint32(m.NeighborReachableTimeInMsec)
+ buf.EncodeUint32(m.TimeInMsecBetweenRetransmittedNeighborSolicitations)
buf.EncodeUint32(uint32(len(m.Prefixes)))
for j0 := 0; j0 < len(m.Prefixes); j0++ {
- var v0 IP6RaPrefixInfo
+ var v0 IP6RaPrefixInfo // Prefixes
if j0 < len(m.Prefixes) {
v0 = m.Prefixes[j0]
}
buf.EncodeUint8(uint8(v0.Prefix.Address.Af))
- buf.EncodeBytes(v0.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(v0.Prefix.Len))
- buf.EncodeUint8(uint8(v0.Flags))
- buf.EncodeUint32(uint32(v0.ValidTime))
- buf.EncodeUint32(uint32(v0.PreferredTime))
+ buf.EncodeBytes(v0.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(v0.Prefix.Len)
+ buf.EncodeUint8(v0.Flags)
+ buf.EncodeUint32(v0.ValidTime)
+ buf.EncodeUint32(v0.PreferredTime)
}
return buf.Bytes(), nil
}
@@ -130,7 +127,7 @@ func (m *IP6RaEvent) Unmarshal(b []byte) error {
m.NeighborReachableTimeInMsec = buf.DecodeUint32()
m.TimeInMsecBetweenRetransmittedNeighborSolicitations = buf.DecodeUint32()
m.NPrefixes = buf.DecodeUint32()
- m.Prefixes = make([]IP6RaPrefixInfo, int(m.NPrefixes))
+ m.Prefixes = make([]IP6RaPrefixInfo, m.NPrefixes)
for j0 := 0; j0 < len(m.Prefixes); j0++ {
m.Prefixes[j0].Prefix.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Prefixes[j0].Prefix.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -156,23 +153,20 @@ func (*IP6ndProxyAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IP6ndProxyAddDel) Size() int {
+func (m *IP6ndProxyAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsAdd
size += 1 * 16 // m.IP
return size
}
func (m *IP6ndProxyAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsAdd)
buf.EncodeBytes(m.IP[:], 16)
@@ -198,27 +192,24 @@ func (*IP6ndProxyAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IP6ndProxyAddDelReply) Size() int {
+func (m *IP6ndProxyAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IP6ndProxyAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IP6ndProxyAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -235,22 +226,19 @@ func (*IP6ndProxyDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IP6ndProxyDetails) Size() int {
+func (m *IP6ndProxyDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 * 16 // m.IP
return size
}
func (m *IP6ndProxyDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.IP[:], 16)
return buf.Bytes(), nil
@@ -272,20 +260,17 @@ func (*IP6ndProxyDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IP6ndProxyDump) Size() int {
+func (m *IP6ndProxyDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IP6ndProxyDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IP6ndProxyDump) Unmarshal(b []byte) error {
@@ -309,11 +294,10 @@ func (*IP6ndSendRouterSolicitation) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IP6ndSendRouterSolicitation) Size() int {
+func (m *IP6ndSendRouterSolicitation) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Irt
size += 4 // m.Mrt
size += 4 // m.Mrc
@@ -323,16 +307,14 @@ func (m *IP6ndSendRouterSolicitation) Size() int {
return size
}
func (m *IP6ndSendRouterSolicitation) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Irt))
- buf.EncodeUint32(uint32(m.Mrt))
- buf.EncodeUint32(uint32(m.Mrc))
- buf.EncodeUint32(uint32(m.Mrd))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Irt)
+ buf.EncodeUint32(m.Mrt)
+ buf.EncodeUint32(m.Mrc)
+ buf.EncodeUint32(m.Mrd)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Stop)
return buf.Bytes(), nil
@@ -362,27 +344,24 @@ func (*IP6ndSendRouterSolicitationReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IP6ndSendRouterSolicitationReply) Size() int {
+func (m *IP6ndSendRouterSolicitationReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IP6ndSendRouterSolicitationReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IP6ndSendRouterSolicitationReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -411,11 +390,10 @@ func (*SwInterfaceIP6ndRaConfig) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceIP6ndRaConfig) Size() int {
+func (m *SwInterfaceIP6ndRaConfig) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Suppress
size += 1 // m.Managed
@@ -433,26 +411,24 @@ func (m *SwInterfaceIP6ndRaConfig) Size() int {
return size
}
func (m *SwInterfaceIP6ndRaConfig) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.Suppress))
- buf.EncodeUint8(uint8(m.Managed))
- buf.EncodeUint8(uint8(m.Other))
- buf.EncodeUint8(uint8(m.LlOption))
- buf.EncodeUint8(uint8(m.SendUnicast))
- buf.EncodeUint8(uint8(m.Cease))
+ buf.EncodeUint8(m.Suppress)
+ buf.EncodeUint8(m.Managed)
+ buf.EncodeUint8(m.Other)
+ buf.EncodeUint8(m.LlOption)
+ buf.EncodeUint8(m.SendUnicast)
+ buf.EncodeUint8(m.Cease)
buf.EncodeBool(m.IsNo)
- buf.EncodeUint8(uint8(m.DefaultRouter))
- buf.EncodeUint32(uint32(m.MaxInterval))
- buf.EncodeUint32(uint32(m.MinInterval))
- buf.EncodeUint32(uint32(m.Lifetime))
- buf.EncodeUint32(uint32(m.InitialCount))
- buf.EncodeUint32(uint32(m.InitialInterval))
+ buf.EncodeUint8(m.DefaultRouter)
+ buf.EncodeUint32(m.MaxInterval)
+ buf.EncodeUint32(m.MinInterval)
+ buf.EncodeUint32(m.Lifetime)
+ buf.EncodeUint32(m.InitialCount)
+ buf.EncodeUint32(m.InitialInterval)
return buf.Bytes(), nil
}
func (m *SwInterfaceIP6ndRaConfig) Unmarshal(b []byte) error {
@@ -488,27 +464,24 @@ func (*SwInterfaceIP6ndRaConfigReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceIP6ndRaConfigReply) Size() int {
+func (m *SwInterfaceIP6ndRaConfigReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceIP6ndRaConfigReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceIP6ndRaConfigReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -533,11 +506,10 @@ func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceIP6ndRaPrefix) Size() int {
+func (m *SwInterfaceIP6ndRaPrefix) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Prefix.Address.Af
size += 1 * 16 // m.Prefix.Address.Un
@@ -553,24 +525,22 @@ func (m *SwInterfaceIP6ndRaPrefix) Size() int {
return size
}
func (m *SwInterfaceIP6ndRaPrefix) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
buf.EncodeBool(m.UseDefault)
buf.EncodeBool(m.NoAdvertise)
buf.EncodeBool(m.OffLink)
buf.EncodeBool(m.NoAutoconfig)
buf.EncodeBool(m.NoOnlink)
buf.EncodeBool(m.IsNo)
- buf.EncodeUint32(uint32(m.ValLifetime))
- buf.EncodeUint32(uint32(m.PrefLifetime))
+ buf.EncodeUint32(m.ValLifetime)
+ buf.EncodeUint32(m.PrefLifetime)
return buf.Bytes(), nil
}
func (m *SwInterfaceIP6ndRaPrefix) Unmarshal(b []byte) error {
@@ -604,27 +574,24 @@ func (*SwInterfaceIP6ndRaPrefixReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceIP6ndRaPrefixReply) Size() int {
+func (m *SwInterfaceIP6ndRaPrefixReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceIP6ndRaPrefixReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceIP6ndRaPrefixReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -641,24 +608,21 @@ func (*WantIP6RaEvents) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *WantIP6RaEvents) Size() int {
+func (m *WantIP6RaEvents) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
size += 4 // m.PID
return size
}
func (m *WantIP6RaEvents) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
- buf.EncodeUint32(uint32(m.PID))
+ buf.EncodeUint32(m.PID)
return buf.Bytes(), nil
}
func (m *WantIP6RaEvents) Unmarshal(b []byte) error {
@@ -680,27 +644,24 @@ func (*WantIP6RaEventsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *WantIP6RaEventsReply) Size() int {
+func (m *WantIP6RaEventsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *WantIP6RaEventsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *WantIP6RaEventsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ip_neighbor/ip_neighbor.ba.go b/binapi/ip_neighbor/ip_neighbor.ba.go
index 60df4cc..b4da5b1 100644
--- a/binapi/ip_neighbor/ip_neighbor.ba.go
+++ b/binapi/ip_neighbor/ip_neighbor.ba.go
@@ -104,11 +104,10 @@ func (*IPNeighborAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPNeighborAddDel) Size() int {
+func (m *IPNeighborAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Neighbor.SwIfIndex
size += 1 // m.Neighbor.Flags
@@ -118,18 +117,16 @@ func (m *IPNeighborAddDel) Size() int {
return size
}
func (m *IPNeighborAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.Neighbor.SwIfIndex))
buf.EncodeUint8(uint8(m.Neighbor.Flags))
buf.EncodeBytes(m.Neighbor.MacAddress[:], 6)
buf.EncodeUint8(uint8(m.Neighbor.IPAddress.Af))
- buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *IPNeighborAddDel) Unmarshal(b []byte) error {
@@ -156,29 +153,26 @@ func (*IPNeighborAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPNeighborAddDelReply) Size() int {
+func (m *IPNeighborAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.StatsIndex
return size
}
func (m *IPNeighborAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.StatsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.StatsIndex)
return buf.Bytes(), nil
}
func (m *IPNeighborAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.StatsIndex = buf.DecodeUint32()
return nil
}
@@ -198,11 +192,10 @@ func (*IPNeighborConfig) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPNeighborConfig) Size() int {
+func (m *IPNeighborConfig) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Af
size += 4 // m.MaxNumber
size += 4 // m.MaxAge
@@ -210,15 +203,13 @@ func (m *IPNeighborConfig) Size() int {
return size
}
func (m *IPNeighborConfig) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Af))
- buf.EncodeUint32(uint32(m.MaxNumber))
- buf.EncodeUint32(uint32(m.MaxAge))
+ buf.EncodeUint32(m.MaxNumber)
+ buf.EncodeUint32(m.MaxAge)
buf.EncodeBool(m.Recycle)
return buf.Bytes(), nil
}
@@ -243,27 +234,24 @@ func (*IPNeighborConfigReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPNeighborConfigReply) Size() int {
+func (m *IPNeighborConfigReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPNeighborConfigReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPNeighborConfigReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -280,11 +268,10 @@ func (*IPNeighborDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPNeighborDetails) Size() int {
+func (m *IPNeighborDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.Age
size += 4 // m.Neighbor.SwIfIndex
size += 1 // m.Neighbor.Flags
@@ -294,23 +281,21 @@ func (m *IPNeighborDetails) Size() int {
return size
}
func (m *IPNeighborDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeFloat64(float64(m.Age))
+ buf := codec.NewBuffer(b)
+ buf.EncodeFloat64(m.Age)
buf.EncodeUint32(uint32(m.Neighbor.SwIfIndex))
buf.EncodeUint8(uint8(m.Neighbor.Flags))
buf.EncodeBytes(m.Neighbor.MacAddress[:], 6)
buf.EncodeUint8(uint8(m.Neighbor.IPAddress.Af))
- buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *IPNeighborDetails) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Age = float64(buf.DecodeFloat64())
+ m.Age = buf.DecodeFloat64()
m.Neighbor.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.Neighbor.Flags = IPNeighborFlags(buf.DecodeUint8())
copy(m.Neighbor.MacAddress[:], buf.DecodeBytes(6))
@@ -321,7 +306,7 @@ func (m *IPNeighborDetails) Unmarshal(b []byte) error {
// IPNeighborDump defines message 'ip_neighbor_dump'.
type IPNeighborDump struct {
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
}
@@ -332,22 +317,19 @@ func (*IPNeighborDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPNeighborDump) Size() int {
+func (m *IPNeighborDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Af
return size
}
func (m *IPNeighborDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.Af))
return buf.Bytes(), nil
@@ -372,11 +354,10 @@ func (*IPNeighborEvent) GetMessageType() api.MessageType {
return api.EventMessage
}
-func (m *IPNeighborEvent) Size() int {
+func (m *IPNeighborEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PID
size += 4 // m.Neighbor.SwIfIndex
size += 1 // m.Neighbor.Flags
@@ -386,18 +367,16 @@ func (m *IPNeighborEvent) Size() int {
return size
}
func (m *IPNeighborEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PID)
buf.EncodeUint32(uint32(m.Neighbor.SwIfIndex))
buf.EncodeUint8(uint8(m.Neighbor.Flags))
buf.EncodeBytes(m.Neighbor.MacAddress[:], 6)
buf.EncodeUint8(uint8(m.Neighbor.IPAddress.Af))
- buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Neighbor.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *IPNeighborEvent) Unmarshal(b []byte) error {
@@ -414,7 +393,7 @@ func (m *IPNeighborEvent) Unmarshal(b []byte) error {
// IPNeighborFlush defines message 'ip_neighbor_flush'.
type IPNeighborFlush struct {
Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *IPNeighborFlush) Reset() { *m = IPNeighborFlush{} }
@@ -424,22 +403,19 @@ func (*IPNeighborFlush) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPNeighborFlush) Size() int {
+func (m *IPNeighborFlush) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Af
size += 4 // m.SwIfIndex
return size
}
func (m *IPNeighborFlush) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Af))
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -463,27 +439,24 @@ func (*IPNeighborFlushReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPNeighborFlushReply) Size() int {
+func (m *IPNeighborFlushReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPNeighborFlushReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPNeighborFlushReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -497,20 +470,17 @@ func (*IPNeighborReplaceBegin) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPNeighborReplaceBegin) Size() int {
+func (m *IPNeighborReplaceBegin) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IPNeighborReplaceBegin) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IPNeighborReplaceBegin) Unmarshal(b []byte) error {
@@ -529,27 +499,24 @@ func (*IPNeighborReplaceBeginReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPNeighborReplaceBeginReply) Size() int {
+func (m *IPNeighborReplaceBeginReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPNeighborReplaceBeginReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPNeighborReplaceBeginReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -563,20 +530,17 @@ func (*IPNeighborReplaceEnd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IPNeighborReplaceEnd) Size() int {
+func (m *IPNeighborReplaceEnd) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IPNeighborReplaceEnd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IPNeighborReplaceEnd) Unmarshal(b []byte) error {
@@ -595,27 +559,24 @@ func (*IPNeighborReplaceEndReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IPNeighborReplaceEndReply) Size() int {
+func (m *IPNeighborReplaceEndReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IPNeighborReplaceEndReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IPNeighborReplaceEndReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -624,7 +585,7 @@ type WantIPNeighborEvents struct {
Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"`
PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"`
IP ip_types.Address `binapi:"address,name=ip" json:"ip,omitempty"`
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *WantIPNeighborEvents) Reset() { *m = WantIPNeighborEvents{} }
@@ -634,11 +595,10 @@ func (*WantIPNeighborEvents) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *WantIPNeighborEvents) Size() int {
+func (m *WantIPNeighborEvents) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
size += 4 // m.PID
size += 1 // m.IP.Af
@@ -647,16 +607,14 @@ func (m *WantIPNeighborEvents) Size() int {
return size
}
func (m *WantIPNeighborEvents) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
- buf.EncodeUint32(uint32(m.PID))
+ buf.EncodeUint32(m.PID)
buf.EncodeUint8(uint8(m.IP.Af))
- buf.EncodeBytes(m.IP.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IP.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -682,27 +640,24 @@ func (*WantIPNeighborEventsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *WantIPNeighborEventsReply) Size() int {
+func (m *WantIPNeighborEventsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *WantIPNeighborEventsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *WantIPNeighborEventsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ip_types/ip_types.ba.go b/binapi/ip_types/ip_types.ba.go
index b9ddb27..9cb2e13 100644
--- a/binapi/ip_types/ip_types.ba.go
+++ b/binapi/ip_types/ip_types.ba.go
@@ -568,11 +568,11 @@ func AddressUnionIP4(a IP4Address) (u AddressUnion) {
return
}
func (u *AddressUnion) SetIP4(a IP4Address) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
buf.EncodeBytes(a[:], 4)
}
func (u *AddressUnion) GetIP4() (a IP4Address) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
copy(a[:], buf.DecodeBytes(4))
return
}
@@ -582,11 +582,11 @@ func AddressUnionIP6(a IP6Address) (u AddressUnion) {
return
}
func (u *AddressUnion) SetIP6(a IP6Address) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
buf.EncodeBytes(a[:], 16)
}
func (u *AddressUnion) GetIP6() (a IP6Address) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
copy(a[:], buf.DecodeBytes(16))
return
}
diff --git a/binapi/ipfix_export/ipfix_export.ba.go b/binapi/ipfix_export/ipfix_export.ba.go
index 7d548f2..e173058 100644
--- a/binapi/ipfix_export/ipfix_export.ba.go
+++ b/binapi/ipfix_export/ipfix_export.ba.go
@@ -42,24 +42,21 @@ func (*IpfixClassifyStreamDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpfixClassifyStreamDetails) Size() int {
+func (m *IpfixClassifyStreamDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.DomainID
size += 2 // m.SrcPort
return size
}
func (m *IpfixClassifyStreamDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.DomainID))
- buf.EncodeUint16(uint16(m.SrcPort))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.DomainID)
+ buf.EncodeUint16(m.SrcPort)
return buf.Bytes(), nil
}
func (m *IpfixClassifyStreamDetails) Unmarshal(b []byte) error {
@@ -79,20 +76,17 @@ func (*IpfixClassifyStreamDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpfixClassifyStreamDump) Size() int {
+func (m *IpfixClassifyStreamDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IpfixClassifyStreamDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IpfixClassifyStreamDump) Unmarshal(b []byte) error {
@@ -114,11 +108,10 @@ func (*IpfixClassifyTableAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpfixClassifyTableAddDel) Size() int {
+func (m *IpfixClassifyTableAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TableID
size += 1 // m.IPVersion
size += 1 // m.TransportProtocol
@@ -126,13 +119,11 @@ func (m *IpfixClassifyTableAddDel) Size() int {
return size
}
func (m *IpfixClassifyTableAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TableID)
buf.EncodeUint8(uint8(m.IPVersion))
buf.EncodeUint8(uint8(m.TransportProtocol))
buf.EncodeBool(m.IsAdd)
@@ -161,27 +152,24 @@ func (*IpfixClassifyTableAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpfixClassifyTableAddDelReply) Size() int {
+func (m *IpfixClassifyTableAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IpfixClassifyTableAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IpfixClassifyTableAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -199,24 +187,21 @@ func (*IpfixClassifyTableDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpfixClassifyTableDetails) Size() int {
+func (m *IpfixClassifyTableDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TableID
size += 1 // m.IPVersion
size += 1 // m.TransportProtocol
return size
}
func (m *IpfixClassifyTableDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TableID)
buf.EncodeUint8(uint8(m.IPVersion))
buf.EncodeUint8(uint8(m.TransportProtocol))
return buf.Bytes(), nil
@@ -239,20 +224,17 @@ func (*IpfixClassifyTableDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpfixClassifyTableDump) Size() int {
+func (m *IpfixClassifyTableDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IpfixClassifyTableDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IpfixClassifyTableDump) Unmarshal(b []byte) error {
@@ -277,11 +259,10 @@ func (*IpfixExporterDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpfixExporterDetails) Size() int {
+func (m *IpfixExporterDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.CollectorAddress.Af
size += 1 * 16 // m.CollectorAddress.Un
size += 2 // m.CollectorPort
@@ -294,20 +275,18 @@ func (m *IpfixExporterDetails) Size() int {
return size
}
func (m *IpfixExporterDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.CollectorAddress.Af))
- buf.EncodeBytes(m.CollectorAddress.Un.XXX_UnionData[:], 0)
- buf.EncodeUint16(uint16(m.CollectorPort))
+ buf.EncodeBytes(m.CollectorAddress.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint16(m.CollectorPort)
buf.EncodeUint8(uint8(m.SrcAddress.Af))
- buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.VrfID))
- buf.EncodeUint32(uint32(m.PathMtu))
- buf.EncodeUint32(uint32(m.TemplateInterval))
+ buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.VrfID)
+ buf.EncodeUint32(m.PathMtu)
+ buf.EncodeUint32(m.TemplateInterval)
buf.EncodeBool(m.UDPChecksum)
return buf.Bytes(), nil
}
@@ -335,20 +314,17 @@ func (*IpfixExporterDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpfixExporterDump) Size() int {
+func (m *IpfixExporterDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IpfixExporterDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IpfixExporterDump) Unmarshal(b []byte) error {
@@ -365,20 +341,17 @@ func (*IpfixFlush) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpfixFlush) Size() int {
+func (m *IpfixFlush) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IpfixFlush) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IpfixFlush) Unmarshal(b []byte) error {
@@ -397,27 +370,24 @@ func (*IpfixFlushReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpfixFlushReply) Size() int {
+func (m *IpfixFlushReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IpfixFlushReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IpfixFlushReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -434,24 +404,21 @@ func (*SetIpfixClassifyStream) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SetIpfixClassifyStream) Size() int {
+func (m *SetIpfixClassifyStream) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.DomainID
size += 2 // m.SrcPort
return size
}
func (m *SetIpfixClassifyStream) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.DomainID))
- buf.EncodeUint16(uint16(m.SrcPort))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.DomainID)
+ buf.EncodeUint16(m.SrcPort)
return buf.Bytes(), nil
}
func (m *SetIpfixClassifyStream) Unmarshal(b []byte) error {
@@ -473,27 +440,24 @@ func (*SetIpfixClassifyStreamReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SetIpfixClassifyStreamReply) Size() int {
+func (m *SetIpfixClassifyStreamReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SetIpfixClassifyStreamReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SetIpfixClassifyStreamReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -515,11 +479,10 @@ func (*SetIpfixExporter) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SetIpfixExporter) Size() int {
+func (m *SetIpfixExporter) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.CollectorAddress.Af
size += 1 * 16 // m.CollectorAddress.Un
size += 2 // m.CollectorPort
@@ -532,20 +495,18 @@ func (m *SetIpfixExporter) Size() int {
return size
}
func (m *SetIpfixExporter) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.CollectorAddress.Af))
- buf.EncodeBytes(m.CollectorAddress.Un.XXX_UnionData[:], 0)
- buf.EncodeUint16(uint16(m.CollectorPort))
+ buf.EncodeBytes(m.CollectorAddress.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint16(m.CollectorPort)
buf.EncodeUint8(uint8(m.SrcAddress.Af))
- buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.VrfID))
- buf.EncodeUint32(uint32(m.PathMtu))
- buf.EncodeUint32(uint32(m.TemplateInterval))
+ buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.VrfID)
+ buf.EncodeUint32(m.PathMtu)
+ buf.EncodeUint32(m.TemplateInterval)
buf.EncodeBool(m.UDPChecksum)
return buf.Bytes(), nil
}
@@ -575,27 +536,24 @@ func (*SetIpfixExporterReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SetIpfixExporterReply) Size() int {
+func (m *SetIpfixExporterReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SetIpfixExporterReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SetIpfixExporterReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ipip/ipip.ba.go b/binapi/ipip/ipip.ba.go
index aab72c2..05821cb 100644
--- a/binapi/ipip/ipip.ba.go
+++ b/binapi/ipip/ipip.ba.go
@@ -62,11 +62,10 @@ func (*Ipip6rdAddTunnel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ipip6rdAddTunnel) Size() int {
+func (m *Ipip6rdAddTunnel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.IP6TableID
size += 4 // m.IP4TableID
size += 1 * 16 // m.IP6Prefix.Address
@@ -79,21 +78,19 @@ func (m *Ipip6rdAddTunnel) Size() int {
return size
}
func (m *Ipip6rdAddTunnel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.IP6TableID))
- buf.EncodeUint32(uint32(m.IP4TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.IP6TableID)
+ buf.EncodeUint32(m.IP4TableID)
buf.EncodeBytes(m.IP6Prefix.Address[:], 16)
- buf.EncodeUint8(uint8(m.IP6Prefix.Len))
+ buf.EncodeUint8(m.IP6Prefix.Len)
buf.EncodeBytes(m.IP4Prefix.Address[:], 4)
- buf.EncodeUint8(uint8(m.IP4Prefix.Len))
+ buf.EncodeUint8(m.IP4Prefix.Len)
buf.EncodeBytes(m.IP4Src[:], 4)
buf.EncodeBool(m.SecurityCheck)
- buf.EncodeUint8(uint8(m.TcTos))
+ buf.EncodeUint8(m.TcTos)
return buf.Bytes(), nil
}
func (m *Ipip6rdAddTunnel) Unmarshal(b []byte) error {
@@ -123,29 +120,26 @@ func (*Ipip6rdAddTunnelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ipip6rdAddTunnelReply) Size() int {
+func (m *Ipip6rdAddTunnelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *Ipip6rdAddTunnelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *Ipip6rdAddTunnelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -162,21 +156,18 @@ func (*Ipip6rdDelTunnel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Ipip6rdDelTunnel) Size() int {
+func (m *Ipip6rdDelTunnel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *Ipip6rdDelTunnel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -198,27 +189,24 @@ func (*Ipip6rdDelTunnelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Ipip6rdDelTunnelReply) Size() int {
+func (m *Ipip6rdDelTunnelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Ipip6rdDelTunnelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Ipip6rdDelTunnelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -234,11 +222,10 @@ func (*IpipAddTunnel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpipAddTunnel) Size() int {
+func (m *IpipAddTunnel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Tunnel.Instance
size += 1 // m.Tunnel.Src.Af
size += 1 * 16 // m.Tunnel.Src.Un
@@ -252,19 +239,17 @@ func (m *IpipAddTunnel) Size() int {
return size
}
func (m *IpipAddTunnel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Tunnel.Instance))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Tunnel.Instance)
buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
- buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
- buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
- buf.EncodeUint32(uint32(m.Tunnel.TableID))
+ buf.EncodeUint32(m.Tunnel.TableID)
buf.EncodeUint8(uint8(m.Tunnel.Flags))
buf.EncodeUint8(uint8(m.Tunnel.Mode))
buf.EncodeUint8(uint8(m.Tunnel.Dscp))
@@ -298,29 +283,26 @@ func (*IpipAddTunnelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpipAddTunnelReply) Size() int {
+func (m *IpipAddTunnelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *IpipAddTunnelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *IpipAddTunnelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -337,21 +319,18 @@ func (*IpipDelTunnel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpipDelTunnel) Size() int {
+func (m *IpipDelTunnel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *IpipDelTunnel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -373,27 +352,24 @@ func (*IpipDelTunnelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpipDelTunnelReply) Size() int {
+func (m *IpipDelTunnelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IpipDelTunnelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IpipDelTunnelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -409,11 +385,10 @@ func (*IpipTunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpipTunnelDetails) Size() int {
+func (m *IpipTunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Tunnel.Instance
size += 1 // m.Tunnel.Src.Af
size += 1 * 16 // m.Tunnel.Src.Un
@@ -427,19 +402,17 @@ func (m *IpipTunnelDetails) Size() int {
return size
}
func (m *IpipTunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Tunnel.Instance))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Tunnel.Instance)
buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
- buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
- buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
- buf.EncodeUint32(uint32(m.Tunnel.TableID))
+ buf.EncodeUint32(m.Tunnel.TableID)
buf.EncodeUint8(uint8(m.Tunnel.Flags))
buf.EncodeUint8(uint8(m.Tunnel.Mode))
buf.EncodeUint8(uint8(m.Tunnel.Dscp))
@@ -472,21 +445,18 @@ func (*IpipTunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpipTunnelDump) Size() int {
+func (m *IpipTunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *IpipTunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
diff --git a/binapi/ipsec/ipsec.ba.go b/binapi/ipsec/ipsec.ba.go
index 564c457..6a6abde 100644
--- a/binapi/ipsec/ipsec.ba.go
+++ b/binapi/ipsec/ipsec.ba.go
@@ -109,11 +109,10 @@ func (*IpsecBackendDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecBackendDetails) Size() int {
+func (m *IpsecBackendDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 128 // m.Name
size += 4 // m.Protocol
size += 1 // m.Index
@@ -121,15 +120,13 @@ func (m *IpsecBackendDetails) Size() int {
return size
}
func (m *IpsecBackendDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 128)
buf.EncodeUint32(uint32(m.Protocol))
- buf.EncodeUint8(uint8(m.Index))
+ buf.EncodeUint8(m.Index)
buf.EncodeBool(m.Active)
return buf.Bytes(), nil
}
@@ -152,20 +149,17 @@ func (*IpsecBackendDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecBackendDump) Size() int {
+func (m *IpsecBackendDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IpsecBackendDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IpsecBackendDump) Unmarshal(b []byte) error {
@@ -186,26 +180,23 @@ func (*IpsecInterfaceAddDelSpd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecInterfaceAddDelSpd) Size() int {
+func (m *IpsecInterfaceAddDelSpd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SwIfIndex
size += 4 // m.SpdID
return size
}
func (m *IpsecInterfaceAddDelSpd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.SpdID))
+ buf.EncodeUint32(m.SpdID)
return buf.Bytes(), nil
}
func (m *IpsecInterfaceAddDelSpd) Unmarshal(b []byte) error {
@@ -230,27 +221,24 @@ func (*IpsecInterfaceAddDelSpdReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecInterfaceAddDelSpdReply) Size() int {
+func (m *IpsecInterfaceAddDelSpdReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IpsecInterfaceAddDelSpdReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IpsecInterfaceAddDelSpdReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -272,11 +260,10 @@ func (*IpsecSaDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecSaDetails) Size() int {
+func (m *IpsecSaDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Entry.SadID
size += 4 // m.Entry.Spi
size += 4 // m.Entry.Protocol
@@ -304,36 +291,34 @@ func (m *IpsecSaDetails) Size() int {
return size
}
func (m *IpsecSaDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Entry.SadID))
- buf.EncodeUint32(uint32(m.Entry.Spi))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Entry.SadID)
+ buf.EncodeUint32(m.Entry.Spi)
buf.EncodeUint32(uint32(m.Entry.Protocol))
buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm))
- buf.EncodeUint8(uint8(m.Entry.CryptoKey.Length))
- buf.EncodeBytes(m.Entry.CryptoKey.Data[:], 128)
+ buf.EncodeUint8(m.Entry.CryptoKey.Length)
+ buf.EncodeBytes(m.Entry.CryptoKey.Data, 128)
buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm))
- buf.EncodeUint8(uint8(m.Entry.IntegrityKey.Length))
- buf.EncodeBytes(m.Entry.IntegrityKey.Data[:], 128)
+ buf.EncodeUint8(m.Entry.IntegrityKey.Length)
+ buf.EncodeBytes(m.Entry.IntegrityKey.Data, 128)
buf.EncodeUint32(uint32(m.Entry.Flags))
buf.EncodeUint8(uint8(m.Entry.TunnelSrc.Af))
- buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.TunnelDst.Af))
- buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Entry.TxTableID))
- buf.EncodeUint32(uint32(m.Entry.Salt))
- buf.EncodeUint16(uint16(m.Entry.UDPSrcPort))
- buf.EncodeUint16(uint16(m.Entry.UDPDstPort))
+ buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.Entry.TxTableID)
+ buf.EncodeUint32(m.Entry.Salt)
+ buf.EncodeUint16(m.Entry.UDPSrcPort)
+ buf.EncodeUint16(m.Entry.UDPDstPort)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.Salt))
- buf.EncodeUint64(uint64(m.SeqOutbound))
- buf.EncodeUint64(uint64(m.LastSeqInbound))
- buf.EncodeUint64(uint64(m.ReplayWindow))
- buf.EncodeUint32(uint32(m.StatIndex))
+ buf.EncodeUint32(m.Salt)
+ buf.EncodeUint64(m.SeqOutbound)
+ buf.EncodeUint64(m.LastSeqInbound)
+ buf.EncodeUint64(m.ReplayWindow)
+ buf.EncodeUint32(m.StatIndex)
return buf.Bytes(), nil
}
func (m *IpsecSaDetails) Unmarshal(b []byte) error {
@@ -343,10 +328,12 @@ func (m *IpsecSaDetails) Unmarshal(b []byte) error {
m.Entry.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32())
m.Entry.CryptoAlgorithm = ipsec_types.IpsecCryptoAlg(buf.DecodeUint32())
m.Entry.CryptoKey.Length = buf.DecodeUint8()
- copy(m.Entry.CryptoKey.Data[:], buf.DecodeBytes(128))
+ m.Entry.CryptoKey.Data = make([]byte, 128)
+ copy(m.Entry.CryptoKey.Data, buf.DecodeBytes(len(m.Entry.CryptoKey.Data)))
m.Entry.IntegrityAlgorithm = ipsec_types.IpsecIntegAlg(buf.DecodeUint32())
m.Entry.IntegrityKey.Length = buf.DecodeUint8()
- copy(m.Entry.IntegrityKey.Data[:], buf.DecodeBytes(128))
+ m.Entry.IntegrityKey.Data = make([]byte, 128)
+ copy(m.Entry.IntegrityKey.Data, buf.DecodeBytes(len(m.Entry.IntegrityKey.Data)))
m.Entry.Flags = ipsec_types.IpsecSadFlags(buf.DecodeUint32())
m.Entry.TunnelSrc.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Entry.TunnelSrc.Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -377,22 +364,19 @@ func (*IpsecSaDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecSaDump) Size() int {
+func (m *IpsecSaDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SaID
return size
}
func (m *IpsecSaDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SaID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SaID)
return buf.Bytes(), nil
}
func (m *IpsecSaDump) Unmarshal(b []byte) error {
@@ -414,11 +398,10 @@ func (*IpsecSadEntryAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecSadEntryAddDel) Size() int {
+func (m *IpsecSadEntryAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Entry.SadID
size += 4 // m.Entry.Spi
@@ -441,31 +424,29 @@ func (m *IpsecSadEntryAddDel) Size() int {
return size
}
func (m *IpsecSadEntryAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Entry.SadID))
- buf.EncodeUint32(uint32(m.Entry.Spi))
+ buf.EncodeUint32(m.Entry.SadID)
+ buf.EncodeUint32(m.Entry.Spi)
buf.EncodeUint32(uint32(m.Entry.Protocol))
buf.EncodeUint32(uint32(m.Entry.CryptoAlgorithm))
- buf.EncodeUint8(uint8(m.Entry.CryptoKey.Length))
- buf.EncodeBytes(m.Entry.CryptoKey.Data[:], 128)
+ buf.EncodeUint8(m.Entry.CryptoKey.Length)
+ buf.EncodeBytes(m.Entry.CryptoKey.Data, 128)
buf.EncodeUint32(uint32(m.Entry.IntegrityAlgorithm))
- buf.EncodeUint8(uint8(m.Entry.IntegrityKey.Length))
- buf.EncodeBytes(m.Entry.IntegrityKey.Data[:], 128)
+ buf.EncodeUint8(m.Entry.IntegrityKey.Length)
+ buf.EncodeBytes(m.Entry.IntegrityKey.Data, 128)
buf.EncodeUint32(uint32(m.Entry.Flags))
buf.EncodeUint8(uint8(m.Entry.TunnelSrc.Af))
- buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.TunnelSrc.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.TunnelDst.Af))
- buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Entry.TxTableID))
- buf.EncodeUint32(uint32(m.Entry.Salt))
- buf.EncodeUint16(uint16(m.Entry.UDPSrcPort))
- buf.EncodeUint16(uint16(m.Entry.UDPDstPort))
+ buf.EncodeBytes(m.Entry.TunnelDst.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.Entry.TxTableID)
+ buf.EncodeUint32(m.Entry.Salt)
+ buf.EncodeUint16(m.Entry.UDPSrcPort)
+ buf.EncodeUint16(m.Entry.UDPDstPort)
return buf.Bytes(), nil
}
func (m *IpsecSadEntryAddDel) Unmarshal(b []byte) error {
@@ -476,10 +457,12 @@ func (m *IpsecSadEntryAddDel) Unmarshal(b []byte) error {
m.Entry.Protocol = ipsec_types.IpsecProto(buf.DecodeUint32())
m.Entry.CryptoAlgorithm = ipsec_types.IpsecCryptoAlg(buf.DecodeUint32())
m.Entry.CryptoKey.Length = buf.DecodeUint8()
- copy(m.Entry.CryptoKey.Data[:], buf.DecodeBytes(128))
+ m.Entry.CryptoKey.Data = make([]byte, 128)
+ copy(m.Entry.CryptoKey.Data, buf.DecodeBytes(len(m.Entry.CryptoKey.Data)))
m.Entry.IntegrityAlgorithm = ipsec_types.IpsecIntegAlg(buf.DecodeUint32())
m.Entry.IntegrityKey.Length = buf.DecodeUint8()
- copy(m.Entry.IntegrityKey.Data[:], buf.DecodeBytes(128))
+ m.Entry.IntegrityKey.Data = make([]byte, 128)
+ copy(m.Entry.IntegrityKey.Data, buf.DecodeBytes(len(m.Entry.IntegrityKey.Data)))
m.Entry.Flags = ipsec_types.IpsecSadFlags(buf.DecodeUint32())
m.Entry.TunnelSrc.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Entry.TunnelSrc.Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -505,29 +488,26 @@ func (*IpsecSadEntryAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecSadEntryAddDelReply) Size() int {
+func (m *IpsecSadEntryAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.StatIndex
return size
}
func (m *IpsecSadEntryAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.StatIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.StatIndex)
return buf.Bytes(), nil
}
func (m *IpsecSadEntryAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.StatIndex = buf.DecodeUint32()
return nil
}
@@ -545,24 +525,21 @@ func (*IpsecSelectBackend) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecSelectBackend) Size() int {
+func (m *IpsecSelectBackend) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Protocol
size += 1 // m.Index
return size
}
func (m *IpsecSelectBackend) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Protocol))
- buf.EncodeUint8(uint8(m.Index))
+ buf.EncodeUint8(m.Index)
return buf.Bytes(), nil
}
func (m *IpsecSelectBackend) Unmarshal(b []byte) error {
@@ -584,27 +561,24 @@ func (*IpsecSelectBackendReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecSelectBackendReply) Size() int {
+func (m *IpsecSelectBackendReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IpsecSelectBackendReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IpsecSelectBackendReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -621,24 +595,21 @@ func (*IpsecSpdAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecSpdAddDel) Size() int {
+func (m *IpsecSpdAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SpdID
return size
}
func (m *IpsecSpdAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.SpdID))
+ buf.EncodeUint32(m.SpdID)
return buf.Bytes(), nil
}
func (m *IpsecSpdAddDel) Unmarshal(b []byte) error {
@@ -660,27 +631,24 @@ func (*IpsecSpdAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecSpdAddDelReply) Size() int {
+func (m *IpsecSpdAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IpsecSpdAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IpsecSpdAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -696,11 +664,10 @@ func (*IpsecSpdDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecSpdDetails) Size() int {
+func (m *IpsecSpdDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Entry.SpdID
size += 4 // m.Entry.Priority
size += 1 // m.Entry.IsOutbound
@@ -722,36 +689,34 @@ func (m *IpsecSpdDetails) Size() int {
return size
}
func (m *IpsecSpdDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Entry.SpdID))
- buf.EncodeUint32(uint32(m.Entry.Priority))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Entry.SpdID)
+ buf.EncodeInt32(m.Entry.Priority)
buf.EncodeBool(m.Entry.IsOutbound)
- buf.EncodeUint32(uint32(m.Entry.SaID))
+ buf.EncodeUint32(m.Entry.SaID)
buf.EncodeUint32(uint32(m.Entry.Policy))
- buf.EncodeUint8(uint8(m.Entry.Protocol))
+ buf.EncodeUint8(m.Entry.Protocol)
buf.EncodeUint8(uint8(m.Entry.RemoteAddressStart.Af))
- buf.EncodeBytes(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.RemoteAddressStop.Af))
- buf.EncodeBytes(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.LocalAddressStart.Af))
- buf.EncodeBytes(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.LocalAddressStop.Af))
- buf.EncodeBytes(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], 0)
- buf.EncodeUint16(uint16(m.Entry.RemotePortStart))
- buf.EncodeUint16(uint16(m.Entry.RemotePortStop))
- buf.EncodeUint16(uint16(m.Entry.LocalPortStart))
- buf.EncodeUint16(uint16(m.Entry.LocalPortStop))
+ buf.EncodeBytes(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint16(m.Entry.RemotePortStart)
+ buf.EncodeUint16(m.Entry.RemotePortStop)
+ buf.EncodeUint16(m.Entry.LocalPortStart)
+ buf.EncodeUint16(m.Entry.LocalPortStop)
return buf.Bytes(), nil
}
func (m *IpsecSpdDetails) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Entry.SpdID = buf.DecodeUint32()
- m.Entry.Priority = int32(buf.DecodeUint32())
+ m.Entry.Priority = buf.DecodeInt32()
m.Entry.IsOutbound = buf.DecodeBool()
m.Entry.SaID = buf.DecodeUint32()
m.Entry.Policy = IpsecSpdAction(buf.DecodeUint32())
@@ -784,24 +749,21 @@ func (*IpsecSpdDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecSpdDump) Size() int {
+func (m *IpsecSpdDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SpdID
size += 4 // m.SaID
return size
}
func (m *IpsecSpdDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SpdID))
- buf.EncodeUint32(uint32(m.SaID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SpdID)
+ buf.EncodeUint32(m.SaID)
return buf.Bytes(), nil
}
func (m *IpsecSpdDump) Unmarshal(b []byte) error {
@@ -824,11 +786,10 @@ func (*IpsecSpdEntryAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecSpdEntryAddDel) Size() int {
+func (m *IpsecSpdEntryAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Entry.SpdID
size += 4 // m.Entry.Priority
@@ -851,38 +812,36 @@ func (m *IpsecSpdEntryAddDel) Size() int {
return size
}
func (m *IpsecSpdEntryAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Entry.SpdID))
- buf.EncodeUint32(uint32(m.Entry.Priority))
+ buf.EncodeUint32(m.Entry.SpdID)
+ buf.EncodeInt32(m.Entry.Priority)
buf.EncodeBool(m.Entry.IsOutbound)
- buf.EncodeUint32(uint32(m.Entry.SaID))
+ buf.EncodeUint32(m.Entry.SaID)
buf.EncodeUint32(uint32(m.Entry.Policy))
- buf.EncodeUint8(uint8(m.Entry.Protocol))
+ buf.EncodeUint8(m.Entry.Protocol)
buf.EncodeUint8(uint8(m.Entry.RemoteAddressStart.Af))
- buf.EncodeBytes(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.RemoteAddressStart.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.RemoteAddressStop.Af))
- buf.EncodeBytes(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.RemoteAddressStop.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.LocalAddressStart.Af))
- buf.EncodeBytes(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.LocalAddressStart.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.LocalAddressStop.Af))
- buf.EncodeBytes(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], 0)
- buf.EncodeUint16(uint16(m.Entry.RemotePortStart))
- buf.EncodeUint16(uint16(m.Entry.RemotePortStop))
- buf.EncodeUint16(uint16(m.Entry.LocalPortStart))
- buf.EncodeUint16(uint16(m.Entry.LocalPortStop))
+ buf.EncodeBytes(m.Entry.LocalAddressStop.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint16(m.Entry.RemotePortStart)
+ buf.EncodeUint16(m.Entry.RemotePortStop)
+ buf.EncodeUint16(m.Entry.LocalPortStart)
+ buf.EncodeUint16(m.Entry.LocalPortStop)
return buf.Bytes(), nil
}
func (m *IpsecSpdEntryAddDel) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.IsAdd = buf.DecodeBool()
m.Entry.SpdID = buf.DecodeUint32()
- m.Entry.Priority = int32(buf.DecodeUint32())
+ m.Entry.Priority = buf.DecodeInt32()
m.Entry.IsOutbound = buf.DecodeBool()
m.Entry.SaID = buf.DecodeUint32()
m.Entry.Policy = IpsecSpdAction(buf.DecodeUint32())
@@ -915,29 +874,26 @@ func (*IpsecSpdEntryAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecSpdEntryAddDelReply) Size() int {
+func (m *IpsecSpdEntryAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.StatIndex
return size
}
func (m *IpsecSpdEntryAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.StatIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.StatIndex)
return buf.Bytes(), nil
}
func (m *IpsecSpdEntryAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.StatIndex = buf.DecodeUint32()
return nil
}
@@ -955,23 +911,20 @@ func (*IpsecSpdInterfaceDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecSpdInterfaceDetails) Size() int {
+func (m *IpsecSpdInterfaceDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SpdIndex
size += 4 // m.SwIfIndex
return size
}
func (m *IpsecSpdInterfaceDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SpdIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SpdIndex)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -995,24 +948,21 @@ func (*IpsecSpdInterfaceDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecSpdInterfaceDump) Size() int {
+func (m *IpsecSpdInterfaceDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SpdIndex
size += 1 // m.SpdIndexValid
return size
}
func (m *IpsecSpdInterfaceDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SpdIndex))
- buf.EncodeUint8(uint8(m.SpdIndexValid))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SpdIndex)
+ buf.EncodeUint8(m.SpdIndexValid)
return buf.Bytes(), nil
}
func (m *IpsecSpdInterfaceDump) Unmarshal(b []byte) error {
@@ -1035,24 +985,21 @@ func (*IpsecSpdsDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecSpdsDetails) Size() int {
+func (m *IpsecSpdsDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SpdID
size += 4 // m.Npolicies
return size
}
func (m *IpsecSpdsDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SpdID))
- buf.EncodeUint32(uint32(m.Npolicies))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SpdID)
+ buf.EncodeUint32(m.Npolicies)
return buf.Bytes(), nil
}
func (m *IpsecSpdsDetails) Unmarshal(b []byte) error {
@@ -1072,20 +1019,17 @@ func (*IpsecSpdsDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecSpdsDump) Size() int {
+func (m *IpsecSpdsDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *IpsecSpdsDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *IpsecSpdsDump) Unmarshal(b []byte) error {
@@ -1125,11 +1069,10 @@ func (*IpsecTunnelIfAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecTunnelIfAddDel) Size() int {
+func (m *IpsecTunnelIfAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Esn
size += 1 // m.AntiReplay
@@ -1157,36 +1100,34 @@ func (m *IpsecTunnelIfAddDel) Size() int {
return size
}
func (m *IpsecTunnelIfAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.Esn)
buf.EncodeBool(m.AntiReplay)
buf.EncodeUint8(uint8(m.LocalIP.Af))
- buf.EncodeBytes(m.LocalIP.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LocalIP.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.RemoteIP.Af))
- buf.EncodeBytes(m.RemoteIP.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.LocalSpi))
- buf.EncodeUint32(uint32(m.RemoteSpi))
- buf.EncodeUint8(uint8(m.CryptoAlg))
- buf.EncodeUint8(uint8(m.LocalCryptoKeyLen))
- buf.EncodeBytes(m.LocalCryptoKey[:], 128)
- buf.EncodeUint8(uint8(m.RemoteCryptoKeyLen))
- buf.EncodeBytes(m.RemoteCryptoKey[:], 128)
- buf.EncodeUint8(uint8(m.IntegAlg))
- buf.EncodeUint8(uint8(m.LocalIntegKeyLen))
- buf.EncodeBytes(m.LocalIntegKey[:], 128)
- buf.EncodeUint8(uint8(m.RemoteIntegKeyLen))
- buf.EncodeBytes(m.RemoteIntegKey[:], 128)
+ buf.EncodeBytes(m.RemoteIP.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.LocalSpi)
+ buf.EncodeUint32(m.RemoteSpi)
+ buf.EncodeUint8(m.CryptoAlg)
+ buf.EncodeUint8(m.LocalCryptoKeyLen)
+ buf.EncodeBytes(m.LocalCryptoKey, 128)
+ buf.EncodeUint8(m.RemoteCryptoKeyLen)
+ buf.EncodeBytes(m.RemoteCryptoKey, 128)
+ buf.EncodeUint8(m.IntegAlg)
+ buf.EncodeUint8(m.LocalIntegKeyLen)
+ buf.EncodeBytes(m.LocalIntegKey, 128)
+ buf.EncodeUint8(m.RemoteIntegKeyLen)
+ buf.EncodeBytes(m.RemoteIntegKey, 128)
buf.EncodeBool(m.Renumber)
- buf.EncodeUint32(uint32(m.ShowInstance))
+ buf.EncodeUint32(m.ShowInstance)
buf.EncodeBool(m.UDPEncap)
- buf.EncodeUint32(uint32(m.TxTableID))
- buf.EncodeUint32(uint32(m.Salt))
+ buf.EncodeUint32(m.TxTableID)
+ buf.EncodeUint32(m.Salt)
return buf.Bytes(), nil
}
func (m *IpsecTunnelIfAddDel) Unmarshal(b []byte) error {
@@ -1202,14 +1143,18 @@ func (m *IpsecTunnelIfAddDel) Unmarshal(b []byte) error {
m.RemoteSpi = buf.DecodeUint32()
m.CryptoAlg = buf.DecodeUint8()
m.LocalCryptoKeyLen = buf.DecodeUint8()
- copy(m.LocalCryptoKey[:], buf.DecodeBytes(128))
+ m.LocalCryptoKey = make([]byte, 128)
+ copy(m.LocalCryptoKey, buf.DecodeBytes(len(m.LocalCryptoKey)))
m.RemoteCryptoKeyLen = buf.DecodeUint8()
- copy(m.RemoteCryptoKey[:], buf.DecodeBytes(128))
+ m.RemoteCryptoKey = make([]byte, 128)
+ copy(m.RemoteCryptoKey, buf.DecodeBytes(len(m.RemoteCryptoKey)))
m.IntegAlg = buf.DecodeUint8()
m.LocalIntegKeyLen = buf.DecodeUint8()
- copy(m.LocalIntegKey[:], buf.DecodeBytes(128))
+ m.LocalIntegKey = make([]byte, 128)
+ copy(m.LocalIntegKey, buf.DecodeBytes(len(m.LocalIntegKey)))
m.RemoteIntegKeyLen = buf.DecodeUint8()
- copy(m.RemoteIntegKey[:], buf.DecodeBytes(128))
+ m.RemoteIntegKey = make([]byte, 128)
+ copy(m.RemoteIntegKey, buf.DecodeBytes(len(m.RemoteIntegKey)))
m.Renumber = buf.DecodeBool()
m.ShowInstance = buf.DecodeUint32()
m.UDPEncap = buf.DecodeBool()
@@ -1231,29 +1176,26 @@ func (*IpsecTunnelIfAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecTunnelIfAddDelReply) Size() int {
+func (m *IpsecTunnelIfAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *IpsecTunnelIfAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *IpsecTunnelIfAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -1272,26 +1214,23 @@ func (*IpsecTunnelIfSetSa) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecTunnelIfSetSa) Size() int {
+func (m *IpsecTunnelIfSetSa) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.SaID
size += 1 // m.IsOutbound
return size
}
func (m *IpsecTunnelIfSetSa) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.SaID))
- buf.EncodeUint8(uint8(m.IsOutbound))
+ buf.EncodeUint32(m.SaID)
+ buf.EncodeUint8(m.IsOutbound)
return buf.Bytes(), nil
}
func (m *IpsecTunnelIfSetSa) Unmarshal(b []byte) error {
@@ -1314,27 +1253,24 @@ func (*IpsecTunnelIfSetSaReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecTunnelIfSetSaReply) Size() int {
+func (m *IpsecTunnelIfSetSaReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IpsecTunnelIfSetSaReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IpsecTunnelIfSetSaReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1351,26 +1287,23 @@ func (*IpsecTunnelProtectDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecTunnelProtectDel) Size() int {
+func (m *IpsecTunnelProtectDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Nh.Af
size += 1 * 16 // m.Nh.Un
return size
}
func (m *IpsecTunnelProtectDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.Nh.Af))
- buf.EncodeBytes(m.Nh.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Nh.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *IpsecTunnelProtectDel) Unmarshal(b []byte) error {
@@ -1393,27 +1326,24 @@ func (*IpsecTunnelProtectDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecTunnelProtectDelReply) Size() int {
+func (m *IpsecTunnelProtectDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IpsecTunnelProtectDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IpsecTunnelProtectDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1429,11 +1359,10 @@ func (*IpsecTunnelProtectDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecTunnelProtectDetails) Size() int {
+func (m *IpsecTunnelProtectDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Tun.SwIfIndex
size += 1 // m.Tun.Nh.Af
size += 1 * 16 // m.Tun.Nh.Un
@@ -1443,23 +1372,21 @@ func (m *IpsecTunnelProtectDetails) Size() int {
return size
}
func (m *IpsecTunnelProtectDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Tun.SwIfIndex))
buf.EncodeUint8(uint8(m.Tun.Nh.Af))
- buf.EncodeBytes(m.Tun.Nh.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Tun.SaOut))
+ buf.EncodeBytes(m.Tun.Nh.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.Tun.SaOut)
buf.EncodeUint8(uint8(len(m.Tun.SaIn)))
for i := 0; i < len(m.Tun.SaIn); i++ {
var x uint32
if i < len(m.Tun.SaIn) {
x = uint32(m.Tun.SaIn[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
@@ -1489,21 +1416,18 @@ func (*IpsecTunnelProtectDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecTunnelProtectDump) Size() int {
+func (m *IpsecTunnelProtectDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *IpsecTunnelProtectDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -1525,11 +1449,10 @@ func (*IpsecTunnelProtectUpdate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IpsecTunnelProtectUpdate) Size() int {
+func (m *IpsecTunnelProtectUpdate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Tunnel.SwIfIndex
size += 1 // m.Tunnel.Nh.Af
size += 1 * 16 // m.Tunnel.Nh.Un
@@ -1539,23 +1462,21 @@ func (m *IpsecTunnelProtectUpdate) Size() int {
return size
}
func (m *IpsecTunnelProtectUpdate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
buf.EncodeUint8(uint8(m.Tunnel.Nh.Af))
- buf.EncodeBytes(m.Tunnel.Nh.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Tunnel.SaOut))
+ buf.EncodeBytes(m.Tunnel.Nh.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.Tunnel.SaOut)
buf.EncodeUint8(uint8(len(m.Tunnel.SaIn)))
for i := 0; i < len(m.Tunnel.SaIn); i++ {
var x uint32
if i < len(m.Tunnel.SaIn) {
x = uint32(m.Tunnel.SaIn[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
@@ -1587,27 +1508,24 @@ func (*IpsecTunnelProtectUpdateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IpsecTunnelProtectUpdateReply) Size() int {
+func (m *IpsecTunnelProtectUpdateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IpsecTunnelProtectUpdateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IpsecTunnelProtectUpdateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/ipsec_types/ipsec_types.ba.go b/binapi/ipsec_types/ipsec_types.ba.go
index c1d80aa..149c35f 100644
--- a/binapi/ipsec_types/ipsec_types.ba.go
+++ b/binapi/ipsec_types/ipsec_types.ba.go
@@ -225,8 +225,8 @@ type IpsecSadEntry struct {
TunnelDst ip_types.Address `binapi:"address,name=tunnel_dst" json:"tunnel_dst,omitempty"`
TxTableID uint32 `binapi:"u32,name=tx_table_id" json:"tx_table_id,omitempty"`
Salt uint32 `binapi:"u32,name=salt" json:"salt,omitempty"`
- UDPSrcPort uint16 `binapi:"u16,name=udp_src_port,default=%!s(float64=4500)" json:"udp_src_port,omitempty"`
- UDPDstPort uint16 `binapi:"u16,name=udp_dst_port,default=%!s(float64=4500)" json:"udp_dst_port,omitempty"`
+ UDPSrcPort uint16 `binapi:"u16,name=udp_src_port,default=4500" json:"udp_src_port,omitempty"`
+ UDPDstPort uint16 `binapi:"u16,name=udp_dst_port,default=4500" json:"udp_dst_port,omitempty"`
}
// Key defines type 'key'.
diff --git a/binapi/l2/l2.ba.go b/binapi/l2/l2.ba.go
index 0eb75f2..7413635 100644
--- a/binapi/l2/l2.ba.go
+++ b/binapi/l2/l2.ba.go
@@ -190,11 +190,10 @@ func (*BdIPMacAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BdIPMacAddDel) Size() int {
+func (m *BdIPMacAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Entry.BdID
size += 1 // m.Entry.IP.Af
@@ -203,16 +202,14 @@ func (m *BdIPMacAddDel) Size() int {
return size
}
func (m *BdIPMacAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Entry.BdID))
+ buf.EncodeUint32(m.Entry.BdID)
buf.EncodeUint8(uint8(m.Entry.IP.Af))
- buf.EncodeBytes(m.Entry.IP.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.IP.Un.XXX_UnionData[:], 16)
buf.EncodeBytes(m.Entry.Mac[:], 6)
return buf.Bytes(), nil
}
@@ -238,27 +235,24 @@ func (*BdIPMacAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BdIPMacAddDelReply) Size() int {
+func (m *BdIPMacAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BdIPMacAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BdIPMacAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -274,11 +268,10 @@ func (*BdIPMacDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BdIPMacDetails) Size() int {
+func (m *BdIPMacDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Entry.BdID
size += 1 // m.Entry.IP.Af
size += 1 * 16 // m.Entry.IP.Un
@@ -286,15 +279,13 @@ func (m *BdIPMacDetails) Size() int {
return size
}
func (m *BdIPMacDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Entry.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Entry.BdID)
buf.EncodeUint8(uint8(m.Entry.IP.Af))
- buf.EncodeBytes(m.Entry.IP.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.IP.Un.XXX_UnionData[:], 16)
buf.EncodeBytes(m.Entry.Mac[:], 6)
return buf.Bytes(), nil
}
@@ -319,22 +310,19 @@ func (*BdIPMacDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BdIPMacDump) Size() int {
+func (m *BdIPMacDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
return size
}
func (m *BdIPMacDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
return buf.Bytes(), nil
}
func (m *BdIPMacDump) Unmarshal(b []byte) error {
@@ -355,22 +343,19 @@ func (*BdIPMacFlush) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BdIPMacFlush) Size() int {
+func (m *BdIPMacFlush) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
return size
}
func (m *BdIPMacFlush) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
return buf.Bytes(), nil
}
func (m *BdIPMacFlush) Unmarshal(b []byte) error {
@@ -391,27 +376,24 @@ func (*BdIPMacFlushReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BdIPMacFlushReply) Size() int {
+func (m *BdIPMacFlushReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BdIPMacFlushReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BdIPMacFlushReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -436,11 +418,10 @@ func (*BridgeDomainAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BridgeDomainAddDel) Size() int {
+func (m *BridgeDomainAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
size += 1 // m.Flood
size += 1 // m.UuFlood
@@ -454,20 +435,18 @@ func (m *BridgeDomainAddDel) Size() int {
return size
}
func (m *BridgeDomainAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
buf.EncodeBool(m.Flood)
buf.EncodeBool(m.UuFlood)
buf.EncodeBool(m.Forward)
buf.EncodeBool(m.Learn)
buf.EncodeBool(m.ArpTerm)
buf.EncodeBool(m.ArpUfwd)
- buf.EncodeUint8(uint8(m.MacAge))
+ buf.EncodeUint8(m.MacAge)
buf.EncodeString(m.BdTag, 64)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
@@ -499,27 +478,24 @@ func (*BridgeDomainAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BridgeDomainAddDelReply) Size() int {
+func (m *BridgeDomainAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BridgeDomainAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BridgeDomainAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -547,11 +523,10 @@ func (*BridgeDomainDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BridgeDomainDetails) Size() int {
+func (m *BridgeDomainDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
size += 1 // m.Flood
size += 1 // m.UuFlood
@@ -577,32 +552,30 @@ func (m *BridgeDomainDetails) Size() int {
return size
}
func (m *BridgeDomainDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
buf.EncodeBool(m.Flood)
buf.EncodeBool(m.UuFlood)
buf.EncodeBool(m.Forward)
buf.EncodeBool(m.Learn)
buf.EncodeBool(m.ArpTerm)
buf.EncodeBool(m.ArpUfwd)
- buf.EncodeUint8(uint8(m.MacAge))
+ buf.EncodeUint8(m.MacAge)
buf.EncodeString(m.BdTag, 64)
buf.EncodeUint32(uint32(m.BviSwIfIndex))
buf.EncodeUint32(uint32(m.UuFwdSwIfIndex))
buf.EncodeUint32(uint32(len(m.SwIfDetails)))
for j0 := 0; j0 < len(m.SwIfDetails); j0++ {
- var v0 BridgeDomainSwIf
+ var v0 BridgeDomainSwIf // SwIfDetails
if j0 < len(m.SwIfDetails) {
v0 = m.SwIfDetails[j0]
}
- buf.EncodeUint32(uint32(v0.Context))
+ buf.EncodeUint32(v0.Context)
buf.EncodeUint32(uint32(v0.SwIfIndex))
- buf.EncodeUint8(uint8(v0.Shg))
+ buf.EncodeUint8(v0.Shg)
}
return buf.Bytes(), nil
}
@@ -620,7 +593,7 @@ func (m *BridgeDomainDetails) Unmarshal(b []byte) error {
m.BviSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.UuFwdSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.NSwIfs = buf.DecodeUint32()
- m.SwIfDetails = make([]BridgeDomainSwIf, int(m.NSwIfs))
+ m.SwIfDetails = make([]BridgeDomainSwIf, m.NSwIfs)
for j0 := 0; j0 < len(m.SwIfDetails); j0++ {
m.SwIfDetails[j0].Context = buf.DecodeUint32()
m.SwIfDetails[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
@@ -631,8 +604,8 @@ func (m *BridgeDomainDetails) Unmarshal(b []byte) error {
// BridgeDomainDump defines message 'bridge_domain_dump'.
type BridgeDomainDump struct {
- BdID uint32 `binapi:"u32,name=bd_id,default=%!s(float64=4.294967295e+09)" json:"bd_id,omitempty"`
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ BdID uint32 `binapi:"u32,name=bd_id,default=4294967295" json:"bd_id,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *BridgeDomainDump) Reset() { *m = BridgeDomainDump{} }
@@ -642,23 +615,20 @@ func (*BridgeDomainDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BridgeDomainDump) Size() int {
+func (m *BridgeDomainDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
size += 4 // m.SwIfIndex
return size
}
func (m *BridgeDomainDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -682,24 +652,21 @@ func (*BridgeDomainSetMacAge) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BridgeDomainSetMacAge) Size() int {
+func (m *BridgeDomainSetMacAge) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
size += 1 // m.MacAge
return size
}
func (m *BridgeDomainSetMacAge) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
- buf.EncodeUint8(uint8(m.MacAge))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
+ buf.EncodeUint8(m.MacAge)
return buf.Bytes(), nil
}
func (m *BridgeDomainSetMacAge) Unmarshal(b []byte) error {
@@ -721,27 +688,24 @@ func (*BridgeDomainSetMacAgeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BridgeDomainSetMacAgeReply) Size() int {
+func (m *BridgeDomainSetMacAgeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BridgeDomainSetMacAgeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BridgeDomainSetMacAgeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -759,24 +723,21 @@ func (*BridgeFlags) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BridgeFlags) Size() int {
+func (m *BridgeFlags) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
size += 1 // m.IsSet
size += 4 // m.Flags
return size
}
func (m *BridgeFlags) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
buf.EncodeBool(m.IsSet)
buf.EncodeUint32(uint32(m.Flags))
return buf.Bytes(), nil
@@ -802,29 +763,26 @@ func (*BridgeFlagsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BridgeFlagsReply) Size() int {
+func (m *BridgeFlagsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.ResultingFeatureBitmap
return size
}
func (m *BridgeFlagsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.ResultingFeatureBitmap))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.ResultingFeatureBitmap)
return buf.Bytes(), nil
}
func (m *BridgeFlagsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ResultingFeatureBitmap = buf.DecodeUint32()
return nil
}
@@ -832,7 +790,7 @@ func (m *BridgeFlagsReply) Unmarshal(b []byte) error {
// BviCreate defines message 'bvi_create'.
type BviCreate struct {
Mac ethernet_types.MacAddress `binapi:"mac_address,name=mac" json:"mac,omitempty"`
- UserInstance uint32 `binapi:"u32,name=user_instance,default=%!s(float64=4.294967295e+09)" json:"user_instance,omitempty"`
+ UserInstance uint32 `binapi:"u32,name=user_instance,default=4294967295" json:"user_instance,omitempty"`
}
func (m *BviCreate) Reset() { *m = BviCreate{} }
@@ -842,24 +800,21 @@ func (*BviCreate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BviCreate) Size() int {
+func (m *BviCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 6 // m.Mac
size += 4 // m.UserInstance
return size
}
func (m *BviCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.Mac[:], 6)
- buf.EncodeUint32(uint32(m.UserInstance))
+ buf.EncodeUint32(m.UserInstance)
return buf.Bytes(), nil
}
func (m *BviCreate) Unmarshal(b []byte) error {
@@ -882,29 +837,26 @@ func (*BviCreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BviCreateReply) Size() int {
+func (m *BviCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *BviCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *BviCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -921,21 +873,18 @@ func (*BviDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *BviDelete) Size() int {
+func (m *BviDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *BviDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -957,27 +906,24 @@ func (*BviDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *BviDeleteReply) Size() int {
+func (m *BviDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *BviDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *BviDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -996,11 +942,10 @@ func (*L2ArpTermEvent) GetMessageType() api.MessageType {
return api.EventMessage
}
-func (m *L2ArpTermEvent) Size() int {
+func (m *L2ArpTermEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PID
size += 1 // m.IP.Af
size += 1 * 16 // m.IP.Un
@@ -1009,15 +954,13 @@ func (m *L2ArpTermEvent) Size() int {
return size
}
func (m *L2ArpTermEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PID)
buf.EncodeUint8(uint8(m.IP.Af))
- buf.EncodeBytes(m.IP.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IP.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.Mac[:], 6)
return buf.Bytes(), nil
@@ -1042,20 +985,17 @@ func (*L2FibClearTable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2FibClearTable) Size() int {
+func (m *L2FibClearTable) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *L2FibClearTable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *L2FibClearTable) Unmarshal(b []byte) error {
@@ -1074,27 +1014,24 @@ func (*L2FibClearTableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2FibClearTableReply) Size() int {
+func (m *L2FibClearTableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2FibClearTableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2FibClearTableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1115,11 +1052,10 @@ func (*L2FibTableDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2FibTableDetails) Size() int {
+func (m *L2FibTableDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
size += 1 * 6 // m.Mac
size += 4 // m.SwIfIndex
@@ -1129,13 +1065,11 @@ func (m *L2FibTableDetails) Size() int {
return size
}
func (m *L2FibTableDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
buf.EncodeBytes(m.Mac[:], 6)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.StaticMac)
@@ -1166,22 +1100,19 @@ func (*L2FibTableDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2FibTableDump) Size() int {
+func (m *L2FibTableDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
return size
}
func (m *L2FibTableDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
return buf.Bytes(), nil
}
func (m *L2FibTableDump) Unmarshal(b []byte) error {
@@ -1204,26 +1135,23 @@ func (*L2Flags) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2Flags) Size() int {
+func (m *L2Flags) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsSet
size += 4 // m.FeatureBitmap
return size
}
func (m *L2Flags) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsSet)
- buf.EncodeUint32(uint32(m.FeatureBitmap))
+ buf.EncodeUint32(m.FeatureBitmap)
return buf.Bytes(), nil
}
func (m *L2Flags) Unmarshal(b []byte) error {
@@ -1247,29 +1175,26 @@ func (*L2FlagsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2FlagsReply) Size() int {
+func (m *L2FlagsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.ResultingFeatureBitmap
return size
}
func (m *L2FlagsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.ResultingFeatureBitmap))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.ResultingFeatureBitmap)
return buf.Bytes(), nil
}
func (m *L2FlagsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ResultingFeatureBitmap = buf.DecodeUint32()
return nil
}
@@ -1287,22 +1212,19 @@ func (*L2InterfaceEfpFilter) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2InterfaceEfpFilter) Size() int {
+func (m *L2InterfaceEfpFilter) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.EnableDisable
return size
}
func (m *L2InterfaceEfpFilter) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.EnableDisable)
return buf.Bytes(), nil
@@ -1326,27 +1248,24 @@ func (*L2InterfaceEfpFilterReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2InterfaceEfpFilterReply) Size() int {
+func (m *L2InterfaceEfpFilterReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2InterfaceEfpFilterReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2InterfaceEfpFilterReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1368,11 +1287,10 @@ func (*L2InterfacePbbTagRewrite) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2InterfacePbbTagRewrite) Size() int {
+func (m *L2InterfacePbbTagRewrite) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.VtrOp
size += 2 // m.OuterTag
@@ -1383,19 +1301,17 @@ func (m *L2InterfacePbbTagRewrite) Size() int {
return size
}
func (m *L2InterfacePbbTagRewrite) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.VtrOp))
- buf.EncodeUint16(uint16(m.OuterTag))
+ buf.EncodeUint32(m.VtrOp)
+ buf.EncodeUint16(m.OuterTag)
buf.EncodeBytes(m.BDmac[:], 6)
buf.EncodeBytes(m.BSmac[:], 6)
- buf.EncodeUint16(uint16(m.BVlanid))
- buf.EncodeUint32(uint32(m.ISid))
+ buf.EncodeUint16(m.BVlanid)
+ buf.EncodeUint32(m.ISid)
return buf.Bytes(), nil
}
func (m *L2InterfacePbbTagRewrite) Unmarshal(b []byte) error {
@@ -1424,27 +1340,24 @@ func (*L2InterfacePbbTagRewriteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2InterfacePbbTagRewriteReply) Size() int {
+func (m *L2InterfacePbbTagRewriteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2InterfacePbbTagRewriteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2InterfacePbbTagRewriteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1464,11 +1377,10 @@ func (*L2InterfaceVlanTagRewrite) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2InterfaceVlanTagRewrite) Size() int {
+func (m *L2InterfaceVlanTagRewrite) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.VtrOp
size += 4 // m.PushDot1q
@@ -1477,17 +1389,15 @@ func (m *L2InterfaceVlanTagRewrite) Size() int {
return size
}
func (m *L2InterfaceVlanTagRewrite) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.VtrOp))
- buf.EncodeUint32(uint32(m.PushDot1q))
- buf.EncodeUint32(uint32(m.Tag1))
- buf.EncodeUint32(uint32(m.Tag2))
+ buf.EncodeUint32(m.VtrOp)
+ buf.EncodeUint32(m.PushDot1q)
+ buf.EncodeUint32(m.Tag1)
+ buf.EncodeUint32(m.Tag2)
return buf.Bytes(), nil
}
func (m *L2InterfaceVlanTagRewrite) Unmarshal(b []byte) error {
@@ -1514,27 +1424,24 @@ func (*L2InterfaceVlanTagRewriteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2InterfaceVlanTagRewriteReply) Size() int {
+func (m *L2InterfaceVlanTagRewriteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2InterfaceVlanTagRewriteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2InterfaceVlanTagRewriteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1552,11 +1459,10 @@ func (*L2MacsEvent) GetMessageType() api.MessageType {
return api.EventMessage
}
-func (m *L2MacsEvent) Size() int {
+func (m *L2MacsEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PID
size += 4 // m.NMacs
for j1 := 0; j1 < len(m.Mac); j1++ {
@@ -1573,23 +1479,21 @@ func (m *L2MacsEvent) Size() int {
return size
}
func (m *L2MacsEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PID)
buf.EncodeUint32(uint32(len(m.Mac)))
for j0 := 0; j0 < len(m.Mac); j0++ {
- var v0 MacEntry
+ var v0 MacEntry // Mac
if j0 < len(m.Mac) {
v0 = m.Mac[j0]
}
buf.EncodeUint32(uint32(v0.SwIfIndex))
buf.EncodeBytes(v0.MacAddr[:], 6)
buf.EncodeUint32(uint32(v0.Action))
- buf.EncodeUint8(uint8(v0.Flags))
+ buf.EncodeUint8(v0.Flags)
}
return buf.Bytes(), nil
}
@@ -1597,7 +1501,7 @@ func (m *L2MacsEvent) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.PID = buf.DecodeUint32()
m.NMacs = buf.DecodeUint32()
- m.Mac = make([]MacEntry, int(m.NMacs))
+ m.Mac = make([]MacEntry, m.NMacs)
for j0 := 0; j0 < len(m.Mac); j0++ {
m.Mac[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
copy(m.Mac[j0].MacAddr[:], buf.DecodeBytes(6))
@@ -1621,23 +1525,20 @@ func (*L2PatchAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2PatchAddDel) Size() int {
+func (m *L2PatchAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.RxSwIfIndex
size += 4 // m.TxSwIfIndex
size += 1 // m.IsAdd
return size
}
func (m *L2PatchAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.RxSwIfIndex))
buf.EncodeUint32(uint32(m.TxSwIfIndex))
buf.EncodeBool(m.IsAdd)
@@ -1663,27 +1564,24 @@ func (*L2PatchAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2PatchAddDelReply) Size() int {
+func (m *L2PatchAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2PatchAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2PatchAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1700,22 +1598,19 @@ func (*L2XconnectDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2XconnectDetails) Size() int {
+func (m *L2XconnectDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.RxSwIfIndex
size += 4 // m.TxSwIfIndex
return size
}
func (m *L2XconnectDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.RxSwIfIndex))
buf.EncodeUint32(uint32(m.TxSwIfIndex))
return buf.Bytes(), nil
@@ -1737,20 +1632,17 @@ func (*L2XconnectDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2XconnectDump) Size() int {
+func (m *L2XconnectDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *L2XconnectDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *L2XconnectDump) Unmarshal(b []byte) error {
@@ -1775,11 +1667,10 @@ func (*L2fibAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2fibAddDel) Size() int {
+func (m *L2fibAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 6 // m.Mac
size += 4 // m.BdID
size += 4 // m.SwIfIndex
@@ -1790,14 +1681,12 @@ func (m *L2fibAddDel) Size() int {
return size
}
func (m *L2fibAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.Mac[:], 6)
- buf.EncodeUint32(uint32(m.BdID))
+ buf.EncodeUint32(m.BdID)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.StaticMac)
@@ -1829,27 +1718,24 @@ func (*L2fibAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2fibAddDelReply) Size() int {
+func (m *L2fibAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2fibAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2fibAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1863,20 +1749,17 @@ func (*L2fibFlushAll) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2fibFlushAll) Size() int {
+func (m *L2fibFlushAll) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *L2fibFlushAll) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *L2fibFlushAll) Unmarshal(b []byte) error {
@@ -1895,27 +1778,24 @@ func (*L2fibFlushAllReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2fibFlushAllReply) Size() int {
+func (m *L2fibFlushAllReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2fibFlushAllReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2fibFlushAllReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1931,22 +1811,19 @@ func (*L2fibFlushBd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2fibFlushBd) Size() int {
+func (m *L2fibFlushBd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.BdID
return size
}
func (m *L2fibFlushBd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.BdID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.BdID)
return buf.Bytes(), nil
}
func (m *L2fibFlushBd) Unmarshal(b []byte) error {
@@ -1967,27 +1844,24 @@ func (*L2fibFlushBdReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2fibFlushBdReply) Size() int {
+func (m *L2fibFlushBdReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2fibFlushBdReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2fibFlushBdReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2003,21 +1877,18 @@ func (*L2fibFlushInt) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2fibFlushInt) Size() int {
+func (m *L2fibFlushInt) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *L2fibFlushInt) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -2039,27 +1910,24 @@ func (*L2fibFlushIntReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2fibFlushIntReply) Size() int {
+func (m *L2fibFlushIntReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2fibFlushIntReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2fibFlushIntReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2079,11 +1947,10 @@ func (*SwInterfaceSetL2Bridge) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetL2Bridge) Size() int {
+func (m *SwInterfaceSetL2Bridge) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.RxSwIfIndex
size += 4 // m.BdID
size += 4 // m.PortType
@@ -2092,16 +1959,14 @@ func (m *SwInterfaceSetL2Bridge) Size() int {
return size
}
func (m *SwInterfaceSetL2Bridge) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.RxSwIfIndex))
- buf.EncodeUint32(uint32(m.BdID))
+ buf.EncodeUint32(m.BdID)
buf.EncodeUint32(uint32(m.PortType))
- buf.EncodeUint8(uint8(m.Shg))
+ buf.EncodeUint8(m.Shg)
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
}
@@ -2129,27 +1994,24 @@ func (*SwInterfaceSetL2BridgeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetL2BridgeReply) Size() int {
+func (m *SwInterfaceSetL2BridgeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetL2BridgeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetL2BridgeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2167,23 +2029,20 @@ func (*SwInterfaceSetL2Xconnect) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetL2Xconnect) Size() int {
+func (m *SwInterfaceSetL2Xconnect) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.RxSwIfIndex
size += 4 // m.TxSwIfIndex
size += 1 // m.Enable
return size
}
func (m *SwInterfaceSetL2Xconnect) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.RxSwIfIndex))
buf.EncodeUint32(uint32(m.TxSwIfIndex))
buf.EncodeBool(m.Enable)
@@ -2211,34 +2070,31 @@ func (*SwInterfaceSetL2XconnectReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetL2XconnectReply) Size() int {
+func (m *SwInterfaceSetL2XconnectReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetL2XconnectReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetL2XconnectReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
// SwInterfaceSetVpath defines message 'sw_interface_set_vpath'.
type SwInterfaceSetVpath struct {
SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
- Enable bool `binapi:"bool,name=enable,default=%!s(float64=4.294967295e+09)" json:"enable,omitempty"`
+ Enable bool `binapi:"bool,name=enable,default=4.294967295e+09" json:"enable,omitempty"`
}
func (m *SwInterfaceSetVpath) Reset() { *m = SwInterfaceSetVpath{} }
@@ -2248,22 +2104,19 @@ func (*SwInterfaceSetVpath) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetVpath) Size() int {
+func (m *SwInterfaceSetVpath) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Enable
return size
}
func (m *SwInterfaceSetVpath) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
@@ -2287,27 +2140,24 @@ func (*SwInterfaceSetVpathReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetVpathReply) Size() int {
+func (m *SwInterfaceSetVpathReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetVpathReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetVpathReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2324,24 +2174,21 @@ func (*WantL2ArpTermEvents) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *WantL2ArpTermEvents) Size() int {
+func (m *WantL2ArpTermEvents) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
size += 4 // m.PID
return size
}
func (m *WantL2ArpTermEvents) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
- buf.EncodeUint32(uint32(m.PID))
+ buf.EncodeUint32(m.PID)
return buf.Bytes(), nil
}
func (m *WantL2ArpTermEvents) Unmarshal(b []byte) error {
@@ -2363,35 +2210,32 @@ func (*WantL2ArpTermEventsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *WantL2ArpTermEventsReply) Size() int {
+func (m *WantL2ArpTermEventsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *WantL2ArpTermEventsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *WantL2ArpTermEventsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
// WantL2MacsEvents defines message 'want_l2_macs_events'.
type WantL2MacsEvents struct {
- LearnLimit uint32 `binapi:"u32,name=learn_limit,default=%!s(float64=1000)" json:"learn_limit,omitempty"`
- ScanDelay uint8 `binapi:"u8,name=scan_delay,default=%!s(float64=10)" json:"scan_delay,omitempty"`
- MaxMacsInEvent uint8 `binapi:"u8,name=max_macs_in_event,default=%!s(float64=10)" json:"max_macs_in_event,omitempty"`
+ LearnLimit uint32 `binapi:"u32,name=learn_limit,default=1000" json:"learn_limit,omitempty"`
+ ScanDelay uint8 `binapi:"u8,name=scan_delay,default=10" json:"scan_delay,omitempty"`
+ MaxMacsInEvent uint8 `binapi:"u8,name=max_macs_in_event,default=10" json:"max_macs_in_event,omitempty"`
EnableDisable bool `binapi:"bool,name=enable_disable,default=true" json:"enable_disable,omitempty"`
PID uint32 `binapi:"u32,name=pid" json:"pid,omitempty"`
}
@@ -2403,11 +2247,10 @@ func (*WantL2MacsEvents) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *WantL2MacsEvents) Size() int {
+func (m *WantL2MacsEvents) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.LearnLimit
size += 1 // m.ScanDelay
size += 1 // m.MaxMacsInEvent
@@ -2416,17 +2259,15 @@ func (m *WantL2MacsEvents) Size() int {
return size
}
func (m *WantL2MacsEvents) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.LearnLimit))
- buf.EncodeUint8(uint8(m.ScanDelay))
- buf.EncodeUint8(uint8(m.MaxMacsInEvent))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.LearnLimit)
+ buf.EncodeUint8(m.ScanDelay)
+ buf.EncodeUint8(m.MaxMacsInEvent)
buf.EncodeBool(m.EnableDisable)
- buf.EncodeUint32(uint32(m.PID))
+ buf.EncodeUint32(m.PID)
return buf.Bytes(), nil
}
func (m *WantL2MacsEvents) Unmarshal(b []byte) error {
@@ -2451,27 +2292,24 @@ func (*WantL2MacsEventsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *WantL2MacsEventsReply) Size() int {
+func (m *WantL2MacsEventsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *WantL2MacsEventsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *WantL2MacsEventsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/l2e/l2e.ba.go b/binapi/l2e/l2e.ba.go
index ebfb464..c1b2a76 100644
--- a/binapi/l2e/l2e.ba.go
+++ b/binapi/l2e/l2e.ba.go
@@ -42,22 +42,19 @@ func (*L2Emulation) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2Emulation) Size() int {
+func (m *L2Emulation) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Enable
return size
}
func (m *L2Emulation) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
@@ -81,27 +78,24 @@ func (*L2EmulationReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2EmulationReply) Size() int {
+func (m *L2EmulationReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2EmulationReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2EmulationReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/l2tp/l2tp.ba.go b/binapi/l2tp/l2tp.ba.go
index d83f7dd..6737baa 100644
--- a/binapi/l2tp/l2tp.ba.go
+++ b/binapi/l2tp/l2tp.ba.go
@@ -82,11 +82,10 @@ func (*L2tpv3CreateTunnel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2tpv3CreateTunnel) Size() int {
+func (m *L2tpv3CreateTunnel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.ClientAddress.Af
size += 1 * 16 // m.ClientAddress.Un
size += 1 // m.OurAddress.Af
@@ -100,22 +99,20 @@ func (m *L2tpv3CreateTunnel) Size() int {
return size
}
func (m *L2tpv3CreateTunnel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.ClientAddress.Af))
- buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.OurAddress.Af))
- buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.LocalSessionID))
- buf.EncodeUint32(uint32(m.RemoteSessionID))
- buf.EncodeUint64(uint64(m.LocalCookie))
- buf.EncodeUint64(uint64(m.RemoteCookie))
+ buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.LocalSessionID)
+ buf.EncodeUint32(m.RemoteSessionID)
+ buf.EncodeUint64(m.LocalCookie)
+ buf.EncodeUint64(m.RemoteCookie)
buf.EncodeBool(m.L2SublayerPresent)
- buf.EncodeUint32(uint32(m.EncapVrfID))
+ buf.EncodeUint32(m.EncapVrfID)
return buf.Bytes(), nil
}
func (m *L2tpv3CreateTunnel) Unmarshal(b []byte) error {
@@ -146,29 +143,26 @@ func (*L2tpv3CreateTunnelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2tpv3CreateTunnelReply) Size() int {
+func (m *L2tpv3CreateTunnelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *L2tpv3CreateTunnelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *L2tpv3CreateTunnelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -188,22 +182,19 @@ func (*L2tpv3InterfaceEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2tpv3InterfaceEnableDisable) Size() int {
+func (m *L2tpv3InterfaceEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
size += 4 // m.SwIfIndex
return size
}
func (m *L2tpv3InterfaceEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -229,27 +220,24 @@ func (*L2tpv3InterfaceEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2tpv3InterfaceEnableDisableReply) Size() int {
+func (m *L2tpv3InterfaceEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2tpv3InterfaceEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2tpv3InterfaceEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -265,21 +253,18 @@ func (*L2tpv3SetLookupKey) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2tpv3SetLookupKey) Size() int {
+func (m *L2tpv3SetLookupKey) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Key
return size
}
func (m *L2tpv3SetLookupKey) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Key))
return buf.Bytes(), nil
}
@@ -301,27 +286,24 @@ func (*L2tpv3SetLookupKeyReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2tpv3SetLookupKeyReply) Size() int {
+func (m *L2tpv3SetLookupKeyReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2tpv3SetLookupKeyReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2tpv3SetLookupKeyReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -339,26 +321,23 @@ func (*L2tpv3SetTunnelCookies) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L2tpv3SetTunnelCookies) Size() int {
+func (m *L2tpv3SetTunnelCookies) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 8 // m.NewLocalCookie
size += 8 // m.NewRemoteCookie
return size
}
func (m *L2tpv3SetTunnelCookies) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint64(uint64(m.NewLocalCookie))
- buf.EncodeUint64(uint64(m.NewRemoteCookie))
+ buf.EncodeUint64(m.NewLocalCookie)
+ buf.EncodeUint64(m.NewRemoteCookie)
return buf.Bytes(), nil
}
func (m *L2tpv3SetTunnelCookies) Unmarshal(b []byte) error {
@@ -381,27 +360,24 @@ func (*L2tpv3SetTunnelCookiesReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L2tpv3SetTunnelCookiesReply) Size() int {
+func (m *L2tpv3SetTunnelCookiesReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L2tpv3SetTunnelCookiesReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L2tpv3SetTunnelCookiesReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -425,11 +401,10 @@ func (*SwIfL2tpv3TunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwIfL2tpv3TunnelDetails) Size() int {
+func (m *SwIfL2tpv3TunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 64 // m.InterfaceName
size += 1 // m.ClientAddress.Af
@@ -444,28 +419,26 @@ func (m *SwIfL2tpv3TunnelDetails) Size() int {
return size
}
func (m *SwIfL2tpv3TunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeString(m.InterfaceName, 64)
buf.EncodeUint8(uint8(m.ClientAddress.Af))
- buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.OurAddress.Af))
- buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.LocalSessionID))
- buf.EncodeUint32(uint32(m.RemoteSessionID))
+ buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.LocalSessionID)
+ buf.EncodeUint32(m.RemoteSessionID)
for i := 0; i < 2; i++ {
var x uint64
if i < len(m.LocalCookie) {
x = uint64(m.LocalCookie[i])
}
- buf.EncodeUint64(uint64(x))
+ buf.EncodeUint64(x)
}
- buf.EncodeUint64(uint64(m.RemoteCookie))
+ buf.EncodeUint64(m.RemoteCookie)
buf.EncodeBool(m.L2SublayerPresent)
return buf.Bytes(), nil
}
@@ -498,20 +471,17 @@ func (*SwIfL2tpv3TunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwIfL2tpv3TunnelDump) Size() int {
+func (m *SwIfL2tpv3TunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SwIfL2tpv3TunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SwIfL2tpv3TunnelDump) Unmarshal(b []byte) error {
diff --git a/binapi/l3xc/l3xc.ba.go b/binapi/l3xc/l3xc.ba.go
index ee9ecb0..3dbcfba 100644
--- a/binapi/l3xc/l3xc.ba.go
+++ b/binapi/l3xc/l3xc.ba.go
@@ -53,22 +53,19 @@ func (*L3xcDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L3xcDel) Size() int {
+func (m *L3xcDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIP6
return size
}
func (m *L3xcDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIP6)
return buf.Bytes(), nil
@@ -92,27 +89,24 @@ func (*L3xcDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L3xcDelReply) Size() int {
+func (m *L3xcDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *L3xcDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *L3xcDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -128,11 +122,10 @@ func (*L3xcDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L3xcDetails) Size() int {
+func (m *L3xcDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.L3xc.SwIfIndex
size += 1 // m.L3xc.IsIP6
size += 1 // m.L3xc.NPaths
@@ -156,56 +149,45 @@ func (m *L3xcDetails) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *L3xcDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.L3xc.SwIfIndex))
buf.EncodeBool(m.L3xc.IsIP6)
buf.EncodeUint8(uint8(len(m.L3xc.Paths)))
for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // Paths
if j1 < len(m.L3xc.Paths) {
v1 = m.L3xc.Paths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -215,7 +197,7 @@ func (m *L3xcDetails) Unmarshal(b []byte) error {
m.L3xc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.L3xc.IsIP6 = buf.DecodeBool()
m.L3xc.NPaths = buf.DecodeUint8()
- m.L3xc.Paths = make([]fib_types.FibPath, int(m.L3xc.NPaths))
+ m.L3xc.Paths = make([]fib_types.FibPath, m.L3xc.NPaths)
for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
m.L3xc.Paths[j1].SwIfIndex = buf.DecodeUint32()
m.L3xc.Paths[j1].TableID = buf.DecodeUint32()
@@ -252,21 +234,18 @@ func (*L3xcDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L3xcDump) Size() int {
+func (m *L3xcDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *L3xcDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -286,20 +265,17 @@ func (*L3xcPluginGetVersion) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L3xcPluginGetVersion) Size() int {
+func (m *L3xcPluginGetVersion) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *L3xcPluginGetVersion) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *L3xcPluginGetVersion) Unmarshal(b []byte) error {
@@ -319,24 +295,21 @@ func (*L3xcPluginGetVersionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L3xcPluginGetVersionReply) Size() int {
+func (m *L3xcPluginGetVersionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Major
size += 4 // m.Minor
return size
}
func (m *L3xcPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Major))
- buf.EncodeUint32(uint32(m.Minor))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Major)
+ buf.EncodeUint32(m.Minor)
return buf.Bytes(), nil
}
func (m *L3xcPluginGetVersionReply) Unmarshal(b []byte) error {
@@ -358,11 +331,10 @@ func (*L3xcUpdate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *L3xcUpdate) Size() int {
+func (m *L3xcUpdate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.L3xc.SwIfIndex
size += 1 // m.L3xc.IsIP6
size += 1 // m.L3xc.NPaths
@@ -386,56 +358,45 @@ func (m *L3xcUpdate) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *L3xcUpdate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.L3xc.SwIfIndex))
buf.EncodeBool(m.L3xc.IsIP6)
buf.EncodeUint8(uint8(len(m.L3xc.Paths)))
for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // Paths
if j1 < len(m.L3xc.Paths) {
v1 = m.L3xc.Paths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -445,7 +406,7 @@ func (m *L3xcUpdate) Unmarshal(b []byte) error {
m.L3xc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.L3xc.IsIP6 = buf.DecodeBool()
m.L3xc.NPaths = buf.DecodeUint8()
- m.L3xc.Paths = make([]fib_types.FibPath, int(m.L3xc.NPaths))
+ m.L3xc.Paths = make([]fib_types.FibPath, m.L3xc.NPaths)
for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
m.L3xc.Paths[j1].SwIfIndex = buf.DecodeUint32()
m.L3xc.Paths[j1].TableID = buf.DecodeUint32()
@@ -483,29 +444,26 @@ func (*L3xcUpdateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *L3xcUpdateReply) Size() int {
+func (m *L3xcUpdateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.StatsIndex
return size
}
func (m *L3xcUpdateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.StatsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.StatsIndex)
return buf.Bytes(), nil
}
func (m *L3xcUpdateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.StatsIndex = buf.DecodeUint32()
return nil
}
diff --git a/binapi/lacp/lacp.ba.go b/binapi/lacp/lacp.ba.go
index 92fd933..f1a9457 100644
--- a/binapi/lacp/lacp.ba.go
+++ b/binapi/lacp/lacp.ba.go
@@ -60,11 +60,10 @@ func (*SwInterfaceLacpDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceLacpDetails) Size() int {
+func (m *SwInterfaceLacpDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 64 // m.InterfaceName
size += 4 // m.RxState
@@ -87,31 +86,29 @@ func (m *SwInterfaceLacpDetails) Size() int {
return size
}
func (m *SwInterfaceLacpDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeString(m.InterfaceName, 64)
- buf.EncodeUint32(uint32(m.RxState))
- buf.EncodeUint32(uint32(m.TxState))
- buf.EncodeUint32(uint32(m.MuxState))
- buf.EncodeUint32(uint32(m.PtxState))
+ buf.EncodeUint32(m.RxState)
+ buf.EncodeUint32(m.TxState)
+ buf.EncodeUint32(m.MuxState)
+ buf.EncodeUint32(m.PtxState)
buf.EncodeString(m.BondInterfaceName, 64)
- buf.EncodeUint16(uint16(m.ActorSystemPriority))
+ buf.EncodeUint16(m.ActorSystemPriority)
buf.EncodeBytes(m.ActorSystem[:], 6)
- buf.EncodeUint16(uint16(m.ActorKey))
- buf.EncodeUint16(uint16(m.ActorPortPriority))
- buf.EncodeUint16(uint16(m.ActorPortNumber))
- buf.EncodeUint8(uint8(m.ActorState))
- buf.EncodeUint16(uint16(m.PartnerSystemPriority))
+ buf.EncodeUint16(m.ActorKey)
+ buf.EncodeUint16(m.ActorPortPriority)
+ buf.EncodeUint16(m.ActorPortNumber)
+ buf.EncodeUint8(m.ActorState)
+ buf.EncodeUint16(m.PartnerSystemPriority)
buf.EncodeBytes(m.PartnerSystem[:], 6)
- buf.EncodeUint16(uint16(m.PartnerKey))
- buf.EncodeUint16(uint16(m.PartnerPortPriority))
- buf.EncodeUint16(uint16(m.PartnerPortNumber))
- buf.EncodeUint8(uint8(m.PartnerState))
+ buf.EncodeUint16(m.PartnerKey)
+ buf.EncodeUint16(m.PartnerPortPriority)
+ buf.EncodeUint16(m.PartnerPortNumber)
+ buf.EncodeUint8(m.PartnerState)
return buf.Bytes(), nil
}
func (m *SwInterfaceLacpDetails) Unmarshal(b []byte) error {
@@ -148,20 +145,17 @@ func (*SwInterfaceLacpDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceLacpDump) Size() int {
+func (m *SwInterfaceLacpDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SwInterfaceLacpDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SwInterfaceLacpDump) Unmarshal(b []byte) error {
diff --git a/binapi/lb/lb.ba.go b/binapi/lb/lb.ba.go
index 018ae4d..9fdfc7f 100644
--- a/binapi/lb/lb.ba.go
+++ b/binapi/lb/lb.ba.go
@@ -34,7 +34,7 @@ const (
// LbAddDelAs defines message 'lb_add_del_as'.
type LbAddDelAs struct {
Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
- Protocol uint8 `binapi:"u8,name=protocol,default=%!s(float64=255)" json:"protocol,omitempty"`
+ Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"`
Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
AsAddress ip_types.Address `binapi:"address,name=as_address" json:"as_address,omitempty"`
IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"`
@@ -48,11 +48,10 @@ func (*LbAddDelAs) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LbAddDelAs) Size() int {
+func (m *LbAddDelAs) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Pfx.Address.Af
size += 1 * 16 // m.Pfx.Address.Un
size += 1 // m.Pfx.Len
@@ -65,19 +64,17 @@ func (m *LbAddDelAs) Size() int {
return size
}
func (m *LbAddDelAs) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Pfx.Address.Af))
- buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Pfx.Len))
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.Port))
+ buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Pfx.Len)
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.Port)
buf.EncodeUint8(uint8(m.AsAddress.Af))
- buf.EncodeBytes(m.AsAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.AsAddress.Un.XXX_UnionData[:], 16)
buf.EncodeBool(m.IsDel)
buf.EncodeBool(m.IsFlush)
return buf.Bytes(), nil
@@ -108,27 +105,24 @@ func (*LbAddDelAsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LbAddDelAsReply) Size() int {
+func (m *LbAddDelAsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LbAddDelAsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LbAddDelAsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -145,22 +139,19 @@ func (*LbAddDelIntfNat4) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LbAddDelIntfNat4) Size() int {
+func (m *LbAddDelIntfNat4) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SwIfIndex
return size
}
func (m *LbAddDelIntfNat4) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -184,27 +175,24 @@ func (*LbAddDelIntfNat4Reply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LbAddDelIntfNat4Reply) Size() int {
+func (m *LbAddDelIntfNat4Reply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LbAddDelIntfNat4Reply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LbAddDelIntfNat4Reply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -221,22 +209,19 @@ func (*LbAddDelIntfNat6) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LbAddDelIntfNat6) Size() int {
+func (m *LbAddDelIntfNat6) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SwIfIndex
return size
}
func (m *LbAddDelIntfNat6) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -260,41 +245,38 @@ func (*LbAddDelIntfNat6Reply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LbAddDelIntfNat6Reply) Size() int {
+func (m *LbAddDelIntfNat6Reply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LbAddDelIntfNat6Reply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LbAddDelIntfNat6Reply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
// LbAddDelVip defines message 'lb_add_del_vip'.
type LbAddDelVip struct {
Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
- Protocol uint8 `binapi:"u8,name=protocol,default=%!s(float64=255)" json:"protocol,omitempty"`
+ Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"`
Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
Encap lb_types.LbEncapType `binapi:"lb_encap_type,name=encap" json:"encap,omitempty"`
Dscp uint8 `binapi:"u8,name=dscp" json:"dscp,omitempty"`
Type lb_types.LbSrvType `binapi:"lb_srv_type,name=type" json:"type,omitempty"`
TargetPort uint16 `binapi:"u16,name=target_port" json:"target_port,omitempty"`
NodePort uint16 `binapi:"u16,name=node_port" json:"node_port,omitempty"`
- NewFlowsTableLength uint32 `binapi:"u32,name=new_flows_table_length,default=%!s(float64=1024)" json:"new_flows_table_length,omitempty"`
+ NewFlowsTableLength uint32 `binapi:"u32,name=new_flows_table_length,default=1024" json:"new_flows_table_length,omitempty"`
IsDel bool `binapi:"bool,name=is_del" json:"is_del,omitempty"`
}
@@ -305,11 +287,10 @@ func (*LbAddDelVip) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LbAddDelVip) Size() int {
+func (m *LbAddDelVip) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Pfx.Address.Af
size += 1 * 16 // m.Pfx.Address.Un
size += 1 // m.Pfx.Len
@@ -325,23 +306,21 @@ func (m *LbAddDelVip) Size() int {
return size
}
func (m *LbAddDelVip) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Pfx.Address.Af))
- buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Pfx.Len))
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.Port))
+ buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Pfx.Len)
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.Port)
buf.EncodeUint32(uint32(m.Encap))
- buf.EncodeUint8(uint8(m.Dscp))
+ buf.EncodeUint8(m.Dscp)
buf.EncodeUint32(uint32(m.Type))
- buf.EncodeUint16(uint16(m.TargetPort))
- buf.EncodeUint16(uint16(m.NodePort))
- buf.EncodeUint32(uint32(m.NewFlowsTableLength))
+ buf.EncodeUint16(m.TargetPort)
+ buf.EncodeUint16(m.NodePort)
+ buf.EncodeUint32(m.NewFlowsTableLength)
buf.EncodeBool(m.IsDel)
return buf.Bytes(), nil
}
@@ -374,27 +353,24 @@ func (*LbAddDelVipReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LbAddDelVipReply) Size() int {
+func (m *LbAddDelVipReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LbAddDelVipReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LbAddDelVipReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -413,11 +389,10 @@ func (*LbAsDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LbAsDetails) Size() int {
+func (m *LbAsDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Vip.Pfx.Address.Af
size += 1 * 16 // m.Vip.Pfx.Address.Un
size += 1 // m.Vip.Pfx.Len
@@ -430,21 +405,19 @@ func (m *LbAsDetails) Size() int {
return size
}
func (m *LbAsDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Vip.Pfx.Address.Af))
- buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Vip.Pfx.Len))
+ buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Vip.Pfx.Len)
buf.EncodeUint8(uint8(m.Vip.Protocol))
- buf.EncodeUint16(uint16(m.Vip.Port))
+ buf.EncodeUint16(m.Vip.Port)
buf.EncodeUint8(uint8(m.AppSrv.Af))
- buf.EncodeBytes(m.AppSrv.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Flags))
- buf.EncodeUint32(uint32(m.InUseSince))
+ buf.EncodeBytes(m.AppSrv.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Flags)
+ buf.EncodeUint32(m.InUseSince)
return buf.Bytes(), nil
}
func (m *LbAsDetails) Unmarshal(b []byte) error {
@@ -475,11 +448,10 @@ func (*LbAsDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LbAsDump) Size() int {
+func (m *LbAsDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Pfx.Address.Af
size += 1 * 16 // m.Pfx.Address.Un
size += 1 // m.Pfx.Len
@@ -488,17 +460,15 @@ func (m *LbAsDump) Size() int {
return size
}
func (m *LbAsDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Pfx.Address.Af))
- buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Pfx.Len))
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.Port))
+ buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Pfx.Len)
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.Port)
return buf.Bytes(), nil
}
func (m *LbAsDump) Unmarshal(b []byte) error {
@@ -515,8 +485,8 @@ func (m *LbAsDump) Unmarshal(b []byte) error {
type LbConf struct {
IP4SrcAddress ip_types.IP4Address `binapi:"ip4_address,name=ip4_src_address" json:"ip4_src_address,omitempty"`
IP6SrcAddress ip_types.IP6Address `binapi:"ip6_address,name=ip6_src_address" json:"ip6_src_address,omitempty"`
- StickyBucketsPerCore uint32 `binapi:"u32,name=sticky_buckets_per_core,default=%!s(float64=4.294967295e+09)" json:"sticky_buckets_per_core,omitempty"`
- FlowTimeout uint32 `binapi:"u32,name=flow_timeout,default=%!s(float64=4.294967295e+09)" json:"flow_timeout,omitempty"`
+ StickyBucketsPerCore uint32 `binapi:"u32,name=sticky_buckets_per_core,default=4294967295" json:"sticky_buckets_per_core,omitempty"`
+ FlowTimeout uint32 `binapi:"u32,name=flow_timeout,default=4294967295" json:"flow_timeout,omitempty"`
}
func (m *LbConf) Reset() { *m = LbConf{} }
@@ -526,11 +496,10 @@ func (*LbConf) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LbConf) Size() int {
+func (m *LbConf) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IP4SrcAddress
size += 1 * 16 // m.IP6SrcAddress
size += 4 // m.StickyBucketsPerCore
@@ -538,16 +507,14 @@ func (m *LbConf) Size() int {
return size
}
func (m *LbConf) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IP4SrcAddress[:], 4)
buf.EncodeBytes(m.IP6SrcAddress[:], 16)
- buf.EncodeUint32(uint32(m.StickyBucketsPerCore))
- buf.EncodeUint32(uint32(m.FlowTimeout))
+ buf.EncodeUint32(m.StickyBucketsPerCore)
+ buf.EncodeUint32(m.FlowTimeout)
return buf.Bytes(), nil
}
func (m *LbConf) Unmarshal(b []byte) error {
@@ -571,27 +538,24 @@ func (*LbConfReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LbConfReply) Size() int {
+func (m *LbConfReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LbConfReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LbConfReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -609,11 +573,10 @@ func (*LbFlushVip) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LbFlushVip) Size() int {
+func (m *LbFlushVip) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Pfx.Address.Af
size += 1 * 16 // m.Pfx.Address.Un
size += 1 // m.Pfx.Len
@@ -622,17 +585,15 @@ func (m *LbFlushVip) Size() int {
return size
}
func (m *LbFlushVip) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Pfx.Address.Af))
- buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Pfx.Len))
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.Port))
+ buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Pfx.Len)
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.Port)
return buf.Bytes(), nil
}
func (m *LbFlushVip) Unmarshal(b []byte) error {
@@ -657,27 +618,24 @@ func (*LbFlushVipReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LbFlushVipReply) Size() int {
+func (m *LbFlushVipReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LbFlushVipReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LbFlushVipReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -698,11 +656,10 @@ func (*LbVipDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LbVipDetails) Size() int {
+func (m *LbVipDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Vip.Pfx.Address.Af
size += 1 * 16 // m.Vip.Pfx.Address.Un
size += 1 // m.Vip.Pfx.Len
@@ -716,22 +673,20 @@ func (m *LbVipDetails) Size() int {
return size
}
func (m *LbVipDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Vip.Pfx.Address.Af))
- buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Vip.Pfx.Len))
+ buf.EncodeBytes(m.Vip.Pfx.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Vip.Pfx.Len)
buf.EncodeUint8(uint8(m.Vip.Protocol))
- buf.EncodeUint16(uint16(m.Vip.Port))
+ buf.EncodeUint16(m.Vip.Port)
buf.EncodeUint32(uint32(m.Encap))
buf.EncodeUint8(uint8(m.Dscp))
buf.EncodeUint32(uint32(m.SrvType))
- buf.EncodeUint16(uint16(m.TargetPort))
- buf.EncodeUint16(uint16(m.FlowTableLength))
+ buf.EncodeUint16(m.TargetPort)
+ buf.EncodeUint16(m.FlowTableLength)
return buf.Bytes(), nil
}
func (m *LbVipDetails) Unmarshal(b []byte) error {
@@ -753,7 +708,7 @@ func (m *LbVipDetails) Unmarshal(b []byte) error {
type LbVipDump struct {
Pfx ip_types.AddressWithPrefix `binapi:"address_with_prefix,name=pfx" json:"pfx,omitempty"`
PfxMatcher ip_types.PrefixMatcher `binapi:"prefix_matcher,name=pfx_matcher" json:"pfx_matcher,omitempty"`
- Protocol uint8 `binapi:"u8,name=protocol,default=%!s(float64=255)" json:"protocol,omitempty"`
+ Protocol uint8 `binapi:"u8,name=protocol,default=255" json:"protocol,omitempty"`
Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
}
@@ -764,11 +719,10 @@ func (*LbVipDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LbVipDump) Size() int {
+func (m *LbVipDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Pfx.Address.Af
size += 1 * 16 // m.Pfx.Address.Un
size += 1 // m.Pfx.Len
@@ -779,19 +733,17 @@ func (m *LbVipDump) Size() int {
return size
}
func (m *LbVipDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Pfx.Address.Af))
- buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Pfx.Len))
- buf.EncodeUint8(uint8(m.PfxMatcher.Le))
- buf.EncodeUint8(uint8(m.PfxMatcher.Ge))
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.Port))
+ buf.EncodeBytes(m.Pfx.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Pfx.Len)
+ buf.EncodeUint8(m.PfxMatcher.Le)
+ buf.EncodeUint8(m.PfxMatcher.Ge)
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.Port)
return buf.Bytes(), nil
}
func (m *LbVipDump) Unmarshal(b []byte) error {
diff --git a/binapi/lisp/lisp.ba.go b/binapi/lisp/lisp.ba.go
index a152648..3358e61 100644
--- a/binapi/lisp/lisp.ba.go
+++ b/binapi/lisp/lisp.ba.go
@@ -86,11 +86,10 @@ func (*LispAddDelAdjacency) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispAddDelAdjacency) Size() int {
+func (m *LispAddDelAdjacency) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Vni
size += 1 // m.Reid.Type
@@ -100,18 +99,16 @@ func (m *LispAddDelAdjacency) Size() int {
return size
}
func (m *LispAddDelAdjacency) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Reid.Type))
- buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.Leid.Type))
- buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 6)
return buf.Bytes(), nil
}
func (m *LispAddDelAdjacency) Unmarshal(b []byte) error {
@@ -137,27 +134,24 @@ func (*LispAddDelAdjacencyReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispAddDelAdjacencyReply) Size() int {
+func (m *LispAddDelAdjacencyReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispAddDelAdjacencyReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispAddDelAdjacencyReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -177,11 +171,10 @@ func (*LispAddDelLocalEid) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispAddDelLocalEid) Size() int {
+func (m *LispAddDelLocalEid) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Eid.Type
size += 1 * 6 // m.Eid.Address
@@ -192,19 +185,17 @@ func (m *LispAddDelLocalEid) Size() int {
return size
}
func (m *LispAddDelLocalEid) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Eid.Type))
- buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 6)
buf.EncodeString(m.LocatorSetName, 64)
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Key.ID))
- buf.EncodeBytes(m.Key.Key[:], 64)
+ buf.EncodeBytes(m.Key.Key, 64)
return buf.Bytes(), nil
}
func (m *LispAddDelLocalEid) Unmarshal(b []byte) error {
@@ -215,7 +206,8 @@ func (m *LispAddDelLocalEid) Unmarshal(b []byte) error {
m.LocatorSetName = buf.DecodeString(64)
m.Vni = buf.DecodeUint32()
m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8())
- copy(m.Key.Key[:], buf.DecodeBytes(64))
+ m.Key.Key = make([]byte, 64)
+ copy(m.Key.Key, buf.DecodeBytes(len(m.Key.Key)))
return nil
}
@@ -231,27 +223,24 @@ func (*LispAddDelLocalEidReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispAddDelLocalEidReply) Size() int {
+func (m *LispAddDelLocalEidReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispAddDelLocalEidReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispAddDelLocalEidReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -271,11 +260,10 @@ func (*LispAddDelLocator) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispAddDelLocator) Size() int {
+func (m *LispAddDelLocator) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.LocatorSetName
size += 4 // m.SwIfIndex
@@ -284,17 +272,15 @@ func (m *LispAddDelLocator) Size() int {
return size
}
func (m *LispAddDelLocator) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.LocatorSetName, 64)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.Priority))
- buf.EncodeUint8(uint8(m.Weight))
+ buf.EncodeUint8(m.Priority)
+ buf.EncodeUint8(m.Weight)
return buf.Bytes(), nil
}
func (m *LispAddDelLocator) Unmarshal(b []byte) error {
@@ -319,27 +305,24 @@ func (*LispAddDelLocatorReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispAddDelLocatorReply) Size() int {
+func (m *LispAddDelLocatorReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispAddDelLocatorReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispAddDelLocatorReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -358,11 +341,10 @@ func (*LispAddDelLocatorSet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispAddDelLocatorSet) Size() int {
+func (m *LispAddDelLocatorSet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.LocatorSetName
size += 4 // m.LocatorNum
@@ -379,23 +361,21 @@ func (m *LispAddDelLocatorSet) Size() int {
return size
}
func (m *LispAddDelLocatorSet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.LocatorSetName, 64)
buf.EncodeUint32(uint32(len(m.Locators)))
for j0 := 0; j0 < len(m.Locators); j0++ {
- var v0 lisp_types.LocalLocator
+ var v0 lisp_types.LocalLocator // Locators
if j0 < len(m.Locators) {
v0 = m.Locators[j0]
}
buf.EncodeUint32(uint32(v0.SwIfIndex))
- buf.EncodeUint8(uint8(v0.Priority))
- buf.EncodeUint8(uint8(v0.Weight))
+ buf.EncodeUint8(v0.Priority)
+ buf.EncodeUint8(v0.Weight)
}
return buf.Bytes(), nil
}
@@ -404,7 +384,7 @@ func (m *LispAddDelLocatorSet) Unmarshal(b []byte) error {
m.IsAdd = buf.DecodeBool()
m.LocatorSetName = buf.DecodeString(64)
m.LocatorNum = buf.DecodeUint32()
- m.Locators = make([]lisp_types.LocalLocator, int(m.LocatorNum))
+ m.Locators = make([]lisp_types.LocalLocator, m.LocatorNum)
for j0 := 0; j0 < len(m.Locators); j0++ {
m.Locators[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.Locators[j0].Priority = buf.DecodeUint8()
@@ -426,29 +406,26 @@ func (*LispAddDelLocatorSetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispAddDelLocatorSetReply) Size() int {
+func (m *LispAddDelLocatorSetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.LsIndex
return size
}
func (m *LispAddDelLocatorSetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.LsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.LsIndex)
return buf.Bytes(), nil
}
func (m *LispAddDelLocatorSetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.LsIndex = buf.DecodeUint32()
return nil
}
@@ -468,22 +445,19 @@ func (*LispAddDelMapRequestItrRlocs) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispAddDelMapRequestItrRlocs) Size() int {
+func (m *LispAddDelMapRequestItrRlocs) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.LocatorSetName
return size
}
func (m *LispAddDelMapRequestItrRlocs) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.LocatorSetName, 64)
return buf.Bytes(), nil
@@ -509,27 +483,24 @@ func (*LispAddDelMapRequestItrRlocsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispAddDelMapRequestItrRlocsReply) Size() int {
+func (m *LispAddDelMapRequestItrRlocsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispAddDelMapRequestItrRlocsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispAddDelMapRequestItrRlocsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -546,26 +517,23 @@ func (*LispAddDelMapResolver) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispAddDelMapResolver) Size() int {
+func (m *LispAddDelMapResolver) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
return size
}
func (m *LispAddDelMapResolver) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *LispAddDelMapResolver) Unmarshal(b []byte) error {
@@ -588,27 +556,24 @@ func (*LispAddDelMapResolverReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispAddDelMapResolverReply) Size() int {
+func (m *LispAddDelMapResolverReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispAddDelMapResolverReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispAddDelMapResolverReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -625,26 +590,23 @@ func (*LispAddDelMapServer) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispAddDelMapServer) Size() int {
+func (m *LispAddDelMapServer) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
return size
}
func (m *LispAddDelMapServer) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *LispAddDelMapServer) Unmarshal(b []byte) error {
@@ -667,27 +629,24 @@ func (*LispAddDelMapServerReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispAddDelMapServerReply) Size() int {
+func (m *LispAddDelMapServerReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispAddDelMapServerReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispAddDelMapServerReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -711,11 +670,10 @@ func (*LispAddDelRemoteMapping) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispAddDelRemoteMapping) Size() int {
+func (m *LispAddDelRemoteMapping) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IsSrcDst
size += 1 // m.DelAll
@@ -740,31 +698,29 @@ func (m *LispAddDelRemoteMapping) Size() int {
return size
}
func (m *LispAddDelRemoteMapping) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.IsSrcDst)
buf.EncodeBool(m.DelAll)
- buf.EncodeUint32(uint32(m.Vni))
- buf.EncodeUint8(uint8(m.Action))
+ buf.EncodeUint32(m.Vni)
+ buf.EncodeUint8(m.Action)
buf.EncodeUint8(uint8(m.Deid.Type))
- buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.Seid.Type))
- buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6)
buf.EncodeUint32(uint32(len(m.Rlocs)))
for j0 := 0; j0 < len(m.Rlocs); j0++ {
- var v0 lisp_types.RemoteLocator
+ var v0 lisp_types.RemoteLocator // Rlocs
if j0 < len(m.Rlocs) {
v0 = m.Rlocs[j0]
}
- buf.EncodeUint8(uint8(v0.Priority))
- buf.EncodeUint8(uint8(v0.Weight))
+ buf.EncodeUint8(v0.Priority)
+ buf.EncodeUint8(v0.Weight)
buf.EncodeUint8(uint8(v0.IPAddress.Af))
- buf.EncodeBytes(v0.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.IPAddress.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -780,7 +736,7 @@ func (m *LispAddDelRemoteMapping) Unmarshal(b []byte) error {
m.Seid.Type = lisp_types.EidType(buf.DecodeUint8())
copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6))
m.RlocNum = buf.DecodeUint32()
- m.Rlocs = make([]lisp_types.RemoteLocator, int(m.RlocNum))
+ m.Rlocs = make([]lisp_types.RemoteLocator, m.RlocNum)
for j0 := 0; j0 < len(m.Rlocs); j0++ {
m.Rlocs[j0].Priority = buf.DecodeUint8()
m.Rlocs[j0].Weight = buf.DecodeUint8()
@@ -804,27 +760,24 @@ func (*LispAddDelRemoteMappingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispAddDelRemoteMappingReply) Size() int {
+func (m *LispAddDelRemoteMappingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispAddDelRemoteMappingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispAddDelRemoteMappingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -840,22 +793,19 @@ func (*LispAdjacenciesGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispAdjacenciesGet) Size() int {
+func (m *LispAdjacenciesGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
return size
}
func (m *LispAdjacenciesGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *LispAdjacenciesGet) Unmarshal(b []byte) error {
@@ -878,11 +828,10 @@ func (*LispAdjacenciesGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispAdjacenciesGetReply) Size() int {
+func (m *LispAdjacenciesGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
for j1 := 0; j1 < len(m.Adjacencies); j1++ {
@@ -899,31 +848,29 @@ func (m *LispAdjacenciesGetReply) Size() int {
return size
}
func (m *LispAdjacenciesGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.Adjacencies)))
for j0 := 0; j0 < len(m.Adjacencies); j0++ {
- var v0 LispAdjacency
+ var v0 LispAdjacency // Adjacencies
if j0 < len(m.Adjacencies) {
v0 = m.Adjacencies[j0]
}
buf.EncodeUint8(uint8(v0.Reid.Type))
- buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(v0.Leid.Type))
- buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 6)
}
return buf.Bytes(), nil
}
func (m *LispAdjacenciesGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
- m.Adjacencies = make([]LispAdjacency, int(m.Count))
+ m.Adjacencies = make([]LispAdjacency, m.Count)
for j0 := 0; j0 < len(m.Adjacencies); j0++ {
m.Adjacencies[j0].Reid.Type = lisp_types.EidType(buf.DecodeUint8())
copy(m.Adjacencies[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6))
@@ -948,11 +895,10 @@ func (*LispEidTableAddDelMap) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispEidTableAddDelMap) Size() int {
+func (m *LispEidTableAddDelMap) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Vni
size += 4 // m.DpTable
@@ -960,15 +906,13 @@ func (m *LispEidTableAddDelMap) Size() int {
return size
}
func (m *LispEidTableAddDelMap) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Vni))
- buf.EncodeUint32(uint32(m.DpTable))
+ buf.EncodeUint32(m.Vni)
+ buf.EncodeUint32(m.DpTable)
buf.EncodeBool(m.IsL2)
return buf.Bytes(), nil
}
@@ -993,27 +937,24 @@ func (*LispEidTableAddDelMapReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispEidTableAddDelMapReply) Size() int {
+func (m *LispEidTableAddDelMapReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispEidTableAddDelMapReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispEidTableAddDelMapReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1038,11 +979,10 @@ func (*LispEidTableDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispEidTableDetails) Size() int {
+func (m *LispEidTableDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.LocatorSetIndex
size += 1 // m.Action
size += 1 // m.IsLocal
@@ -1059,25 +999,23 @@ func (m *LispEidTableDetails) Size() int {
return size
}
func (m *LispEidTableDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.LocatorSetIndex))
- buf.EncodeUint8(uint8(m.Action))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.LocatorSetIndex)
+ buf.EncodeUint8(m.Action)
buf.EncodeBool(m.IsLocal)
buf.EncodeBool(m.IsSrcDst)
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Deid.Type))
- buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.Seid.Type))
- buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.TTL))
- buf.EncodeUint8(uint8(m.Authoritative))
+ buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6)
+ buf.EncodeUint32(m.TTL)
+ buf.EncodeUint8(m.Authoritative)
buf.EncodeUint8(uint8(m.Key.ID))
- buf.EncodeBytes(m.Key.Key[:], 64)
+ buf.EncodeBytes(m.Key.Key, 64)
return buf.Bytes(), nil
}
func (m *LispEidTableDetails) Unmarshal(b []byte) error {
@@ -1094,7 +1032,8 @@ func (m *LispEidTableDetails) Unmarshal(b []byte) error {
m.TTL = buf.DecodeUint32()
m.Authoritative = buf.DecodeUint8()
m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8())
- copy(m.Key.Key[:], buf.DecodeBytes(64))
+ m.Key.Key = make([]byte, 64)
+ copy(m.Key.Key, buf.DecodeBytes(len(m.Key.Key)))
return nil
}
@@ -1114,11 +1053,10 @@ func (*LispEidTableDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispEidTableDump) Size() int {
+func (m *LispEidTableDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EidSet
size += 1 // m.PrefixLength
size += 4 // m.Vni
@@ -1128,17 +1066,15 @@ func (m *LispEidTableDump) Size() int {
return size
}
func (m *LispEidTableDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.EidSet))
- buf.EncodeUint8(uint8(m.PrefixLength))
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.EidSet)
+ buf.EncodeUint8(m.PrefixLength)
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Eid.Type))
- buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.Filter))
return buf.Bytes(), nil
}
@@ -1166,24 +1102,21 @@ func (*LispEidTableMapDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispEidTableMapDetails) Size() int {
+func (m *LispEidTableMapDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
size += 4 // m.DpTable
return size
}
func (m *LispEidTableMapDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
- buf.EncodeUint32(uint32(m.DpTable))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
+ buf.EncodeUint32(m.DpTable)
return buf.Bytes(), nil
}
func (m *LispEidTableMapDetails) Unmarshal(b []byte) error {
@@ -1205,21 +1138,18 @@ func (*LispEidTableMapDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispEidTableMapDump) Size() int {
+func (m *LispEidTableMapDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsL2
return size
}
func (m *LispEidTableMapDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsL2)
return buf.Bytes(), nil
}
@@ -1241,22 +1171,19 @@ func (*LispEidTableVniDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispEidTableVniDetails) Size() int {
+func (m *LispEidTableVniDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
return size
}
func (m *LispEidTableVniDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *LispEidTableVniDetails) Unmarshal(b []byte) error {
@@ -1275,20 +1202,17 @@ func (*LispEidTableVniDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispEidTableVniDump) Size() int {
+func (m *LispEidTableVniDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *LispEidTableVniDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *LispEidTableVniDump) Unmarshal(b []byte) error {
@@ -1307,21 +1231,18 @@ func (*LispEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispEnableDisable) Size() int {
+func (m *LispEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *LispEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -1343,27 +1264,24 @@ func (*LispEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispEnableDisableReply) Size() int {
+func (m *LispEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1377,20 +1295,17 @@ func (*LispGetMapRequestItrRlocs) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispGetMapRequestItrRlocs) Size() int {
+func (m *LispGetMapRequestItrRlocs) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *LispGetMapRequestItrRlocs) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *LispGetMapRequestItrRlocs) Unmarshal(b []byte) error {
@@ -1412,29 +1327,26 @@ func (*LispGetMapRequestItrRlocsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispGetMapRequestItrRlocsReply) Size() int {
+func (m *LispGetMapRequestItrRlocsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 64 // m.LocatorSetName
return size
}
func (m *LispGetMapRequestItrRlocsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeString(m.LocatorSetName, 64)
return buf.Bytes(), nil
}
func (m *LispGetMapRequestItrRlocsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.LocatorSetName = buf.DecodeString(64)
return nil
}
@@ -1455,11 +1367,10 @@ func (*LispLocatorDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispLocatorDetails) Size() int {
+func (m *LispLocatorDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Local
size += 4 // m.SwIfIndex
size += 1 // m.IPAddress.Af
@@ -1469,18 +1380,16 @@ func (m *LispLocatorDetails) Size() int {
return size
}
func (m *LispLocatorDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Local))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Local)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Priority))
- buf.EncodeUint8(uint8(m.Weight))
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Priority)
+ buf.EncodeUint8(m.Weight)
return buf.Bytes(), nil
}
func (m *LispLocatorDetails) Unmarshal(b []byte) error {
@@ -1508,26 +1417,23 @@ func (*LispLocatorDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispLocatorDump) Size() int {
+func (m *LispLocatorDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.LsIndex
size += 64 // m.LsName
size += 1 // m.IsIndexSet
return size
}
func (m *LispLocatorDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.LsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.LsIndex)
buf.EncodeString(m.LsName, 64)
- buf.EncodeUint8(uint8(m.IsIndexSet))
+ buf.EncodeUint8(m.IsIndexSet)
return buf.Bytes(), nil
}
func (m *LispLocatorDump) Unmarshal(b []byte) error {
@@ -1551,23 +1457,20 @@ func (*LispLocatorSetDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispLocatorSetDetails) Size() int {
+func (m *LispLocatorSetDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.LsIndex
size += 64 // m.LsName
return size
}
func (m *LispLocatorSetDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.LsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.LsIndex)
buf.EncodeString(m.LsName, 64)
return buf.Bytes(), nil
}
@@ -1590,21 +1493,18 @@ func (*LispLocatorSetDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispLocatorSetDump) Size() int {
+func (m *LispLocatorSetDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Filter
return size
}
func (m *LispLocatorSetDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Filter))
return buf.Bytes(), nil
}
@@ -1628,21 +1528,18 @@ func (*LispMapRegisterEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispMapRegisterEnableDisable) Size() int {
+func (m *LispMapRegisterEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *LispMapRegisterEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -1666,27 +1563,24 @@ func (*LispMapRegisterEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispMapRegisterEnableDisableReply) Size() int {
+func (m *LispMapRegisterEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispMapRegisterEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispMapRegisterEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1702,21 +1596,18 @@ func (*LispMapRequestMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispMapRequestMode) Size() int {
+func (m *LispMapRequestMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsSrcDst
return size
}
func (m *LispMapRequestMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsSrcDst)
return buf.Bytes(), nil
}
@@ -1738,27 +1629,24 @@ func (*LispMapRequestModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispMapRequestModeReply) Size() int {
+func (m *LispMapRequestModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispMapRequestModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispMapRequestModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1774,24 +1662,21 @@ func (*LispMapResolverDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispMapResolverDetails) Size() int {
+func (m *LispMapResolverDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
return size
}
func (m *LispMapResolverDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *LispMapResolverDetails) Unmarshal(b []byte) error {
@@ -1811,20 +1696,17 @@ func (*LispMapResolverDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispMapResolverDump) Size() int {
+func (m *LispMapResolverDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *LispMapResolverDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *LispMapResolverDump) Unmarshal(b []byte) error {
@@ -1843,24 +1725,21 @@ func (*LispMapServerDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispMapServerDetails) Size() int {
+func (m *LispMapServerDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
return size
}
func (m *LispMapServerDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *LispMapServerDetails) Unmarshal(b []byte) error {
@@ -1880,20 +1759,17 @@ func (*LispMapServerDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispMapServerDump) Size() int {
+func (m *LispMapServerDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *LispMapServerDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *LispMapServerDump) Unmarshal(b []byte) error {
@@ -1913,22 +1789,19 @@ func (*LispPitrSetLocatorSet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispPitrSetLocatorSet) Size() int {
+func (m *LispPitrSetLocatorSet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.LsName
return size
}
func (m *LispPitrSetLocatorSet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.LsName, 64)
return buf.Bytes(), nil
@@ -1952,27 +1825,24 @@ func (*LispPitrSetLocatorSetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispPitrSetLocatorSetReply) Size() int {
+func (m *LispPitrSetLocatorSetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispPitrSetLocatorSetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispPitrSetLocatorSetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1988,21 +1858,18 @@ func (*LispRlocProbeEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispRlocProbeEnableDisable) Size() int {
+func (m *LispRlocProbeEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *LispRlocProbeEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -2026,27 +1893,24 @@ func (*LispRlocProbeEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispRlocProbeEnableDisableReply) Size() int {
+func (m *LispRlocProbeEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispRlocProbeEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispRlocProbeEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2063,25 +1927,22 @@ func (*LispUsePetr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LispUsePetr) Size() int {
+func (m *LispUsePetr) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
size += 1 // m.IsAdd
return size
}
func (m *LispUsePetr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -2105,27 +1966,24 @@ func (*LispUsePetrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LispUsePetrReply) Size() int {
+func (m *LispUsePetrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LispUsePetrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LispUsePetrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2139,20 +1997,17 @@ func (*ShowLispMapRegisterState) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowLispMapRegisterState) Size() int {
+func (m *ShowLispMapRegisterState) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowLispMapRegisterState) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowLispMapRegisterState) Unmarshal(b []byte) error {
@@ -2174,29 +2029,26 @@ func (*ShowLispMapRegisterStateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowLispMapRegisterStateReply) Size() int {
+func (m *ShowLispMapRegisterStateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsEnabled
return size
}
func (m *ShowLispMapRegisterStateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsEnabled)
return buf.Bytes(), nil
}
func (m *ShowLispMapRegisterStateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsEnabled = buf.DecodeBool()
return nil
}
@@ -2211,20 +2063,17 @@ func (*ShowLispMapRequestMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowLispMapRequestMode) Size() int {
+func (m *ShowLispMapRequestMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowLispMapRequestMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowLispMapRequestMode) Unmarshal(b []byte) error {
@@ -2246,29 +2095,26 @@ func (*ShowLispMapRequestModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowLispMapRequestModeReply) Size() int {
+func (m *ShowLispMapRequestModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsSrcDst
return size
}
func (m *ShowLispMapRequestModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsSrcDst)
return buf.Bytes(), nil
}
func (m *ShowLispMapRequestModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsSrcDst = buf.DecodeBool()
return nil
}
@@ -2283,20 +2129,17 @@ func (*ShowLispPitr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowLispPitr) Size() int {
+func (m *ShowLispPitr) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowLispPitr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowLispPitr) Unmarshal(b []byte) error {
@@ -2317,31 +2160,28 @@ func (*ShowLispPitrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowLispPitrReply) Size() int {
+func (m *ShowLispPitrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsEnabled
size += 64 // m.LocatorSetName
return size
}
func (m *ShowLispPitrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsEnabled)
buf.EncodeString(m.LocatorSetName, 64)
return buf.Bytes(), nil
}
func (m *ShowLispPitrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsEnabled = buf.DecodeBool()
m.LocatorSetName = buf.DecodeString(64)
return nil
@@ -2357,20 +2197,17 @@ func (*ShowLispRlocProbeState) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowLispRlocProbeState) Size() int {
+func (m *ShowLispRlocProbeState) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowLispRlocProbeState) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowLispRlocProbeState) Unmarshal(b []byte) error {
@@ -2392,29 +2229,26 @@ func (*ShowLispRlocProbeStateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowLispRlocProbeStateReply) Size() int {
+func (m *ShowLispRlocProbeStateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsEnabled
return size
}
func (m *ShowLispRlocProbeStateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsEnabled)
return buf.Bytes(), nil
}
func (m *ShowLispRlocProbeStateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsEnabled = buf.DecodeBool()
return nil
}
@@ -2429,20 +2263,17 @@ func (*ShowLispStatus) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowLispStatus) Size() int {
+func (m *ShowLispStatus) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowLispStatus) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowLispStatus) Unmarshal(b []byte) error {
@@ -2463,31 +2294,28 @@ func (*ShowLispStatusReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowLispStatusReply) Size() int {
+func (m *ShowLispStatusReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsLispEnabled
size += 1 // m.IsGpeEnabled
return size
}
func (m *ShowLispStatusReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsLispEnabled)
buf.EncodeBool(m.IsGpeEnabled)
return buf.Bytes(), nil
}
func (m *ShowLispStatusReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsLispEnabled = buf.DecodeBool()
m.IsGpeEnabled = buf.DecodeBool()
return nil
@@ -2503,20 +2331,17 @@ func (*ShowLispUsePetr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowLispUsePetr) Size() int {
+func (m *ShowLispUsePetr) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowLispUsePetr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowLispUsePetr) Unmarshal(b []byte) error {
@@ -2537,11 +2362,10 @@ func (*ShowLispUsePetrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowLispUsePetrReply) Size() int {
+func (m *ShowLispUsePetrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsPetrEnable
size += 1 // m.IPAddress.Af
@@ -2549,21 +2373,19 @@ func (m *ShowLispUsePetrReply) Size() int {
return size
}
func (m *ShowLispUsePetrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsPetrEnable)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *ShowLispUsePetrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsPetrEnable = buf.DecodeBool()
m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
diff --git a/binapi/lisp_gpe/lisp_gpe.ba.go b/binapi/lisp_gpe/lisp_gpe.ba.go
index bd817a3..4bc7783 100644
--- a/binapi/lisp_gpe/lisp_gpe.ba.go
+++ b/binapi/lisp_gpe/lisp_gpe.ba.go
@@ -75,11 +75,10 @@ func (*GpeAddDelFwdEntry) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeAddDelFwdEntry) Size() int {
+func (m *GpeAddDelFwdEntry) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.RmtEid.Type
size += 1 * 6 // m.RmtEid.Address
@@ -102,29 +101,27 @@ func (m *GpeAddDelFwdEntry) Size() int {
return size
}
func (m *GpeAddDelFwdEntry) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.RmtEid.Type))
- buf.EncodeBytes(m.RmtEid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.RmtEid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.LclEid.Type))
- buf.EncodeBytes(m.LclEid.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Vni))
- buf.EncodeUint32(uint32(m.DpTable))
- buf.EncodeUint8(uint8(m.Action))
+ buf.EncodeBytes(m.LclEid.Address.XXX_UnionData[:], 6)
+ buf.EncodeUint32(m.Vni)
+ buf.EncodeUint32(m.DpTable)
+ buf.EncodeUint8(m.Action)
buf.EncodeUint32(uint32(len(m.Locs)))
for j0 := 0; j0 < len(m.Locs); j0++ {
- var v0 GpeLocator
+ var v0 GpeLocator // Locs
if j0 < len(m.Locs) {
v0 = m.Locs[j0]
}
- buf.EncodeUint8(uint8(v0.Weight))
+ buf.EncodeUint8(v0.Weight)
buf.EncodeUint8(uint8(v0.Addr.Af))
- buf.EncodeBytes(v0.Addr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Addr.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -139,7 +136,7 @@ func (m *GpeAddDelFwdEntry) Unmarshal(b []byte) error {
m.DpTable = buf.DecodeUint32()
m.Action = buf.DecodeUint8()
m.LocNum = buf.DecodeUint32()
- m.Locs = make([]GpeLocator, int(m.LocNum))
+ m.Locs = make([]GpeLocator, m.LocNum)
for j0 := 0; j0 < len(m.Locs); j0++ {
m.Locs[j0].Weight = buf.DecodeUint8()
m.Locs[j0].Addr.Af = ip_types.AddressFamily(buf.DecodeUint8())
@@ -161,29 +158,26 @@ func (*GpeAddDelFwdEntryReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeAddDelFwdEntryReply) Size() int {
+func (m *GpeAddDelFwdEntryReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.FwdEntryIndex
return size
}
func (m *GpeAddDelFwdEntryReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.FwdEntryIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.FwdEntryIndex)
return buf.Bytes(), nil
}
func (m *GpeAddDelFwdEntryReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.FwdEntryIndex = buf.DecodeUint32()
return nil
}
@@ -203,11 +197,10 @@ func (*GpeAddDelIface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeAddDelIface) Size() int {
+func (m *GpeAddDelIface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IsL2
size += 4 // m.DpTable
@@ -215,16 +208,14 @@ func (m *GpeAddDelIface) Size() int {
return size
}
func (m *GpeAddDelIface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.IsL2)
- buf.EncodeUint32(uint32(m.DpTable))
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.DpTable)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *GpeAddDelIface) Unmarshal(b []byte) error {
@@ -248,27 +239,24 @@ func (*GpeAddDelIfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeAddDelIfaceReply) Size() int {
+func (m *GpeAddDelIfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GpeAddDelIfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GpeAddDelIfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -287,11 +275,10 @@ func (*GpeAddDelNativeFwdRpath) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeAddDelNativeFwdRpath) Size() int {
+func (m *GpeAddDelNativeFwdRpath) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.TableID
size += 4 // m.NhSwIfIndex
@@ -300,17 +287,15 @@ func (m *GpeAddDelNativeFwdRpath) Size() int {
return size
}
func (m *GpeAddDelNativeFwdRpath) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.TableID))
+ buf.EncodeUint32(m.TableID)
buf.EncodeUint32(uint32(m.NhSwIfIndex))
buf.EncodeUint8(uint8(m.NhAddr.Af))
- buf.EncodeBytes(m.NhAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.NhAddr.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *GpeAddDelNativeFwdRpath) Unmarshal(b []byte) error {
@@ -337,27 +322,24 @@ func (*GpeAddDelNativeFwdRpathReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeAddDelNativeFwdRpathReply) Size() int {
+func (m *GpeAddDelNativeFwdRpathReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GpeAddDelNativeFwdRpathReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GpeAddDelNativeFwdRpathReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -373,21 +355,18 @@ func (*GpeEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeEnableDisable) Size() int {
+func (m *GpeEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *GpeEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -409,27 +388,24 @@ func (*GpeEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeEnableDisableReply) Size() int {
+func (m *GpeEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GpeEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GpeEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -445,22 +421,19 @@ func (*GpeFwdEntriesGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeFwdEntriesGet) Size() int {
+func (m *GpeFwdEntriesGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
return size
}
func (m *GpeFwdEntriesGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *GpeFwdEntriesGet) Unmarshal(b []byte) error {
@@ -483,11 +456,10 @@ func (*GpeFwdEntriesGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeFwdEntriesGetReply) Size() int {
+func (m *GpeFwdEntriesGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
for j1 := 0; j1 < len(m.Entries); j1++ {
@@ -508,35 +480,33 @@ func (m *GpeFwdEntriesGetReply) Size() int {
return size
}
func (m *GpeFwdEntriesGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.Entries)))
for j0 := 0; j0 < len(m.Entries); j0++ {
- var v0 GpeFwdEntry
+ var v0 GpeFwdEntry // Entries
if j0 < len(m.Entries) {
v0 = m.Entries[j0]
}
- buf.EncodeUint32(uint32(v0.FwdEntryIndex))
- buf.EncodeUint32(uint32(v0.DpTable))
+ buf.EncodeUint32(v0.FwdEntryIndex)
+ buf.EncodeUint32(v0.DpTable)
buf.EncodeUint8(uint8(v0.Leid.Type))
- buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(v0.Reid.Type))
- buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v0.Vni))
- buf.EncodeUint8(uint8(v0.Action))
+ buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 6)
+ buf.EncodeUint32(v0.Vni)
+ buf.EncodeUint8(v0.Action)
}
return buf.Bytes(), nil
}
func (m *GpeFwdEntriesGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
- m.Entries = make([]GpeFwdEntry, int(m.Count))
+ m.Entries = make([]GpeFwdEntry, m.Count)
for j0 := 0; j0 < len(m.Entries); j0++ {
m.Entries[j0].FwdEntryIndex = buf.DecodeUint32()
m.Entries[j0].DpTable = buf.DecodeUint32()
@@ -563,11 +533,10 @@ func (*GpeFwdEntryPathDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeFwdEntryPathDetails) Size() int {
+func (m *GpeFwdEntryPathDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.LclLoc.Weight
size += 1 // m.LclLoc.Addr.Af
size += 1 * 16 // m.LclLoc.Addr.Un
@@ -577,18 +546,16 @@ func (m *GpeFwdEntryPathDetails) Size() int {
return size
}
func (m *GpeFwdEntryPathDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.LclLoc.Weight))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.LclLoc.Weight)
buf.EncodeUint8(uint8(m.LclLoc.Addr.Af))
- buf.EncodeBytes(m.LclLoc.Addr.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.RmtLoc.Weight))
+ buf.EncodeBytes(m.LclLoc.Addr.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.RmtLoc.Weight)
buf.EncodeUint8(uint8(m.RmtLoc.Addr.Af))
- buf.EncodeBytes(m.RmtLoc.Addr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.RmtLoc.Addr.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *GpeFwdEntryPathDetails) Unmarshal(b []byte) error {
@@ -614,22 +581,19 @@ func (*GpeFwdEntryPathDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeFwdEntryPathDump) Size() int {
+func (m *GpeFwdEntryPathDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.FwdEntryIndex
return size
}
func (m *GpeFwdEntryPathDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.FwdEntryIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.FwdEntryIndex)
return buf.Bytes(), nil
}
func (m *GpeFwdEntryPathDump) Unmarshal(b []byte) error {
@@ -648,20 +612,17 @@ func (*GpeFwdEntryVnisGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeFwdEntryVnisGet) Size() int {
+func (m *GpeFwdEntryVnisGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GpeFwdEntryVnisGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GpeFwdEntryVnisGet) Unmarshal(b []byte) error {
@@ -682,37 +643,34 @@ func (*GpeFwdEntryVnisGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeFwdEntryVnisGetReply) Size() int {
+func (m *GpeFwdEntryVnisGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
size += 4 * len(m.Vnis) // m.Vnis
return size
}
func (m *GpeFwdEntryVnisGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.Vnis)))
for i := 0; i < len(m.Vnis); i++ {
var x uint32
if i < len(m.Vnis) {
x = uint32(m.Vnis[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
func (m *GpeFwdEntryVnisGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
m.Vnis = make([]uint32, m.Count)
for i := 0; i < len(m.Vnis); i++ {
@@ -731,20 +689,17 @@ func (*GpeGetEncapMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeGetEncapMode) Size() int {
+func (m *GpeGetEncapMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GpeGetEncapMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GpeGetEncapMode) Unmarshal(b []byte) error {
@@ -764,29 +719,26 @@ func (*GpeGetEncapModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeGetEncapModeReply) Size() int {
+func (m *GpeGetEncapModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.EncapMode
return size
}
func (m *GpeGetEncapModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint8(uint8(m.EncapMode))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint8(m.EncapMode)
return buf.Bytes(), nil
}
func (m *GpeGetEncapModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.EncapMode = buf.DecodeUint8()
return nil
}
@@ -803,21 +755,18 @@ func (*GpeNativeFwdRpathsGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeNativeFwdRpathsGet) Size() int {
+func (m *GpeNativeFwdRpathsGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsIP4
return size
}
func (m *GpeNativeFwdRpathsGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsIP4)
return buf.Bytes(), nil
}
@@ -841,11 +790,10 @@ func (*GpeNativeFwdRpathsGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeNativeFwdRpathsGetReply) Size() int {
+func (m *GpeNativeFwdRpathsGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
for j1 := 0; j1 < len(m.Entries); j1++ {
@@ -862,31 +810,29 @@ func (m *GpeNativeFwdRpathsGetReply) Size() int {
return size
}
func (m *GpeNativeFwdRpathsGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.Entries)))
for j0 := 0; j0 < len(m.Entries); j0++ {
- var v0 GpeNativeFwdRpath
+ var v0 GpeNativeFwdRpath // Entries
if j0 < len(m.Entries) {
v0 = m.Entries[j0]
}
- buf.EncodeUint32(uint32(v0.FibIndex))
+ buf.EncodeUint32(v0.FibIndex)
buf.EncodeUint32(uint32(v0.NhSwIfIndex))
buf.EncodeUint8(uint8(v0.NhAddr.Af))
- buf.EncodeBytes(v0.NhAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.NhAddr.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
func (m *GpeNativeFwdRpathsGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
- m.Entries = make([]GpeNativeFwdRpath, int(m.Count))
+ m.Entries = make([]GpeNativeFwdRpath, m.Count)
for j0 := 0; j0 < len(m.Entries); j0++ {
m.Entries[j0].FibIndex = buf.DecodeUint32()
m.Entries[j0].NhSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
@@ -908,21 +854,18 @@ func (*GpeSetEncapMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GpeSetEncapMode) Size() int {
+func (m *GpeSetEncapMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsVxlan
return size
}
func (m *GpeSetEncapMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsVxlan)
return buf.Bytes(), nil
}
@@ -944,27 +887,24 @@ func (*GpeSetEncapModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GpeSetEncapModeReply) Size() int {
+func (m *GpeSetEncapModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *GpeSetEncapModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *GpeSetEncapModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/lisp_types/lisp_types.ba.go b/binapi/lisp_types/lisp_types.ba.go
index 6bae4b7..49b2c3d 100644
--- a/binapi/lisp_types/lisp_types.ba.go
+++ b/binapi/lisp_types/lisp_types.ba.go
@@ -133,13 +133,13 @@ func EidAddressPrefix(a ip_types.Prefix) (u EidAddress) {
return
}
func (u *EidAddress) SetPrefix(a ip_types.Prefix) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
buf.EncodeUint8(uint8(a.Address.Af))
- buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(a.Len))
+ buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(a.Len)
}
func (u *EidAddress) GetPrefix() (a ip_types.Prefix) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
a.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(a.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
a.Len = buf.DecodeUint8()
@@ -151,11 +151,11 @@ func EidAddressMac(a ethernet_types.MacAddress) (u EidAddress) {
return
}
func (u *EidAddress) SetMac(a ethernet_types.MacAddress) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
buf.EncodeBytes(a[:], 6)
}
func (u *EidAddress) GetMac() (a ethernet_types.MacAddress) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
copy(a[:], buf.DecodeBytes(6))
return
}
@@ -165,12 +165,12 @@ func EidAddressNsh(a Nsh) (u EidAddress) {
return
}
func (u *EidAddress) SetNsh(a Nsh) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
- buf.EncodeUint32(uint32(a.Spi))
- buf.EncodeUint8(uint8(a.Si))
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
+ buf.EncodeUint32(a.Spi)
+ buf.EncodeUint8(a.Si)
}
func (u *EidAddress) GetNsh() (a Nsh) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
a.Spi = buf.DecodeUint32()
a.Si = buf.DecodeUint8()
return
diff --git a/binapi/lldp/lldp.ba.go b/binapi/lldp/lldp.ba.go
index a9bae7f..a8769b5 100644
--- a/binapi/lldp/lldp.ba.go
+++ b/binapi/lldp/lldp.ba.go
@@ -44,25 +44,22 @@ func (*LldpConfig) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LldpConfig) Size() int {
+func (m *LldpConfig) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TxHold
size += 4 // m.TxInterval
size += 4 + len(m.SystemName) // m.SystemName
return size
}
func (m *LldpConfig) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.TxHold))
- buf.EncodeUint32(uint32(m.TxInterval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TxHold)
+ buf.EncodeUint32(m.TxInterval)
buf.EncodeString(m.SystemName, 0)
return buf.Bytes(), nil
}
@@ -86,27 +83,24 @@ func (*LldpConfigReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LldpConfigReply) Size() int {
+func (m *LldpConfigReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *LldpConfigReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *LldpConfigReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -127,11 +121,10 @@ func (*SwInterfaceSetLldp) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetLldp) Size() int {
+func (m *SwInterfaceSetLldp) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 * 4 // m.MgmtIP4
size += 1 * 16 // m.MgmtIP6
@@ -141,16 +134,14 @@ func (m *SwInterfaceSetLldp) Size() int {
return size
}
func (m *SwInterfaceSetLldp) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.MgmtIP4[:], 4)
buf.EncodeBytes(m.MgmtIP6[:], 16)
- buf.EncodeBytes(m.MgmtOid[:], 128)
+ buf.EncodeBytes(m.MgmtOid, 128)
buf.EncodeBool(m.Enable)
buf.EncodeString(m.PortDesc, 0)
return buf.Bytes(), nil
@@ -160,7 +151,8 @@ func (m *SwInterfaceSetLldp) Unmarshal(b []byte) error {
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
copy(m.MgmtIP4[:], buf.DecodeBytes(4))
copy(m.MgmtIP6[:], buf.DecodeBytes(16))
- copy(m.MgmtOid[:], buf.DecodeBytes(128))
+ m.MgmtOid = make([]byte, 128)
+ copy(m.MgmtOid, buf.DecodeBytes(len(m.MgmtOid)))
m.Enable = buf.DecodeBool()
m.PortDesc = buf.DecodeString(0)
return nil
@@ -178,27 +170,24 @@ func (*SwInterfaceSetLldpReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetLldpReply) Size() int {
+func (m *SwInterfaceSetLldpReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetLldpReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetLldpReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/mactime/mactime.ba.go b/binapi/mactime/mactime.ba.go
index 4019d70..deb7472 100644
--- a/binapi/mactime/mactime.ba.go
+++ b/binapi/mactime/mactime.ba.go
@@ -64,11 +64,10 @@ func (*MactimeAddDelRange) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MactimeAddDelRange) Size() int {
+func (m *MactimeAddDelRange) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Drop
size += 1 // m.Allow
@@ -90,28 +89,26 @@ func (m *MactimeAddDelRange) Size() int {
return size
}
func (m *MactimeAddDelRange) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.Drop)
buf.EncodeBool(m.Allow)
- buf.EncodeUint8(uint8(m.AllowQuota))
+ buf.EncodeUint8(m.AllowQuota)
buf.EncodeBool(m.NoUDP10001)
- buf.EncodeUint64(uint64(m.DataQuota))
+ buf.EncodeUint64(m.DataQuota)
buf.EncodeBytes(m.MacAddress[:], 6)
buf.EncodeString(m.DeviceName, 64)
buf.EncodeUint32(uint32(len(m.Ranges)))
for j0 := 0; j0 < len(m.Ranges); j0++ {
- var v0 TimeRange
+ var v0 TimeRange // Ranges
if j0 < len(m.Ranges) {
v0 = m.Ranges[j0]
}
- buf.EncodeFloat64(float64(v0.Start))
- buf.EncodeFloat64(float64(v0.End))
+ buf.EncodeFloat64(v0.Start)
+ buf.EncodeFloat64(v0.End)
}
return buf.Bytes(), nil
}
@@ -126,10 +123,10 @@ func (m *MactimeAddDelRange) Unmarshal(b []byte) error {
copy(m.MacAddress[:], buf.DecodeBytes(6))
m.DeviceName = buf.DecodeString(64)
m.Count = buf.DecodeUint32()
- m.Ranges = make([]TimeRange, int(m.Count))
+ m.Ranges = make([]TimeRange, m.Count)
for j0 := 0; j0 < len(m.Ranges); j0++ {
- m.Ranges[j0].Start = float64(buf.DecodeFloat64())
- m.Ranges[j0].End = float64(buf.DecodeFloat64())
+ m.Ranges[j0].Start = buf.DecodeFloat64()
+ m.Ranges[j0].End = buf.DecodeFloat64()
}
return nil
}
@@ -146,27 +143,24 @@ func (*MactimeAddDelRangeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MactimeAddDelRangeReply) Size() int {
+func (m *MactimeAddDelRangeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MactimeAddDelRangeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MactimeAddDelRangeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -189,11 +183,10 @@ func (*MactimeDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MactimeDetails) Size() int {
+func (m *MactimeDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PoolIndex
size += 1 * 6 // m.MacAddress
size += 8 // m.DataQuota
@@ -213,26 +206,24 @@ func (m *MactimeDetails) Size() int {
return size
}
func (m *MactimeDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PoolIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PoolIndex)
buf.EncodeBytes(m.MacAddress[:], 6)
- buf.EncodeUint64(uint64(m.DataQuota))
- buf.EncodeUint64(uint64(m.DataUsedInRange))
- buf.EncodeUint32(uint32(m.Flags))
+ buf.EncodeUint64(m.DataQuota)
+ buf.EncodeUint64(m.DataUsedInRange)
+ buf.EncodeUint32(m.Flags)
buf.EncodeString(m.DeviceName, 64)
buf.EncodeUint32(uint32(len(m.Ranges)))
for j0 := 0; j0 < len(m.Ranges); j0++ {
- var v0 MactimeTimeRange
+ var v0 MactimeTimeRange // Ranges
if j0 < len(m.Ranges) {
v0 = m.Ranges[j0]
}
- buf.EncodeFloat64(float64(v0.Start))
- buf.EncodeFloat64(float64(v0.End))
+ buf.EncodeFloat64(v0.Start)
+ buf.EncodeFloat64(v0.End)
}
return buf.Bytes(), nil
}
@@ -245,10 +236,10 @@ func (m *MactimeDetails) Unmarshal(b []byte) error {
m.Flags = buf.DecodeUint32()
m.DeviceName = buf.DecodeString(64)
m.Nranges = buf.DecodeUint32()
- m.Ranges = make([]MactimeTimeRange, int(m.Nranges))
+ m.Ranges = make([]MactimeTimeRange, m.Nranges)
for j0 := 0; j0 < len(m.Ranges); j0++ {
- m.Ranges[j0].Start = float64(buf.DecodeFloat64())
- m.Ranges[j0].End = float64(buf.DecodeFloat64())
+ m.Ranges[j0].Start = buf.DecodeFloat64()
+ m.Ranges[j0].End = buf.DecodeFloat64()
}
return nil
}
@@ -265,22 +256,19 @@ func (*MactimeDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MactimeDump) Size() int {
+func (m *MactimeDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.MyTableEpoch
return size
}
func (m *MactimeDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.MyTableEpoch))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.MyTableEpoch)
return buf.Bytes(), nil
}
func (m *MactimeDump) Unmarshal(b []byte) error {
@@ -302,29 +290,26 @@ func (*MactimeDumpReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MactimeDumpReply) Size() int {
+func (m *MactimeDumpReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.TableEpoch
return size
}
func (m *MactimeDumpReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.TableEpoch))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.TableEpoch)
return buf.Bytes(), nil
}
func (m *MactimeDumpReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.TableEpoch = buf.DecodeUint32()
return nil
}
@@ -342,22 +327,19 @@ func (*MactimeEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MactimeEnableDisable) Size() int {
+func (m *MactimeEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
size += 4 // m.SwIfIndex
return size
}
func (m *MactimeEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -381,27 +363,24 @@ func (*MactimeEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MactimeEnableDisableReply) Size() int {
+func (m *MactimeEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MactimeEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MactimeEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/map/map.ba.go b/binapi/map/map.ba.go
index fc3c733..b906284 100644
--- a/binapi/map/map.ba.go
+++ b/binapi/map/map.ba.go
@@ -45,11 +45,10 @@ func (*MapAddDelRule) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapAddDelRule) Size() int {
+func (m *MapAddDelRule) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Index
size += 1 // m.IsAdd
size += 1 * 16 // m.IP6Dst
@@ -57,16 +56,14 @@ func (m *MapAddDelRule) Size() int {
return size
}
func (m *MapAddDelRule) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Index))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Index)
buf.EncodeBool(m.IsAdd)
buf.EncodeBytes(m.IP6Dst[:], 16)
- buf.EncodeUint16(uint16(m.Psid))
+ buf.EncodeUint16(m.Psid)
return buf.Bytes(), nil
}
func (m *MapAddDelRule) Unmarshal(b []byte) error {
@@ -90,27 +87,24 @@ func (*MapAddDelRuleReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapAddDelRuleReply) Size() int {
+func (m *MapAddDelRuleReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapAddDelRuleReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapAddDelRuleReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -122,7 +116,7 @@ type MapAddDomain struct {
EaBitsLen uint8 `binapi:"u8,name=ea_bits_len" json:"ea_bits_len,omitempty"`
PsidOffset uint8 `binapi:"u8,name=psid_offset" json:"psid_offset,omitempty"`
PsidLength uint8 `binapi:"u8,name=psid_length" json:"psid_length,omitempty"`
- Mtu uint16 `binapi:"u16,name=mtu,default=%!s(float64=1280)" json:"mtu,omitempty"`
+ Mtu uint16 `binapi:"u16,name=mtu,default=1280" json:"mtu,omitempty"`
Tag string `binapi:"string[64],name=tag" json:"tag,omitempty"`
}
@@ -133,11 +127,10 @@ func (*MapAddDomain) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapAddDomain) Size() int {
+func (m *MapAddDomain) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.IP6Prefix.Address
size += 1 // m.IP6Prefix.Len
size += 1 * 4 // m.IP4Prefix.Address
@@ -152,22 +145,20 @@ func (m *MapAddDomain) Size() int {
return size
}
func (m *MapAddDomain) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IP6Prefix.Address[:], 16)
- buf.EncodeUint8(uint8(m.IP6Prefix.Len))
+ buf.EncodeUint8(m.IP6Prefix.Len)
buf.EncodeBytes(m.IP4Prefix.Address[:], 4)
- buf.EncodeUint8(uint8(m.IP4Prefix.Len))
+ buf.EncodeUint8(m.IP4Prefix.Len)
buf.EncodeBytes(m.IP6Src.Address[:], 16)
- buf.EncodeUint8(uint8(m.IP6Src.Len))
- buf.EncodeUint8(uint8(m.EaBitsLen))
- buf.EncodeUint8(uint8(m.PsidOffset))
- buf.EncodeUint8(uint8(m.PsidLength))
- buf.EncodeUint16(uint16(m.Mtu))
+ buf.EncodeUint8(m.IP6Src.Len)
+ buf.EncodeUint8(m.EaBitsLen)
+ buf.EncodeUint8(m.PsidOffset)
+ buf.EncodeUint8(m.PsidLength)
+ buf.EncodeUint16(m.Mtu)
buf.EncodeString(m.Tag, 64)
return buf.Bytes(), nil
}
@@ -200,30 +191,27 @@ func (*MapAddDomainReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapAddDomainReply) Size() int {
+func (m *MapAddDomainReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Index
size += 4 // m.Retval
return size
}
func (m *MapAddDomainReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Index))
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Index)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapAddDomainReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Index = buf.DecodeUint32()
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -239,22 +227,19 @@ func (*MapDelDomain) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapDelDomain) Size() int {
+func (m *MapDelDomain) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Index
return size
}
func (m *MapDelDomain) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Index))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Index)
return buf.Bytes(), nil
}
func (m *MapDelDomain) Unmarshal(b []byte) error {
@@ -275,27 +260,24 @@ func (*MapDelDomainReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapDelDomainReply) Size() int {
+func (m *MapDelDomainReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapDelDomainReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapDelDomainReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -320,11 +302,10 @@ func (*MapDomainDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapDomainDetails) Size() int {
+func (m *MapDomainDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.DomainIndex
size += 1 * 16 // m.IP6Prefix.Address
size += 1 // m.IP6Prefix.Len
@@ -341,24 +322,22 @@ func (m *MapDomainDetails) Size() int {
return size
}
func (m *MapDomainDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.DomainIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.DomainIndex)
buf.EncodeBytes(m.IP6Prefix.Address[:], 16)
- buf.EncodeUint8(uint8(m.IP6Prefix.Len))
+ buf.EncodeUint8(m.IP6Prefix.Len)
buf.EncodeBytes(m.IP4Prefix.Address[:], 4)
- buf.EncodeUint8(uint8(m.IP4Prefix.Len))
+ buf.EncodeUint8(m.IP4Prefix.Len)
buf.EncodeBytes(m.IP6Src.Address[:], 16)
- buf.EncodeUint8(uint8(m.IP6Src.Len))
- buf.EncodeUint8(uint8(m.EaBitsLen))
- buf.EncodeUint8(uint8(m.PsidOffset))
- buf.EncodeUint8(uint8(m.PsidLength))
- buf.EncodeUint8(uint8(m.Flags))
- buf.EncodeUint16(uint16(m.Mtu))
+ buf.EncodeUint8(m.IP6Src.Len)
+ buf.EncodeUint8(m.EaBitsLen)
+ buf.EncodeUint8(m.PsidOffset)
+ buf.EncodeUint8(m.PsidLength)
+ buf.EncodeUint8(m.Flags)
+ buf.EncodeUint16(m.Mtu)
buf.EncodeString(m.Tag, 64)
return buf.Bytes(), nil
}
@@ -390,20 +369,17 @@ func (*MapDomainDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapDomainDump) Size() int {
+func (m *MapDomainDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *MapDomainDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *MapDomainDump) Unmarshal(b []byte) error {
@@ -424,23 +400,20 @@ func (*MapIfEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapIfEnableDisable) Size() int {
+func (m *MapIfEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsEnable
size += 1 // m.IsTranslation
return size
}
func (m *MapIfEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsEnable)
buf.EncodeBool(m.IsTranslation)
@@ -466,27 +439,24 @@ func (*MapIfEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapIfEnableDisableReply) Size() int {
+func (m *MapIfEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapIfEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapIfEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -504,23 +474,20 @@ func (*MapParamAddDelPreResolve) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapParamAddDelPreResolve) Size() int {
+func (m *MapParamAddDelPreResolve) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 * 4 // m.IP4NhAddress
size += 1 * 16 // m.IP6NhAddress
return size
}
func (m *MapParamAddDelPreResolve) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBytes(m.IP4NhAddress[:], 4)
buf.EncodeBytes(m.IP6NhAddress[:], 16)
@@ -548,27 +515,24 @@ func (*MapParamAddDelPreResolveReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapParamAddDelPreResolveReply) Size() int {
+func (m *MapParamAddDelPreResolveReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapParamAddDelPreResolveReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapParamAddDelPreResolveReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -582,20 +546,17 @@ func (*MapParamGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapParamGet) Size() int {
+func (m *MapParamGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *MapParamGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *MapParamGet) Unmarshal(b []byte) error {
@@ -628,11 +589,10 @@ func (*MapParamGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapParamGetReply) Size() int {
+func (m *MapParamGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.FragInner
size += 1 // m.FragIgnoreDf
@@ -651,32 +611,30 @@ func (m *MapParamGetReply) Size() int {
return size
}
func (m *MapParamGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint8(uint8(m.FragInner))
- buf.EncodeUint8(uint8(m.FragIgnoreDf))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint8(m.FragInner)
+ buf.EncodeUint8(m.FragIgnoreDf)
buf.EncodeBytes(m.ICMPIP4ErrRelaySrc[:], 4)
buf.EncodeBool(m.ICMP6EnableUnreachable)
buf.EncodeBytes(m.IP4NhAddress[:], 4)
buf.EncodeBytes(m.IP6NhAddress[:], 16)
- buf.EncodeUint16(uint16(m.IP4LifetimeMs))
- buf.EncodeUint16(uint16(m.IP4PoolSize))
- buf.EncodeUint32(uint32(m.IP4Buffers))
- buf.EncodeFloat64(float64(m.IP4HtRatio))
+ buf.EncodeUint16(m.IP4LifetimeMs)
+ buf.EncodeUint16(m.IP4PoolSize)
+ buf.EncodeUint32(m.IP4Buffers)
+ buf.EncodeFloat64(m.IP4HtRatio)
buf.EncodeBool(m.SecCheckEnable)
buf.EncodeBool(m.SecCheckFragments)
buf.EncodeBool(m.TcCopy)
- buf.EncodeUint8(uint8(m.TcClass))
+ buf.EncodeUint8(m.TcClass)
return buf.Bytes(), nil
}
func (m *MapParamGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.FragInner = buf.DecodeUint8()
m.FragIgnoreDf = buf.DecodeUint8()
copy(m.ICMPIP4ErrRelaySrc[:], buf.DecodeBytes(4))
@@ -686,7 +644,7 @@ func (m *MapParamGetReply) Unmarshal(b []byte) error {
m.IP4LifetimeMs = buf.DecodeUint16()
m.IP4PoolSize = buf.DecodeUint16()
m.IP4Buffers = buf.DecodeUint32()
- m.IP4HtRatio = float64(buf.DecodeFloat64())
+ m.IP4HtRatio = buf.DecodeFloat64()
m.SecCheckEnable = buf.DecodeBool()
m.SecCheckFragments = buf.DecodeBool()
m.TcCopy = buf.DecodeBool()
@@ -707,22 +665,19 @@ func (*MapParamSetFragmentation) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapParamSetFragmentation) Size() int {
+func (m *MapParamSetFragmentation) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Inner
size += 1 // m.IgnoreDf
return size
}
func (m *MapParamSetFragmentation) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Inner)
buf.EncodeBool(m.IgnoreDf)
return buf.Bytes(), nil
@@ -748,27 +703,24 @@ func (*MapParamSetFragmentationReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapParamSetFragmentationReply) Size() int {
+func (m *MapParamSetFragmentationReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapParamSetFragmentationReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapParamSetFragmentationReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -784,21 +736,18 @@ func (*MapParamSetICMP) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapParamSetICMP) Size() int {
+func (m *MapParamSetICMP) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IP4ErrRelaySrc
return size
}
func (m *MapParamSetICMP) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IP4ErrRelaySrc[:], 4)
return buf.Bytes(), nil
}
@@ -820,21 +769,18 @@ func (*MapParamSetICMP6) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapParamSetICMP6) Size() int {
+func (m *MapParamSetICMP6) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableUnreachable
return size
}
func (m *MapParamSetICMP6) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableUnreachable)
return buf.Bytes(), nil
}
@@ -856,27 +802,24 @@ func (*MapParamSetICMP6Reply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapParamSetICMP6Reply) Size() int {
+func (m *MapParamSetICMP6Reply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapParamSetICMP6Reply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapParamSetICMP6Reply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -892,27 +835,24 @@ func (*MapParamSetICMPReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapParamSetICMPReply) Size() int {
+func (m *MapParamSetICMPReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapParamSetICMPReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapParamSetICMPReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -929,22 +869,19 @@ func (*MapParamSetSecurityCheck) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapParamSetSecurityCheck) Size() int {
+func (m *MapParamSetSecurityCheck) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
size += 1 // m.Fragments
return size
}
func (m *MapParamSetSecurityCheck) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
buf.EncodeBool(m.Fragments)
return buf.Bytes(), nil
@@ -970,27 +907,24 @@ func (*MapParamSetSecurityCheckReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapParamSetSecurityCheckReply) Size() int {
+func (m *MapParamSetSecurityCheckReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapParamSetSecurityCheckReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapParamSetSecurityCheckReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1006,22 +940,19 @@ func (*MapParamSetTCP) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapParamSetTCP) Size() int {
+func (m *MapParamSetTCP) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.TCPMss
return size
}
func (m *MapParamSetTCP) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.TCPMss))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.TCPMss)
return buf.Bytes(), nil
}
func (m *MapParamSetTCP) Unmarshal(b []byte) error {
@@ -1042,27 +973,24 @@ func (*MapParamSetTCPReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapParamSetTCPReply) Size() int {
+func (m *MapParamSetTCPReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapParamSetTCPReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapParamSetTCPReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1079,24 +1007,21 @@ func (*MapParamSetTrafficClass) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapParamSetTrafficClass) Size() int {
+func (m *MapParamSetTrafficClass) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Copy
size += 1 // m.TcClass
return size
}
func (m *MapParamSetTrafficClass) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Copy)
- buf.EncodeUint8(uint8(m.TcClass))
+ buf.EncodeUint8(m.TcClass)
return buf.Bytes(), nil
}
func (m *MapParamSetTrafficClass) Unmarshal(b []byte) error {
@@ -1120,27 +1045,24 @@ func (*MapParamSetTrafficClassReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapParamSetTrafficClassReply) Size() int {
+func (m *MapParamSetTrafficClassReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MapParamSetTrafficClassReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MapParamSetTrafficClassReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1157,24 +1079,21 @@ func (*MapRuleDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapRuleDetails) Size() int {
+func (m *MapRuleDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.IP6Dst
size += 2 // m.Psid
return size
}
func (m *MapRuleDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IP6Dst[:], 16)
- buf.EncodeUint16(uint16(m.Psid))
+ buf.EncodeUint16(m.Psid)
return buf.Bytes(), nil
}
func (m *MapRuleDetails) Unmarshal(b []byte) error {
@@ -1196,22 +1115,19 @@ func (*MapRuleDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapRuleDump) Size() int {
+func (m *MapRuleDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.DomainIndex
return size
}
func (m *MapRuleDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.DomainIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.DomainIndex)
return buf.Bytes(), nil
}
func (m *MapRuleDump) Unmarshal(b []byte) error {
@@ -1230,20 +1146,17 @@ func (*MapSummaryStats) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MapSummaryStats) Size() int {
+func (m *MapSummaryStats) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *MapSummaryStats) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *MapSummaryStats) Unmarshal(b []byte) error {
@@ -1267,11 +1180,10 @@ func (*MapSummaryStatsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MapSummaryStatsReply) Size() int {
+func (m *MapSummaryStatsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 8 // m.TotalBindings
size += 8 * 2 // m.TotalPkts
@@ -1281,41 +1193,39 @@ func (m *MapSummaryStatsReply) Size() int {
return size
}
func (m *MapSummaryStatsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint64(uint64(m.TotalBindings))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint64(m.TotalBindings)
for i := 0; i < 2; i++ {
var x uint64
if i < len(m.TotalPkts) {
x = uint64(m.TotalPkts[i])
}
- buf.EncodeUint64(uint64(x))
+ buf.EncodeUint64(x)
}
for i := 0; i < 2; i++ {
var x uint64
if i < len(m.TotalBytes) {
x = uint64(m.TotalBytes[i])
}
- buf.EncodeUint64(uint64(x))
+ buf.EncodeUint64(x)
}
- buf.EncodeUint64(uint64(m.TotalIP4Fragments))
+ buf.EncodeUint64(m.TotalIP4Fragments)
for i := 0; i < 2; i++ {
var x uint64
if i < len(m.TotalSecurityCheck) {
x = uint64(m.TotalSecurityCheck[i])
}
- buf.EncodeUint64(uint64(x))
+ buf.EncodeUint64(x)
}
return buf.Bytes(), nil
}
func (m *MapSummaryStatsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.TotalBindings = buf.DecodeUint64()
m.TotalPkts = make([]uint64, 2)
for i := 0; i < len(m.TotalPkts); i++ {
diff --git a/binapi/mdata/mdata.ba.go b/binapi/mdata/mdata.ba.go
index aba1dee..d4715f7 100644
--- a/binapi/mdata/mdata.ba.go
+++ b/binapi/mdata/mdata.ba.go
@@ -41,21 +41,18 @@ func (*MdataEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MdataEnableDisable) Size() int {
+func (m *MdataEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
return size
}
func (m *MdataEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
return buf.Bytes(), nil
}
@@ -77,27 +74,24 @@ func (*MdataEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MdataEnableDisableReply) Size() int {
+func (m *MdataEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MdataEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MdataEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/memclnt/memclnt.ba.go b/binapi/memclnt/memclnt.ba.go
index 915379c..3bbf88d 100644
--- a/binapi/memclnt/memclnt.ba.go
+++ b/binapi/memclnt/memclnt.ba.go
@@ -53,20 +53,17 @@ func (*APIVersions) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *APIVersions) Size() int {
+func (m *APIVersions) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *APIVersions) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *APIVersions) Unmarshal(b []byte) error {
@@ -87,11 +84,10 @@ func (*APIVersionsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *APIVersionsReply) Size() int {
+func (m *APIVersionsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
for j1 := 0; j1 < len(m.APIVersions); j1++ {
@@ -108,31 +104,29 @@ func (m *APIVersionsReply) Size() int {
return size
}
func (m *APIVersionsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.APIVersions)))
for j0 := 0; j0 < len(m.APIVersions); j0++ {
- var v0 ModuleVersion
+ var v0 ModuleVersion // APIVersions
if j0 < len(m.APIVersions) {
v0 = m.APIVersions[j0]
}
- buf.EncodeUint32(uint32(v0.Major))
- buf.EncodeUint32(uint32(v0.Minor))
- buf.EncodeUint32(uint32(v0.Patch))
+ buf.EncodeUint32(v0.Major)
+ buf.EncodeUint32(v0.Minor)
+ buf.EncodeUint32(v0.Patch)
buf.EncodeString(v0.Name, 64)
}
return buf.Bytes(), nil
}
func (m *APIVersionsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
- m.APIVersions = make([]ModuleVersion, int(m.Count))
+ m.APIVersions = make([]ModuleVersion, m.Count)
for j0 := 0; j0 < len(m.APIVersions); j0++ {
m.APIVersions[j0].Major = buf.DecodeUint32()
m.APIVersions[j0].Minor = buf.DecodeUint32()
@@ -154,21 +148,18 @@ func (*GetFirstMsgID) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GetFirstMsgID) Size() int {
+func (m *GetFirstMsgID) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
return size
}
func (m *GetFirstMsgID) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
return buf.Bytes(), nil
}
@@ -191,29 +182,26 @@ func (*GetFirstMsgIDReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GetFirstMsgIDReply) Size() int {
+func (m *GetFirstMsgIDReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 2 // m.FirstMsgID
return size
}
func (m *GetFirstMsgIDReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint16(uint16(m.FirstMsgID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint16(m.FirstMsgID)
return buf.Bytes(), nil
}
func (m *GetFirstMsgIDReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.FirstMsgID = buf.DecodeUint16()
return nil
}
@@ -233,11 +221,10 @@ func (*MemclntCreate) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MemclntCreate) Size() int {
+func (m *MemclntCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.CtxQuota
size += 8 // m.InputQueue
size += 64 // m.Name
@@ -245,27 +232,25 @@ func (m *MemclntCreate) Size() int {
return size
}
func (m *MemclntCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.CtxQuota))
- buf.EncodeUint64(uint64(m.InputQueue))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.CtxQuota)
+ buf.EncodeUint64(m.InputQueue)
buf.EncodeString(m.Name, 64)
for i := 0; i < 8; i++ {
var x uint32
if i < len(m.APIVersions) {
x = uint32(m.APIVersions[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
func (m *MemclntCreate) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.CtxQuota = int32(buf.DecodeUint32())
+ m.CtxQuota = buf.DecodeInt32()
m.InputQueue = buf.DecodeUint64()
m.Name = buf.DecodeString(64)
m.APIVersions = make([]uint32, 8)
@@ -290,11 +275,10 @@ func (*MemclntCreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MemclntCreateReply) Size() int {
+func (m *MemclntCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Response
size += 8 // m.Handle
size += 4 // m.Index
@@ -302,21 +286,19 @@ func (m *MemclntCreateReply) Size() int {
return size
}
func (m *MemclntCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Response))
- buf.EncodeUint64(uint64(m.Handle))
- buf.EncodeUint32(uint32(m.Index))
- buf.EncodeUint64(uint64(m.MessageTable))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Response)
+ buf.EncodeUint64(m.Handle)
+ buf.EncodeUint32(m.Index)
+ buf.EncodeUint64(m.MessageTable)
return buf.Bytes(), nil
}
func (m *MemclntCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Response = int32(buf.DecodeUint32())
+ m.Response = buf.DecodeInt32()
m.Handle = buf.DecodeUint64()
m.Index = buf.DecodeUint32()
m.MessageTable = buf.DecodeUint64()
@@ -337,25 +319,22 @@ func (*MemclntDelete) GetMessageType() api.MessageType {
return api.OtherMessage
}
-func (m *MemclntDelete) Size() int {
+func (m *MemclntDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Index
size += 8 // m.Handle
size += 1 // m.DoCleanup
return size
}
func (m *MemclntDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Index))
- buf.EncodeUint64(uint64(m.Handle))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Index)
+ buf.EncodeUint64(m.Handle)
buf.EncodeBool(m.DoCleanup)
return buf.Bytes(), nil
}
@@ -380,29 +359,26 @@ func (*MemclntDeleteReply) GetMessageType() api.MessageType {
return api.OtherMessage
}
-func (m *MemclntDeleteReply) Size() int {
+func (m *MemclntDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Response
size += 8 // m.Handle
return size
}
func (m *MemclntDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Response))
- buf.EncodeUint64(uint64(m.Handle))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Response)
+ buf.EncodeUint64(m.Handle)
return buf.Bytes(), nil
}
func (m *MemclntDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Response = int32(buf.DecodeUint32())
+ m.Response = buf.DecodeInt32()
m.Handle = buf.DecodeUint64()
return nil
}
@@ -417,20 +393,17 @@ func (*MemclntKeepalive) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MemclntKeepalive) Size() int {
+func (m *MemclntKeepalive) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *MemclntKeepalive) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *MemclntKeepalive) Unmarshal(b []byte) error {
@@ -449,27 +422,24 @@ func (*MemclntKeepaliveReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MemclntKeepaliveReply) Size() int {
+func (m *MemclntKeepaliveReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MemclntKeepaliveReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MemclntKeepaliveReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -485,22 +455,19 @@ func (*MemclntReadTimeout) GetMessageType() api.MessageType {
return api.OtherMessage
}
-func (m *MemclntReadTimeout) Size() int {
+func (m *MemclntReadTimeout) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Dummy
return size
}
func (m *MemclntReadTimeout) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Dummy))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Dummy)
return buf.Bytes(), nil
}
func (m *MemclntReadTimeout) Unmarshal(b []byte) error {
@@ -521,22 +488,19 @@ func (*MemclntRxThreadSuspend) GetMessageType() api.MessageType {
return api.OtherMessage
}
-func (m *MemclntRxThreadSuspend) Size() int {
+func (m *MemclntRxThreadSuspend) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Dummy
return size
}
func (m *MemclntRxThreadSuspend) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Dummy))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Dummy)
return buf.Bytes(), nil
}
func (m *MemclntRxThreadSuspend) Unmarshal(b []byte) error {
@@ -562,11 +526,10 @@ func (*RPCCall) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *RPCCall) Size() int {
+func (m *RPCCall) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.Function
size += 1 // m.Multicast
size += 1 // m.NeedBarrierSync
@@ -576,18 +539,16 @@ func (m *RPCCall) Size() int {
return size
}
func (m *RPCCall) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint64(uint64(m.Function))
- buf.EncodeUint8(uint8(m.Multicast))
- buf.EncodeUint8(uint8(m.NeedBarrierSync))
- buf.EncodeUint8(uint8(m.SendReply))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint64(m.Function)
+ buf.EncodeUint8(m.Multicast)
+ buf.EncodeUint8(m.NeedBarrierSync)
+ buf.EncodeUint8(m.SendReply)
buf.EncodeUint32(uint32(len(m.Data)))
- buf.EncodeBytes(m.Data[:], 0)
+ buf.EncodeBytes(m.Data, 0)
return buf.Bytes(), nil
}
func (m *RPCCall) Unmarshal(b []byte) error {
@@ -597,7 +558,8 @@ func (m *RPCCall) Unmarshal(b []byte) error {
m.NeedBarrierSync = buf.DecodeUint8()
m.SendReply = buf.DecodeUint8()
m.DataLen = buf.DecodeUint32()
- copy(m.Data[:], buf.DecodeBytes(0))
+ m.Data = make([]byte, m.DataLen)
+ copy(m.Data, buf.DecodeBytes(len(m.Data)))
return nil
}
@@ -613,27 +575,24 @@ func (*RPCCallReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *RPCCallReply) Size() int {
+func (m *RPCCallReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *RPCCallReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *RPCCallReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -649,22 +608,19 @@ func (*RxThreadExit) GetMessageType() api.MessageType {
return api.OtherMessage
}
-func (m *RxThreadExit) Size() int {
+func (m *RxThreadExit) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Dummy
return size
}
func (m *RxThreadExit) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Dummy))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Dummy)
return buf.Bytes(), nil
}
func (m *RxThreadExit) Unmarshal(b []byte) error {
@@ -687,31 +643,28 @@ func (*SockInitShm) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SockInitShm) Size() int {
+func (m *SockInitShm) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.RequestedSize
size += 1 // m.Nitems
size += 8 * len(m.Configs) // m.Configs
return size
}
func (m *SockInitShm) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.RequestedSize))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.RequestedSize)
buf.EncodeUint8(uint8(len(m.Configs)))
for i := 0; i < len(m.Configs); i++ {
var x uint64
if i < len(m.Configs) {
x = uint64(m.Configs[i])
}
- buf.EncodeUint64(uint64(x))
+ buf.EncodeUint64(x)
}
return buf.Bytes(), nil
}
@@ -738,27 +691,24 @@ func (*SockInitShmReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SockInitShmReply) Size() int {
+func (m *SockInitShmReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SockInitShmReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SockInitShmReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -774,21 +724,18 @@ func (*SockclntCreate) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SockclntCreate) Size() int {
+func (m *SockclntCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
return size
}
func (m *SockclntCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
return buf.Bytes(), nil
}
@@ -813,11 +760,10 @@ func (*SockclntCreateReply) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SockclntCreateReply) Size() int {
+func (m *SockclntCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Response
size += 4 // m.Index
size += 2 // m.Count
@@ -833,31 +779,29 @@ func (m *SockclntCreateReply) Size() int {
return size
}
func (m *SockclntCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Response))
- buf.EncodeUint32(uint32(m.Index))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Response)
+ buf.EncodeUint32(m.Index)
buf.EncodeUint16(uint16(len(m.MessageTable)))
for j0 := 0; j0 < len(m.MessageTable); j0++ {
- var v0 MessageTableEntry
+ var v0 MessageTableEntry // MessageTable
if j0 < len(m.MessageTable) {
v0 = m.MessageTable[j0]
}
- buf.EncodeUint16(uint16(v0.Index))
+ buf.EncodeUint16(v0.Index)
buf.EncodeString(v0.Name, 64)
}
return buf.Bytes(), nil
}
func (m *SockclntCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Response = int32(buf.DecodeUint32())
+ m.Response = buf.DecodeInt32()
m.Index = buf.DecodeUint32()
m.Count = buf.DecodeUint16()
- m.MessageTable = make([]MessageTableEntry, int(m.Count))
+ m.MessageTable = make([]MessageTableEntry, m.Count)
for j0 := 0; j0 < len(m.MessageTable); j0++ {
m.MessageTable[j0].Index = buf.DecodeUint16()
m.MessageTable[j0].Name = buf.DecodeString(64)
@@ -877,22 +821,19 @@ func (*SockclntDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SockclntDelete) Size() int {
+func (m *SockclntDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Index
return size
}
func (m *SockclntDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Index))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Index)
return buf.Bytes(), nil
}
func (m *SockclntDelete) Unmarshal(b []byte) error {
@@ -913,27 +854,24 @@ func (*SockclntDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SockclntDeleteReply) Size() int {
+func (m *SockclntDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Response
return size
}
func (m *SockclntDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Response))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Response)
return buf.Bytes(), nil
}
func (m *SockclntDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Response = int32(buf.DecodeUint32())
+ m.Response = buf.DecodeInt32()
return nil
}
@@ -951,26 +889,23 @@ func (*TracePluginMsgIds) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TracePluginMsgIds) Size() int {
+func (m *TracePluginMsgIds) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 128 // m.PluginName
size += 2 // m.FirstMsgID
size += 2 // m.LastMsgID
return size
}
func (m *TracePluginMsgIds) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.PluginName, 128)
- buf.EncodeUint16(uint16(m.FirstMsgID))
- buf.EncodeUint16(uint16(m.LastMsgID))
+ buf.EncodeUint16(m.FirstMsgID)
+ buf.EncodeUint16(m.LastMsgID)
return buf.Bytes(), nil
}
func (m *TracePluginMsgIds) Unmarshal(b []byte) error {
diff --git a/binapi/memif/memif.ba.go b/binapi/memif/memif.ba.go
index be5d392..adc41b6 100644
--- a/binapi/memif/memif.ba.go
+++ b/binapi/memif/memif.ba.go
@@ -111,11 +111,10 @@ func (*MemifCreate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MemifCreate) Size() int {
+func (m *MemifCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Role
size += 4 // m.Mode
size += 1 // m.RxQueues
@@ -130,20 +129,18 @@ func (m *MemifCreate) Size() int {
return size
}
func (m *MemifCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Role))
buf.EncodeUint32(uint32(m.Mode))
- buf.EncodeUint8(uint8(m.RxQueues))
- buf.EncodeUint8(uint8(m.TxQueues))
- buf.EncodeUint32(uint32(m.ID))
- buf.EncodeUint32(uint32(m.SocketID))
- buf.EncodeUint32(uint32(m.RingSize))
- buf.EncodeUint16(uint16(m.BufferSize))
+ buf.EncodeUint8(m.RxQueues)
+ buf.EncodeUint8(m.TxQueues)
+ buf.EncodeUint32(m.ID)
+ buf.EncodeUint32(m.SocketID)
+ buf.EncodeUint32(m.RingSize)
+ buf.EncodeUint16(m.BufferSize)
buf.EncodeBool(m.NoZeroCopy)
buf.EncodeBytes(m.HwAddr[:], 6)
buf.EncodeString(m.Secret, 24)
@@ -178,29 +175,26 @@ func (*MemifCreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MemifCreateReply) Size() int {
+func (m *MemifCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *MemifCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -217,21 +211,18 @@ func (*MemifDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MemifDelete) Size() int {
+func (m *MemifDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *MemifDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -253,27 +244,24 @@ func (*MemifDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MemifDeleteReply) Size() int {
+func (m *MemifDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MemifDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -299,11 +287,10 @@ func (*MemifDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MemifDetails) Size() int {
+func (m *MemifDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 * 6 // m.HwAddr
size += 4 // m.ID
@@ -318,21 +305,19 @@ func (m *MemifDetails) Size() int {
return size
}
func (m *MemifDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.HwAddr[:], 6)
- buf.EncodeUint32(uint32(m.ID))
+ buf.EncodeUint32(m.ID)
buf.EncodeUint32(uint32(m.Role))
buf.EncodeUint32(uint32(m.Mode))
buf.EncodeBool(m.ZeroCopy)
- buf.EncodeUint32(uint32(m.SocketID))
- buf.EncodeUint32(uint32(m.RingSize))
- buf.EncodeUint16(uint16(m.BufferSize))
+ buf.EncodeUint32(m.SocketID)
+ buf.EncodeUint32(m.RingSize)
+ buf.EncodeUint16(m.BufferSize)
buf.EncodeUint32(uint32(m.Flags))
buf.EncodeString(m.IfName, 64)
return buf.Bytes(), nil
@@ -363,20 +348,17 @@ func (*MemifDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MemifDump) Size() int {
+func (m *MemifDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *MemifDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *MemifDump) Unmarshal(b []byte) error {
@@ -397,25 +379,22 @@ func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MemifSocketFilenameAddDel) Size() int {
+func (m *MemifSocketFilenameAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SocketID
size += 108 // m.SocketFilename
return size
}
func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.SocketID))
+ buf.EncodeUint32(m.SocketID)
buf.EncodeString(m.SocketFilename, 108)
return buf.Bytes(), nil
}
@@ -441,27 +420,24 @@ func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MemifSocketFilenameAddDelReply) Size() int {
+func (m *MemifSocketFilenameAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MemifSocketFilenameAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -478,23 +454,20 @@ func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MemifSocketFilenameDetails) Size() int {
+func (m *MemifSocketFilenameDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SocketID
size += 108 // m.SocketFilename
return size
}
func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SocketID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SocketID)
buf.EncodeString(m.SocketFilename, 108)
return buf.Bytes(), nil
}
@@ -515,20 +488,17 @@ func (*MemifSocketFilenameDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MemifSocketFilenameDump) Size() int {
+func (m *MemifSocketFilenameDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *MemifSocketFilenameDump) Unmarshal(b []byte) error {
diff --git a/binapi/mpls/mpls.ba.go b/binapi/mpls/mpls.ba.go
index 4656a9a..9443728 100644
--- a/binapi/mpls/mpls.ba.go
+++ b/binapi/mpls/mpls.ba.go
@@ -76,11 +76,10 @@ func (*MplsIPBindUnbind) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MplsIPBindUnbind) Size() int {
+func (m *MplsIPBindUnbind) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.MbMplsTableID
size += 4 // m.MbLabel
size += 4 // m.MbIPTableID
@@ -91,19 +90,17 @@ func (m *MplsIPBindUnbind) Size() int {
return size
}
func (m *MplsIPBindUnbind) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.MbMplsTableID))
- buf.EncodeUint32(uint32(m.MbLabel))
- buf.EncodeUint32(uint32(m.MbIPTableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.MbMplsTableID)
+ buf.EncodeUint32(m.MbLabel)
+ buf.EncodeUint32(m.MbIPTableID)
buf.EncodeBool(m.MbIsBind)
buf.EncodeUint8(uint8(m.MbPrefix.Address.Af))
- buf.EncodeBytes(m.MbPrefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.MbPrefix.Len))
+ buf.EncodeBytes(m.MbPrefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.MbPrefix.Len)
return buf.Bytes(), nil
}
func (m *MplsIPBindUnbind) Unmarshal(b []byte) error {
@@ -130,27 +127,24 @@ func (*MplsIPBindUnbindReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MplsIPBindUnbindReply) Size() int {
+func (m *MplsIPBindUnbindReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MplsIPBindUnbindReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MplsIPBindUnbindReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -168,11 +162,10 @@ func (*MplsRouteAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MplsRouteAddDel) Size() int {
+func (m *MplsRouteAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.MrIsAdd
size += 1 // m.MrIsMultipath
size += 4 // m.MrRoute.MrTableID
@@ -201,61 +194,50 @@ func (m *MplsRouteAddDel) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *MplsRouteAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.MrIsAdd)
buf.EncodeBool(m.MrIsMultipath)
- buf.EncodeUint32(uint32(m.MrRoute.MrTableID))
- buf.EncodeUint32(uint32(m.MrRoute.MrLabel))
- buf.EncodeUint8(uint8(m.MrRoute.MrEos))
- buf.EncodeUint8(uint8(m.MrRoute.MrEosProto))
+ buf.EncodeUint32(m.MrRoute.MrTableID)
+ buf.EncodeUint32(m.MrRoute.MrLabel)
+ buf.EncodeUint8(m.MrRoute.MrEos)
+ buf.EncodeUint8(m.MrRoute.MrEosProto)
buf.EncodeBool(m.MrRoute.MrIsMulticast)
buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths)))
for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // MrPaths
if j1 < len(m.MrRoute.MrPaths) {
v1 = m.MrRoute.MrPaths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -270,7 +252,7 @@ func (m *MplsRouteAddDel) Unmarshal(b []byte) error {
m.MrRoute.MrEosProto = buf.DecodeUint8()
m.MrRoute.MrIsMulticast = buf.DecodeBool()
m.MrRoute.MrNPaths = buf.DecodeUint8()
- m.MrRoute.MrPaths = make([]fib_types.FibPath, int(m.MrRoute.MrNPaths))
+ m.MrRoute.MrPaths = make([]fib_types.FibPath, m.MrRoute.MrNPaths)
for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32()
m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32()
@@ -308,29 +290,26 @@ func (*MplsRouteAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MplsRouteAddDelReply) Size() int {
+func (m *MplsRouteAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.StatsIndex
return size
}
func (m *MplsRouteAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.StatsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.StatsIndex)
return buf.Bytes(), nil
}
func (m *MplsRouteAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.StatsIndex = buf.DecodeUint32()
return nil
}
@@ -347,11 +326,10 @@ func (*MplsRouteDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MplsRouteDetails) Size() int {
+func (m *MplsRouteDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.MrRoute.MrTableID
size += 4 // m.MrRoute.MrLabel
size += 1 // m.MrRoute.MrEos
@@ -378,59 +356,48 @@ func (m *MplsRouteDetails) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *MplsRouteDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.MrRoute.MrTableID))
- buf.EncodeUint32(uint32(m.MrRoute.MrLabel))
- buf.EncodeUint8(uint8(m.MrRoute.MrEos))
- buf.EncodeUint8(uint8(m.MrRoute.MrEosProto))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.MrRoute.MrTableID)
+ buf.EncodeUint32(m.MrRoute.MrLabel)
+ buf.EncodeUint8(m.MrRoute.MrEos)
+ buf.EncodeUint8(m.MrRoute.MrEosProto)
buf.EncodeBool(m.MrRoute.MrIsMulticast)
buf.EncodeUint8(uint8(len(m.MrRoute.MrPaths)))
for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // MrPaths
if j1 < len(m.MrRoute.MrPaths) {
v1 = m.MrRoute.MrPaths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -443,7 +410,7 @@ func (m *MplsRouteDetails) Unmarshal(b []byte) error {
m.MrRoute.MrEosProto = buf.DecodeUint8()
m.MrRoute.MrIsMulticast = buf.DecodeBool()
m.MrRoute.MrNPaths = buf.DecodeUint8()
- m.MrRoute.MrPaths = make([]fib_types.FibPath, int(m.MrRoute.MrNPaths))
+ m.MrRoute.MrPaths = make([]fib_types.FibPath, m.MrRoute.MrNPaths)
for j1 := 0; j1 < len(m.MrRoute.MrPaths); j1++ {
m.MrRoute.MrPaths[j1].SwIfIndex = buf.DecodeUint32()
m.MrRoute.MrPaths[j1].TableID = buf.DecodeUint32()
@@ -480,23 +447,20 @@ func (*MplsRouteDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MplsRouteDump) Size() int {
+func (m *MplsRouteDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Table.MtTableID
size += 64 // m.Table.MtName
return size
}
func (m *MplsRouteDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Table.MtTableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Table.MtTableID)
buf.EncodeString(m.Table.MtName, 64)
return buf.Bytes(), nil
}
@@ -520,25 +484,22 @@ func (*MplsTableAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MplsTableAddDel) Size() int {
+func (m *MplsTableAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.MtIsAdd
size += 4 // m.MtTable.MtTableID
size += 64 // m.MtTable.MtName
return size
}
func (m *MplsTableAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.MtIsAdd)
- buf.EncodeUint32(uint32(m.MtTable.MtTableID))
+ buf.EncodeUint32(m.MtTable.MtTableID)
buf.EncodeString(m.MtTable.MtName, 64)
return buf.Bytes(), nil
}
@@ -562,27 +523,24 @@ func (*MplsTableAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MplsTableAddDelReply) Size() int {
+func (m *MplsTableAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *MplsTableAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *MplsTableAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -598,23 +556,20 @@ func (*MplsTableDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MplsTableDetails) Size() int {
+func (m *MplsTableDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.MtTable.MtTableID
size += 64 // m.MtTable.MtName
return size
}
func (m *MplsTableDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.MtTable.MtTableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.MtTable.MtTableID)
buf.EncodeString(m.MtTable.MtName, 64)
return buf.Bytes(), nil
}
@@ -635,20 +590,17 @@ func (*MplsTableDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MplsTableDump) Size() int {
+func (m *MplsTableDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *MplsTableDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *MplsTableDump) Unmarshal(b []byte) error {
@@ -668,11 +620,10 @@ func (*MplsTunnelAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MplsTunnelAddDel) Size() int {
+func (m *MplsTunnelAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.MtIsAdd
size += 4 // m.MtTunnel.MtSwIfIndex
size += 4 // m.MtTunnel.MtTunnelIndex
@@ -700,60 +651,49 @@ func (m *MplsTunnelAddDel) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *MplsTunnelAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.MtIsAdd)
buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex))
- buf.EncodeUint32(uint32(m.MtTunnel.MtTunnelIndex))
+ buf.EncodeUint32(m.MtTunnel.MtTunnelIndex)
buf.EncodeBool(m.MtTunnel.MtL2Only)
buf.EncodeBool(m.MtTunnel.MtIsMulticast)
buf.EncodeString(m.MtTunnel.MtTag, 64)
buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths)))
for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // MtPaths
if j1 < len(m.MtTunnel.MtPaths) {
v1 = m.MtTunnel.MtPaths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -767,7 +707,7 @@ func (m *MplsTunnelAddDel) Unmarshal(b []byte) error {
m.MtTunnel.MtIsMulticast = buf.DecodeBool()
m.MtTunnel.MtTag = buf.DecodeString(64)
m.MtTunnel.MtNPaths = buf.DecodeUint8()
- m.MtTunnel.MtPaths = make([]fib_types.FibPath, int(m.MtTunnel.MtNPaths))
+ m.MtTunnel.MtPaths = make([]fib_types.FibPath, m.MtTunnel.MtNPaths)
for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32()
m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32()
@@ -806,31 +746,28 @@ func (*MplsTunnelAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MplsTunnelAddDelReply) Size() int {
+func (m *MplsTunnelAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
size += 4 // m.TunnelIndex
return size
}
func (m *MplsTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.TunnelIndex))
+ buf.EncodeUint32(m.TunnelIndex)
return buf.Bytes(), nil
}
func (m *MplsTunnelAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.TunnelIndex = buf.DecodeUint32()
return nil
@@ -848,11 +785,10 @@ func (*MplsTunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *MplsTunnelDetails) Size() int {
+func (m *MplsTunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.MtTunnel.MtSwIfIndex
size += 4 // m.MtTunnel.MtTunnelIndex
size += 1 // m.MtTunnel.MtL2Only
@@ -879,59 +815,48 @@ func (m *MplsTunnelDetails) Size() int {
size += 4 // s2.Nh.ClassifyTableIndex
size += 1 // s2.NLabels
for j3 := 0; j3 < 16; j3++ {
- var s3 fib_types.FibMplsLabel
- _ = s3
- if j3 < len(s2.LabelStack) {
- s3 = s2.LabelStack[j3]
- }
- size += 1 // s3.IsUniform
- size += 4 // s3.Label
- size += 1 // s3.TTL
- size += 1 // s3.Exp
+ size += 1 // s2.LabelStack[j3].IsUniform
+ size += 4 // s2.LabelStack[j3].Label
+ size += 1 // s2.LabelStack[j3].TTL
+ size += 1 // s2.LabelStack[j3].Exp
}
}
return size
}
func (m *MplsTunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.MtTunnel.MtSwIfIndex))
- buf.EncodeUint32(uint32(m.MtTunnel.MtTunnelIndex))
+ buf.EncodeUint32(m.MtTunnel.MtTunnelIndex)
buf.EncodeBool(m.MtTunnel.MtL2Only)
buf.EncodeBool(m.MtTunnel.MtIsMulticast)
buf.EncodeString(m.MtTunnel.MtTag, 64)
buf.EncodeUint8(uint8(len(m.MtTunnel.MtPaths)))
for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
- var v1 fib_types.FibPath
+ var v1 fib_types.FibPath // MtPaths
if j1 < len(m.MtTunnel.MtPaths) {
v1 = m.MtTunnel.MtPaths[j1]
}
- buf.EncodeUint32(uint32(v1.SwIfIndex))
- buf.EncodeUint32(uint32(v1.TableID))
- buf.EncodeUint32(uint32(v1.RpfID))
- buf.EncodeUint8(uint8(v1.Weight))
- buf.EncodeUint8(uint8(v1.Preference))
+ buf.EncodeUint32(v1.SwIfIndex)
+ buf.EncodeUint32(v1.TableID)
+ buf.EncodeUint32(v1.RpfID)
+ buf.EncodeUint8(v1.Weight)
+ buf.EncodeUint8(v1.Preference)
buf.EncodeUint32(uint32(v1.Type))
buf.EncodeUint32(uint32(v1.Flags))
buf.EncodeUint32(uint32(v1.Proto))
- buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(v1.Nh.ViaLabel))
- buf.EncodeUint32(uint32(v1.Nh.ObjID))
- buf.EncodeUint32(uint32(v1.Nh.ClassifyTableIndex))
- buf.EncodeUint8(uint8(v1.NLabels))
+ buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
+ buf.EncodeUint32(v1.Nh.ViaLabel)
+ buf.EncodeUint32(v1.Nh.ObjID)
+ buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
+ buf.EncodeUint8(v1.NLabels)
for j2 := 0; j2 < 16; j2++ {
- var v2 fib_types.FibMplsLabel
- if j2 < len(v1.LabelStack) {
- v2 = v1.LabelStack[j2]
- }
- buf.EncodeUint8(uint8(v2.IsUniform))
- buf.EncodeUint32(uint32(v2.Label))
- buf.EncodeUint8(uint8(v2.TTL))
- buf.EncodeUint8(uint8(v2.Exp))
+ buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
+ buf.EncodeUint32(v1.LabelStack[j2].Label)
+ buf.EncodeUint8(v1.LabelStack[j2].TTL)
+ buf.EncodeUint8(v1.LabelStack[j2].Exp)
}
}
return buf.Bytes(), nil
@@ -944,7 +869,7 @@ func (m *MplsTunnelDetails) Unmarshal(b []byte) error {
m.MtTunnel.MtIsMulticast = buf.DecodeBool()
m.MtTunnel.MtTag = buf.DecodeString(64)
m.MtTunnel.MtNPaths = buf.DecodeUint8()
- m.MtTunnel.MtPaths = make([]fib_types.FibPath, int(m.MtTunnel.MtNPaths))
+ m.MtTunnel.MtPaths = make([]fib_types.FibPath, m.MtTunnel.MtNPaths)
for j1 := 0; j1 < len(m.MtTunnel.MtPaths); j1++ {
m.MtTunnel.MtPaths[j1].SwIfIndex = buf.DecodeUint32()
m.MtTunnel.MtPaths[j1].TableID = buf.DecodeUint32()
@@ -971,7 +896,7 @@ func (m *MplsTunnelDetails) Unmarshal(b []byte) error {
// MplsTunnelDump defines message 'mpls_tunnel_dump'.
type MplsTunnelDump struct {
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *MplsTunnelDump) Reset() { *m = MplsTunnelDump{} }
@@ -981,21 +906,18 @@ func (*MplsTunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *MplsTunnelDump) Size() int {
+func (m *MplsTunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *MplsTunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -1018,22 +940,19 @@ func (*SwInterfaceSetMplsEnable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetMplsEnable) Size() int {
+func (m *SwInterfaceSetMplsEnable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Enable
return size
}
func (m *SwInterfaceSetMplsEnable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
@@ -1059,27 +978,24 @@ func (*SwInterfaceSetMplsEnableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetMplsEnableReply) Size() int {
+func (m *SwInterfaceSetMplsEnableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetMplsEnableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetMplsEnableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/nat/nat.ba.go b/binapi/nat/nat.ba.go
index 75a9f98..811ed63 100644
--- a/binapi/nat/nat.ba.go
+++ b/binapi/nat/nat.ba.go
@@ -163,11 +163,10 @@ func (*Nat44AddDelAddressRange) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44AddDelAddressRange) Size() int {
+func (m *Nat44AddDelAddressRange) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.FirstIPAddress
size += 1 * 4 // m.LastIPAddress
size += 4 // m.VrfID
@@ -176,15 +175,13 @@ func (m *Nat44AddDelAddressRange) Size() int {
return size
}
func (m *Nat44AddDelAddressRange) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.FirstIPAddress[:], 4)
buf.EncodeBytes(m.LastIPAddress[:], 4)
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Flags))
return buf.Bytes(), nil
@@ -213,27 +210,24 @@ func (*Nat44AddDelAddressRangeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44AddDelAddressRangeReply) Size() int {
+func (m *Nat44AddDelAddressRangeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44AddDelAddressRangeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44AddDelAddressRangeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -256,11 +250,10 @@ func (*Nat44AddDelIdentityMapping) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44AddDelIdentityMapping) Size() int {
+func (m *Nat44AddDelIdentityMapping) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Flags
size += 1 * 4 // m.IPAddress
@@ -272,19 +265,17 @@ func (m *Nat44AddDelIdentityMapping) Size() int {
return size
}
func (m *Nat44AddDelIdentityMapping) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeBytes(m.IPAddress[:], 4)
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.Port))
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.Port)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
buf.EncodeString(m.Tag, 64)
return buf.Bytes(), nil
}
@@ -315,27 +306,24 @@ func (*Nat44AddDelIdentityMappingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44AddDelIdentityMappingReply) Size() int {
+func (m *Nat44AddDelIdentityMappingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44AddDelIdentityMappingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44AddDelIdentityMappingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -353,23 +341,20 @@ func (*Nat44AddDelInterfaceAddr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44AddDelInterfaceAddr) Size() int {
+func (m *Nat44AddDelInterfaceAddr) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SwIfIndex
size += 1 // m.Flags
return size
}
func (m *Nat44AddDelInterfaceAddr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.Flags))
@@ -397,27 +382,24 @@ func (*Nat44AddDelInterfaceAddrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44AddDelInterfaceAddrReply) Size() int {
+func (m *Nat44AddDelInterfaceAddrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44AddDelInterfaceAddrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44AddDelInterfaceAddrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -441,11 +423,10 @@ func (*Nat44AddDelLbStaticMapping) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44AddDelLbStaticMapping) Size() int {
+func (m *Nat44AddDelLbStaticMapping) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Flags
size += 1 * 4 // m.ExternalAddr
@@ -468,29 +449,27 @@ func (m *Nat44AddDelLbStaticMapping) Size() int {
return size
}
func (m *Nat44AddDelLbStaticMapping) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeBytes(m.ExternalAddr[:], 4)
- buf.EncodeUint16(uint16(m.ExternalPort))
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint32(uint32(m.Affinity))
+ buf.EncodeUint16(m.ExternalPort)
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint32(m.Affinity)
buf.EncodeString(m.Tag, 64)
buf.EncodeUint32(uint32(len(m.Locals)))
for j0 := 0; j0 < len(m.Locals); j0++ {
- var v0 Nat44LbAddrPort
+ var v0 Nat44LbAddrPort // Locals
if j0 < len(m.Locals) {
v0 = m.Locals[j0]
}
buf.EncodeBytes(v0.Addr[:], 4)
- buf.EncodeUint16(uint16(v0.Port))
- buf.EncodeUint8(uint8(v0.Probability))
- buf.EncodeUint32(uint32(v0.VrfID))
+ buf.EncodeUint16(v0.Port)
+ buf.EncodeUint8(v0.Probability)
+ buf.EncodeUint32(v0.VrfID)
}
return buf.Bytes(), nil
}
@@ -504,7 +483,7 @@ func (m *Nat44AddDelLbStaticMapping) Unmarshal(b []byte) error {
m.Affinity = buf.DecodeUint32()
m.Tag = buf.DecodeString(64)
m.LocalNum = buf.DecodeUint32()
- m.Locals = make([]Nat44LbAddrPort, int(m.LocalNum))
+ m.Locals = make([]Nat44LbAddrPort, m.LocalNum)
for j0 := 0; j0 < len(m.Locals); j0++ {
copy(m.Locals[j0].Addr[:], buf.DecodeBytes(4))
m.Locals[j0].Port = buf.DecodeUint16()
@@ -528,27 +507,24 @@ func (*Nat44AddDelLbStaticMappingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44AddDelLbStaticMappingReply) Size() int {
+func (m *Nat44AddDelLbStaticMappingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44AddDelLbStaticMappingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44AddDelLbStaticMappingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -573,11 +549,10 @@ func (*Nat44AddDelStaticMapping) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44AddDelStaticMapping) Size() int {
+func (m *Nat44AddDelStaticMapping) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Flags
size += 1 * 4 // m.LocalIPAddress
@@ -591,21 +566,19 @@ func (m *Nat44AddDelStaticMapping) Size() int {
return size
}
func (m *Nat44AddDelStaticMapping) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeBytes(m.LocalIPAddress[:], 4)
buf.EncodeBytes(m.ExternalIPAddress[:], 4)
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.LocalPort))
- buf.EncodeUint16(uint16(m.ExternalPort))
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.LocalPort)
+ buf.EncodeUint16(m.ExternalPort)
buf.EncodeUint32(uint32(m.ExternalSwIfIndex))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
buf.EncodeString(m.Tag, 64)
return buf.Bytes(), nil
}
@@ -638,27 +611,24 @@ func (*Nat44AddDelStaticMappingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44AddDelStaticMappingReply) Size() int {
+func (m *Nat44AddDelStaticMappingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44AddDelStaticMappingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44AddDelStaticMappingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -676,26 +646,23 @@ func (*Nat44AddressDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44AddressDetails) Size() int {
+func (m *Nat44AddressDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IPAddress
size += 1 // m.Flags
size += 4 // m.VrfID
return size
}
func (m *Nat44AddressDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IPAddress[:], 4)
buf.EncodeUint8(uint8(m.Flags))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
return buf.Bytes(), nil
}
func (m *Nat44AddressDetails) Unmarshal(b []byte) error {
@@ -716,20 +683,17 @@ func (*Nat44AddressDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44AddressDump) Size() int {
+func (m *Nat44AddressDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44AddressDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44AddressDump) Unmarshal(b []byte) error {
@@ -754,11 +718,10 @@ func (*Nat44DelSession) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44DelSession) Size() int {
+func (m *Nat44DelSession) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.Address
size += 1 // m.Protocol
size += 2 // m.Port
@@ -769,19 +732,17 @@ func (m *Nat44DelSession) Size() int {
return size
}
func (m *Nat44DelSession) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.Address[:], 4)
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.Port))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.Port)
+ buf.EncodeUint32(m.VrfID)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeBytes(m.ExtHostAddress[:], 4)
- buf.EncodeUint16(uint16(m.ExtHostPort))
+ buf.EncodeUint16(m.ExtHostPort)
return buf.Bytes(), nil
}
func (m *Nat44DelSession) Unmarshal(b []byte) error {
@@ -808,27 +769,24 @@ func (*Nat44DelSessionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44DelSessionReply) Size() int {
+func (m *Nat44DelSessionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44DelSessionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44DelSessionReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -845,24 +803,21 @@ func (*Nat44DelUser) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44DelUser) Size() int {
+func (m *Nat44DelUser) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IPAddress
size += 4 // m.FibIndex
return size
}
func (m *Nat44DelUser) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IPAddress[:], 4)
- buf.EncodeUint32(uint32(m.FibIndex))
+ buf.EncodeUint32(m.FibIndex)
return buf.Bytes(), nil
}
func (m *Nat44DelUser) Unmarshal(b []byte) error {
@@ -884,27 +839,24 @@ func (*Nat44DelUserReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44DelUserReply) Size() int {
+func (m *Nat44DelUserReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44DelUserReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44DelUserReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -922,21 +874,18 @@ func (*Nat44ForwardingEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44ForwardingEnableDisable) Size() int {
+func (m *Nat44ForwardingEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
return size
}
func (m *Nat44ForwardingEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
}
@@ -960,27 +909,24 @@ func (*Nat44ForwardingEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44ForwardingEnableDisableReply) Size() int {
+func (m *Nat44ForwardingEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44ForwardingEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44ForwardingEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -994,20 +940,17 @@ func (*Nat44ForwardingIsEnabled) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44ForwardingIsEnabled) Size() int {
+func (m *Nat44ForwardingIsEnabled) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44ForwardingIsEnabled) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44ForwardingIsEnabled) Unmarshal(b []byte) error {
@@ -1028,21 +971,18 @@ func (*Nat44ForwardingIsEnabledReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44ForwardingIsEnabledReply) Size() int {
+func (m *Nat44ForwardingIsEnabledReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enabled
return size
}
func (m *Nat44ForwardingIsEnabledReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enabled)
return buf.Bytes(), nil
}
@@ -1070,11 +1010,10 @@ func (*Nat44IdentityMappingDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44IdentityMappingDetails) Size() int {
+func (m *Nat44IdentityMappingDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Flags
size += 1 * 4 // m.IPAddress
size += 1 // m.Protocol
@@ -1085,18 +1024,16 @@ func (m *Nat44IdentityMappingDetails) Size() int {
return size
}
func (m *Nat44IdentityMappingDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeBytes(m.IPAddress[:], 4)
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.Port))
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.Port)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
buf.EncodeString(m.Tag, 64)
return buf.Bytes(), nil
}
@@ -1122,20 +1059,17 @@ func (*Nat44IdentityMappingDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44IdentityMappingDump) Size() int {
+func (m *Nat44IdentityMappingDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44IdentityMappingDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44IdentityMappingDump) Unmarshal(b []byte) error {
@@ -1156,23 +1090,20 @@ func (*Nat44InterfaceAddDelFeature) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44InterfaceAddDelFeature) Size() int {
+func (m *Nat44InterfaceAddDelFeature) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Flags
size += 4 // m.SwIfIndex
return size
}
func (m *Nat44InterfaceAddDelFeature) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeUint32(uint32(m.SwIfIndex))
@@ -1200,27 +1131,24 @@ func (*Nat44InterfaceAddDelFeatureReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44InterfaceAddDelFeatureReply) Size() int {
+func (m *Nat44InterfaceAddDelFeatureReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44InterfaceAddDelFeatureReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44InterfaceAddDelFeatureReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1240,23 +1168,20 @@ func (*Nat44InterfaceAddDelOutputFeature) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44InterfaceAddDelOutputFeature) Size() int {
+func (m *Nat44InterfaceAddDelOutputFeature) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Flags
size += 4 // m.SwIfIndex
return size
}
func (m *Nat44InterfaceAddDelOutputFeature) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeUint32(uint32(m.SwIfIndex))
@@ -1286,27 +1211,24 @@ func (*Nat44InterfaceAddDelOutputFeatureReply) GetMessageType() api.MessageType
return api.ReplyMessage
}
-func (m *Nat44InterfaceAddDelOutputFeatureReply) Size() int {
+func (m *Nat44InterfaceAddDelOutputFeatureReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44InterfaceAddDelOutputFeatureReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44InterfaceAddDelOutputFeatureReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1323,22 +1245,19 @@ func (*Nat44InterfaceAddrDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44InterfaceAddrDetails) Size() int {
+func (m *Nat44InterfaceAddrDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Flags
return size
}
func (m *Nat44InterfaceAddrDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.Flags))
return buf.Bytes(), nil
@@ -1360,20 +1279,17 @@ func (*Nat44InterfaceAddrDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44InterfaceAddrDump) Size() int {
+func (m *Nat44InterfaceAddrDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44InterfaceAddrDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44InterfaceAddrDump) Unmarshal(b []byte) error {
@@ -1393,22 +1309,19 @@ func (*Nat44InterfaceDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44InterfaceDetails) Size() int {
+func (m *Nat44InterfaceDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Flags
size += 4 // m.SwIfIndex
return size
}
func (m *Nat44InterfaceDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -1430,20 +1343,17 @@ func (*Nat44InterfaceDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44InterfaceDump) Size() int {
+func (m *Nat44InterfaceDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44InterfaceDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44InterfaceDump) Unmarshal(b []byte) error {
@@ -1465,22 +1375,19 @@ func (*Nat44InterfaceOutputFeatureDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44InterfaceOutputFeatureDetails) Size() int {
+func (m *Nat44InterfaceOutputFeatureDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Flags
size += 4 // m.SwIfIndex
return size
}
func (m *Nat44InterfaceOutputFeatureDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -1504,20 +1411,17 @@ func (*Nat44InterfaceOutputFeatureDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44InterfaceOutputFeatureDump) Size() int {
+func (m *Nat44InterfaceOutputFeatureDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44InterfaceOutputFeatureDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44InterfaceOutputFeatureDump) Unmarshal(b []byte) error {
@@ -1542,11 +1446,10 @@ func (*Nat44LbStaticMappingAddDelLocal) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44LbStaticMappingAddDelLocal) Size() int {
+func (m *Nat44LbStaticMappingAddDelLocal) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 * 4 // m.ExternalAddr
size += 2 // m.ExternalPort
@@ -1558,20 +1461,18 @@ func (m *Nat44LbStaticMappingAddDelLocal) Size() int {
return size
}
func (m *Nat44LbStaticMappingAddDelLocal) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBytes(m.ExternalAddr[:], 4)
- buf.EncodeUint16(uint16(m.ExternalPort))
- buf.EncodeUint8(uint8(m.Protocol))
+ buf.EncodeUint16(m.ExternalPort)
+ buf.EncodeUint8(m.Protocol)
buf.EncodeBytes(m.Local.Addr[:], 4)
- buf.EncodeUint16(uint16(m.Local.Port))
- buf.EncodeUint8(uint8(m.Local.Probability))
- buf.EncodeUint32(uint32(m.Local.VrfID))
+ buf.EncodeUint16(m.Local.Port)
+ buf.EncodeUint8(m.Local.Probability)
+ buf.EncodeUint32(m.Local.VrfID)
return buf.Bytes(), nil
}
func (m *Nat44LbStaticMappingAddDelLocal) Unmarshal(b []byte) error {
@@ -1601,27 +1502,24 @@ func (*Nat44LbStaticMappingAddDelLocalReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44LbStaticMappingAddDelLocalReply) Size() int {
+func (m *Nat44LbStaticMappingAddDelLocalReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44LbStaticMappingAddDelLocalReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44LbStaticMappingAddDelLocalReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1644,11 +1542,10 @@ func (*Nat44LbStaticMappingDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44LbStaticMappingDetails) Size() int {
+func (m *Nat44LbStaticMappingDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.ExternalAddr
size += 2 // m.ExternalPort
size += 1 // m.Protocol
@@ -1670,28 +1567,26 @@ func (m *Nat44LbStaticMappingDetails) Size() int {
return size
}
func (m *Nat44LbStaticMappingDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.ExternalAddr[:], 4)
- buf.EncodeUint16(uint16(m.ExternalPort))
- buf.EncodeUint8(uint8(m.Protocol))
+ buf.EncodeUint16(m.ExternalPort)
+ buf.EncodeUint8(m.Protocol)
buf.EncodeUint8(uint8(m.Flags))
- buf.EncodeUint32(uint32(m.Affinity))
+ buf.EncodeUint32(m.Affinity)
buf.EncodeString(m.Tag, 64)
buf.EncodeUint32(uint32(len(m.Locals)))
for j0 := 0; j0 < len(m.Locals); j0++ {
- var v0 Nat44LbAddrPort
+ var v0 Nat44LbAddrPort // Locals
if j0 < len(m.Locals) {
v0 = m.Locals[j0]
}
buf.EncodeBytes(v0.Addr[:], 4)
- buf.EncodeUint16(uint16(v0.Port))
- buf.EncodeUint8(uint8(v0.Probability))
- buf.EncodeUint32(uint32(v0.VrfID))
+ buf.EncodeUint16(v0.Port)
+ buf.EncodeUint8(v0.Probability)
+ buf.EncodeUint32(v0.VrfID)
}
return buf.Bytes(), nil
}
@@ -1704,7 +1599,7 @@ func (m *Nat44LbStaticMappingDetails) Unmarshal(b []byte) error {
m.Affinity = buf.DecodeUint32()
m.Tag = buf.DecodeString(64)
m.LocalNum = buf.DecodeUint32()
- m.Locals = make([]Nat44LbAddrPort, int(m.LocalNum))
+ m.Locals = make([]Nat44LbAddrPort, m.LocalNum)
for j0 := 0; j0 < len(m.Locals); j0++ {
copy(m.Locals[j0].Addr[:], buf.DecodeBytes(4))
m.Locals[j0].Port = buf.DecodeUint16()
@@ -1724,20 +1619,17 @@ func (*Nat44LbStaticMappingDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44LbStaticMappingDump) Size() int {
+func (m *Nat44LbStaticMappingDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44LbStaticMappingDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44LbStaticMappingDump) Unmarshal(b []byte) error {
@@ -1754,20 +1646,17 @@ func (*Nat44SessionCleanup) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44SessionCleanup) Size() int {
+func (m *Nat44SessionCleanup) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44SessionCleanup) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44SessionCleanup) Unmarshal(b []byte) error {
@@ -1786,27 +1675,24 @@ func (*Nat44SessionCleanupReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44SessionCleanupReply) Size() int {
+func (m *Nat44SessionCleanupReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44SessionCleanupReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44SessionCleanupReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1823,24 +1709,21 @@ func (*Nat44SetSessionLimit) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44SetSessionLimit) Size() int {
+func (m *Nat44SetSessionLimit) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SessionLimit
size += 4 // m.VrfID
return size
}
func (m *Nat44SetSessionLimit) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SessionLimit))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SessionLimit)
+ buf.EncodeUint32(m.VrfID)
return buf.Bytes(), nil
}
func (m *Nat44SetSessionLimit) Unmarshal(b []byte) error {
@@ -1862,27 +1745,24 @@ func (*Nat44SetSessionLimitReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44SetSessionLimitReply) Size() int {
+func (m *Nat44SetSessionLimitReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat44SetSessionLimitReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat44SetSessionLimitReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1906,11 +1786,10 @@ func (*Nat44StaticMappingDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44StaticMappingDetails) Size() int {
+func (m *Nat44StaticMappingDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Flags
size += 1 * 4 // m.LocalIPAddress
size += 1 * 4 // m.ExternalIPAddress
@@ -1923,20 +1802,18 @@ func (m *Nat44StaticMappingDetails) Size() int {
return size
}
func (m *Nat44StaticMappingDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeBytes(m.LocalIPAddress[:], 4)
buf.EncodeBytes(m.ExternalIPAddress[:], 4)
- buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint16(uint16(m.LocalPort))
- buf.EncodeUint16(uint16(m.ExternalPort))
+ buf.EncodeUint8(m.Protocol)
+ buf.EncodeUint16(m.LocalPort)
+ buf.EncodeUint16(m.ExternalPort)
buf.EncodeUint32(uint32(m.ExternalSwIfIndex))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
buf.EncodeString(m.Tag, 64)
return buf.Bytes(), nil
}
@@ -1964,20 +1841,17 @@ func (*Nat44StaticMappingDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44StaticMappingDump) Size() int {
+func (m *Nat44StaticMappingDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44StaticMappingDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44StaticMappingDump) Unmarshal(b []byte) error {
@@ -1999,11 +1873,10 @@ func (*Nat44UserDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44UserDetails) Size() int {
+func (m *Nat44UserDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.VrfID
size += 1 * 4 // m.IPAddress
size += 4 // m.Nsessions
@@ -2011,16 +1884,14 @@ func (m *Nat44UserDetails) Size() int {
return size
}
func (m *Nat44UserDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.VrfID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.VrfID)
buf.EncodeBytes(m.IPAddress[:], 4)
- buf.EncodeUint32(uint32(m.Nsessions))
- buf.EncodeUint32(uint32(m.Nstaticsessions))
+ buf.EncodeUint32(m.Nsessions)
+ buf.EncodeUint32(m.Nstaticsessions)
return buf.Bytes(), nil
}
func (m *Nat44UserDetails) Unmarshal(b []byte) error {
@@ -2042,20 +1913,17 @@ func (*Nat44UserDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44UserDump) Size() int {
+func (m *Nat44UserDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat44UserDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat44UserDump) Unmarshal(b []byte) error {
@@ -2086,11 +1954,10 @@ func (*Nat44UserSessionDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat44UserSessionDetails) Size() int {
+func (m *Nat44UserSessionDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.OutsideIPAddress
size += 2 // m.OutsidePort
size += 1 * 4 // m.InsideIPAddress
@@ -2107,25 +1974,23 @@ func (m *Nat44UserSessionDetails) Size() int {
return size
}
func (m *Nat44UserSessionDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.OutsideIPAddress[:], 4)
- buf.EncodeUint16(uint16(m.OutsidePort))
+ buf.EncodeUint16(m.OutsidePort)
buf.EncodeBytes(m.InsideIPAddress[:], 4)
- buf.EncodeUint16(uint16(m.InsidePort))
- buf.EncodeUint16(uint16(m.Protocol))
+ buf.EncodeUint16(m.InsidePort)
+ buf.EncodeUint16(m.Protocol)
buf.EncodeUint8(uint8(m.Flags))
- buf.EncodeUint64(uint64(m.LastHeard))
- buf.EncodeUint64(uint64(m.TotalBytes))
- buf.EncodeUint32(uint32(m.TotalPkts))
+ buf.EncodeUint64(m.LastHeard)
+ buf.EncodeUint64(m.TotalBytes)
+ buf.EncodeUint32(m.TotalPkts)
buf.EncodeBytes(m.ExtHostAddress[:], 4)
- buf.EncodeUint16(uint16(m.ExtHostPort))
+ buf.EncodeUint16(m.ExtHostPort)
buf.EncodeBytes(m.ExtHostNatAddress[:], 4)
- buf.EncodeUint16(uint16(m.ExtHostNatPort))
+ buf.EncodeUint16(m.ExtHostNatPort)
return buf.Bytes(), nil
}
func (m *Nat44UserSessionDetails) Unmarshal(b []byte) error {
@@ -2159,24 +2024,21 @@ func (*Nat44UserSessionDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat44UserSessionDump) Size() int {
+func (m *Nat44UserSessionDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IPAddress
size += 4 // m.VrfID
return size
}
func (m *Nat44UserSessionDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IPAddress[:], 4)
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
return buf.Bytes(), nil
}
func (m *Nat44UserSessionDump) Unmarshal(b []byte) error {
@@ -2200,23 +2062,20 @@ func (*Nat64AddDelInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64AddDelInterface) Size() int {
+func (m *Nat64AddDelInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Flags
size += 4 // m.SwIfIndex
return size
}
func (m *Nat64AddDelInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeUint32(uint32(m.SwIfIndex))
@@ -2243,22 +2102,19 @@ func (*Nat64AddDelInterfaceAddr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64AddDelInterfaceAddr) Size() int {
+func (m *Nat64AddDelInterfaceAddr) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SwIfIndex
return size
}
func (m *Nat64AddDelInterfaceAddr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -2284,27 +2140,24 @@ func (*Nat64AddDelInterfaceAddrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64AddDelInterfaceAddrReply) Size() int {
+func (m *Nat64AddDelInterfaceAddrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat64AddDelInterfaceAddrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat64AddDelInterfaceAddrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2320,27 +2173,24 @@ func (*Nat64AddDelInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64AddDelInterfaceReply) Size() int {
+func (m *Nat64AddDelInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat64AddDelInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat64AddDelInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2359,11 +2209,10 @@ func (*Nat64AddDelPoolAddrRange) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64AddDelPoolAddrRange) Size() int {
+func (m *Nat64AddDelPoolAddrRange) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.StartAddr
size += 1 * 4 // m.EndAddr
size += 4 // m.VrfID
@@ -2371,15 +2220,13 @@ func (m *Nat64AddDelPoolAddrRange) Size() int {
return size
}
func (m *Nat64AddDelPoolAddrRange) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.StartAddr[:], 4)
buf.EncodeBytes(m.EndAddr[:], 4)
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -2406,27 +2253,24 @@ func (*Nat64AddDelPoolAddrRangeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64AddDelPoolAddrRangeReply) Size() int {
+func (m *Nat64AddDelPoolAddrRangeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat64AddDelPoolAddrRangeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat64AddDelPoolAddrRangeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2444,11 +2288,10 @@ func (*Nat64AddDelPrefix) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64AddDelPrefix) Size() int {
+func (m *Nat64AddDelPrefix) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.Prefix.Address
size += 1 // m.Prefix.Len
size += 4 // m.VrfID
@@ -2456,15 +2299,13 @@ func (m *Nat64AddDelPrefix) Size() int {
return size
}
func (m *Nat64AddDelPrefix) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.Prefix.Address[:], 16)
- buf.EncodeUint8(uint8(m.Prefix.Len))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint8(m.Prefix.Len)
+ buf.EncodeUint32(m.VrfID)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -2489,27 +2330,24 @@ func (*Nat64AddDelPrefixReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64AddDelPrefixReply) Size() int {
+func (m *Nat64AddDelPrefixReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat64AddDelPrefixReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat64AddDelPrefixReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2531,11 +2369,10 @@ func (*Nat64AddDelStaticBib) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64AddDelStaticBib) Size() int {
+func (m *Nat64AddDelStaticBib) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.IAddr
size += 1 * 4 // m.OAddr
size += 2 // m.IPort
@@ -2546,18 +2383,16 @@ func (m *Nat64AddDelStaticBib) Size() int {
return size
}
func (m *Nat64AddDelStaticBib) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IAddr[:], 16)
buf.EncodeBytes(m.OAddr[:], 4)
- buf.EncodeUint16(uint16(m.IPort))
- buf.EncodeUint16(uint16(m.OPort))
- buf.EncodeUint32(uint32(m.VrfID))
- buf.EncodeUint8(uint8(m.Proto))
+ buf.EncodeUint16(m.IPort)
+ buf.EncodeUint16(m.OPort)
+ buf.EncodeUint32(m.VrfID)
+ buf.EncodeUint8(m.Proto)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -2585,27 +2420,24 @@ func (*Nat64AddDelStaticBibReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64AddDelStaticBibReply) Size() int {
+func (m *Nat64AddDelStaticBibReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat64AddDelStaticBibReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat64AddDelStaticBibReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2628,11 +2460,10 @@ func (*Nat64BibDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64BibDetails) Size() int {
+func (m *Nat64BibDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.IAddr
size += 1 * 4 // m.OAddr
size += 2 // m.IPort
@@ -2644,20 +2475,18 @@ func (m *Nat64BibDetails) Size() int {
return size
}
func (m *Nat64BibDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IAddr[:], 16)
buf.EncodeBytes(m.OAddr[:], 4)
- buf.EncodeUint16(uint16(m.IPort))
- buf.EncodeUint16(uint16(m.OPort))
- buf.EncodeUint32(uint32(m.VrfID))
- buf.EncodeUint8(uint8(m.Proto))
+ buf.EncodeUint16(m.IPort)
+ buf.EncodeUint16(m.OPort)
+ buf.EncodeUint32(m.VrfID)
+ buf.EncodeUint8(m.Proto)
buf.EncodeUint8(uint8(m.Flags))
- buf.EncodeUint32(uint32(m.SesNum))
+ buf.EncodeUint32(m.SesNum)
return buf.Bytes(), nil
}
func (m *Nat64BibDetails) Unmarshal(b []byte) error {
@@ -2685,22 +2514,19 @@ func (*Nat64BibDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64BibDump) Size() int {
+func (m *Nat64BibDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Proto
return size
}
func (m *Nat64BibDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Proto))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Proto)
return buf.Bytes(), nil
}
func (m *Nat64BibDump) Unmarshal(b []byte) error {
@@ -2722,22 +2548,19 @@ func (*Nat64InterfaceDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64InterfaceDetails) Size() int {
+func (m *Nat64InterfaceDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Flags
size += 4 // m.SwIfIndex
return size
}
func (m *Nat64InterfaceDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -2759,20 +2582,17 @@ func (*Nat64InterfaceDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64InterfaceDump) Size() int {
+func (m *Nat64InterfaceDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat64InterfaceDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat64InterfaceDump) Unmarshal(b []byte) error {
@@ -2792,24 +2612,21 @@ func (*Nat64PoolAddrDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64PoolAddrDetails) Size() int {
+func (m *Nat64PoolAddrDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.Address
size += 4 // m.VrfID
return size
}
func (m *Nat64PoolAddrDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.Address[:], 4)
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
return buf.Bytes(), nil
}
func (m *Nat64PoolAddrDetails) Unmarshal(b []byte) error {
@@ -2829,20 +2646,17 @@ func (*Nat64PoolAddrDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64PoolAddrDump) Size() int {
+func (m *Nat64PoolAddrDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat64PoolAddrDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat64PoolAddrDump) Unmarshal(b []byte) error {
@@ -2862,26 +2676,23 @@ func (*Nat64PrefixDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64PrefixDetails) Size() int {
+func (m *Nat64PrefixDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.Prefix.Address
size += 1 // m.Prefix.Len
size += 4 // m.VrfID
return size
}
func (m *Nat64PrefixDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.Prefix.Address[:], 16)
- buf.EncodeUint8(uint8(m.Prefix.Len))
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint8(m.Prefix.Len)
+ buf.EncodeUint32(m.VrfID)
return buf.Bytes(), nil
}
func (m *Nat64PrefixDetails) Unmarshal(b []byte) error {
@@ -2902,20 +2713,17 @@ func (*Nat64PrefixDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64PrefixDump) Size() int {
+func (m *Nat64PrefixDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat64PrefixDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat64PrefixDump) Unmarshal(b []byte) error {
@@ -2942,11 +2750,10 @@ func (*Nat64StDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat64StDetails) Size() int {
+func (m *Nat64StDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.IlAddr
size += 1 * 4 // m.OlAddr
size += 2 // m.IlPort
@@ -2959,21 +2766,19 @@ func (m *Nat64StDetails) Size() int {
return size
}
func (m *Nat64StDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IlAddr[:], 16)
buf.EncodeBytes(m.OlAddr[:], 4)
- buf.EncodeUint16(uint16(m.IlPort))
- buf.EncodeUint16(uint16(m.OlPort))
+ buf.EncodeUint16(m.IlPort)
+ buf.EncodeUint16(m.OlPort)
buf.EncodeBytes(m.IrAddr[:], 16)
buf.EncodeBytes(m.OrAddr[:], 4)
- buf.EncodeUint16(uint16(m.RPort))
- buf.EncodeUint32(uint32(m.VrfID))
- buf.EncodeUint8(uint8(m.Proto))
+ buf.EncodeUint16(m.RPort)
+ buf.EncodeUint32(m.VrfID)
+ buf.EncodeUint8(m.Proto)
return buf.Bytes(), nil
}
func (m *Nat64StDetails) Unmarshal(b []byte) error {
@@ -3002,22 +2807,19 @@ func (*Nat64StDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat64StDump) Size() int {
+func (m *Nat64StDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Proto
return size
}
func (m *Nat64StDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Proto))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Proto)
return buf.Bytes(), nil
}
func (m *Nat64StDump) Unmarshal(b []byte) error {
@@ -3040,23 +2842,20 @@ func (*Nat66AddDelInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat66AddDelInterface) Size() int {
+func (m *Nat66AddDelInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Flags
size += 4 // m.SwIfIndex
return size
}
func (m *Nat66AddDelInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeUint32(uint32(m.SwIfIndex))
@@ -3082,27 +2881,24 @@ func (*Nat66AddDelInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat66AddDelInterfaceReply) Size() int {
+func (m *Nat66AddDelInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat66AddDelInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat66AddDelInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3121,11 +2917,10 @@ func (*Nat66AddDelStaticMapping) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat66AddDelStaticMapping) Size() int {
+func (m *Nat66AddDelStaticMapping) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 * 16 // m.LocalIPAddress
size += 1 * 16 // m.ExternalIPAddress
@@ -3133,16 +2928,14 @@ func (m *Nat66AddDelStaticMapping) Size() int {
return size
}
func (m *Nat66AddDelStaticMapping) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBytes(m.LocalIPAddress[:], 16)
buf.EncodeBytes(m.ExternalIPAddress[:], 16)
- buf.EncodeUint32(uint32(m.VrfID))
+ buf.EncodeUint32(m.VrfID)
return buf.Bytes(), nil
}
func (m *Nat66AddDelStaticMapping) Unmarshal(b []byte) error {
@@ -3168,27 +2961,24 @@ func (*Nat66AddDelStaticMappingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat66AddDelStaticMappingReply) Size() int {
+func (m *Nat66AddDelStaticMappingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Nat66AddDelStaticMappingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Nat66AddDelStaticMappingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3205,22 +2995,19 @@ func (*Nat66InterfaceDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat66InterfaceDetails) Size() int {
+func (m *Nat66InterfaceDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Flags
size += 4 // m.SwIfIndex
return size
}
func (m *Nat66InterfaceDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Flags))
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -3242,20 +3029,17 @@ func (*Nat66InterfaceDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat66InterfaceDump) Size() int {
+func (m *Nat66InterfaceDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat66InterfaceDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat66InterfaceDump) Unmarshal(b []byte) error {
@@ -3278,11 +3062,10 @@ func (*Nat66StaticMappingDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Nat66StaticMappingDetails) Size() int {
+func (m *Nat66StaticMappingDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.LocalIPAddress
size += 1 * 16 // m.ExternalIPAddress
size += 4 // m.VrfID
@@ -3291,17 +3074,15 @@ func (m *Nat66StaticMappingDetails) Size() int {
return size
}
func (m *Nat66StaticMappingDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.LocalIPAddress[:], 16)
buf.EncodeBytes(m.ExternalIPAddress[:], 16)
- buf.EncodeUint32(uint32(m.VrfID))
- buf.EncodeUint64(uint64(m.TotalBytes))
- buf.EncodeUint64(uint64(m.TotalPkts))
+ buf.EncodeUint32(m.VrfID)
+ buf.EncodeUint64(m.TotalBytes)
+ buf.EncodeUint64(m.TotalPkts)
return buf.Bytes(), nil
}
func (m *Nat66StaticMappingDetails) Unmarshal(b []byte) error {
@@ -3324,20 +3105,17 @@ func (*Nat66StaticMappingDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Nat66StaticMappingDump) Size() int {
+func (m *Nat66StaticMappingDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Nat66StaticMappingDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Nat66StaticMappingDump) Unmarshal(b []byte) error {
@@ -3354,20 +3132,17 @@ func (*NatControlPing) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatControlPing) Size() int {
+func (m *NatControlPing) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatControlPing) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatControlPing) Unmarshal(b []byte) error {
@@ -3388,31 +3163,28 @@ func (*NatControlPingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatControlPingReply) Size() int {
+func (m *NatControlPingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.ClientIndex
size += 4 // m.VpePID
return size
}
func (m *NatControlPingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.ClientIndex))
- buf.EncodeUint32(uint32(m.VpePID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.ClientIndex)
+ buf.EncodeUint32(m.VpePID)
return buf.Bytes(), nil
}
func (m *NatControlPingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ClientIndex = buf.DecodeUint32()
m.VpePID = buf.DecodeUint32()
return nil
@@ -3434,11 +3206,10 @@ func (*NatDetAddDelMap) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatDetAddDelMap) Size() int {
+func (m *NatDetAddDelMap) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 * 4 // m.InAddr
size += 1 // m.InPlen
@@ -3447,17 +3218,15 @@ func (m *NatDetAddDelMap) Size() int {
return size
}
func (m *NatDetAddDelMap) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBytes(m.InAddr[:], 4)
- buf.EncodeUint8(uint8(m.InPlen))
+ buf.EncodeUint8(m.InPlen)
buf.EncodeBytes(m.OutAddr[:], 4)
- buf.EncodeUint8(uint8(m.OutPlen))
+ buf.EncodeUint8(m.OutPlen)
return buf.Bytes(), nil
}
func (m *NatDetAddDelMap) Unmarshal(b []byte) error {
@@ -3482,27 +3251,24 @@ func (*NatDetAddDelMapReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatDetAddDelMapReply) Size() int {
+func (m *NatDetAddDelMapReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatDetAddDelMapReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatDetAddDelMapReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3521,11 +3287,10 @@ func (*NatDetCloseSessionIn) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatDetCloseSessionIn) Size() int {
+func (m *NatDetCloseSessionIn) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.InAddr
size += 2 // m.InPort
size += 1 * 4 // m.ExtAddr
@@ -3533,16 +3298,14 @@ func (m *NatDetCloseSessionIn) Size() int {
return size
}
func (m *NatDetCloseSessionIn) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.InAddr[:], 4)
- buf.EncodeUint16(uint16(m.InPort))
+ buf.EncodeUint16(m.InPort)
buf.EncodeBytes(m.ExtAddr[:], 4)
- buf.EncodeUint16(uint16(m.ExtPort))
+ buf.EncodeUint16(m.ExtPort)
return buf.Bytes(), nil
}
func (m *NatDetCloseSessionIn) Unmarshal(b []byte) error {
@@ -3566,27 +3329,24 @@ func (*NatDetCloseSessionInReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatDetCloseSessionInReply) Size() int {
+func (m *NatDetCloseSessionInReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatDetCloseSessionInReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatDetCloseSessionInReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3605,11 +3365,10 @@ func (*NatDetCloseSessionOut) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatDetCloseSessionOut) Size() int {
+func (m *NatDetCloseSessionOut) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.OutAddr
size += 2 // m.OutPort
size += 1 * 4 // m.ExtAddr
@@ -3617,16 +3376,14 @@ func (m *NatDetCloseSessionOut) Size() int {
return size
}
func (m *NatDetCloseSessionOut) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.OutAddr[:], 4)
- buf.EncodeUint16(uint16(m.OutPort))
+ buf.EncodeUint16(m.OutPort)
buf.EncodeBytes(m.ExtAddr[:], 4)
- buf.EncodeUint16(uint16(m.ExtPort))
+ buf.EncodeUint16(m.ExtPort)
return buf.Bytes(), nil
}
func (m *NatDetCloseSessionOut) Unmarshal(b []byte) error {
@@ -3650,27 +3407,24 @@ func (*NatDetCloseSessionOutReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatDetCloseSessionOutReply) Size() int {
+func (m *NatDetCloseSessionOutReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatDetCloseSessionOutReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatDetCloseSessionOutReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3686,21 +3440,18 @@ func (*NatDetForward) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatDetForward) Size() int {
+func (m *NatDetForward) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.InAddr
return size
}
func (m *NatDetForward) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.InAddr[:], 4)
return buf.Bytes(), nil
}
@@ -3725,11 +3476,10 @@ func (*NatDetForwardReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatDetForwardReply) Size() int {
+func (m *NatDetForwardReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 2 // m.OutPortLo
size += 2 // m.OutPortHi
@@ -3737,21 +3487,19 @@ func (m *NatDetForwardReply) Size() int {
return size
}
func (m *NatDetForwardReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint16(uint16(m.OutPortLo))
- buf.EncodeUint16(uint16(m.OutPortHi))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint16(m.OutPortLo)
+ buf.EncodeUint16(m.OutPortHi)
buf.EncodeBytes(m.OutAddr[:], 4)
return buf.Bytes(), nil
}
func (m *NatDetForwardReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.OutPortLo = buf.DecodeUint16()
m.OutPortHi = buf.DecodeUint16()
copy(m.OutAddr[:], buf.DecodeBytes(4))
@@ -3776,11 +3524,10 @@ func (*NatDetMapDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatDetMapDetails) Size() int {
+func (m *NatDetMapDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.InAddr
size += 1 // m.InPlen
size += 1 * 4 // m.OutAddr
@@ -3791,19 +3538,17 @@ func (m *NatDetMapDetails) Size() int {
return size
}
func (m *NatDetMapDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.InAddr[:], 4)
- buf.EncodeUint8(uint8(m.InPlen))
+ buf.EncodeUint8(m.InPlen)
buf.EncodeBytes(m.OutAddr[:], 4)
- buf.EncodeUint8(uint8(m.OutPlen))
- buf.EncodeUint32(uint32(m.SharingRatio))
- buf.EncodeUint16(uint16(m.PortsPerHost))
- buf.EncodeUint32(uint32(m.SesNum))
+ buf.EncodeUint8(m.OutPlen)
+ buf.EncodeUint32(m.SharingRatio)
+ buf.EncodeUint16(m.PortsPerHost)
+ buf.EncodeUint32(m.SesNum)
return buf.Bytes(), nil
}
func (m *NatDetMapDetails) Unmarshal(b []byte) error {
@@ -3828,20 +3573,17 @@ func (*NatDetMapDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatDetMapDump) Size() int {
+func (m *NatDetMapDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatDetMapDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatDetMapDump) Unmarshal(b []byte) error {
@@ -3861,23 +3603,20 @@ func (*NatDetReverse) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatDetReverse) Size() int {
+func (m *NatDetReverse) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.OutPort
size += 1 * 4 // m.OutAddr
return size
}
func (m *NatDetReverse) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.OutPort))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.OutPort)
buf.EncodeBytes(m.OutAddr[:], 4)
return buf.Bytes(), nil
}
@@ -3901,29 +3640,26 @@ func (*NatDetReverseReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatDetReverseReply) Size() int {
+func (m *NatDetReverseReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 * 4 // m.InAddr
return size
}
func (m *NatDetReverseReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBytes(m.InAddr[:], 4)
return buf.Bytes(), nil
}
func (m *NatDetReverseReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
copy(m.InAddr[:], buf.DecodeBytes(4))
return nil
}
@@ -3945,11 +3681,10 @@ func (*NatDetSessionDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatDetSessionDetails) Size() int {
+func (m *NatDetSessionDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.InPort
size += 1 * 4 // m.ExtAddr
size += 2 // m.ExtPort
@@ -3959,18 +3694,16 @@ func (m *NatDetSessionDetails) Size() int {
return size
}
func (m *NatDetSessionDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.InPort))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.InPort)
buf.EncodeBytes(m.ExtAddr[:], 4)
- buf.EncodeUint16(uint16(m.ExtPort))
- buf.EncodeUint16(uint16(m.OutPort))
- buf.EncodeUint8(uint8(m.State))
- buf.EncodeUint32(uint32(m.Expire))
+ buf.EncodeUint16(m.ExtPort)
+ buf.EncodeUint16(m.OutPort)
+ buf.EncodeUint8(m.State)
+ buf.EncodeUint32(m.Expire)
return buf.Bytes(), nil
}
func (m *NatDetSessionDetails) Unmarshal(b []byte) error {
@@ -3996,21 +3729,18 @@ func (*NatDetSessionDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatDetSessionDump) Size() int {
+func (m *NatDetSessionDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.UserAddr
return size
}
func (m *NatDetSessionDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.UserAddr[:], 4)
return buf.Bytes(), nil
}
@@ -4030,20 +3760,17 @@ func (*NatGetAddrAndPortAllocAlg) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatGetAddrAndPortAllocAlg) Size() int {
+func (m *NatGetAddrAndPortAllocAlg) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatGetAddrAndPortAllocAlg) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatGetAddrAndPortAllocAlg) Unmarshal(b []byte) error {
@@ -4070,11 +3797,10 @@ func (*NatGetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatGetAddrAndPortAllocAlgReply) Size() int {
+func (m *NatGetAddrAndPortAllocAlgReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.Alg
size += 1 // m.PsidOffset
@@ -4085,24 +3811,22 @@ func (m *NatGetAddrAndPortAllocAlgReply) Size() int {
return size
}
func (m *NatGetAddrAndPortAllocAlgReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint8(uint8(m.Alg))
- buf.EncodeUint8(uint8(m.PsidOffset))
- buf.EncodeUint8(uint8(m.PsidLength))
- buf.EncodeUint16(uint16(m.Psid))
- buf.EncodeUint16(uint16(m.StartPort))
- buf.EncodeUint16(uint16(m.EndPort))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint8(m.Alg)
+ buf.EncodeUint8(m.PsidOffset)
+ buf.EncodeUint8(m.PsidLength)
+ buf.EncodeUint16(m.Psid)
+ buf.EncodeUint16(m.StartPort)
+ buf.EncodeUint16(m.EndPort)
return buf.Bytes(), nil
}
func (m *NatGetAddrAndPortAllocAlgReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Alg = buf.DecodeUint8()
m.PsidOffset = buf.DecodeUint8()
m.PsidLength = buf.DecodeUint8()
@@ -4122,20 +3846,17 @@ func (*NatGetMssClamping) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatGetMssClamping) Size() int {
+func (m *NatGetMssClamping) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatGetMssClamping) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatGetMssClamping) Unmarshal(b []byte) error {
@@ -4156,31 +3877,28 @@ func (*NatGetMssClampingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatGetMssClampingReply) Size() int {
+func (m *NatGetMssClampingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 2 // m.MssValue
size += 1 // m.Enable
return size
}
func (m *NatGetMssClampingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint16(uint16(m.MssValue))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint16(m.MssValue)
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
}
func (m *NatGetMssClampingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.MssValue = buf.DecodeUint16()
m.Enable = buf.DecodeBool()
return nil
@@ -4196,20 +3914,17 @@ func (*NatGetTimeouts) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatGetTimeouts) Size() int {
+func (m *NatGetTimeouts) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatGetTimeouts) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatGetTimeouts) Unmarshal(b []byte) error {
@@ -4232,11 +3947,10 @@ func (*NatGetTimeoutsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatGetTimeoutsReply) Size() int {
+func (m *NatGetTimeoutsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.UDP
size += 4 // m.TCPEstablished
@@ -4245,22 +3959,20 @@ func (m *NatGetTimeoutsReply) Size() int {
return size
}
func (m *NatGetTimeoutsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.UDP))
- buf.EncodeUint32(uint32(m.TCPEstablished))
- buf.EncodeUint32(uint32(m.TCPTransitory))
- buf.EncodeUint32(uint32(m.ICMP))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.UDP)
+ buf.EncodeUint32(m.TCPEstablished)
+ buf.EncodeUint32(m.TCPTransitory)
+ buf.EncodeUint32(m.ICMP)
return buf.Bytes(), nil
}
func (m *NatGetTimeoutsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.UDP = buf.DecodeUint32()
m.TCPEstablished = buf.DecodeUint32()
m.TCPTransitory = buf.DecodeUint32()
@@ -4278,20 +3990,17 @@ func (*NatHaFlush) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatHaFlush) Size() int {
+func (m *NatHaFlush) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatHaFlush) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatHaFlush) Unmarshal(b []byte) error {
@@ -4310,27 +4019,24 @@ func (*NatHaFlushReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatHaFlushReply) Size() int {
+func (m *NatHaFlushReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatHaFlushReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatHaFlushReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -4344,20 +4050,17 @@ func (*NatHaGetFailover) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatHaGetFailover) Size() int {
+func (m *NatHaGetFailover) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatHaGetFailover) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatHaGetFailover) Unmarshal(b []byte) error {
@@ -4379,11 +4082,10 @@ func (*NatHaGetFailoverReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatHaGetFailoverReply) Size() int {
+func (m *NatHaGetFailoverReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 * 4 // m.IPAddress
size += 2 // m.Port
@@ -4391,21 +4093,19 @@ func (m *NatHaGetFailoverReply) Size() int {
return size
}
func (m *NatHaGetFailoverReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBytes(m.IPAddress[:], 4)
- buf.EncodeUint16(uint16(m.Port))
- buf.EncodeUint32(uint32(m.SessionRefreshInterval))
+ buf.EncodeUint16(m.Port)
+ buf.EncodeUint32(m.SessionRefreshInterval)
return buf.Bytes(), nil
}
func (m *NatHaGetFailoverReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
copy(m.IPAddress[:], buf.DecodeBytes(4))
m.Port = buf.DecodeUint16()
m.SessionRefreshInterval = buf.DecodeUint32()
@@ -4422,20 +4122,17 @@ func (*NatHaGetListener) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatHaGetListener) Size() int {
+func (m *NatHaGetListener) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatHaGetListener) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatHaGetListener) Unmarshal(b []byte) error {
@@ -4457,11 +4154,10 @@ func (*NatHaGetListenerReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatHaGetListenerReply) Size() int {
+func (m *NatHaGetListenerReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 * 4 // m.IPAddress
size += 2 // m.Port
@@ -4469,21 +4165,19 @@ func (m *NatHaGetListenerReply) Size() int {
return size
}
func (m *NatHaGetListenerReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBytes(m.IPAddress[:], 4)
- buf.EncodeUint16(uint16(m.Port))
- buf.EncodeUint32(uint32(m.PathMtu))
+ buf.EncodeUint16(m.Port)
+ buf.EncodeUint32(m.PathMtu)
return buf.Bytes(), nil
}
func (m *NatHaGetListenerReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
copy(m.IPAddress[:], buf.DecodeBytes(4))
m.Port = buf.DecodeUint16()
m.PathMtu = buf.DecodeUint32()
@@ -4503,24 +4197,21 @@ func (*NatHaResync) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatHaResync) Size() int {
+func (m *NatHaResync) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.WantResyncEvent
size += 4 // m.PID
return size
}
func (m *NatHaResync) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.WantResyncEvent))
- buf.EncodeUint32(uint32(m.PID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.WantResyncEvent)
+ buf.EncodeUint32(m.PID)
return buf.Bytes(), nil
}
func (m *NatHaResync) Unmarshal(b []byte) error {
@@ -4543,24 +4234,21 @@ func (*NatHaResyncCompletedEvent) GetMessageType() api.MessageType {
return api.EventMessage
}
-func (m *NatHaResyncCompletedEvent) Size() int {
+func (m *NatHaResyncCompletedEvent) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PID
size += 4 // m.MissedCount
return size
}
func (m *NatHaResyncCompletedEvent) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PID))
- buf.EncodeUint32(uint32(m.MissedCount))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PID)
+ buf.EncodeUint32(m.MissedCount)
return buf.Bytes(), nil
}
func (m *NatHaResyncCompletedEvent) Unmarshal(b []byte) error {
@@ -4582,27 +4270,24 @@ func (*NatHaResyncReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatHaResyncReply) Size() int {
+func (m *NatHaResyncReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatHaResyncReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatHaResyncReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -4620,26 +4305,23 @@ func (*NatHaSetFailover) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatHaSetFailover) Size() int {
+func (m *NatHaSetFailover) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IPAddress
size += 2 // m.Port
size += 4 // m.SessionRefreshInterval
return size
}
func (m *NatHaSetFailover) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IPAddress[:], 4)
- buf.EncodeUint16(uint16(m.Port))
- buf.EncodeUint32(uint32(m.SessionRefreshInterval))
+ buf.EncodeUint16(m.Port)
+ buf.EncodeUint32(m.SessionRefreshInterval)
return buf.Bytes(), nil
}
func (m *NatHaSetFailover) Unmarshal(b []byte) error {
@@ -4662,27 +4344,24 @@ func (*NatHaSetFailoverReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatHaSetFailoverReply) Size() int {
+func (m *NatHaSetFailoverReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatHaSetFailoverReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatHaSetFailoverReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -4700,26 +4379,23 @@ func (*NatHaSetListener) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatHaSetListener) Size() int {
+func (m *NatHaSetListener) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.IPAddress
size += 2 // m.Port
size += 4 // m.PathMtu
return size
}
func (m *NatHaSetListener) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.IPAddress[:], 4)
- buf.EncodeUint16(uint16(m.Port))
- buf.EncodeUint32(uint32(m.PathMtu))
+ buf.EncodeUint16(m.Port)
+ buf.EncodeUint32(m.PathMtu)
return buf.Bytes(), nil
}
func (m *NatHaSetListener) Unmarshal(b []byte) error {
@@ -4742,27 +4418,24 @@ func (*NatHaSetListenerReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatHaSetListenerReply) Size() int {
+func (m *NatHaSetListenerReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatHaSetListenerReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatHaSetListenerReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -4780,25 +4453,22 @@ func (*NatIpfixEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatIpfixEnableDisable) Size() int {
+func (m *NatIpfixEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.DomainID
size += 2 // m.SrcPort
size += 1 // m.Enable
return size
}
func (m *NatIpfixEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.DomainID))
- buf.EncodeUint16(uint16(m.SrcPort))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.DomainID)
+ buf.EncodeUint16(m.SrcPort)
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
}
@@ -4822,27 +4492,24 @@ func (*NatIpfixEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatIpfixEnableDisableReply) Size() int {
+func (m *NatIpfixEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatIpfixEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatIpfixEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -4863,11 +4530,10 @@ func (*NatSetAddrAndPortAllocAlg) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatSetAddrAndPortAllocAlg) Size() int {
+func (m *NatSetAddrAndPortAllocAlg) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Alg
size += 1 // m.PsidOffset
size += 1 // m.PsidLength
@@ -4877,18 +4543,16 @@ func (m *NatSetAddrAndPortAllocAlg) Size() int {
return size
}
func (m *NatSetAddrAndPortAllocAlg) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint8(uint8(m.Alg))
- buf.EncodeUint8(uint8(m.PsidOffset))
- buf.EncodeUint8(uint8(m.PsidLength))
- buf.EncodeUint16(uint16(m.Psid))
- buf.EncodeUint16(uint16(m.StartPort))
- buf.EncodeUint16(uint16(m.EndPort))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Alg)
+ buf.EncodeUint8(m.PsidOffset)
+ buf.EncodeUint8(m.PsidLength)
+ buf.EncodeUint16(m.Psid)
+ buf.EncodeUint16(m.StartPort)
+ buf.EncodeUint16(m.EndPort)
return buf.Bytes(), nil
}
func (m *NatSetAddrAndPortAllocAlg) Unmarshal(b []byte) error {
@@ -4916,27 +4580,24 @@ func (*NatSetAddrAndPortAllocAlgReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatSetAddrAndPortAllocAlgReply) Size() int {
+func (m *NatSetAddrAndPortAllocAlgReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatSetAddrAndPortAllocAlgReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatSetAddrAndPortAllocAlgReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -4952,21 +4613,18 @@ func (*NatSetLogLevel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatSetLogLevel) Size() int {
+func (m *NatSetLogLevel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.LogLevel
return size
}
func (m *NatSetLogLevel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.LogLevel))
return buf.Bytes(), nil
}
@@ -4988,27 +4646,24 @@ func (*NatSetLogLevelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatSetLogLevelReply) Size() int {
+func (m *NatSetLogLevelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatSetLogLevelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatSetLogLevelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -5025,23 +4680,20 @@ func (*NatSetMssClamping) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatSetMssClamping) Size() int {
+func (m *NatSetMssClamping) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.MssValue
size += 1 // m.Enable
return size
}
func (m *NatSetMssClamping) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.MssValue))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.MssValue)
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
}
@@ -5064,27 +4716,24 @@ func (*NatSetMssClampingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatSetMssClampingReply) Size() int {
+func (m *NatSetMssClampingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatSetMssClampingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatSetMssClampingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -5103,11 +4752,10 @@ func (*NatSetTimeouts) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatSetTimeouts) Size() int {
+func (m *NatSetTimeouts) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.UDP
size += 4 // m.TCPEstablished
size += 4 // m.TCPTransitory
@@ -5115,16 +4763,14 @@ func (m *NatSetTimeouts) Size() int {
return size
}
func (m *NatSetTimeouts) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
- }
- buf.EncodeUint32(uint32(m.UDP))
- buf.EncodeUint32(uint32(m.TCPEstablished))
- buf.EncodeUint32(uint32(m.TCPTransitory))
- buf.EncodeUint32(uint32(m.ICMP))
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.UDP)
+ buf.EncodeUint32(m.TCPEstablished)
+ buf.EncodeUint32(m.TCPTransitory)
+ buf.EncodeUint32(m.ICMP)
return buf.Bytes(), nil
}
func (m *NatSetTimeouts) Unmarshal(b []byte) error {
@@ -5148,27 +4794,24 @@ func (*NatSetTimeoutsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatSetTimeoutsReply) Size() int {
+func (m *NatSetTimeoutsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatSetTimeoutsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatSetTimeoutsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -5184,22 +4827,19 @@ func (*NatSetWorkers) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatSetWorkers) Size() int {
+func (m *NatSetWorkers) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.WorkerMask
return size
}
func (m *NatSetWorkers) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint64(uint64(m.WorkerMask))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint64(m.WorkerMask)
return buf.Bytes(), nil
}
func (m *NatSetWorkers) Unmarshal(b []byte) error {
@@ -5220,27 +4860,24 @@ func (*NatSetWorkersReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatSetWorkersReply) Size() int {
+func (m *NatSetWorkersReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NatSetWorkersReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NatSetWorkersReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -5254,20 +4891,17 @@ func (*NatShowConfig) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatShowConfig) Size() int {
+func (m *NatShowConfig) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatShowConfig) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatShowConfig) Unmarshal(b []byte) error {
@@ -5303,11 +4937,10 @@ func (*NatShowConfigReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatShowConfigReply) Size() int {
+func (m *NatShowConfigReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.StaticMappingOnly
size += 1 // m.StaticMappingConnectionTracking
@@ -5329,35 +4962,33 @@ func (m *NatShowConfigReply) Size() int {
return size
}
func (m *NatShowConfigReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.StaticMappingOnly)
buf.EncodeBool(m.StaticMappingConnectionTracking)
buf.EncodeBool(m.Deterministic)
buf.EncodeBool(m.EndpointDependent)
buf.EncodeBool(m.Out2inDpo)
buf.EncodeBool(m.DsliteCe)
- buf.EncodeUint32(uint32(m.TranslationBuckets))
- buf.EncodeUint32(uint32(m.TranslationMemorySize))
- buf.EncodeUint32(uint32(m.UserBuckets))
- buf.EncodeUint64(uint64(m.UserMemorySize))
- buf.EncodeUint32(uint32(m.MaxTranslationsPerUser))
- buf.EncodeUint32(uint32(m.OutsideVrfID))
- buf.EncodeUint32(uint32(m.InsideVrfID))
- buf.EncodeUint32(uint32(m.Nat64BibBuckets))
- buf.EncodeUint64(uint64(m.Nat64BibMemorySize))
- buf.EncodeUint32(uint32(m.Nat64StBuckets))
- buf.EncodeUint64(uint64(m.Nat64StMemorySize))
+ buf.EncodeUint32(m.TranslationBuckets)
+ buf.EncodeUint32(m.TranslationMemorySize)
+ buf.EncodeUint32(m.UserBuckets)
+ buf.EncodeUint64(m.UserMemorySize)
+ buf.EncodeUint32(m.MaxTranslationsPerUser)
+ buf.EncodeUint32(m.OutsideVrfID)
+ buf.EncodeUint32(m.InsideVrfID)
+ buf.EncodeUint32(m.Nat64BibBuckets)
+ buf.EncodeUint64(m.Nat64BibMemorySize)
+ buf.EncodeUint32(m.Nat64StBuckets)
+ buf.EncodeUint64(m.Nat64StMemorySize)
return buf.Bytes(), nil
}
func (m *NatShowConfigReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.StaticMappingOnly = buf.DecodeBool()
m.StaticMappingConnectionTracking = buf.DecodeBool()
m.Deterministic = buf.DecodeBool()
@@ -5392,25 +5023,22 @@ func (*NatWorkerDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NatWorkerDetails) Size() int {
+func (m *NatWorkerDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.WorkerIndex
size += 4 // m.LcoreID
size += 64 // m.Name
return size
}
func (m *NatWorkerDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.WorkerIndex))
- buf.EncodeUint32(uint32(m.LcoreID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.WorkerIndex)
+ buf.EncodeUint32(m.LcoreID)
buf.EncodeString(m.Name, 64)
return buf.Bytes(), nil
}
@@ -5432,20 +5060,17 @@ func (*NatWorkerDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NatWorkerDump) Size() int {
+func (m *NatWorkerDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *NatWorkerDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *NatWorkerDump) Unmarshal(b []byte) error {
diff --git a/binapi/nsh/nsh.ba.go b/binapi/nsh/nsh.ba.go
index a918c98..5897a90 100644
--- a/binapi/nsh/nsh.ba.go
+++ b/binapi/nsh/nsh.ba.go
@@ -53,11 +53,10 @@ func (*NshAddDelEntry) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NshAddDelEntry) Size() int {
+func (m *NshAddDelEntry) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.NspNsi
size += 1 // m.MdType
@@ -74,25 +73,23 @@ func (m *NshAddDelEntry) Size() int {
return size
}
func (m *NshAddDelEntry) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.NspNsi))
- buf.EncodeUint8(uint8(m.MdType))
- buf.EncodeUint8(uint8(m.VerOC))
- buf.EncodeUint8(uint8(m.TTL))
- buf.EncodeUint8(uint8(m.Length))
- buf.EncodeUint8(uint8(m.NextProtocol))
- buf.EncodeUint32(uint32(m.C1))
- buf.EncodeUint32(uint32(m.C2))
- buf.EncodeUint32(uint32(m.C3))
- buf.EncodeUint32(uint32(m.C4))
- buf.EncodeUint8(uint8(m.TlvLength))
- buf.EncodeBytes(m.Tlv[:], 248)
+ buf.EncodeUint32(m.NspNsi)
+ buf.EncodeUint8(m.MdType)
+ buf.EncodeUint8(m.VerOC)
+ buf.EncodeUint8(m.TTL)
+ buf.EncodeUint8(m.Length)
+ buf.EncodeUint8(m.NextProtocol)
+ buf.EncodeUint32(m.C1)
+ buf.EncodeUint32(m.C2)
+ buf.EncodeUint32(m.C3)
+ buf.EncodeUint32(m.C4)
+ buf.EncodeUint8(m.TlvLength)
+ buf.EncodeBytes(m.Tlv, 248)
return buf.Bytes(), nil
}
func (m *NshAddDelEntry) Unmarshal(b []byte) error {
@@ -109,7 +106,8 @@ func (m *NshAddDelEntry) Unmarshal(b []byte) error {
m.C3 = buf.DecodeUint32()
m.C4 = buf.DecodeUint32()
m.TlvLength = buf.DecodeUint8()
- copy(m.Tlv[:], buf.DecodeBytes(248))
+ m.Tlv = make([]byte, 248)
+ copy(m.Tlv, buf.DecodeBytes(len(m.Tlv)))
return nil
}
@@ -126,29 +124,26 @@ func (*NshAddDelEntryReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NshAddDelEntryReply) Size() int {
+func (m *NshAddDelEntryReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.EntryIndex
return size
}
func (m *NshAddDelEntryReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.EntryIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.EntryIndex)
return buf.Bytes(), nil
}
func (m *NshAddDelEntryReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.EntryIndex = buf.DecodeUint32()
return nil
}
@@ -171,11 +166,10 @@ func (*NshAddDelMap) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NshAddDelMap) Size() int {
+func (m *NshAddDelMap) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.NspNsi
size += 4 // m.MappedNspNsi
@@ -186,19 +180,17 @@ func (m *NshAddDelMap) Size() int {
return size
}
func (m *NshAddDelMap) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.NspNsi))
- buf.EncodeUint32(uint32(m.MappedNspNsi))
- buf.EncodeUint32(uint32(m.NshAction))
+ buf.EncodeUint32(m.NspNsi)
+ buf.EncodeUint32(m.MappedNspNsi)
+ buf.EncodeUint32(m.NshAction)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint32(uint32(m.RxSwIfIndex))
- buf.EncodeUint32(uint32(m.NextNode))
+ buf.EncodeUint32(m.NextNode)
return buf.Bytes(), nil
}
func (m *NshAddDelMap) Unmarshal(b []byte) error {
@@ -226,29 +218,26 @@ func (*NshAddDelMapReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NshAddDelMapReply) Size() int {
+func (m *NshAddDelMapReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.MapIndex
return size
}
func (m *NshAddDelMapReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.MapIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.MapIndex)
return buf.Bytes(), nil
}
func (m *NshAddDelMapReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.MapIndex = buf.DecodeUint32()
return nil
}
@@ -277,11 +266,10 @@ func (*NshEntryDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NshEntryDetails) Size() int {
+func (m *NshEntryDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.EntryIndex
size += 4 // m.NspNsi
size += 1 // m.MdType
@@ -298,25 +286,23 @@ func (m *NshEntryDetails) Size() int {
return size
}
func (m *NshEntryDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.EntryIndex))
- buf.EncodeUint32(uint32(m.NspNsi))
- buf.EncodeUint8(uint8(m.MdType))
- buf.EncodeUint8(uint8(m.VerOC))
- buf.EncodeUint8(uint8(m.TTL))
- buf.EncodeUint8(uint8(m.Length))
- buf.EncodeUint8(uint8(m.NextProtocol))
- buf.EncodeUint32(uint32(m.C1))
- buf.EncodeUint32(uint32(m.C2))
- buf.EncodeUint32(uint32(m.C3))
- buf.EncodeUint32(uint32(m.C4))
- buf.EncodeUint8(uint8(m.TlvLength))
- buf.EncodeBytes(m.Tlv[:], 248)
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.EntryIndex)
+ buf.EncodeUint32(m.NspNsi)
+ buf.EncodeUint8(m.MdType)
+ buf.EncodeUint8(m.VerOC)
+ buf.EncodeUint8(m.TTL)
+ buf.EncodeUint8(m.Length)
+ buf.EncodeUint8(m.NextProtocol)
+ buf.EncodeUint32(m.C1)
+ buf.EncodeUint32(m.C2)
+ buf.EncodeUint32(m.C3)
+ buf.EncodeUint32(m.C4)
+ buf.EncodeUint8(m.TlvLength)
+ buf.EncodeBytes(m.Tlv, 248)
return buf.Bytes(), nil
}
func (m *NshEntryDetails) Unmarshal(b []byte) error {
@@ -333,7 +319,8 @@ func (m *NshEntryDetails) Unmarshal(b []byte) error {
m.C3 = buf.DecodeUint32()
m.C4 = buf.DecodeUint32()
m.TlvLength = buf.DecodeUint8()
- copy(m.Tlv[:], buf.DecodeBytes(248))
+ m.Tlv = make([]byte, 248)
+ copy(m.Tlv, buf.DecodeBytes(len(m.Tlv)))
return nil
}
@@ -349,22 +336,19 @@ func (*NshEntryDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NshEntryDump) Size() int {
+func (m *NshEntryDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.EntryIndex
return size
}
func (m *NshEntryDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.EntryIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.EntryIndex)
return buf.Bytes(), nil
}
func (m *NshEntryDump) Unmarshal(b []byte) error {
@@ -391,11 +375,10 @@ func (*NshMapDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NshMapDetails) Size() int {
+func (m *NshMapDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.MapIndex
size += 4 // m.NspNsi
size += 4 // m.MappedNspNsi
@@ -406,19 +389,17 @@ func (m *NshMapDetails) Size() int {
return size
}
func (m *NshMapDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.MapIndex))
- buf.EncodeUint32(uint32(m.NspNsi))
- buf.EncodeUint32(uint32(m.MappedNspNsi))
- buf.EncodeUint32(uint32(m.NshAction))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.MapIndex)
+ buf.EncodeUint32(m.NspNsi)
+ buf.EncodeUint32(m.MappedNspNsi)
+ buf.EncodeUint32(m.NshAction)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint32(uint32(m.RxSwIfIndex))
- buf.EncodeUint32(uint32(m.NextNode))
+ buf.EncodeUint32(m.NextNode)
return buf.Bytes(), nil
}
func (m *NshMapDetails) Unmarshal(b []byte) error {
@@ -445,22 +426,19 @@ func (*NshMapDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NshMapDump) Size() int {
+func (m *NshMapDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.MapIndex
return size
}
func (m *NshMapDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.MapIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.MapIndex)
return buf.Bytes(), nil
}
func (m *NshMapDump) Unmarshal(b []byte) error {
diff --git a/binapi/nsim/nsim.ba.go b/binapi/nsim/nsim.ba.go
index 5b751b8..fb540ac 100644
--- a/binapi/nsim/nsim.ba.go
+++ b/binapi/nsim/nsim.ba.go
@@ -44,11 +44,10 @@ func (*NsimConfigure) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NsimConfigure) Size() int {
+func (m *NsimConfigure) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.DelayInUsec
size += 4 // m.AveragePacketSize
size += 8 // m.BandwidthInBitsPerSecond
@@ -56,16 +55,14 @@ func (m *NsimConfigure) Size() int {
return size
}
func (m *NsimConfigure) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.DelayInUsec))
- buf.EncodeUint32(uint32(m.AveragePacketSize))
- buf.EncodeUint64(uint64(m.BandwidthInBitsPerSecond))
- buf.EncodeUint32(uint32(m.PacketsPerDrop))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.DelayInUsec)
+ buf.EncodeUint32(m.AveragePacketSize)
+ buf.EncodeUint64(m.BandwidthInBitsPerSecond)
+ buf.EncodeUint32(m.PacketsPerDrop)
return buf.Bytes(), nil
}
func (m *NsimConfigure) Unmarshal(b []byte) error {
@@ -89,27 +86,24 @@ func (*NsimConfigureReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NsimConfigureReply) Size() int {
+func (m *NsimConfigureReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NsimConfigureReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NsimConfigureReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -129,23 +123,20 @@ func (*NsimCrossConnectEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NsimCrossConnectEnableDisable) Size() int {
+func (m *NsimCrossConnectEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
size += 4 // m.SwIfIndex0
size += 4 // m.SwIfIndex1
return size
}
func (m *NsimCrossConnectEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
buf.EncodeUint32(uint32(m.SwIfIndex0))
buf.EncodeUint32(uint32(m.SwIfIndex1))
@@ -173,27 +164,24 @@ func (*NsimCrossConnectEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NsimCrossConnectEnableDisableReply) Size() int {
+func (m *NsimCrossConnectEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NsimCrossConnectEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NsimCrossConnectEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -212,22 +200,19 @@ func (*NsimOutputFeatureEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *NsimOutputFeatureEnableDisable) Size() int {
+func (m *NsimOutputFeatureEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
size += 4 // m.SwIfIndex
return size
}
func (m *NsimOutputFeatureEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -253,27 +238,24 @@ func (*NsimOutputFeatureEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *NsimOutputFeatureEnableDisableReply) Size() int {
+func (m *NsimOutputFeatureEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *NsimOutputFeatureEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *NsimOutputFeatureEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/oddbuf/oddbuf.ba.go b/binapi/oddbuf/oddbuf.ba.go
index ceceaae..c6f3e21 100644
--- a/binapi/oddbuf/oddbuf.ba.go
+++ b/binapi/oddbuf/oddbuf.ba.go
@@ -42,22 +42,19 @@ func (*OddbufEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OddbufEnableDisable) Size() int {
+func (m *OddbufEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EnableDisable
size += 4 // m.SwIfIndex
return size
}
func (m *OddbufEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EnableDisable)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
@@ -81,27 +78,24 @@ func (*OddbufEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OddbufEnableDisableReply) Size() int {
+func (m *OddbufEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OddbufEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OddbufEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/one/one.ba.go b/binapi/one/one.ba.go
index 259e3f2..fa3b5af 100644
--- a/binapi/one/one.ba.go
+++ b/binapi/one/one.ba.go
@@ -125,11 +125,10 @@ func (*OneAddDelAdjacency) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelAdjacency) Size() int {
+func (m *OneAddDelAdjacency) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Vni
size += 1 // m.Reid.Type
@@ -139,18 +138,16 @@ func (m *OneAddDelAdjacency) Size() int {
return size
}
func (m *OneAddDelAdjacency) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.IsAdd))
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.IsAdd)
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Reid.Type))
- buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Reid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.Leid.Type))
- buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Leid.Address.XXX_UnionData[:], 6)
return buf.Bytes(), nil
}
func (m *OneAddDelAdjacency) Unmarshal(b []byte) error {
@@ -176,27 +173,24 @@ func (*OneAddDelAdjacencyReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelAdjacencyReply) Size() int {
+func (m *OneAddDelAdjacencyReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneAddDelAdjacencyReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneAddDelAdjacencyReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -214,11 +208,10 @@ func (*OneAddDelL2ArpEntry) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelL2ArpEntry) Size() int {
+func (m *OneAddDelL2ArpEntry) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Bd
size += 1 * 6 // m.Entry.Mac
@@ -226,14 +219,12 @@ func (m *OneAddDelL2ArpEntry) Size() int {
return size
}
func (m *OneAddDelL2ArpEntry) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Bd))
+ buf.EncodeUint32(m.Bd)
buf.EncodeBytes(m.Entry.Mac[:], 6)
buf.EncodeBytes(m.Entry.IP4[:], 4)
return buf.Bytes(), nil
@@ -259,27 +250,24 @@ func (*OneAddDelL2ArpEntryReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelL2ArpEntryReply) Size() int {
+func (m *OneAddDelL2ArpEntryReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneAddDelL2ArpEntryReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneAddDelL2ArpEntryReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -299,11 +287,10 @@ func (*OneAddDelLocalEid) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelLocalEid) Size() int {
+func (m *OneAddDelLocalEid) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Eid.Type
size += 1 * 6 // m.Eid.Address
@@ -314,19 +301,17 @@ func (m *OneAddDelLocalEid) Size() int {
return size
}
func (m *OneAddDelLocalEid) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Eid.Type))
- buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 6)
buf.EncodeString(m.LocatorSetName, 64)
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Key.ID))
- buf.EncodeBytes(m.Key.Key[:], 64)
+ buf.EncodeBytes(m.Key.Key, 64)
return buf.Bytes(), nil
}
func (m *OneAddDelLocalEid) Unmarshal(b []byte) error {
@@ -337,7 +322,8 @@ func (m *OneAddDelLocalEid) Unmarshal(b []byte) error {
m.LocatorSetName = buf.DecodeString(64)
m.Vni = buf.DecodeUint32()
m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8())
- copy(m.Key.Key[:], buf.DecodeBytes(64))
+ m.Key.Key = make([]byte, 64)
+ copy(m.Key.Key, buf.DecodeBytes(len(m.Key.Key)))
return nil
}
@@ -353,27 +339,24 @@ func (*OneAddDelLocalEidReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelLocalEidReply) Size() int {
+func (m *OneAddDelLocalEidReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneAddDelLocalEidReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneAddDelLocalEidReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -393,11 +376,10 @@ func (*OneAddDelLocator) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelLocator) Size() int {
+func (m *OneAddDelLocator) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.LocatorSetName
size += 4 // m.SwIfIndex
@@ -406,17 +388,15 @@ func (m *OneAddDelLocator) Size() int {
return size
}
func (m *OneAddDelLocator) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.LocatorSetName, 64)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.Priority))
- buf.EncodeUint8(uint8(m.Weight))
+ buf.EncodeUint8(m.Priority)
+ buf.EncodeUint8(m.Weight)
return buf.Bytes(), nil
}
func (m *OneAddDelLocator) Unmarshal(b []byte) error {
@@ -441,27 +421,24 @@ func (*OneAddDelLocatorReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelLocatorReply) Size() int {
+func (m *OneAddDelLocatorReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneAddDelLocatorReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneAddDelLocatorReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -480,11 +457,10 @@ func (*OneAddDelLocatorSet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelLocatorSet) Size() int {
+func (m *OneAddDelLocatorSet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.LocatorSetName
size += 4 // m.LocatorNum
@@ -501,23 +477,21 @@ func (m *OneAddDelLocatorSet) Size() int {
return size
}
func (m *OneAddDelLocatorSet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.LocatorSetName, 64)
buf.EncodeUint32(uint32(len(m.Locators)))
for j0 := 0; j0 < len(m.Locators); j0++ {
- var v0 lisp_types.LocalLocator
+ var v0 lisp_types.LocalLocator // Locators
if j0 < len(m.Locators) {
v0 = m.Locators[j0]
}
buf.EncodeUint32(uint32(v0.SwIfIndex))
- buf.EncodeUint8(uint8(v0.Priority))
- buf.EncodeUint8(uint8(v0.Weight))
+ buf.EncodeUint8(v0.Priority)
+ buf.EncodeUint8(v0.Weight)
}
return buf.Bytes(), nil
}
@@ -526,7 +500,7 @@ func (m *OneAddDelLocatorSet) Unmarshal(b []byte) error {
m.IsAdd = buf.DecodeBool()
m.LocatorSetName = buf.DecodeString(64)
m.LocatorNum = buf.DecodeUint32()
- m.Locators = make([]lisp_types.LocalLocator, int(m.LocatorNum))
+ m.Locators = make([]lisp_types.LocalLocator, m.LocatorNum)
for j0 := 0; j0 < len(m.Locators); j0++ {
m.Locators[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.Locators[j0].Priority = buf.DecodeUint8()
@@ -548,29 +522,26 @@ func (*OneAddDelLocatorSetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelLocatorSetReply) Size() int {
+func (m *OneAddDelLocatorSetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.LsIndex
return size
}
func (m *OneAddDelLocatorSetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.LsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.LsIndex)
return buf.Bytes(), nil
}
func (m *OneAddDelLocatorSetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.LsIndex = buf.DecodeUint32()
return nil
}
@@ -590,22 +561,19 @@ func (*OneAddDelMapRequestItrRlocs) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelMapRequestItrRlocs) Size() int {
+func (m *OneAddDelMapRequestItrRlocs) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.LocatorSetName
return size
}
func (m *OneAddDelMapRequestItrRlocs) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.LocatorSetName, 64)
return buf.Bytes(), nil
@@ -631,27 +599,24 @@ func (*OneAddDelMapRequestItrRlocsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelMapRequestItrRlocsReply) Size() int {
+func (m *OneAddDelMapRequestItrRlocsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneAddDelMapRequestItrRlocsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneAddDelMapRequestItrRlocsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -668,26 +633,23 @@ func (*OneAddDelMapResolver) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelMapResolver) Size() int {
+func (m *OneAddDelMapResolver) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
return size
}
func (m *OneAddDelMapResolver) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *OneAddDelMapResolver) Unmarshal(b []byte) error {
@@ -710,27 +672,24 @@ func (*OneAddDelMapResolverReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelMapResolverReply) Size() int {
+func (m *OneAddDelMapResolverReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneAddDelMapResolverReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneAddDelMapResolverReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -747,26 +706,23 @@ func (*OneAddDelMapServer) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelMapServer) Size() int {
+func (m *OneAddDelMapServer) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
return size
}
func (m *OneAddDelMapServer) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *OneAddDelMapServer) Unmarshal(b []byte) error {
@@ -789,27 +745,24 @@ func (*OneAddDelMapServerReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelMapServerReply) Size() int {
+func (m *OneAddDelMapServerReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneAddDelMapServerReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneAddDelMapServerReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -827,11 +780,10 @@ func (*OneAddDelNdpEntry) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelNdpEntry) Size() int {
+func (m *OneAddDelNdpEntry) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Bd
size += 1 * 6 // m.Entry.Mac
@@ -839,14 +791,12 @@ func (m *OneAddDelNdpEntry) Size() int {
return size
}
func (m *OneAddDelNdpEntry) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Bd))
+ buf.EncodeUint32(m.Bd)
buf.EncodeBytes(m.Entry.Mac[:], 6)
buf.EncodeBytes(m.Entry.IP6[:], 16)
return buf.Bytes(), nil
@@ -872,27 +822,24 @@ func (*OneAddDelNdpEntryReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelNdpEntryReply) Size() int {
+func (m *OneAddDelNdpEntryReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneAddDelNdpEntryReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneAddDelNdpEntryReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -916,11 +863,10 @@ func (*OneAddDelRemoteMapping) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAddDelRemoteMapping) Size() int {
+func (m *OneAddDelRemoteMapping) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.IsSrcDst
size += 1 // m.DelAll
@@ -945,31 +891,29 @@ func (m *OneAddDelRemoteMapping) Size() int {
return size
}
func (m *OneAddDelRemoteMapping) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeBool(m.IsSrcDst)
buf.EncodeBool(m.DelAll)
- buf.EncodeUint32(uint32(m.Vni))
- buf.EncodeUint8(uint8(m.Action))
+ buf.EncodeUint32(m.Vni)
+ buf.EncodeUint8(m.Action)
buf.EncodeUint8(uint8(m.Deid.Type))
- buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.Seid.Type))
- buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6)
buf.EncodeUint32(uint32(len(m.Rlocs)))
for j0 := 0; j0 < len(m.Rlocs); j0++ {
- var v0 lisp_types.RemoteLocator
+ var v0 lisp_types.RemoteLocator // Rlocs
if j0 < len(m.Rlocs) {
v0 = m.Rlocs[j0]
}
- buf.EncodeUint8(uint8(v0.Priority))
- buf.EncodeUint8(uint8(v0.Weight))
+ buf.EncodeUint8(v0.Priority)
+ buf.EncodeUint8(v0.Weight)
buf.EncodeUint8(uint8(v0.IPAddress.Af))
- buf.EncodeBytes(v0.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.IPAddress.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -985,7 +929,7 @@ func (m *OneAddDelRemoteMapping) Unmarshal(b []byte) error {
m.Seid.Type = lisp_types.EidType(buf.DecodeUint8())
copy(m.Seid.Address.XXX_UnionData[:], buf.DecodeBytes(6))
m.RlocNum = buf.DecodeUint32()
- m.Rlocs = make([]lisp_types.RemoteLocator, int(m.RlocNum))
+ m.Rlocs = make([]lisp_types.RemoteLocator, m.RlocNum)
for j0 := 0; j0 < len(m.Rlocs); j0++ {
m.Rlocs[j0].Priority = buf.DecodeUint8()
m.Rlocs[j0].Weight = buf.DecodeUint8()
@@ -1009,27 +953,24 @@ func (*OneAddDelRemoteMappingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAddDelRemoteMappingReply) Size() int {
+func (m *OneAddDelRemoteMappingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneAddDelRemoteMappingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneAddDelRemoteMappingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1045,22 +986,19 @@ func (*OneAdjacenciesGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneAdjacenciesGet) Size() int {
+func (m *OneAdjacenciesGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
return size
}
func (m *OneAdjacenciesGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *OneAdjacenciesGet) Unmarshal(b []byte) error {
@@ -1083,11 +1021,10 @@ func (*OneAdjacenciesGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneAdjacenciesGetReply) Size() int {
+func (m *OneAdjacenciesGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
for j1 := 0; j1 < len(m.Adjacencies); j1++ {
@@ -1104,31 +1041,29 @@ func (m *OneAdjacenciesGetReply) Size() int {
return size
}
func (m *OneAdjacenciesGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.Adjacencies)))
for j0 := 0; j0 < len(m.Adjacencies); j0++ {
- var v0 OneAdjacency
+ var v0 OneAdjacency // Adjacencies
if j0 < len(m.Adjacencies) {
v0 = m.Adjacencies[j0]
}
buf.EncodeUint8(uint8(v0.Reid.Type))
- buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Reid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(v0.Leid.Type))
- buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Leid.Address.XXX_UnionData[:], 6)
}
return buf.Bytes(), nil
}
func (m *OneAdjacenciesGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
- m.Adjacencies = make([]OneAdjacency, int(m.Count))
+ m.Adjacencies = make([]OneAdjacency, m.Count)
for j0 := 0; j0 < len(m.Adjacencies); j0++ {
m.Adjacencies[j0].Reid.Type = lisp_types.EidType(buf.DecodeUint8())
copy(m.Adjacencies[j0].Reid.Address.XXX_UnionData[:], buf.DecodeBytes(6))
@@ -1153,11 +1088,10 @@ func (*OneEidTableAddDelMap) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneEidTableAddDelMap) Size() int {
+func (m *OneEidTableAddDelMap) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Vni
size += 4 // m.DpTable
@@ -1165,15 +1099,13 @@ func (m *OneEidTableAddDelMap) Size() int {
return size
}
func (m *OneEidTableAddDelMap) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Vni))
- buf.EncodeUint32(uint32(m.DpTable))
+ buf.EncodeUint32(m.Vni)
+ buf.EncodeUint32(m.DpTable)
buf.EncodeBool(m.IsL2)
return buf.Bytes(), nil
}
@@ -1198,27 +1130,24 @@ func (*OneEidTableAddDelMapReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneEidTableAddDelMapReply) Size() int {
+func (m *OneEidTableAddDelMapReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneEidTableAddDelMapReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneEidTableAddDelMapReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1243,11 +1172,10 @@ func (*OneEidTableDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneEidTableDetails) Size() int {
+func (m *OneEidTableDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.LocatorSetIndex
size += 1 // m.Action
size += 1 // m.IsLocal
@@ -1264,25 +1192,23 @@ func (m *OneEidTableDetails) Size() int {
return size
}
func (m *OneEidTableDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.LocatorSetIndex))
- buf.EncodeUint8(uint8(m.Action))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.LocatorSetIndex)
+ buf.EncodeUint8(m.Action)
buf.EncodeBool(m.IsLocal)
buf.EncodeBool(m.IsSrcDst)
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Deid.Type))
- buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.Seid.Type))
- buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.TTL))
- buf.EncodeUint8(uint8(m.Authoritative))
+ buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6)
+ buf.EncodeUint32(m.TTL)
+ buf.EncodeUint8(m.Authoritative)
buf.EncodeUint8(uint8(m.Key.ID))
- buf.EncodeBytes(m.Key.Key[:], 64)
+ buf.EncodeBytes(m.Key.Key, 64)
return buf.Bytes(), nil
}
func (m *OneEidTableDetails) Unmarshal(b []byte) error {
@@ -1299,7 +1225,8 @@ func (m *OneEidTableDetails) Unmarshal(b []byte) error {
m.TTL = buf.DecodeUint32()
m.Authoritative = buf.DecodeUint8()
m.Key.ID = lisp_types.HmacKeyID(buf.DecodeUint8())
- copy(m.Key.Key[:], buf.DecodeBytes(64))
+ m.Key.Key = make([]byte, 64)
+ copy(m.Key.Key, buf.DecodeBytes(len(m.Key.Key)))
return nil
}
@@ -1318,11 +1245,10 @@ func (*OneEidTableDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneEidTableDump) Size() int {
+func (m *OneEidTableDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.EidSet
size += 4 // m.Vni
size += 1 // m.Eid.Type
@@ -1331,16 +1257,14 @@ func (m *OneEidTableDump) Size() int {
return size
}
func (m *OneEidTableDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.EidSet)
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Eid.Type))
- buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Eid.Address.XXX_UnionData[:], 6)
buf.EncodeUint32(uint32(m.Filter))
return buf.Bytes(), nil
}
@@ -1367,24 +1291,21 @@ func (*OneEidTableMapDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneEidTableMapDetails) Size() int {
+func (m *OneEidTableMapDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
size += 4 // m.DpTable
return size
}
func (m *OneEidTableMapDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
- buf.EncodeUint32(uint32(m.DpTable))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
+ buf.EncodeUint32(m.DpTable)
return buf.Bytes(), nil
}
func (m *OneEidTableMapDetails) Unmarshal(b []byte) error {
@@ -1406,21 +1327,18 @@ func (*OneEidTableMapDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneEidTableMapDump) Size() int {
+func (m *OneEidTableMapDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsL2
return size
}
func (m *OneEidTableMapDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsL2)
return buf.Bytes(), nil
}
@@ -1442,22 +1360,19 @@ func (*OneEidTableVniDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneEidTableVniDetails) Size() int {
+func (m *OneEidTableVniDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
return size
}
func (m *OneEidTableVniDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *OneEidTableVniDetails) Unmarshal(b []byte) error {
@@ -1476,20 +1391,17 @@ func (*OneEidTableVniDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneEidTableVniDump) Size() int {
+func (m *OneEidTableVniDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneEidTableVniDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneEidTableVniDump) Unmarshal(b []byte) error {
@@ -1508,21 +1420,18 @@ func (*OneEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneEnableDisable) Size() int {
+func (m *OneEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *OneEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -1544,21 +1453,18 @@ func (*OneEnableDisablePetrMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneEnableDisablePetrMode) Size() int {
+func (m *OneEnableDisablePetrMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *OneEnableDisablePetrMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -1582,27 +1488,24 @@ func (*OneEnableDisablePetrModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneEnableDisablePetrModeReply) Size() int {
+func (m *OneEnableDisablePetrModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneEnableDisablePetrModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneEnableDisablePetrModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1618,21 +1521,18 @@ func (*OneEnableDisablePitrMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneEnableDisablePitrMode) Size() int {
+func (m *OneEnableDisablePitrMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *OneEnableDisablePitrMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -1656,27 +1556,24 @@ func (*OneEnableDisablePitrModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneEnableDisablePitrModeReply) Size() int {
+func (m *OneEnableDisablePitrModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneEnableDisablePitrModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneEnableDisablePitrModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1692,27 +1589,24 @@ func (*OneEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneEnableDisableReply) Size() int {
+func (m *OneEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1728,21 +1622,18 @@ func (*OneEnableDisableXtrMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneEnableDisableXtrMode) Size() int {
+func (m *OneEnableDisableXtrMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *OneEnableDisableXtrMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -1766,27 +1657,24 @@ func (*OneEnableDisableXtrModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneEnableDisableXtrModeReply) Size() int {
+func (m *OneEnableDisableXtrModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneEnableDisableXtrModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneEnableDisableXtrModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1800,20 +1688,17 @@ func (*OneGetMapRequestItrRlocs) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneGetMapRequestItrRlocs) Size() int {
+func (m *OneGetMapRequestItrRlocs) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneGetMapRequestItrRlocs) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneGetMapRequestItrRlocs) Unmarshal(b []byte) error {
@@ -1835,29 +1720,26 @@ func (*OneGetMapRequestItrRlocsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneGetMapRequestItrRlocsReply) Size() int {
+func (m *OneGetMapRequestItrRlocsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 64 // m.LocatorSetName
return size
}
func (m *OneGetMapRequestItrRlocsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeString(m.LocatorSetName, 64)
return buf.Bytes(), nil
}
func (m *OneGetMapRequestItrRlocsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.LocatorSetName = buf.DecodeString(64)
return nil
}
@@ -1872,20 +1754,17 @@ func (*OneGetTransportProtocol) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneGetTransportProtocol) Size() int {
+func (m *OneGetTransportProtocol) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneGetTransportProtocol) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneGetTransportProtocol) Unmarshal(b []byte) error {
@@ -1907,29 +1786,26 @@ func (*OneGetTransportProtocolReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneGetTransportProtocolReply) Size() int {
+func (m *OneGetTransportProtocolReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.Protocol
return size
}
func (m *OneGetTransportProtocolReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint8(uint8(m.Protocol))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint8(m.Protocol)
return buf.Bytes(), nil
}
func (m *OneGetTransportProtocolReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Protocol = buf.DecodeUint8()
return nil
}
@@ -1944,20 +1820,17 @@ func (*OneL2ArpBdGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneL2ArpBdGet) Size() int {
+func (m *OneL2ArpBdGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneL2ArpBdGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneL2ArpBdGet) Unmarshal(b []byte) error {
@@ -1978,37 +1851,34 @@ func (*OneL2ArpBdGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneL2ArpBdGetReply) Size() int {
+func (m *OneL2ArpBdGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
size += 4 * len(m.BridgeDomains) // m.BridgeDomains
return size
}
func (m *OneL2ArpBdGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.BridgeDomains)))
for i := 0; i < len(m.BridgeDomains); i++ {
var x uint32
if i < len(m.BridgeDomains) {
x = uint32(m.BridgeDomains[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
func (m *OneL2ArpBdGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
m.BridgeDomains = make([]uint32, m.Count)
for i := 0; i < len(m.BridgeDomains); i++ {
@@ -2029,22 +1899,19 @@ func (*OneL2ArpEntriesGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneL2ArpEntriesGet) Size() int {
+func (m *OneL2ArpEntriesGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Bd
return size
}
func (m *OneL2ArpEntriesGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Bd))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Bd)
return buf.Bytes(), nil
}
func (m *OneL2ArpEntriesGet) Unmarshal(b []byte) error {
@@ -2067,11 +1934,10 @@ func (*OneL2ArpEntriesGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneL2ArpEntriesGetReply) Size() int {
+func (m *OneL2ArpEntriesGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
for j1 := 0; j1 < len(m.Entries); j1++ {
@@ -2086,16 +1952,14 @@ func (m *OneL2ArpEntriesGetReply) Size() int {
return size
}
func (m *OneL2ArpEntriesGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.Entries)))
for j0 := 0; j0 < len(m.Entries); j0++ {
- var v0 OneL2ArpEntry
+ var v0 OneL2ArpEntry // Entries
if j0 < len(m.Entries) {
v0 = m.Entries[j0]
}
@@ -2106,9 +1970,9 @@ func (m *OneL2ArpEntriesGetReply) Marshal(b []byte) ([]byte, error) {
}
func (m *OneL2ArpEntriesGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
- m.Entries = make([]OneL2ArpEntry, int(m.Count))
+ m.Entries = make([]OneL2ArpEntry, m.Count)
for j0 := 0; j0 < len(m.Entries); j0++ {
copy(m.Entries[j0].Mac[:], buf.DecodeBytes(6))
copy(m.Entries[j0].IP4[:], buf.DecodeBytes(4))
@@ -2132,11 +1996,10 @@ func (*OneLocatorDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneLocatorDetails) Size() int {
+func (m *OneLocatorDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Local
size += 4 // m.SwIfIndex
size += 1 // m.IPAddress.Af
@@ -2146,18 +2009,16 @@ func (m *OneLocatorDetails) Size() int {
return size
}
func (m *OneLocatorDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Local))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Local)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Priority))
- buf.EncodeUint8(uint8(m.Weight))
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Priority)
+ buf.EncodeUint8(m.Weight)
return buf.Bytes(), nil
}
func (m *OneLocatorDetails) Unmarshal(b []byte) error {
@@ -2185,24 +2046,21 @@ func (*OneLocatorDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneLocatorDump) Size() int {
+func (m *OneLocatorDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.LsIndex
size += 64 // m.LsName
size += 1 // m.IsIndexSet
return size
}
func (m *OneLocatorDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.LsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.LsIndex)
buf.EncodeString(m.LsName, 64)
buf.EncodeBool(m.IsIndexSet)
return buf.Bytes(), nil
@@ -2228,23 +2086,20 @@ func (*OneLocatorSetDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneLocatorSetDetails) Size() int {
+func (m *OneLocatorSetDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.LsIndex
size += 64 // m.LsName
return size
}
func (m *OneLocatorSetDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.LsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.LsIndex)
buf.EncodeString(m.LsName, 64)
return buf.Bytes(), nil
}
@@ -2267,21 +2122,18 @@ func (*OneLocatorSetDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneLocatorSetDump) Size() int {
+func (m *OneLocatorSetDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Filter
return size
}
func (m *OneLocatorSetDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Filter))
return buf.Bytes(), nil
}
@@ -2303,21 +2155,18 @@ func (*OneMapRegisterEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneMapRegisterEnableDisable) Size() int {
+func (m *OneMapRegisterEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *OneMapRegisterEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -2341,27 +2190,24 @@ func (*OneMapRegisterEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneMapRegisterEnableDisableReply) Size() int {
+func (m *OneMapRegisterEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneMapRegisterEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneMapRegisterEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2379,22 +2225,19 @@ func (*OneMapRegisterFallbackThreshold) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneMapRegisterFallbackThreshold) Size() int {
+func (m *OneMapRegisterFallbackThreshold) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Value
return size
}
func (m *OneMapRegisterFallbackThreshold) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Value))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Value)
return buf.Bytes(), nil
}
func (m *OneMapRegisterFallbackThreshold) Unmarshal(b []byte) error {
@@ -2417,27 +2260,24 @@ func (*OneMapRegisterFallbackThresholdReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneMapRegisterFallbackThresholdReply) Size() int {
+func (m *OneMapRegisterFallbackThresholdReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneMapRegisterFallbackThresholdReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneMapRegisterFallbackThresholdReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2453,22 +2293,19 @@ func (*OneMapRegisterSetTTL) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneMapRegisterSetTTL) Size() int {
+func (m *OneMapRegisterSetTTL) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TTL
return size
}
func (m *OneMapRegisterSetTTL) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.TTL))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TTL)
return buf.Bytes(), nil
}
func (m *OneMapRegisterSetTTL) Unmarshal(b []byte) error {
@@ -2489,27 +2326,24 @@ func (*OneMapRegisterSetTTLReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneMapRegisterSetTTLReply) Size() int {
+func (m *OneMapRegisterSetTTLReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneMapRegisterSetTTLReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneMapRegisterSetTTLReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2525,21 +2359,18 @@ func (*OneMapRequestMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneMapRequestMode) Size() int {
+func (m *OneMapRequestMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Mode
return size
}
func (m *OneMapRequestMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Mode))
return buf.Bytes(), nil
}
@@ -2561,27 +2392,24 @@ func (*OneMapRequestModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneMapRequestModeReply) Size() int {
+func (m *OneMapRequestModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneMapRequestModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneMapRequestModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2597,24 +2425,21 @@ func (*OneMapResolverDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneMapResolverDetails) Size() int {
+func (m *OneMapResolverDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
return size
}
func (m *OneMapResolverDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *OneMapResolverDetails) Unmarshal(b []byte) error {
@@ -2634,20 +2459,17 @@ func (*OneMapResolverDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneMapResolverDump) Size() int {
+func (m *OneMapResolverDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneMapResolverDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneMapResolverDump) Unmarshal(b []byte) error {
@@ -2666,24 +2488,21 @@ func (*OneMapServerDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneMapServerDetails) Size() int {
+func (m *OneMapServerDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
return size
}
func (m *OneMapServerDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *OneMapServerDetails) Unmarshal(b []byte) error {
@@ -2703,20 +2522,17 @@ func (*OneMapServerDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneMapServerDump) Size() int {
+func (m *OneMapServerDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneMapServerDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneMapServerDump) Unmarshal(b []byte) error {
@@ -2733,20 +2549,17 @@ func (*OneNdpBdGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneNdpBdGet) Size() int {
+func (m *OneNdpBdGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneNdpBdGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneNdpBdGet) Unmarshal(b []byte) error {
@@ -2767,37 +2580,34 @@ func (*OneNdpBdGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneNdpBdGetReply) Size() int {
+func (m *OneNdpBdGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
size += 4 * len(m.BridgeDomains) // m.BridgeDomains
return size
}
func (m *OneNdpBdGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.BridgeDomains)))
for i := 0; i < len(m.BridgeDomains); i++ {
var x uint32
if i < len(m.BridgeDomains) {
x = uint32(m.BridgeDomains[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
func (m *OneNdpBdGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
m.BridgeDomains = make([]uint32, m.Count)
for i := 0; i < len(m.BridgeDomains); i++ {
@@ -2818,22 +2628,19 @@ func (*OneNdpEntriesGet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneNdpEntriesGet) Size() int {
+func (m *OneNdpEntriesGet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Bd
return size
}
func (m *OneNdpEntriesGet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Bd))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Bd)
return buf.Bytes(), nil
}
func (m *OneNdpEntriesGet) Unmarshal(b []byte) error {
@@ -2856,11 +2663,10 @@ func (*OneNdpEntriesGetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneNdpEntriesGetReply) Size() int {
+func (m *OneNdpEntriesGetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
for j1 := 0; j1 < len(m.Entries); j1++ {
@@ -2875,16 +2681,14 @@ func (m *OneNdpEntriesGetReply) Size() int {
return size
}
func (m *OneNdpEntriesGetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.Entries)))
for j0 := 0; j0 < len(m.Entries); j0++ {
- var v0 OneNdpEntry
+ var v0 OneNdpEntry // Entries
if j0 < len(m.Entries) {
v0 = m.Entries[j0]
}
@@ -2895,9 +2699,9 @@ func (m *OneNdpEntriesGetReply) Marshal(b []byte) ([]byte, error) {
}
func (m *OneNdpEntriesGetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
- m.Entries = make([]OneNdpEntry, int(m.Count))
+ m.Entries = make([]OneNdpEntry, m.Count)
for j0 := 0; j0 < len(m.Entries); j0++ {
copy(m.Entries[j0].Mac[:], buf.DecodeBytes(6))
copy(m.Entries[j0].IP6[:], buf.DecodeBytes(16))
@@ -2918,22 +2722,19 @@ func (*OneNshSetLocatorSet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneNshSetLocatorSet) Size() int {
+func (m *OneNshSetLocatorSet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.LsName
return size
}
func (m *OneNshSetLocatorSet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.LsName, 64)
return buf.Bytes(), nil
@@ -2957,27 +2758,24 @@ func (*OneNshSetLocatorSetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneNshSetLocatorSetReply) Size() int {
+func (m *OneNshSetLocatorSetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneNshSetLocatorSetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneNshSetLocatorSetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -2994,22 +2792,19 @@ func (*OnePitrSetLocatorSet) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OnePitrSetLocatorSet) Size() int {
+func (m *OnePitrSetLocatorSet) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.LsName
return size
}
func (m *OnePitrSetLocatorSet) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.LsName, 64)
return buf.Bytes(), nil
@@ -3033,27 +2828,24 @@ func (*OnePitrSetLocatorSetReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OnePitrSetLocatorSetReply) Size() int {
+func (m *OnePitrSetLocatorSetReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OnePitrSetLocatorSetReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OnePitrSetLocatorSetReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3069,21 +2861,18 @@ func (*OneRlocProbeEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneRlocProbeEnableDisable) Size() int {
+func (m *OneRlocProbeEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *OneRlocProbeEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -3107,27 +2896,24 @@ func (*OneRlocProbeEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneRlocProbeEnableDisableReply) Size() int {
+func (m *OneRlocProbeEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneRlocProbeEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneRlocProbeEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3143,22 +2929,19 @@ func (*OneSetTransportProtocol) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneSetTransportProtocol) Size() int {
+func (m *OneSetTransportProtocol) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Protocol
return size
}
func (m *OneSetTransportProtocol) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.Protocol))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.Protocol)
return buf.Bytes(), nil
}
func (m *OneSetTransportProtocol) Unmarshal(b []byte) error {
@@ -3181,27 +2964,24 @@ func (*OneSetTransportProtocolReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneSetTransportProtocolReply) Size() int {
+func (m *OneSetTransportProtocolReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneSetTransportProtocolReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneSetTransportProtocolReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3215,20 +2995,17 @@ func (*OneShowPetrMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneShowPetrMode) Size() int {
+func (m *OneShowPetrMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneShowPetrMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneShowPetrMode) Unmarshal(b []byte) error {
@@ -3248,29 +3025,26 @@ func (*OneShowPetrModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneShowPetrModeReply) Size() int {
+func (m *OneShowPetrModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsEnable
return size
}
func (m *OneShowPetrModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
func (m *OneShowPetrModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsEnable = buf.DecodeBool()
return nil
}
@@ -3285,20 +3059,17 @@ func (*OneShowPitrMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneShowPitrMode) Size() int {
+func (m *OneShowPitrMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneShowPitrMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneShowPitrMode) Unmarshal(b []byte) error {
@@ -3318,29 +3089,26 @@ func (*OneShowPitrModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneShowPitrModeReply) Size() int {
+func (m *OneShowPitrModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsEnable
return size
}
func (m *OneShowPitrModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
func (m *OneShowPitrModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsEnable = buf.DecodeBool()
return nil
}
@@ -3355,20 +3123,17 @@ func (*OneShowXtrMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneShowXtrMode) Size() int {
+func (m *OneShowXtrMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneShowXtrMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneShowXtrMode) Unmarshal(b []byte) error {
@@ -3388,29 +3153,26 @@ func (*OneShowXtrModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneShowXtrModeReply) Size() int {
+func (m *OneShowXtrModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsEnable
return size
}
func (m *OneShowXtrModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
func (m *OneShowXtrModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsEnable = buf.DecodeBool()
return nil
}
@@ -3433,11 +3195,10 @@ func (*OneStatsDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneStatsDetails) Size() int {
+func (m *OneStatsDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Vni
size += 1 // m.Deid.Type
size += 1 * 6 // m.Deid.Address
@@ -3452,23 +3213,21 @@ func (m *OneStatsDetails) Size() int {
return size
}
func (m *OneStatsDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Vni))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Deid.Type))
- buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Deid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.Seid.Type))
- buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Seid.Address.XXX_UnionData[:], 6)
buf.EncodeUint8(uint8(m.Rloc.Af))
- buf.EncodeBytes(m.Rloc.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Rloc.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Lloc.Af))
- buf.EncodeBytes(m.Lloc.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.PktCount))
- buf.EncodeUint32(uint32(m.Bytes))
+ buf.EncodeBytes(m.Lloc.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.PktCount)
+ buf.EncodeUint32(m.Bytes)
return buf.Bytes(), nil
}
func (m *OneStatsDetails) Unmarshal(b []byte) error {
@@ -3497,20 +3256,17 @@ func (*OneStatsDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneStatsDump) Size() int {
+func (m *OneStatsDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneStatsDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneStatsDump) Unmarshal(b []byte) error {
@@ -3529,21 +3285,18 @@ func (*OneStatsEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneStatsEnableDisable) Size() int {
+func (m *OneStatsEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *OneStatsEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -3565,27 +3318,24 @@ func (*OneStatsEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneStatsEnableDisableReply) Size() int {
+func (m *OneStatsEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneStatsEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneStatsEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3599,20 +3349,17 @@ func (*OneStatsFlush) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneStatsFlush) Size() int {
+func (m *OneStatsFlush) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *OneStatsFlush) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *OneStatsFlush) Unmarshal(b []byte) error {
@@ -3631,27 +3378,24 @@ func (*OneStatsFlushReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneStatsFlushReply) Size() int {
+func (m *OneStatsFlushReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneStatsFlushReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneStatsFlushReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3668,25 +3412,22 @@ func (*OneUsePetr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *OneUsePetr) Size() int {
+func (m *OneUsePetr) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
size += 1 // m.IsAdd
return size
}
func (m *OneUsePetr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -3710,27 +3451,24 @@ func (*OneUsePetrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *OneUsePetrReply) Size() int {
+func (m *OneUsePetrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *OneUsePetrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *OneUsePetrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -3746,20 +3484,17 @@ func (*ShowOneMapRegisterFallbackThreshold) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOneMapRegisterFallbackThreshold) Size() int {
+func (m *ShowOneMapRegisterFallbackThreshold) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOneMapRegisterFallbackThreshold) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOneMapRegisterFallbackThreshold) Unmarshal(b []byte) error {
@@ -3783,29 +3518,26 @@ func (*ShowOneMapRegisterFallbackThresholdReply) GetMessageType() api.MessageTyp
return api.ReplyMessage
}
-func (m *ShowOneMapRegisterFallbackThresholdReply) Size() int {
+func (m *ShowOneMapRegisterFallbackThresholdReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Value
return size
}
func (m *ShowOneMapRegisterFallbackThresholdReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.Value))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.Value)
return buf.Bytes(), nil
}
func (m *ShowOneMapRegisterFallbackThresholdReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Value = buf.DecodeUint32()
return nil
}
@@ -3820,20 +3552,17 @@ func (*ShowOneMapRegisterState) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOneMapRegisterState) Size() int {
+func (m *ShowOneMapRegisterState) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOneMapRegisterState) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOneMapRegisterState) Unmarshal(b []byte) error {
@@ -3855,29 +3584,26 @@ func (*ShowOneMapRegisterStateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowOneMapRegisterStateReply) Size() int {
+func (m *ShowOneMapRegisterStateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsEnable
return size
}
func (m *ShowOneMapRegisterStateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
func (m *ShowOneMapRegisterStateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsEnable = buf.DecodeBool()
return nil
}
@@ -3892,20 +3618,17 @@ func (*ShowOneMapRegisterTTL) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOneMapRegisterTTL) Size() int {
+func (m *ShowOneMapRegisterTTL) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOneMapRegisterTTL) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOneMapRegisterTTL) Unmarshal(b []byte) error {
@@ -3925,29 +3648,26 @@ func (*ShowOneMapRegisterTTLReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowOneMapRegisterTTLReply) Size() int {
+func (m *ShowOneMapRegisterTTLReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.TTL
return size
}
func (m *ShowOneMapRegisterTTLReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.TTL))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.TTL)
return buf.Bytes(), nil
}
func (m *ShowOneMapRegisterTTLReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.TTL = buf.DecodeUint32()
return nil
}
@@ -3962,20 +3682,17 @@ func (*ShowOneMapRequestMode) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOneMapRequestMode) Size() int {
+func (m *ShowOneMapRequestMode) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOneMapRequestMode) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOneMapRequestMode) Unmarshal(b []byte) error {
@@ -3995,29 +3712,26 @@ func (*ShowOneMapRequestModeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowOneMapRequestModeReply) Size() int {
+func (m *ShowOneMapRequestModeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Mode
return size
}
func (m *ShowOneMapRequestModeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.Mode))
return buf.Bytes(), nil
}
func (m *ShowOneMapRequestModeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Mode = OneMapMode(buf.DecodeUint32())
return nil
}
@@ -4032,20 +3746,17 @@ func (*ShowOneNshMapping) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOneNshMapping) Size() int {
+func (m *ShowOneNshMapping) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOneNshMapping) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOneNshMapping) Unmarshal(b []byte) error {
@@ -4066,31 +3777,28 @@ func (*ShowOneNshMappingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowOneNshMappingReply) Size() int {
+func (m *ShowOneNshMappingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsSet
size += 64 // m.LocatorSetName
return size
}
func (m *ShowOneNshMappingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsSet)
buf.EncodeString(m.LocatorSetName, 64)
return buf.Bytes(), nil
}
func (m *ShowOneNshMappingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsSet = buf.DecodeBool()
m.LocatorSetName = buf.DecodeString(64)
return nil
@@ -4106,20 +3814,17 @@ func (*ShowOnePitr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOnePitr) Size() int {
+func (m *ShowOnePitr) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOnePitr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOnePitr) Unmarshal(b []byte) error {
@@ -4140,31 +3845,28 @@ func (*ShowOnePitrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowOnePitrReply) Size() int {
+func (m *ShowOnePitrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.Status
size += 64 // m.LocatorSetName
return size
}
func (m *ShowOnePitrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.Status)
buf.EncodeString(m.LocatorSetName, 64)
return buf.Bytes(), nil
}
func (m *ShowOnePitrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Status = buf.DecodeBool()
m.LocatorSetName = buf.DecodeString(64)
return nil
@@ -4180,20 +3882,17 @@ func (*ShowOneRlocProbeState) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOneRlocProbeState) Size() int {
+func (m *ShowOneRlocProbeState) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOneRlocProbeState) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOneRlocProbeState) Unmarshal(b []byte) error {
@@ -4213,29 +3912,26 @@ func (*ShowOneRlocProbeStateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowOneRlocProbeStateReply) Size() int {
+func (m *ShowOneRlocProbeStateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsEnable
return size
}
func (m *ShowOneRlocProbeStateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
func (m *ShowOneRlocProbeStateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsEnable = buf.DecodeBool()
return nil
}
@@ -4250,20 +3946,17 @@ func (*ShowOneStatsEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOneStatsEnableDisable) Size() int {
+func (m *ShowOneStatsEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOneStatsEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOneStatsEnableDisable) Unmarshal(b []byte) error {
@@ -4285,29 +3978,26 @@ func (*ShowOneStatsEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowOneStatsEnableDisableReply) Size() int {
+func (m *ShowOneStatsEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.IsEnable
return size
}
func (m *ShowOneStatsEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
func (m *ShowOneStatsEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.IsEnable = buf.DecodeBool()
return nil
}
@@ -4322,20 +4012,17 @@ func (*ShowOneStatus) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOneStatus) Size() int {
+func (m *ShowOneStatus) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOneStatus) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOneStatus) Unmarshal(b []byte) error {
@@ -4356,31 +4043,28 @@ func (*ShowOneStatusReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowOneStatusReply) Size() int {
+func (m *ShowOneStatusReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.FeatureStatus
size += 1 // m.GpeStatus
return size
}
func (m *ShowOneStatusReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.FeatureStatus)
buf.EncodeBool(m.GpeStatus)
return buf.Bytes(), nil
}
func (m *ShowOneStatusReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.FeatureStatus = buf.DecodeBool()
m.GpeStatus = buf.DecodeBool()
return nil
@@ -4396,20 +4080,17 @@ func (*ShowOneUsePetr) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowOneUsePetr) Size() int {
+func (m *ShowOneUsePetr) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowOneUsePetr) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowOneUsePetr) Unmarshal(b []byte) error {
@@ -4430,11 +4111,10 @@ func (*ShowOneUsePetrReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowOneUsePetrReply) Size() int {
+func (m *ShowOneUsePetrReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.Status
size += 1 // m.IPAddress.Af
@@ -4442,21 +4122,19 @@ func (m *ShowOneUsePetrReply) Size() int {
return size
}
func (m *ShowOneUsePetrReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBool(m.Status)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *ShowOneUsePetrReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Status = buf.DecodeBool()
m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
diff --git a/binapi/p2p_ethernet/p2p_ethernet.ba.go b/binapi/p2p_ethernet/p2p_ethernet.ba.go
index 5435390..2f76041 100644
--- a/binapi/p2p_ethernet/p2p_ethernet.ba.go
+++ b/binapi/p2p_ethernet/p2p_ethernet.ba.go
@@ -44,25 +44,22 @@ func (*P2pEthernetAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *P2pEthernetAdd) Size() int {
+func (m *P2pEthernetAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ParentIfIndex
size += 4 // m.SubifID
size += 1 * 6 // m.RemoteMac
return size
}
func (m *P2pEthernetAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.ParentIfIndex))
- buf.EncodeUint32(uint32(m.SubifID))
+ buf.EncodeUint32(m.SubifID)
buf.EncodeBytes(m.RemoteMac[:], 6)
return buf.Bytes(), nil
}
@@ -87,29 +84,26 @@ func (*P2pEthernetAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *P2pEthernetAddReply) Size() int {
+func (m *P2pEthernetAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *P2pEthernetAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *P2pEthernetAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -127,22 +121,19 @@ func (*P2pEthernetDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *P2pEthernetDel) Size() int {
+func (m *P2pEthernetDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ParentIfIndex
size += 1 * 6 // m.RemoteMac
return size
}
func (m *P2pEthernetDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.ParentIfIndex))
buf.EncodeBytes(m.RemoteMac[:], 6)
return buf.Bytes(), nil
@@ -166,27 +157,24 @@ func (*P2pEthernetDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *P2pEthernetDelReply) Size() int {
+func (m *P2pEthernetDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *P2pEthernetDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *P2pEthernetDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/pg/pg.ba.go b/binapi/pg/pg.ba.go
index 2f45135..9a522c2 100644
--- a/binapi/pg/pg.ba.go
+++ b/binapi/pg/pg.ba.go
@@ -44,11 +44,10 @@ func (*PgCapture) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PgCapture) Size() int {
+func (m *PgCapture) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.InterfaceID
size += 1 // m.IsEnabled
size += 4 // m.Count
@@ -56,15 +55,13 @@ func (m *PgCapture) Size() int {
return size
}
func (m *PgCapture) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.InterfaceID))
buf.EncodeBool(m.IsEnabled)
- buf.EncodeUint32(uint32(m.Count))
+ buf.EncodeUint32(m.Count)
buf.EncodeString(m.PcapFileName, 0)
return buf.Bytes(), nil
}
@@ -89,27 +86,24 @@ func (*PgCaptureReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PgCaptureReply) Size() int {
+func (m *PgCaptureReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *PgCaptureReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *PgCaptureReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -127,26 +121,23 @@ func (*PgCreateInterface) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PgCreateInterface) Size() int {
+func (m *PgCreateInterface) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.InterfaceID
size += 1 // m.GsoEnabled
size += 4 // m.GsoSize
return size
}
func (m *PgCreateInterface) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.InterfaceID))
buf.EncodeBool(m.GsoEnabled)
- buf.EncodeUint32(uint32(m.GsoSize))
+ buf.EncodeUint32(m.GsoSize)
return buf.Bytes(), nil
}
func (m *PgCreateInterface) Unmarshal(b []byte) error {
@@ -170,29 +161,26 @@ func (*PgCreateInterfaceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PgCreateInterfaceReply) Size() int {
+func (m *PgCreateInterfaceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *PgCreateInterfaceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *PgCreateInterfaceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -210,22 +198,19 @@ func (*PgEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PgEnableDisable) Size() int {
+func (m *PgEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnabled
size += 4 + len(m.StreamName) // m.StreamName
return size
}
func (m *PgEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnabled)
buf.EncodeString(m.StreamName, 0)
return buf.Bytes(), nil
@@ -249,27 +234,24 @@ func (*PgEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PgEnableDisableReply) Size() int {
+func (m *PgEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *PgEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *PgEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/pipe/pipe.ba.go b/binapi/pipe/pipe.ba.go
index 24881cc..6123059 100644
--- a/binapi/pipe/pipe.ba.go
+++ b/binapi/pipe/pipe.ba.go
@@ -42,24 +42,21 @@ func (*PipeCreate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PipeCreate) Size() int {
+func (m *PipeCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsSpecified
size += 4 // m.UserInstance
return size
}
func (m *PipeCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsSpecified)
- buf.EncodeUint32(uint32(m.UserInstance))
+ buf.EncodeUint32(m.UserInstance)
return buf.Bytes(), nil
}
func (m *PipeCreate) Unmarshal(b []byte) error {
@@ -83,44 +80,32 @@ func (*PipeCreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PipeCreateReply) Size() int {
+func (m *PipeCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
for j1 := 0; j1 < 2; j1++ {
- var s1 interface_types.InterfaceIndex
- _ = s1
- if j1 < len(m.PipeSwIfIndex) {
- s1 = m.PipeSwIfIndex[j1]
- }
- size += 4 // s1
+ size += 4 // m.PipeSwIfIndex[j1]
}
return size
}
func (m *PipeCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
for j0 := 0; j0 < 2; j0++ {
- var v0 interface_types.InterfaceIndex
- if j0 < len(m.PipeSwIfIndex) {
- v0 = m.PipeSwIfIndex[j0]
- }
- buf.EncodeUint32(uint32(v0))
+ buf.EncodeUint32(uint32(m.PipeSwIfIndex[j0]))
}
return buf.Bytes(), nil
}
func (m *PipeCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
for j0 := 0; j0 < 2; j0++ {
m.PipeSwIfIndex[j0] = interface_types.InterfaceIndex(buf.DecodeUint32())
@@ -140,21 +125,18 @@ func (*PipeDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PipeDelete) Size() int {
+func (m *PipeDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *PipeDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -176,27 +158,24 @@ func (*PipeDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PipeDeleteReply) Size() int {
+func (m *PipeDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *PipeDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *PipeDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -214,39 +193,27 @@ func (*PipeDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PipeDetails) Size() int {
+func (m *PipeDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
for j1 := 0; j1 < 2; j1++ {
- var s1 interface_types.InterfaceIndex
- _ = s1
- if j1 < len(m.PipeSwIfIndex) {
- s1 = m.PipeSwIfIndex[j1]
- }
- size += 4 // s1
+ size += 4 // m.PipeSwIfIndex[j1]
}
size += 4 // m.Instance
return size
}
func (m *PipeDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
for j0 := 0; j0 < 2; j0++ {
- var v0 interface_types.InterfaceIndex
- if j0 < len(m.PipeSwIfIndex) {
- v0 = m.PipeSwIfIndex[j0]
- }
- buf.EncodeUint32(uint32(v0))
+ buf.EncodeUint32(uint32(m.PipeSwIfIndex[j0]))
}
- buf.EncodeUint32(uint32(m.Instance))
+ buf.EncodeUint32(m.Instance)
return buf.Bytes(), nil
}
func (m *PipeDetails) Unmarshal(b []byte) error {
@@ -269,20 +236,17 @@ func (*PipeDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PipeDump) Size() int {
+func (m *PipeDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *PipeDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *PipeDump) Unmarshal(b []byte) error {
diff --git a/binapi/policer/policer.ba.go b/binapi/policer/policer.ba.go
index f529a38..1314dce 100644
--- a/binapi/policer/policer.ba.go
+++ b/binapi/policer/policer.ba.go
@@ -53,11 +53,10 @@ func (*PolicerAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PolicerAddDel) Size() int {
+func (m *PolicerAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 64 // m.Name
size += 4 // m.Cir
@@ -77,28 +76,26 @@ func (m *PolicerAddDel) Size() int {
return size
}
func (m *PolicerAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.Name, 64)
- buf.EncodeUint32(uint32(m.Cir))
- buf.EncodeUint32(uint32(m.Eir))
- buf.EncodeUint64(uint64(m.Cb))
- buf.EncodeUint64(uint64(m.Eb))
+ buf.EncodeUint32(m.Cir)
+ buf.EncodeUint32(m.Eir)
+ buf.EncodeUint64(m.Cb)
+ buf.EncodeUint64(m.Eb)
buf.EncodeUint8(uint8(m.RateType))
buf.EncodeUint8(uint8(m.RoundType))
buf.EncodeUint8(uint8(m.Type))
buf.EncodeBool(m.ColorAware)
buf.EncodeUint8(uint8(m.ConformAction.Type))
- buf.EncodeUint8(uint8(m.ConformAction.Dscp))
+ buf.EncodeUint8(m.ConformAction.Dscp)
buf.EncodeUint8(uint8(m.ExceedAction.Type))
- buf.EncodeUint8(uint8(m.ExceedAction.Dscp))
+ buf.EncodeUint8(m.ExceedAction.Dscp)
buf.EncodeUint8(uint8(m.ViolateAction.Type))
- buf.EncodeUint8(uint8(m.ViolateAction.Dscp))
+ buf.EncodeUint8(m.ViolateAction.Dscp)
return buf.Bytes(), nil
}
func (m *PolicerAddDel) Unmarshal(b []byte) error {
@@ -135,29 +132,26 @@ func (*PolicerAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PolicerAddDelReply) Size() int {
+func (m *PolicerAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.PolicerIndex
return size
}
func (m *PolicerAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.PolicerIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.PolicerIndex)
return buf.Bytes(), nil
}
func (m *PolicerAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.PolicerIndex = buf.DecodeUint32()
return nil
}
@@ -194,11 +188,10 @@ func (*PolicerDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PolicerDetails) Size() int {
+func (m *PolicerDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.Name
size += 4 // m.Cir
size += 4 // m.Eir
@@ -226,36 +219,34 @@ func (m *PolicerDetails) Size() int {
return size
}
func (m *PolicerDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Name, 64)
- buf.EncodeUint32(uint32(m.Cir))
- buf.EncodeUint32(uint32(m.Eir))
- buf.EncodeUint64(uint64(m.Cb))
- buf.EncodeUint64(uint64(m.Eb))
+ buf.EncodeUint32(m.Cir)
+ buf.EncodeUint32(m.Eir)
+ buf.EncodeUint64(m.Cb)
+ buf.EncodeUint64(m.Eb)
buf.EncodeUint8(uint8(m.RateType))
buf.EncodeUint8(uint8(m.RoundType))
buf.EncodeUint8(uint8(m.Type))
buf.EncodeUint8(uint8(m.ConformAction.Type))
- buf.EncodeUint8(uint8(m.ConformAction.Dscp))
+ buf.EncodeUint8(m.ConformAction.Dscp)
buf.EncodeUint8(uint8(m.ExceedAction.Type))
- buf.EncodeUint8(uint8(m.ExceedAction.Dscp))
+ buf.EncodeUint8(m.ExceedAction.Dscp)
buf.EncodeUint8(uint8(m.ViolateAction.Type))
- buf.EncodeUint8(uint8(m.ViolateAction.Dscp))
+ buf.EncodeUint8(m.ViolateAction.Dscp)
buf.EncodeBool(m.SingleRate)
buf.EncodeBool(m.ColorAware)
- buf.EncodeUint32(uint32(m.Scale))
- buf.EncodeUint32(uint32(m.CirTokensPerPeriod))
- buf.EncodeUint32(uint32(m.PirTokensPerPeriod))
- buf.EncodeUint32(uint32(m.CurrentLimit))
- buf.EncodeUint32(uint32(m.CurrentBucket))
- buf.EncodeUint32(uint32(m.ExtendedLimit))
- buf.EncodeUint32(uint32(m.ExtendedBucket))
- buf.EncodeUint64(uint64(m.LastUpdateTime))
+ buf.EncodeUint32(m.Scale)
+ buf.EncodeUint32(m.CirTokensPerPeriod)
+ buf.EncodeUint32(m.PirTokensPerPeriod)
+ buf.EncodeUint32(m.CurrentLimit)
+ buf.EncodeUint32(m.CurrentBucket)
+ buf.EncodeUint32(m.ExtendedLimit)
+ buf.EncodeUint32(m.ExtendedBucket)
+ buf.EncodeUint64(m.LastUpdateTime)
return buf.Bytes(), nil
}
func (m *PolicerDetails) Unmarshal(b []byte) error {
@@ -300,22 +291,19 @@ func (*PolicerDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PolicerDump) Size() int {
+func (m *PolicerDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.MatchNameValid
size += 64 // m.MatchName
return size
}
func (m *PolicerDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.MatchNameValid)
buf.EncodeString(m.MatchName, 64)
return buf.Bytes(), nil
diff --git a/binapi/pot/pot.ba.go b/binapi/pot/pot.ba.go
index f037a53..2c2d1f4 100644
--- a/binapi/pot/pot.ba.go
+++ b/binapi/pot/pot.ba.go
@@ -41,23 +41,20 @@ func (*PotProfileActivate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PotProfileActivate) Size() int {
+func (m *PotProfileActivate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.ID
size += 4 + len(m.ListName) // m.ListName
return size
}
func (m *PotProfileActivate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.ID)
buf.EncodeString(m.ListName, 0)
return buf.Bytes(), nil
}
@@ -80,27 +77,24 @@ func (*PotProfileActivateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PotProfileActivateReply) Size() int {
+func (m *PotProfileActivateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *PotProfileActivateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *PotProfileActivateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -124,11 +118,10 @@ func (*PotProfileAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PotProfileAdd) Size() int {
+func (m *PotProfileAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.ID
size += 1 // m.Validator
size += 8 // m.SecretKey
@@ -141,20 +134,18 @@ func (m *PotProfileAdd) Size() int {
return size
}
func (m *PotProfileAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.ID))
- buf.EncodeUint8(uint8(m.Validator))
- buf.EncodeUint64(uint64(m.SecretKey))
- buf.EncodeUint64(uint64(m.SecretShare))
- buf.EncodeUint64(uint64(m.Prime))
- buf.EncodeUint8(uint8(m.MaxBits))
- buf.EncodeUint64(uint64(m.Lpc))
- buf.EncodeUint64(uint64(m.PolynomialPublic))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.ID)
+ buf.EncodeUint8(m.Validator)
+ buf.EncodeUint64(m.SecretKey)
+ buf.EncodeUint64(m.SecretShare)
+ buf.EncodeUint64(m.Prime)
+ buf.EncodeUint8(m.MaxBits)
+ buf.EncodeUint64(m.Lpc)
+ buf.EncodeUint64(m.PolynomialPublic)
buf.EncodeString(m.ListName, 0)
return buf.Bytes(), nil
}
@@ -184,27 +175,24 @@ func (*PotProfileAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PotProfileAddReply) Size() int {
+func (m *PotProfileAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *PotProfileAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *PotProfileAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -220,21 +208,18 @@ func (*PotProfileDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PotProfileDel) Size() int {
+func (m *PotProfileDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 + len(m.ListName) // m.ListName
return size
}
func (m *PotProfileDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.ListName, 0)
return buf.Bytes(), nil
}
@@ -256,27 +241,24 @@ func (*PotProfileDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PotProfileDelReply) Size() int {
+func (m *PotProfileDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *PotProfileDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *PotProfileDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -300,11 +282,10 @@ func (*PotProfileShowConfigDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PotProfileShowConfigDetails) Size() int {
+func (m *PotProfileShowConfigDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.ID
size += 1 // m.Validator
@@ -317,26 +298,24 @@ func (m *PotProfileShowConfigDetails) Size() int {
return size
}
func (m *PotProfileShowConfigDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint8(uint8(m.ID))
- buf.EncodeUint8(uint8(m.Validator))
- buf.EncodeUint64(uint64(m.SecretKey))
- buf.EncodeUint64(uint64(m.SecretShare))
- buf.EncodeUint64(uint64(m.Prime))
- buf.EncodeUint64(uint64(m.BitMask))
- buf.EncodeUint64(uint64(m.Lpc))
- buf.EncodeUint64(uint64(m.PolynomialPublic))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint8(m.ID)
+ buf.EncodeUint8(m.Validator)
+ buf.EncodeUint64(m.SecretKey)
+ buf.EncodeUint64(m.SecretShare)
+ buf.EncodeUint64(m.Prime)
+ buf.EncodeUint64(m.BitMask)
+ buf.EncodeUint64(m.Lpc)
+ buf.EncodeUint64(m.PolynomialPublic)
return buf.Bytes(), nil
}
func (m *PotProfileShowConfigDetails) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ID = buf.DecodeUint8()
m.Validator = buf.DecodeUint8()
m.SecretKey = buf.DecodeUint64()
@@ -360,22 +339,19 @@ func (*PotProfileShowConfigDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PotProfileShowConfigDump) Size() int {
+func (m *PotProfileShowConfigDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.ID
return size
}
func (m *PotProfileShowConfigDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.ID)
return buf.Bytes(), nil
}
func (m *PotProfileShowConfigDump) Unmarshal(b []byte) error {
diff --git a/binapi/pppoe/pppoe.ba.go b/binapi/pppoe/pppoe.ba.go
index 0b7cafb..e01d3b5 100644
--- a/binapi/pppoe/pppoe.ba.go
+++ b/binapi/pppoe/pppoe.ba.go
@@ -47,11 +47,10 @@ func (*PppoeAddDelSession) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PppoeAddDelSession) Size() int {
+func (m *PppoeAddDelSession) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 2 // m.SessionID
size += 1 // m.ClientIP.Af
@@ -61,17 +60,15 @@ func (m *PppoeAddDelSession) Size() int {
return size
}
func (m *PppoeAddDelSession) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint16(uint16(m.SessionID))
+ buf.EncodeUint16(m.SessionID)
buf.EncodeUint8(uint8(m.ClientIP.Af))
- buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.DecapVrfID))
+ buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.DecapVrfID)
buf.EncodeBytes(m.ClientMac[:], 6)
return buf.Bytes(), nil
}
@@ -99,29 +96,26 @@ func (*PppoeAddDelSessionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PppoeAddDelSessionReply) Size() int {
+func (m *PppoeAddDelSessionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *PppoeAddDelSessionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *PppoeAddDelSessionReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -144,11 +138,10 @@ func (*PppoeSessionDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PppoeSessionDetails) Size() int {
+func (m *PppoeSessionDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 2 // m.SessionID
size += 1 // m.ClientIP.Af
@@ -160,18 +153,16 @@ func (m *PppoeSessionDetails) Size() int {
return size
}
func (m *PppoeSessionDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint16(uint16(m.SessionID))
+ buf.EncodeUint16(m.SessionID)
buf.EncodeUint8(uint8(m.ClientIP.Af))
- buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.EncapIfIndex))
- buf.EncodeUint32(uint32(m.DecapVrfID))
+ buf.EncodeUint32(m.DecapVrfID)
buf.EncodeBytes(m.LocalMac[:], 6)
buf.EncodeBytes(m.ClientMac[:], 6)
return buf.Bytes(), nil
@@ -201,21 +192,18 @@ func (*PppoeSessionDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PppoeSessionDump) Size() int {
+func (m *PppoeSessionDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *PppoeSessionDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
diff --git a/binapi/punt/punt.ba.go b/binapi/punt/punt.ba.go
index 53af1a3..18ff678 100644
--- a/binapi/punt/punt.ba.go
+++ b/binapi/punt/punt.ba.go
@@ -106,11 +106,11 @@ func PuntUnionException(a PuntException) (u PuntUnion) {
return
}
func (u *PuntUnion) SetException(a PuntException) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
- buf.EncodeUint32(uint32(a.ID))
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
+ buf.EncodeUint32(a.ID)
}
func (u *PuntUnion) GetException() (a PuntException) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
a.ID = buf.DecodeUint32()
return
}
@@ -120,13 +120,13 @@ func PuntUnionL4(a PuntL4) (u PuntUnion) {
return
}
func (u *PuntUnion) SetL4(a PuntL4) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
buf.EncodeUint8(uint8(a.Af))
buf.EncodeUint8(uint8(a.Protocol))
- buf.EncodeUint16(uint16(a.Port))
+ buf.EncodeUint16(a.Port)
}
func (u *PuntUnion) GetL4() (a PuntL4) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
a.Af = ip_types.AddressFamily(buf.DecodeUint8())
a.Protocol = ip_types.IPProto(buf.DecodeUint8())
a.Port = buf.DecodeUint16()
@@ -138,12 +138,12 @@ func PuntUnionIPProto(a PuntIPProto) (u PuntUnion) {
return
}
func (u *PuntUnion) SetIPProto(a PuntIPProto) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
buf.EncodeUint8(uint8(a.Af))
buf.EncodeUint8(uint8(a.Protocol))
}
func (u *PuntUnion) GetIPProto() (a PuntIPProto) {
- var buf = codec.NewBuffer(u.XXX_UnionData[:])
+ buf := codec.NewBuffer(u.XXX_UnionData[:])
a.Af = ip_types.AddressFamily(buf.DecodeUint8())
a.Protocol = ip_types.IPProto(buf.DecodeUint8())
return
@@ -161,23 +161,20 @@ func (*PuntReasonDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PuntReasonDetails) Size() int {
+func (m *PuntReasonDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Reason.ID
size += 4 + len(m.Reason.Name) // m.Reason.Name
return size
}
func (m *PuntReasonDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Reason.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Reason.ID)
buf.EncodeString(m.Reason.Name, 0)
return buf.Bytes(), nil
}
@@ -200,23 +197,20 @@ func (*PuntReasonDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PuntReasonDump) Size() int {
+func (m *PuntReasonDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Reason.ID
size += 4 + len(m.Reason.Name) // m.Reason.Name
return size
}
func (m *PuntReasonDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Reason.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Reason.ID)
buf.EncodeString(m.Reason.Name, 0)
return buf.Bytes(), nil
}
@@ -239,24 +233,21 @@ func (*PuntSocketDeregister) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PuntSocketDeregister) Size() int {
+func (m *PuntSocketDeregister) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Punt.Type
size += 1 * 4 // m.Punt.Punt
return size
}
func (m *PuntSocketDeregister) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Punt.Type))
- buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
return buf.Bytes(), nil
}
func (m *PuntSocketDeregister) Unmarshal(b []byte) error {
@@ -278,27 +269,24 @@ func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PuntSocketDeregisterReply) Size() int {
+func (m *PuntSocketDeregisterReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *PuntSocketDeregisterReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *PuntSocketDeregisterReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -315,25 +303,22 @@ func (*PuntSocketDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PuntSocketDetails) Size() int {
+func (m *PuntSocketDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Punt.Type
size += 1 * 4 // m.Punt.Punt
size += 108 // m.Pathname
return size
}
func (m *PuntSocketDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Punt.Type))
- buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
buf.EncodeString(m.Pathname, 108)
return buf.Bytes(), nil
}
@@ -357,21 +342,18 @@ func (*PuntSocketDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PuntSocketDump) Size() int {
+func (m *PuntSocketDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Type
return size
}
func (m *PuntSocketDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Type))
return buf.Bytes(), nil
}
@@ -395,11 +377,10 @@ func (*PuntSocketRegister) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *PuntSocketRegister) Size() int {
+func (m *PuntSocketRegister) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.HeaderVersion
size += 4 // m.Punt.Type
size += 1 * 4 // m.Punt.Punt
@@ -407,15 +388,13 @@ func (m *PuntSocketRegister) Size() int {
return size
}
func (m *PuntSocketRegister) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.HeaderVersion))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.HeaderVersion)
buf.EncodeUint32(uint32(m.Punt.Type))
- buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
buf.EncodeString(m.Pathname, 108)
return buf.Bytes(), nil
}
@@ -441,29 +420,26 @@ func (*PuntSocketRegisterReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *PuntSocketRegisterReply) Size() int {
+func (m *PuntSocketRegisterReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 108 // m.Pathname
return size
}
func (m *PuntSocketRegisterReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeString(m.Pathname, 108)
return buf.Bytes(), nil
}
func (m *PuntSocketRegisterReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Pathname = buf.DecodeString(108)
return nil
}
@@ -481,26 +457,23 @@ func (*SetPunt) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SetPunt) Size() int {
+func (m *SetPunt) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Punt.Type
size += 1 * 4 // m.Punt.Punt
return size
}
func (m *SetPunt) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint32(uint32(m.Punt.Type))
- buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
return buf.Bytes(), nil
}
func (m *SetPunt) Unmarshal(b []byte) error {
@@ -523,27 +496,24 @@ func (*SetPuntReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SetPuntReply) Size() int {
+func (m *SetPuntReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SetPuntReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SetPuntReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/qos/qos.ba.go b/binapi/qos/qos.ba.go
index 9ff70dd..2f889fd 100644
--- a/binapi/qos/qos.ba.go
+++ b/binapi/qos/qos.ba.go
@@ -109,22 +109,19 @@ func (*QosEgressMapDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *QosEgressMapDelete) Size() int {
+func (m *QosEgressMapDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ID
return size
}
func (m *QosEgressMapDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ID)
return buf.Bytes(), nil
}
func (m *QosEgressMapDelete) Unmarshal(b []byte) error {
@@ -145,27 +142,24 @@ func (*QosEgressMapDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosEgressMapDeleteReply) Size() int {
+func (m *QosEgressMapDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *QosEgressMapDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *QosEgressMapDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -181,36 +175,24 @@ func (*QosEgressMapDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosEgressMapDetails) Size() int {
+func (m *QosEgressMapDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Map.ID
for j2 := 0; j2 < 4; j2++ {
- var s2 QosEgressMapRow
- _ = s2
- if j2 < len(m.Map.Rows) {
- s2 = m.Map.Rows[j2]
- }
- size += 1 * 256 // s2.Outputs
+ size += 1 * 256 // m.Map.Rows[j2].Outputs
}
return size
}
func (m *QosEgressMapDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Map.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Map.ID)
for j1 := 0; j1 < 4; j1++ {
- var v1 QosEgressMapRow
- if j1 < len(m.Map.Rows) {
- v1 = m.Map.Rows[j1]
- }
- buf.EncodeBytes(v1.Outputs[:], 256)
+ buf.EncodeBytes(m.Map.Rows[j1].Outputs, 256)
}
return buf.Bytes(), nil
}
@@ -218,7 +200,8 @@ func (m *QosEgressMapDetails) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Map.ID = buf.DecodeUint32()
for j1 := 0; j1 < 4; j1++ {
- copy(m.Map.Rows[j1].Outputs[:], buf.DecodeBytes(256))
+ m.Map.Rows[j1].Outputs = make([]byte, 256)
+ copy(m.Map.Rows[j1].Outputs, buf.DecodeBytes(len(m.Map.Rows[j1].Outputs)))
}
return nil
}
@@ -233,20 +216,17 @@ func (*QosEgressMapDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *QosEgressMapDump) Size() int {
+func (m *QosEgressMapDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *QosEgressMapDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *QosEgressMapDump) Unmarshal(b []byte) error {
@@ -265,36 +245,24 @@ func (*QosEgressMapUpdate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *QosEgressMapUpdate) Size() int {
+func (m *QosEgressMapUpdate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Map.ID
for j2 := 0; j2 < 4; j2++ {
- var s2 QosEgressMapRow
- _ = s2
- if j2 < len(m.Map.Rows) {
- s2 = m.Map.Rows[j2]
- }
- size += 1 * 256 // s2.Outputs
+ size += 1 * 256 // m.Map.Rows[j2].Outputs
}
return size
}
func (m *QosEgressMapUpdate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Map.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Map.ID)
for j1 := 0; j1 < 4; j1++ {
- var v1 QosEgressMapRow
- if j1 < len(m.Map.Rows) {
- v1 = m.Map.Rows[j1]
- }
- buf.EncodeBytes(v1.Outputs[:], 256)
+ buf.EncodeBytes(m.Map.Rows[j1].Outputs, 256)
}
return buf.Bytes(), nil
}
@@ -302,7 +270,8 @@ func (m *QosEgressMapUpdate) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Map.ID = buf.DecodeUint32()
for j1 := 0; j1 < 4; j1++ {
- copy(m.Map.Rows[j1].Outputs[:], buf.DecodeBytes(256))
+ m.Map.Rows[j1].Outputs = make([]byte, 256)
+ copy(m.Map.Rows[j1].Outputs, buf.DecodeBytes(len(m.Map.Rows[j1].Outputs)))
}
return nil
}
@@ -319,27 +288,24 @@ func (*QosEgressMapUpdateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosEgressMapUpdateReply) Size() int {
+func (m *QosEgressMapUpdateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *QosEgressMapUpdateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *QosEgressMapUpdateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -355,25 +321,22 @@ func (*QosMarkDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosMarkDetails) Size() int {
+func (m *QosMarkDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Mark.SwIfIndex
size += 4 // m.Mark.MapID
size += 1 // m.Mark.OutputSource
return size
}
func (m *QosMarkDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Mark.SwIfIndex))
- buf.EncodeUint32(uint32(m.Mark.MapID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Mark.SwIfIndex)
+ buf.EncodeUint32(m.Mark.MapID)
buf.EncodeUint8(uint8(m.Mark.OutputSource))
return buf.Bytes(), nil
}
@@ -397,27 +360,24 @@ func (*QosMarkDetailsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosMarkDetailsReply) Size() int {
+func (m *QosMarkDetailsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *QosMarkDetailsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *QosMarkDetailsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -433,21 +393,18 @@ func (*QosMarkDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *QosMarkDump) Size() int {
+func (m *QosMarkDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *QosMarkDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -470,11 +427,10 @@ func (*QosMarkEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *QosMarkEnableDisable) Size() int {
+func (m *QosMarkEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
size += 4 // m.Mark.SwIfIndex
size += 4 // m.Mark.MapID
@@ -482,15 +438,13 @@ func (m *QosMarkEnableDisable) Size() int {
return size
}
func (m *QosMarkEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
- buf.EncodeUint32(uint32(m.Mark.SwIfIndex))
- buf.EncodeUint32(uint32(m.Mark.MapID))
+ buf.EncodeUint32(m.Mark.SwIfIndex)
+ buf.EncodeUint32(m.Mark.MapID)
buf.EncodeUint8(uint8(m.Mark.OutputSource))
return buf.Bytes(), nil
}
@@ -515,27 +469,24 @@ func (*QosMarkEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosMarkEnableDisableReply) Size() int {
+func (m *QosMarkEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *QosMarkEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *QosMarkEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -551,22 +502,19 @@ func (*QosRecordDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosRecordDetails) Size() int {
+func (m *QosRecordDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Record.SwIfIndex
size += 1 // m.Record.InputSource
return size
}
func (m *QosRecordDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Record.SwIfIndex))
buf.EncodeUint8(uint8(m.Record.InputSource))
return buf.Bytes(), nil
@@ -588,20 +536,17 @@ func (*QosRecordDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *QosRecordDump) Size() int {
+func (m *QosRecordDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *QosRecordDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *QosRecordDump) Unmarshal(b []byte) error {
@@ -621,23 +566,20 @@ func (*QosRecordEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *QosRecordEnableDisable) Size() int {
+func (m *QosRecordEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
size += 4 // m.Record.SwIfIndex
size += 1 // m.Record.InputSource
return size
}
func (m *QosRecordEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
buf.EncodeUint32(uint32(m.Record.SwIfIndex))
buf.EncodeUint8(uint8(m.Record.InputSource))
@@ -663,27 +605,24 @@ func (*QosRecordEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosRecordEnableDisableReply) Size() int {
+func (m *QosRecordEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *QosRecordEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *QosRecordEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -699,26 +638,23 @@ func (*QosStoreDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosStoreDetails) Size() int {
+func (m *QosStoreDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Store.SwIfIndex
size += 1 // m.Store.InputSource
size += 1 // m.Store.Value
return size
}
func (m *QosStoreDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Store.SwIfIndex))
buf.EncodeUint8(uint8(m.Store.InputSource))
- buf.EncodeUint8(uint8(m.Store.Value))
+ buf.EncodeUint8(m.Store.Value)
return buf.Bytes(), nil
}
func (m *QosStoreDetails) Unmarshal(b []byte) error {
@@ -739,20 +675,17 @@ func (*QosStoreDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *QosStoreDump) Size() int {
+func (m *QosStoreDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *QosStoreDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *QosStoreDump) Unmarshal(b []byte) error {
@@ -772,11 +705,10 @@ func (*QosStoreEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *QosStoreEnableDisable) Size() int {
+func (m *QosStoreEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
size += 4 // m.Store.SwIfIndex
size += 1 // m.Store.InputSource
@@ -784,16 +716,14 @@ func (m *QosStoreEnableDisable) Size() int {
return size
}
func (m *QosStoreEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
buf.EncodeUint32(uint32(m.Store.SwIfIndex))
buf.EncodeUint8(uint8(m.Store.InputSource))
- buf.EncodeUint8(uint8(m.Store.Value))
+ buf.EncodeUint8(m.Store.Value)
return buf.Bytes(), nil
}
func (m *QosStoreEnableDisable) Unmarshal(b []byte) error {
@@ -817,27 +747,24 @@ func (*QosStoreEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *QosStoreEnableDisableReply) Size() int {
+func (m *QosStoreEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *QosStoreEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *QosStoreEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/rd_cp/rd_cp.ba.go b/binapi/rd_cp/rd_cp.ba.go
index 7fefd79..8cafa0f 100644
--- a/binapi/rd_cp/rd_cp.ba.go
+++ b/binapi/rd_cp/rd_cp.ba.go
@@ -43,23 +43,20 @@ func (*IP6NdAddressAutoconfig) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *IP6NdAddressAutoconfig) Size() int {
+func (m *IP6NdAddressAutoconfig) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Enable
size += 1 // m.InstallDefaultRoutes
return size
}
func (m *IP6NdAddressAutoconfig) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
buf.EncodeBool(m.InstallDefaultRoutes)
@@ -85,27 +82,24 @@ func (*IP6NdAddressAutoconfigReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *IP6NdAddressAutoconfigReply) Size() int {
+func (m *IP6NdAddressAutoconfigReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *IP6NdAddressAutoconfigReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *IP6NdAddressAutoconfigReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/rdma/rdma.ba.go b/binapi/rdma/rdma.ba.go
index 43ab597..001fefe 100644
--- a/binapi/rdma/rdma.ba.go
+++ b/binapi/rdma/rdma.ba.go
@@ -65,10 +65,10 @@ func (x RdmaMode) String() string {
type RdmaCreate struct {
HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
Name string `binapi:"string[64],name=name" json:"name,omitempty"`
- RxqNum uint16 `binapi:"u16,name=rxq_num,default=%!s(float64=1)" json:"rxq_num,omitempty"`
- RxqSize uint16 `binapi:"u16,name=rxq_size,default=%!s(float64=1024)" json:"rxq_size,omitempty"`
- TxqSize uint16 `binapi:"u16,name=txq_size,default=%!s(float64=1024)" json:"txq_size,omitempty"`
- Mode RdmaMode `binapi:"rdma_mode,name=mode,default=%!s(float64=0)" json:"mode,omitempty"`
+ RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"`
+ RxqSize uint16 `binapi:"u16,name=rxq_size,default=1024" json:"rxq_size,omitempty"`
+ TxqSize uint16 `binapi:"u16,name=txq_size,default=1024" json:"txq_size,omitempty"`
+ Mode RdmaMode `binapi:"rdma_mode,name=mode,default=0" json:"mode,omitempty"`
}
func (m *RdmaCreate) Reset() { *m = RdmaCreate{} }
@@ -78,11 +78,10 @@ func (*RdmaCreate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *RdmaCreate) Size() int {
+func (m *RdmaCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.HostIf
size += 64 // m.Name
size += 2 // m.RxqNum
@@ -92,17 +91,15 @@ func (m *RdmaCreate) Size() int {
return size
}
func (m *RdmaCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.HostIf, 64)
buf.EncodeString(m.Name, 64)
- buf.EncodeUint16(uint16(m.RxqNum))
- buf.EncodeUint16(uint16(m.RxqSize))
- buf.EncodeUint16(uint16(m.TxqSize))
+ buf.EncodeUint16(m.RxqNum)
+ buf.EncodeUint16(m.RxqSize)
+ buf.EncodeUint16(m.TxqSize)
buf.EncodeUint32(uint32(m.Mode))
return buf.Bytes(), nil
}
@@ -130,29 +127,26 @@ func (*RdmaCreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *RdmaCreateReply) Size() int {
+func (m *RdmaCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *RdmaCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *RdmaCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -169,21 +163,18 @@ func (*RdmaDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *RdmaDelete) Size() int {
+func (m *RdmaDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *RdmaDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -205,27 +196,24 @@ func (*RdmaDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *RdmaDeleteReply) Size() int {
+func (m *RdmaDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *RdmaDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *RdmaDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/session/session.ba.go b/binapi/session/session.ba.go
index 1da2733..6e20c49 100644
--- a/binapi/session/session.ba.go
+++ b/binapi/session/session.ba.go
@@ -112,33 +112,31 @@ func (*AppAddCertKeyPair) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AppAddCertKeyPair) Size() int {
+func (m *AppAddCertKeyPair) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.CertLen
size += 2 // m.CertkeyLen
size += 1 * len(m.Certkey) // m.Certkey
return size
}
func (m *AppAddCertKeyPair) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.CertLen))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.CertLen)
buf.EncodeUint16(uint16(len(m.Certkey)))
- buf.EncodeBytes(m.Certkey[:], 0)
+ buf.EncodeBytes(m.Certkey, 0)
return buf.Bytes(), nil
}
func (m *AppAddCertKeyPair) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.CertLen = buf.DecodeUint16()
m.CertkeyLen = buf.DecodeUint16()
- copy(m.Certkey[:], buf.DecodeBytes(0))
+ m.Certkey = make([]byte, m.CertkeyLen)
+ copy(m.Certkey, buf.DecodeBytes(len(m.Certkey)))
return nil
}
@@ -155,29 +153,26 @@ func (*AppAddCertKeyPairReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AppAddCertKeyPairReply) Size() int {
+func (m *AppAddCertKeyPairReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Index
return size
}
func (m *AppAddCertKeyPairReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.Index))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.Index)
return buf.Bytes(), nil
}
func (m *AppAddCertKeyPairReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Index = buf.DecodeUint32()
return nil
}
@@ -195,28 +190,25 @@ func (*AppAttach) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AppAttach) Size() int {
+func (m *AppAttach) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 * 18 // m.Options
size += 4 + len(m.NamespaceID) // m.NamespaceID
return size
}
func (m *AppAttach) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
for i := 0; i < 18; i++ {
var x uint64
if i < len(m.Options) {
x = uint64(m.Options[i])
}
- buf.EncodeUint64(uint64(x))
+ buf.EncodeUint64(x)
}
buf.EncodeString(m.NamespaceID, 0)
return buf.Bytes(), nil
@@ -252,11 +244,10 @@ func (*AppAttachReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AppAttachReply) Size() int {
+func (m *AppAttachReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 8 // m.AppMq
size += 8 // m.VppCtrlMq
@@ -270,27 +261,25 @@ func (m *AppAttachReply) Size() int {
return size
}
func (m *AppAttachReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint64(uint64(m.AppMq))
- buf.EncodeUint64(uint64(m.VppCtrlMq))
- buf.EncodeUint8(uint8(m.VppCtrlMqThread))
- buf.EncodeUint32(uint32(m.AppIndex))
- buf.EncodeUint8(uint8(m.NFds))
- buf.EncodeUint8(uint8(m.FdFlags))
- buf.EncodeUint32(uint32(m.SegmentSize))
- buf.EncodeUint64(uint64(m.SegmentHandle))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint64(m.AppMq)
+ buf.EncodeUint64(m.VppCtrlMq)
+ buf.EncodeUint8(m.VppCtrlMqThread)
+ buf.EncodeUint32(m.AppIndex)
+ buf.EncodeUint8(m.NFds)
+ buf.EncodeUint8(m.FdFlags)
+ buf.EncodeUint32(m.SegmentSize)
+ buf.EncodeUint64(m.SegmentHandle)
buf.EncodeString(m.SegmentName, 0)
return buf.Bytes(), nil
}
func (m *AppAttachReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.AppMq = buf.DecodeUint64()
m.VppCtrlMq = buf.DecodeUint64()
m.VppCtrlMqThread = buf.DecodeUint8()
@@ -315,22 +304,19 @@ func (*AppDelCertKeyPair) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AppDelCertKeyPair) Size() int {
+func (m *AppDelCertKeyPair) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Index
return size
}
func (m *AppDelCertKeyPair) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Index))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Index)
return buf.Bytes(), nil
}
func (m *AppDelCertKeyPair) Unmarshal(b []byte) error {
@@ -351,34 +337,31 @@ func (*AppDelCertKeyPairReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AppDelCertKeyPairReply) Size() int {
+func (m *AppDelCertKeyPairReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *AppDelCertKeyPairReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *AppDelCertKeyPairReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
// AppNamespaceAddDel defines message 'app_namespace_add_del'.
type AppNamespaceAddDel struct {
Secret uint64 `binapi:"u64,name=secret" json:"secret,omitempty"`
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
IP4FibID uint32 `binapi:"u32,name=ip4_fib_id" json:"ip4_fib_id,omitempty"`
IP6FibID uint32 `binapi:"u32,name=ip6_fib_id" json:"ip6_fib_id,omitempty"`
NamespaceID string `binapi:"string[],name=namespace_id" json:"namespace_id,omitempty"`
@@ -391,11 +374,10 @@ func (*AppNamespaceAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AppNamespaceAddDel) Size() int {
+func (m *AppNamespaceAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.Secret
size += 4 // m.SwIfIndex
size += 4 // m.IP4FibID
@@ -404,16 +386,14 @@ func (m *AppNamespaceAddDel) Size() int {
return size
}
func (m *AppNamespaceAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint64(uint64(m.Secret))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint64(m.Secret)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.IP4FibID))
- buf.EncodeUint32(uint32(m.IP6FibID))
+ buf.EncodeUint32(m.IP4FibID)
+ buf.EncodeUint32(m.IP6FibID)
buf.EncodeString(m.NamespaceID, 0)
return buf.Bytes(), nil
}
@@ -440,29 +420,26 @@ func (*AppNamespaceAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AppNamespaceAddDelReply) Size() int {
+func (m *AppNamespaceAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.AppnsIndex
return size
}
func (m *AppNamespaceAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.AppnsIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.AppnsIndex)
return buf.Bytes(), nil
}
func (m *AppNamespaceAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.AppnsIndex = buf.DecodeUint32()
return nil
}
@@ -481,25 +458,22 @@ func (*AppWorkerAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AppWorkerAddDel) Size() int {
+func (m *AppWorkerAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.AppIndex
size += 4 // m.WrkIndex
size += 1 // m.IsAdd
return size
}
func (m *AppWorkerAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.AppIndex))
- buf.EncodeUint32(uint32(m.WrkIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.AppIndex)
+ buf.EncodeUint32(m.WrkIndex)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -530,11 +504,10 @@ func (*AppWorkerAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AppWorkerAddDelReply) Size() int {
+func (m *AppWorkerAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.WrkIndex
size += 8 // m.AppEventQueueAddress
@@ -546,25 +519,23 @@ func (m *AppWorkerAddDelReply) Size() int {
return size
}
func (m *AppWorkerAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.WrkIndex))
- buf.EncodeUint64(uint64(m.AppEventQueueAddress))
- buf.EncodeUint8(uint8(m.NFds))
- buf.EncodeUint8(uint8(m.FdFlags))
- buf.EncodeUint64(uint64(m.SegmentHandle))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.WrkIndex)
+ buf.EncodeUint64(m.AppEventQueueAddress)
+ buf.EncodeUint8(m.NFds)
+ buf.EncodeUint8(m.FdFlags)
+ buf.EncodeUint64(m.SegmentHandle)
buf.EncodeBool(m.IsAdd)
buf.EncodeString(m.SegmentName, 0)
return buf.Bytes(), nil
}
func (m *AppWorkerAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.WrkIndex = buf.DecodeUint32()
m.AppEventQueueAddress = buf.DecodeUint64()
m.NFds = buf.DecodeUint8()
@@ -585,20 +556,17 @@ func (*ApplicationDetach) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ApplicationDetach) Size() int {
+func (m *ApplicationDetach) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ApplicationDetach) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ApplicationDetach) Unmarshal(b []byte) error {
@@ -617,27 +585,24 @@ func (*ApplicationDetachReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ApplicationDetachReply) Size() int {
+func (m *ApplicationDetachReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ApplicationDetachReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ApplicationDetachReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -655,33 +620,31 @@ func (*ApplicationTLSCertAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ApplicationTLSCertAdd) Size() int {
+func (m *ApplicationTLSCertAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.AppIndex
size += 2 // m.CertLen
size += 1 * len(m.Cert) // m.Cert
return size
}
func (m *ApplicationTLSCertAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.AppIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.AppIndex)
buf.EncodeUint16(uint16(len(m.Cert)))
- buf.EncodeBytes(m.Cert[:], 0)
+ buf.EncodeBytes(m.Cert, 0)
return buf.Bytes(), nil
}
func (m *ApplicationTLSCertAdd) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.AppIndex = buf.DecodeUint32()
m.CertLen = buf.DecodeUint16()
- copy(m.Cert[:], buf.DecodeBytes(0))
+ m.Cert = make([]byte, m.CertLen)
+ copy(m.Cert, buf.DecodeBytes(len(m.Cert)))
return nil
}
@@ -697,27 +660,24 @@ func (*ApplicationTLSCertAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ApplicationTLSCertAddReply) Size() int {
+func (m *ApplicationTLSCertAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ApplicationTLSCertAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ApplicationTLSCertAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -735,33 +695,31 @@ func (*ApplicationTLSKeyAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ApplicationTLSKeyAdd) Size() int {
+func (m *ApplicationTLSKeyAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.AppIndex
size += 2 // m.KeyLen
size += 1 * len(m.Key) // m.Key
return size
}
func (m *ApplicationTLSKeyAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.AppIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.AppIndex)
buf.EncodeUint16(uint16(len(m.Key)))
- buf.EncodeBytes(m.Key[:], 0)
+ buf.EncodeBytes(m.Key, 0)
return buf.Bytes(), nil
}
func (m *ApplicationTLSKeyAdd) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.AppIndex = buf.DecodeUint32()
m.KeyLen = buf.DecodeUint16()
- copy(m.Key[:], buf.DecodeBytes(0))
+ m.Key = make([]byte, m.KeyLen)
+ copy(m.Key, buf.DecodeBytes(len(m.Key)))
return nil
}
@@ -777,27 +735,24 @@ func (*ApplicationTLSKeyAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ApplicationTLSKeyAddReply) Size() int {
+func (m *ApplicationTLSKeyAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ApplicationTLSKeyAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ApplicationTLSKeyAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -813,21 +768,18 @@ func (*SessionEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SessionEnableDisable) Size() int {
+func (m *SessionEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
return size
}
func (m *SessionEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
return buf.Bytes(), nil
}
@@ -849,27 +801,24 @@ func (*SessionEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SessionEnableDisableReply) Size() int {
+func (m *SessionEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SessionEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SessionEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -894,11 +843,10 @@ func (*SessionRuleAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SessionRuleAddDel) Size() int {
+func (m *SessionRuleAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.TransportProto
size += 1 // m.Lcl.Address.Af
size += 1 * 16 // m.Lcl.Address.Un
@@ -916,24 +864,22 @@ func (m *SessionRuleAddDel) Size() int {
return size
}
func (m *SessionRuleAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.TransportProto))
buf.EncodeUint8(uint8(m.Lcl.Address.Af))
- buf.EncodeBytes(m.Lcl.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Lcl.Len))
+ buf.EncodeBytes(m.Lcl.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Lcl.Len)
buf.EncodeUint8(uint8(m.Rmt.Address.Af))
- buf.EncodeBytes(m.Rmt.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Rmt.Len))
- buf.EncodeUint16(uint16(m.LclPort))
- buf.EncodeUint16(uint16(m.RmtPort))
- buf.EncodeUint32(uint32(m.ActionIndex))
+ buf.EncodeBytes(m.Rmt.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Rmt.Len)
+ buf.EncodeUint16(m.LclPort)
+ buf.EncodeUint16(m.RmtPort)
+ buf.EncodeUint32(m.ActionIndex)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.AppnsIndex))
+ buf.EncodeUint32(m.AppnsIndex)
buf.EncodeUint32(uint32(m.Scope))
buf.EncodeString(m.Tag, 64)
return buf.Bytes(), nil
@@ -969,27 +915,24 @@ func (*SessionRuleAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SessionRuleAddDelReply) Size() int {
+func (m *SessionRuleAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SessionRuleAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SessionRuleAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -1013,11 +956,10 @@ func (*SessionRulesDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SessionRulesDetails) Size() int {
+func (m *SessionRulesDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.TransportProto
size += 1 // m.Lcl.Address.Af
size += 1 * 16 // m.Lcl.Address.Un
@@ -1034,23 +976,21 @@ func (m *SessionRulesDetails) Size() int {
return size
}
func (m *SessionRulesDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.TransportProto))
buf.EncodeUint8(uint8(m.Lcl.Address.Af))
- buf.EncodeBytes(m.Lcl.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Lcl.Len))
+ buf.EncodeBytes(m.Lcl.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Lcl.Len)
buf.EncodeUint8(uint8(m.Rmt.Address.Af))
- buf.EncodeBytes(m.Rmt.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Rmt.Len))
- buf.EncodeUint16(uint16(m.LclPort))
- buf.EncodeUint16(uint16(m.RmtPort))
- buf.EncodeUint32(uint32(m.ActionIndex))
- buf.EncodeUint32(uint32(m.AppnsIndex))
+ buf.EncodeBytes(m.Rmt.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Rmt.Len)
+ buf.EncodeUint16(m.LclPort)
+ buf.EncodeUint16(m.RmtPort)
+ buf.EncodeUint32(m.ActionIndex)
+ buf.EncodeUint32(m.AppnsIndex)
buf.EncodeUint32(uint32(m.Scope))
buf.EncodeString(m.Tag, 64)
return buf.Bytes(), nil
@@ -1083,20 +1023,17 @@ func (*SessionRulesDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SessionRulesDump) Size() int {
+func (m *SessionRulesDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SessionRulesDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SessionRulesDump) Unmarshal(b []byte) error {
diff --git a/binapi/span/span.ba.go b/binapi/span/span.ba.go
index 156a1d7..2dcbc37 100644
--- a/binapi/span/span.ba.go
+++ b/binapi/span/span.ba.go
@@ -79,11 +79,10 @@ func (*SwInterfaceSpanDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSpanDetails) Size() int {
+func (m *SwInterfaceSpanDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndexFrom
size += 4 // m.SwIfIndexTo
size += 4 // m.State
@@ -91,12 +90,10 @@ func (m *SwInterfaceSpanDetails) Size() int {
return size
}
func (m *SwInterfaceSpanDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndexFrom))
buf.EncodeUint32(uint32(m.SwIfIndexTo))
buf.EncodeUint32(uint32(m.State))
@@ -124,21 +121,18 @@ func (*SwInterfaceSpanDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSpanDump) Size() int {
+func (m *SwInterfaceSpanDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsL2
return size
}
func (m *SwInterfaceSpanDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsL2)
return buf.Bytes(), nil
}
@@ -165,11 +159,10 @@ func (*SwInterfaceSpanEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSpanEnableDisable) Size() int {
+func (m *SwInterfaceSpanEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndexFrom
size += 4 // m.SwIfIndexTo
size += 4 // m.State
@@ -177,12 +170,10 @@ func (m *SwInterfaceSpanEnableDisable) Size() int {
return size
}
func (m *SwInterfaceSpanEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndexFrom))
buf.EncodeUint32(uint32(m.SwIfIndexTo))
buf.EncodeUint32(uint32(m.State))
@@ -212,27 +203,24 @@ func (*SwInterfaceSpanEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSpanEnableDisableReply) Size() int {
+func (m *SwInterfaceSpanEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSpanEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSpanEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/sr/sr.ba.go b/binapi/sr/sr.ba.go
index d26f89b..2b98b8a 100644
--- a/binapi/sr/sr.ba.go
+++ b/binapi/sr/sr.ba.go
@@ -41,11 +41,11 @@ type Srv6SidList struct {
// SrLocalsidAddDel defines message 'sr_localsid_add_del'.
type SrLocalsidAddDel struct {
- IsDel bool `binapi:"bool,name=is_del,default=%!s(bool=false)" json:"is_del,omitempty"`
+ IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"`
Localsid ip_types.IP6Address `binapi:"ip6_address,name=localsid" json:"localsid,omitempty"`
EndPsp bool `binapi:"bool,name=end_psp" json:"end_psp,omitempty"`
Behavior sr_types.SrBehavior `binapi:"sr_behavior,name=behavior" json:"behavior,omitempty"`
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
VlanIndex uint32 `binapi:"u32,name=vlan_index" json:"vlan_index,omitempty"`
FibTable uint32 `binapi:"u32,name=fib_table" json:"fib_table,omitempty"`
NhAddr ip_types.Address `binapi:"address,name=nh_addr" json:"nh_addr,omitempty"`
@@ -58,11 +58,10 @@ func (*SrLocalsidAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrLocalsidAddDel) Size() int {
+func (m *SrLocalsidAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsDel
size += 1 * 16 // m.Localsid
size += 1 // m.EndPsp
@@ -75,21 +74,19 @@ func (m *SrLocalsidAddDel) Size() int {
return size
}
func (m *SrLocalsidAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsDel)
buf.EncodeBytes(m.Localsid[:], 16)
buf.EncodeBool(m.EndPsp)
buf.EncodeUint8(uint8(m.Behavior))
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.VlanIndex))
- buf.EncodeUint32(uint32(m.FibTable))
+ buf.EncodeUint32(m.VlanIndex)
+ buf.EncodeUint32(m.FibTable)
buf.EncodeUint8(uint8(m.NhAddr.Af))
- buf.EncodeBytes(m.NhAddr.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.NhAddr.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *SrLocalsidAddDel) Unmarshal(b []byte) error {
@@ -118,27 +115,24 @@ func (*SrLocalsidAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrLocalsidAddDelReply) Size() int {
+func (m *SrLocalsidAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrLocalsidAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrLocalsidAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -160,11 +154,10 @@ func (*SrLocalsidsDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrLocalsidsDetails) Size() int {
+func (m *SrLocalsidsDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.Addr
size += 1 // m.EndPsp
size += 1 // m.Behavior
@@ -176,20 +169,18 @@ func (m *SrLocalsidsDetails) Size() int {
return size
}
func (m *SrLocalsidsDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.Addr[:], 16)
buf.EncodeBool(m.EndPsp)
buf.EncodeUint8(uint8(m.Behavior))
- buf.EncodeUint32(uint32(m.FibTable))
- buf.EncodeUint32(uint32(m.VlanIndex))
+ buf.EncodeUint32(m.FibTable)
+ buf.EncodeUint32(m.VlanIndex)
buf.EncodeUint8(uint8(m.XconnectNhAddr.Af))
- buf.EncodeBytes(m.XconnectNhAddr.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.XconnectIfaceOrVrfTable))
+ buf.EncodeBytes(m.XconnectNhAddr.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.XconnectIfaceOrVrfTable)
return buf.Bytes(), nil
}
func (m *SrLocalsidsDetails) Unmarshal(b []byte) error {
@@ -215,20 +206,17 @@ func (*SrLocalsidsDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrLocalsidsDump) Size() int {
+func (m *SrLocalsidsDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SrLocalsidsDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SrLocalsidsDump) Unmarshal(b []byte) error {
@@ -252,11 +240,10 @@ func (*SrPoliciesDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrPoliciesDetails) Size() int {
+func (m *SrPoliciesDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.Bsid
size += 1 // m.IsSpray
size += 1 // m.IsEncap
@@ -271,41 +258,30 @@ func (m *SrPoliciesDetails) Size() int {
size += 1 // s1.NumSids
size += 4 // s1.Weight
for j2 := 0; j2 < 16; j2++ {
- var s2 ip_types.IP6Address
- _ = s2
- if j2 < len(s1.Sids) {
- s2 = s1.Sids[j2]
- }
- size += 1 * 16 // s2
+ size += 1 * 16 // s1.Sids[j2]
}
}
return size
}
func (m *SrPoliciesDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.Bsid[:], 16)
buf.EncodeBool(m.IsSpray)
buf.EncodeBool(m.IsEncap)
- buf.EncodeUint32(uint32(m.FibTable))
+ buf.EncodeUint32(m.FibTable)
buf.EncodeUint8(uint8(len(m.SidLists)))
for j0 := 0; j0 < len(m.SidLists); j0++ {
- var v0 Srv6SidList
+ var v0 Srv6SidList // SidLists
if j0 < len(m.SidLists) {
v0 = m.SidLists[j0]
}
- buf.EncodeUint8(uint8(v0.NumSids))
- buf.EncodeUint32(uint32(v0.Weight))
+ buf.EncodeUint8(v0.NumSids)
+ buf.EncodeUint32(v0.Weight)
for j1 := 0; j1 < 16; j1++ {
- var v1 ip_types.IP6Address
- if j1 < len(v0.Sids) {
- v1 = v0.Sids[j1]
- }
- buf.EncodeBytes(v1[:], 16)
+ buf.EncodeBytes(v0.Sids[j1][:], 16)
}
}
return buf.Bytes(), nil
@@ -317,7 +293,7 @@ func (m *SrPoliciesDetails) Unmarshal(b []byte) error {
m.IsEncap = buf.DecodeBool()
m.FibTable = buf.DecodeUint32()
m.NumSidLists = buf.DecodeUint8()
- m.SidLists = make([]Srv6SidList, int(m.NumSidLists))
+ m.SidLists = make([]Srv6SidList, m.NumSidLists)
for j0 := 0; j0 < len(m.SidLists); j0++ {
m.SidLists[j0].NumSids = buf.DecodeUint8()
m.SidLists[j0].Weight = buf.DecodeUint32()
@@ -338,20 +314,17 @@ func (*SrPoliciesDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrPoliciesDump) Size() int {
+func (m *SrPoliciesDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SrPoliciesDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SrPoliciesDump) Unmarshal(b []byte) error {
@@ -375,11 +348,10 @@ func (*SrPolicyAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrPolicyAdd) Size() int {
+func (m *SrPolicyAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.BsidAddr
size += 4 // m.Weight
size += 1 // m.IsEncap
@@ -388,35 +360,24 @@ func (m *SrPolicyAdd) Size() int {
size += 1 // m.Sids.NumSids
size += 4 // m.Sids.Weight
for j2 := 0; j2 < 16; j2++ {
- var s2 ip_types.IP6Address
- _ = s2
- if j2 < len(m.Sids.Sids) {
- s2 = m.Sids.Sids[j2]
- }
- size += 1 * 16 // s2
+ size += 1 * 16 // m.Sids.Sids[j2]
}
return size
}
func (m *SrPolicyAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.BsidAddr[:], 16)
- buf.EncodeUint32(uint32(m.Weight))
+ buf.EncodeUint32(m.Weight)
buf.EncodeBool(m.IsEncap)
buf.EncodeBool(m.IsSpray)
- buf.EncodeUint32(uint32(m.FibTable))
- buf.EncodeUint8(uint8(m.Sids.NumSids))
- buf.EncodeUint32(uint32(m.Sids.Weight))
+ buf.EncodeUint32(m.FibTable)
+ buf.EncodeUint8(m.Sids.NumSids)
+ buf.EncodeUint32(m.Sids.Weight)
for j1 := 0; j1 < 16; j1++ {
- var v1 ip_types.IP6Address
- if j1 < len(m.Sids.Sids) {
- v1 = m.Sids.Sids[j1]
- }
- buf.EncodeBytes(v1[:], 16)
+ buf.EncodeBytes(m.Sids.Sids[j1][:], 16)
}
return buf.Bytes(), nil
}
@@ -447,27 +408,24 @@ func (*SrPolicyAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrPolicyAddReply) Size() int {
+func (m *SrPolicyAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrPolicyAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrPolicyAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -484,24 +442,21 @@ func (*SrPolicyDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrPolicyDel) Size() int {
+func (m *SrPolicyDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.BsidAddr
size += 4 // m.SrPolicyIndex
return size
}
func (m *SrPolicyDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.BsidAddr[:], 16)
- buf.EncodeUint32(uint32(m.SrPolicyIndex))
+ buf.EncodeUint32(m.SrPolicyIndex)
return buf.Bytes(), nil
}
func (m *SrPolicyDel) Unmarshal(b []byte) error {
@@ -523,27 +478,24 @@ func (*SrPolicyDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrPolicyDelReply) Size() int {
+func (m *SrPolicyDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrPolicyDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrPolicyDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -565,11 +517,10 @@ func (*SrPolicyMod) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrPolicyMod) Size() int {
+func (m *SrPolicyMod) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.BsidAddr
size += 4 // m.SrPolicyIndex
size += 4 // m.FibTable
@@ -579,36 +530,25 @@ func (m *SrPolicyMod) Size() int {
size += 1 // m.Sids.NumSids
size += 4 // m.Sids.Weight
for j2 := 0; j2 < 16; j2++ {
- var s2 ip_types.IP6Address
- _ = s2
- if j2 < len(m.Sids.Sids) {
- s2 = m.Sids.Sids[j2]
- }
- size += 1 * 16 // s2
+ size += 1 * 16 // m.Sids.Sids[j2]
}
return size
}
func (m *SrPolicyMod) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.BsidAddr[:], 16)
- buf.EncodeUint32(uint32(m.SrPolicyIndex))
- buf.EncodeUint32(uint32(m.FibTable))
+ buf.EncodeUint32(m.SrPolicyIndex)
+ buf.EncodeUint32(m.FibTable)
buf.EncodeUint8(uint8(m.Operation))
- buf.EncodeUint32(uint32(m.SlIndex))
- buf.EncodeUint32(uint32(m.Weight))
- buf.EncodeUint8(uint8(m.Sids.NumSids))
- buf.EncodeUint32(uint32(m.Sids.Weight))
+ buf.EncodeUint32(m.SlIndex)
+ buf.EncodeUint32(m.Weight)
+ buf.EncodeUint8(m.Sids.NumSids)
+ buf.EncodeUint32(m.Sids.Weight)
for j1 := 0; j1 < 16; j1++ {
- var v1 ip_types.IP6Address
- if j1 < len(m.Sids.Sids) {
- v1 = m.Sids.Sids[j1]
- }
- buf.EncodeBytes(v1[:], 16)
+ buf.EncodeBytes(m.Sids.Sids[j1][:], 16)
}
return buf.Bytes(), nil
}
@@ -640,27 +580,24 @@ func (*SrPolicyModReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrPolicyModReply) Size() int {
+func (m *SrPolicyModReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrPolicyModReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrPolicyModReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -676,22 +613,19 @@ func (*SrSetEncapHopLimit) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrSetEncapHopLimit) Size() int {
+func (m *SrSetEncapHopLimit) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.HopLimit
return size
}
func (m *SrSetEncapHopLimit) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.HopLimit))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.HopLimit)
return buf.Bytes(), nil
}
func (m *SrSetEncapHopLimit) Unmarshal(b []byte) error {
@@ -712,27 +646,24 @@ func (*SrSetEncapHopLimitReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrSetEncapHopLimitReply) Size() int {
+func (m *SrSetEncapHopLimitReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrSetEncapHopLimitReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrSetEncapHopLimitReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -748,21 +679,18 @@ func (*SrSetEncapSource) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrSetEncapSource) Size() int {
+func (m *SrSetEncapSource) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 16 // m.EncapsSource
return size
}
func (m *SrSetEncapSource) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.EncapsSource[:], 16)
return buf.Bytes(), nil
}
@@ -784,33 +712,30 @@ func (*SrSetEncapSourceReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrSetEncapSourceReply) Size() int {
+func (m *SrSetEncapSourceReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrSetEncapSourceReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrSetEncapSourceReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
// SrSteeringAddDel defines message 'sr_steering_add_del'.
type SrSteeringAddDel struct {
- IsDel bool `binapi:"bool,name=is_del,default=%!s(bool=false)" json:"is_del,omitempty"`
+ IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"`
BsidAddr ip_types.IP6Address `binapi:"ip6_address,name=bsid_addr" json:"bsid_addr,omitempty"`
SrPolicyIndex uint32 `binapi:"u32,name=sr_policy_index" json:"sr_policy_index,omitempty"`
TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"`
@@ -826,11 +751,10 @@ func (*SrSteeringAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrSteeringAddDel) Size() int {
+func (m *SrSteeringAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsDel
size += 1 * 16 // m.BsidAddr
size += 4 // m.SrPolicyIndex
@@ -843,19 +767,17 @@ func (m *SrSteeringAddDel) Size() int {
return size
}
func (m *SrSteeringAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsDel)
buf.EncodeBytes(m.BsidAddr[:], 16)
- buf.EncodeUint32(uint32(m.SrPolicyIndex))
- buf.EncodeUint32(uint32(m.TableID))
+ buf.EncodeUint32(m.SrPolicyIndex)
+ buf.EncodeUint32(m.TableID)
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.TrafficType))
return buf.Bytes(), nil
@@ -886,27 +808,24 @@ func (*SrSteeringAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrSteeringAddDelReply) Size() int {
+func (m *SrSteeringAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrSteeringAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrSteeringAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -926,11 +845,10 @@ func (*SrSteeringPolDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrSteeringPolDetails) Size() int {
+func (m *SrSteeringPolDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.TrafficType
size += 4 // m.FibTable
size += 1 // m.Prefix.Address.Af
@@ -941,17 +859,15 @@ func (m *SrSteeringPolDetails) Size() int {
return size
}
func (m *SrSteeringPolDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.TrafficType))
- buf.EncodeUint32(uint32(m.FibTable))
+ buf.EncodeUint32(m.FibTable)
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBytes(m.Bsid[:], 16)
return buf.Bytes(), nil
@@ -978,20 +894,17 @@ func (*SrSteeringPolDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrSteeringPolDump) Size() int {
+func (m *SrSteeringPolDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SrSteeringPolDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SrSteeringPolDump) Unmarshal(b []byte) error {
diff --git a/binapi/sr_mpls/sr_mpls.ba.go b/binapi/sr_mpls/sr_mpls.ba.go
index c34522d..e6bd9f0 100644
--- a/binapi/sr_mpls/sr_mpls.ba.go
+++ b/binapi/sr_mpls/sr_mpls.ba.go
@@ -47,11 +47,10 @@ func (*SrMplsPolicyAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrMplsPolicyAdd) Size() int {
+func (m *SrMplsPolicyAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Bsid
size += 4 // m.Weight
size += 1 // m.IsSpray
@@ -60,14 +59,12 @@ func (m *SrMplsPolicyAdd) Size() int {
return size
}
func (m *SrMplsPolicyAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Bsid))
- buf.EncodeUint32(uint32(m.Weight))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Bsid)
+ buf.EncodeUint32(m.Weight)
buf.EncodeBool(m.IsSpray)
buf.EncodeUint8(uint8(len(m.Segments)))
for i := 0; i < len(m.Segments); i++ {
@@ -75,7 +72,7 @@ func (m *SrMplsPolicyAdd) Marshal(b []byte) ([]byte, error) {
if i < len(m.Segments) {
x = uint32(m.Segments[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
@@ -104,27 +101,24 @@ func (*SrMplsPolicyAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrMplsPolicyAddReply) Size() int {
+func (m *SrMplsPolicyAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrMplsPolicyAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrMplsPolicyAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -144,11 +138,10 @@ func (*SrMplsPolicyAssignEndpointColor) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrMplsPolicyAssignEndpointColor) Size() int {
+func (m *SrMplsPolicyAssignEndpointColor) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Bsid
size += 1 // m.Endpoint.Af
size += 1 * 16 // m.Endpoint.Un
@@ -156,16 +149,14 @@ func (m *SrMplsPolicyAssignEndpointColor) Size() int {
return size
}
func (m *SrMplsPolicyAssignEndpointColor) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Bsid))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Bsid)
buf.EncodeUint8(uint8(m.Endpoint.Af))
- buf.EncodeBytes(m.Endpoint.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Color))
+ buf.EncodeBytes(m.Endpoint.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.Color)
return buf.Bytes(), nil
}
func (m *SrMplsPolicyAssignEndpointColor) Unmarshal(b []byte) error {
@@ -191,27 +182,24 @@ func (*SrMplsPolicyAssignEndpointColorReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrMplsPolicyAssignEndpointColorReply) Size() int {
+func (m *SrMplsPolicyAssignEndpointColorReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrMplsPolicyAssignEndpointColorReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrMplsPolicyAssignEndpointColorReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -227,22 +215,19 @@ func (*SrMplsPolicyDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrMplsPolicyDel) Size() int {
+func (m *SrMplsPolicyDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Bsid
return size
}
func (m *SrMplsPolicyDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Bsid))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Bsid)
return buf.Bytes(), nil
}
func (m *SrMplsPolicyDel) Unmarshal(b []byte) error {
@@ -263,27 +248,24 @@ func (*SrMplsPolicyDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrMplsPolicyDelReply) Size() int {
+func (m *SrMplsPolicyDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrMplsPolicyDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrMplsPolicyDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -304,11 +286,10 @@ func (*SrMplsPolicyMod) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrMplsPolicyMod) Size() int {
+func (m *SrMplsPolicyMod) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Bsid
size += 1 // m.Operation
size += 4 // m.SlIndex
@@ -318,23 +299,21 @@ func (m *SrMplsPolicyMod) Size() int {
return size
}
func (m *SrMplsPolicyMod) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Bsid))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Bsid)
buf.EncodeUint8(uint8(m.Operation))
- buf.EncodeUint32(uint32(m.SlIndex))
- buf.EncodeUint32(uint32(m.Weight))
+ buf.EncodeUint32(m.SlIndex)
+ buf.EncodeUint32(m.Weight)
buf.EncodeUint8(uint8(len(m.Segments)))
for i := 0; i < len(m.Segments); i++ {
var x uint32
if i < len(m.Segments) {
x = uint32(m.Segments[i])
}
- buf.EncodeUint32(uint32(x))
+ buf.EncodeUint32(x)
}
return buf.Bytes(), nil
}
@@ -364,33 +343,30 @@ func (*SrMplsPolicyModReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrMplsPolicyModReply) Size() int {
+func (m *SrMplsPolicyModReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrMplsPolicyModReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrMplsPolicyModReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
// SrMplsSteeringAddDel defines message 'sr_mpls_steering_add_del'.
type SrMplsSteeringAddDel struct {
- IsDel bool `binapi:"bool,name=is_del,default=%!s(bool=false)" json:"is_del,omitempty"`
+ IsDel bool `binapi:"bool,name=is_del,default=false" json:"is_del,omitempty"`
Bsid uint32 `binapi:"u32,name=bsid" json:"bsid,omitempty"`
TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"`
Prefix ip_types.Prefix `binapi:"prefix,name=prefix" json:"prefix,omitempty"`
@@ -408,11 +384,10 @@ func (*SrMplsSteeringAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SrMplsSteeringAddDel) Size() int {
+func (m *SrMplsSteeringAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsDel
size += 4 // m.Bsid
size += 4 // m.TableID
@@ -428,24 +403,22 @@ func (m *SrMplsSteeringAddDel) Size() int {
return size
}
func (m *SrMplsSteeringAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsDel)
- buf.EncodeUint32(uint32(m.Bsid))
- buf.EncodeUint32(uint32(m.TableID))
+ buf.EncodeUint32(m.Bsid)
+ buf.EncodeUint32(m.TableID)
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
- buf.EncodeUint32(uint32(m.MaskWidth))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
+ buf.EncodeUint32(m.MaskWidth)
buf.EncodeUint8(uint8(m.NextHop.Af))
- buf.EncodeBytes(m.NextHop.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Color))
- buf.EncodeUint8(uint8(m.CoBits))
- buf.EncodeUint32(uint32(m.VPNLabel))
+ buf.EncodeBytes(m.NextHop.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.Color)
+ buf.EncodeUint8(m.CoBits)
+ buf.EncodeUint32(m.VPNLabel)
return buf.Bytes(), nil
}
func (m *SrMplsSteeringAddDel) Unmarshal(b []byte) error {
@@ -477,27 +450,24 @@ func (*SrMplsSteeringAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SrMplsSteeringAddDelReply) Size() int {
+func (m *SrMplsSteeringAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SrMplsSteeringAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SrMplsSteeringAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/stn/stn.ba.go b/binapi/stn/stn.ba.go
index 34cb419..b44adf5 100644
--- a/binapi/stn/stn.ba.go
+++ b/binapi/stn/stn.ba.go
@@ -44,11 +44,10 @@ func (*StnAddDelRule) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *StnAddDelRule) Size() int {
+func (m *StnAddDelRule) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
size += 4 // m.SwIfIndex
@@ -56,14 +55,12 @@ func (m *StnAddDelRule) Size() int {
return size
}
func (m *StnAddDelRule) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
@@ -89,27 +86,24 @@ func (*StnAddDelRuleReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *StnAddDelRuleReply) Size() int {
+func (m *StnAddDelRuleReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *StnAddDelRuleReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *StnAddDelRuleReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -126,25 +120,22 @@ func (*StnRulesDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *StnRulesDetails) Size() int {
+func (m *StnRulesDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IPAddress.Af
size += 1 * 16 // m.IPAddress.Un
size += 4 // m.SwIfIndex
return size
}
func (m *StnRulesDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.IPAddress.Af))
- buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -166,20 +157,17 @@ func (*StnRulesDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *StnRulesDump) Size() int {
+func (m *StnRulesDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *StnRulesDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *StnRulesDump) Unmarshal(b []byte) error {
diff --git a/binapi/svs/svs.ba.go b/binapi/svs/svs.ba.go
index 06573cc..911e936 100644
--- a/binapi/svs/svs.ba.go
+++ b/binapi/svs/svs.ba.go
@@ -44,24 +44,21 @@ func (*SvsDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SvsDetails) Size() int {
+func (m *SvsDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.TableID
size += 4 // m.SwIfIndex
size += 1 // m.Af
return size
}
func (m *SvsDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.TableID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.TableID)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.Af))
return buf.Bytes(), nil
@@ -84,20 +81,17 @@ func (*SvsDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SvsDump) Size() int {
+func (m *SvsDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SvsDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SvsDump) Unmarshal(b []byte) error {
@@ -119,11 +113,10 @@ func (*SvsEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SvsEnableDisable) Size() int {
+func (m *SvsEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsEnable
size += 1 // m.Af
size += 4 // m.TableID
@@ -131,15 +124,13 @@ func (m *SvsEnableDisable) Size() int {
return size
}
func (m *SvsEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsEnable)
buf.EncodeUint8(uint8(m.Af))
- buf.EncodeUint32(uint32(m.TableID))
+ buf.EncodeUint32(m.TableID)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -164,27 +155,24 @@ func (*SvsEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SvsEnableDisableReply) Size() int {
+func (m *SvsEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SvsEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SvsEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -198,20 +186,17 @@ func (*SvsPluginGetVersion) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SvsPluginGetVersion) Size() int {
+func (m *SvsPluginGetVersion) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SvsPluginGetVersion) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SvsPluginGetVersion) Unmarshal(b []byte) error {
@@ -231,24 +216,21 @@ func (*SvsPluginGetVersionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SvsPluginGetVersionReply) Size() int {
+func (m *SvsPluginGetVersionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Major
size += 4 // m.Minor
return size
}
func (m *SvsPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Major))
- buf.EncodeUint32(uint32(m.Minor))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Major)
+ buf.EncodeUint32(m.Minor)
return buf.Bytes(), nil
}
func (m *SvsPluginGetVersionReply) Unmarshal(b []byte) error {
@@ -273,11 +255,10 @@ func (*SvsRouteAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SvsRouteAddDel) Size() int {
+func (m *SvsRouteAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Prefix.Address.Af
size += 1 * 16 // m.Prefix.Address.Un
@@ -287,18 +268,16 @@ func (m *SvsRouteAddDel) Size() int {
return size
}
func (m *SvsRouteAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Prefix.Address.Af))
- buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 0)
- buf.EncodeUint8(uint8(m.Prefix.Len))
- buf.EncodeUint32(uint32(m.TableID))
- buf.EncodeUint32(uint32(m.SourceTableID))
+ buf.EncodeBytes(m.Prefix.Address.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint8(m.Prefix.Len)
+ buf.EncodeUint32(m.TableID)
+ buf.EncodeUint32(m.SourceTableID)
return buf.Bytes(), nil
}
func (m *SvsRouteAddDel) Unmarshal(b []byte) error {
@@ -324,27 +303,24 @@ func (*SvsRouteAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SvsRouteAddDelReply) Size() int {
+func (m *SvsRouteAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SvsRouteAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SvsRouteAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -362,26 +338,23 @@ func (*SvsTableAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SvsTableAddDel) Size() int {
+func (m *SvsTableAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 1 // m.Af
size += 4 // m.TableID
return size
}
func (m *SvsTableAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
buf.EncodeUint8(uint8(m.Af))
- buf.EncodeUint32(uint32(m.TableID))
+ buf.EncodeUint32(m.TableID)
return buf.Bytes(), nil
}
func (m *SvsTableAddDel) Unmarshal(b []byte) error {
@@ -404,27 +377,24 @@ func (*SvsTableAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SvsTableAddDelReply) Size() int {
+func (m *SvsTableAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SvsTableAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SvsTableAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/syslog/syslog.ba.go b/binapi/syslog/syslog.ba.go
index c6d78dc..c9bdab7 100644
--- a/binapi/syslog/syslog.ba.go
+++ b/binapi/syslog/syslog.ba.go
@@ -86,20 +86,17 @@ func (*SyslogGetFilter) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SyslogGetFilter) Size() int {
+func (m *SyslogGetFilter) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SyslogGetFilter) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SyslogGetFilter) Unmarshal(b []byte) error {
@@ -119,29 +116,26 @@ func (*SyslogGetFilterReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SyslogGetFilterReply) Size() int {
+func (m *SyslogGetFilterReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Severity
return size
}
func (m *SyslogGetFilterReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.Severity))
return buf.Bytes(), nil
}
func (m *SyslogGetFilterReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Severity = SyslogSeverity(buf.DecodeUint32())
return nil
}
@@ -156,20 +150,17 @@ func (*SyslogGetSender) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SyslogGetSender) Size() int {
+func (m *SyslogGetSender) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SyslogGetSender) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SyslogGetSender) Unmarshal(b []byte) error {
@@ -193,11 +184,10 @@ func (*SyslogGetSenderReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SyslogGetSenderReply) Size() int {
+func (m *SyslogGetSenderReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 * 4 // m.SrcAddress
size += 1 * 4 // m.CollectorAddress
@@ -207,23 +197,21 @@ func (m *SyslogGetSenderReply) Size() int {
return size
}
func (m *SyslogGetSenderReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeBytes(m.SrcAddress[:], 4)
buf.EncodeBytes(m.CollectorAddress[:], 4)
- buf.EncodeUint16(uint16(m.CollectorPort))
- buf.EncodeUint32(uint32(m.VrfID))
- buf.EncodeUint32(uint32(m.MaxMsgSize))
+ buf.EncodeUint16(m.CollectorPort)
+ buf.EncodeUint32(m.VrfID)
+ buf.EncodeUint32(m.MaxMsgSize)
return buf.Bytes(), nil
}
func (m *SyslogGetSenderReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
copy(m.SrcAddress[:], buf.DecodeBytes(4))
copy(m.CollectorAddress[:], buf.DecodeBytes(4))
m.CollectorPort = buf.DecodeUint16()
@@ -244,21 +232,18 @@ func (*SyslogSetFilter) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SyslogSetFilter) Size() int {
+func (m *SyslogSetFilter) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Severity
return size
}
func (m *SyslogSetFilter) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Severity))
return buf.Bytes(), nil
}
@@ -280,27 +265,24 @@ func (*SyslogSetFilterReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SyslogSetFilterReply) Size() int {
+func (m *SyslogSetFilterReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SyslogSetFilterReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SyslogSetFilterReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -308,9 +290,9 @@ func (m *SyslogSetFilterReply) Unmarshal(b []byte) error {
type SyslogSetSender struct {
SrcAddress ip_types.IP4Address `binapi:"ip4_address,name=src_address" json:"src_address,omitempty"`
CollectorAddress ip_types.IP4Address `binapi:"ip4_address,name=collector_address" json:"collector_address,omitempty"`
- CollectorPort uint16 `binapi:"u16,name=collector_port,default=%!s(float64=514)" json:"collector_port,omitempty"`
+ CollectorPort uint16 `binapi:"u16,name=collector_port,default=514" json:"collector_port,omitempty"`
VrfID uint32 `binapi:"u32,name=vrf_id" json:"vrf_id,omitempty"`
- MaxMsgSize uint32 `binapi:"u32,name=max_msg_size,default=%!s(float64=480)" json:"max_msg_size,omitempty"`
+ MaxMsgSize uint32 `binapi:"u32,name=max_msg_size,default=480" json:"max_msg_size,omitempty"`
}
func (m *SyslogSetSender) Reset() { *m = SyslogSetSender{} }
@@ -320,11 +302,10 @@ func (*SyslogSetSender) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SyslogSetSender) Size() int {
+func (m *SyslogSetSender) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 * 4 // m.SrcAddress
size += 1 * 4 // m.CollectorAddress
size += 2 // m.CollectorPort
@@ -333,17 +314,15 @@ func (m *SyslogSetSender) Size() int {
return size
}
func (m *SyslogSetSender) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBytes(m.SrcAddress[:], 4)
buf.EncodeBytes(m.CollectorAddress[:], 4)
- buf.EncodeUint16(uint16(m.CollectorPort))
- buf.EncodeUint32(uint32(m.VrfID))
- buf.EncodeUint32(uint32(m.MaxMsgSize))
+ buf.EncodeUint16(m.CollectorPort)
+ buf.EncodeUint32(m.VrfID)
+ buf.EncodeUint32(m.MaxMsgSize)
return buf.Bytes(), nil
}
func (m *SyslogSetSender) Unmarshal(b []byte) error {
@@ -368,27 +347,24 @@ func (*SyslogSetSenderReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SyslogSetSenderReply) Size() int {
+func (m *SyslogSetSenderReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SyslogSetSenderReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SyslogSetSenderReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/tapv2/tapv2.ba.go b/binapi/tapv2/tapv2.ba.go
index e19b556..3745c83 100644
--- a/binapi/tapv2/tapv2.ba.go
+++ b/binapi/tapv2/tapv2.ba.go
@@ -115,11 +115,10 @@ func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceTapV2Details) Size() int {
+func (m *SwInterfaceTapV2Details) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.ID
size += 2 // m.TxRingSz
@@ -138,22 +137,20 @@ func (m *SwInterfaceTapV2Details) Size() int {
return size
}
func (m *SwInterfaceTapV2Details) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.ID))
- buf.EncodeUint16(uint16(m.TxRingSz))
- buf.EncodeUint16(uint16(m.RxRingSz))
- buf.EncodeUint32(uint32(m.HostMtuSize))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.SwIfIndex)
+ buf.EncodeUint32(m.ID)
+ buf.EncodeUint16(m.TxRingSz)
+ buf.EncodeUint16(m.RxRingSz)
+ buf.EncodeUint32(m.HostMtuSize)
buf.EncodeBytes(m.HostMacAddr[:], 6)
buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
- buf.EncodeUint8(uint8(m.HostIP4Prefix.Len))
+ buf.EncodeUint8(m.HostIP4Prefix.Len)
buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
- buf.EncodeUint8(uint8(m.HostIP6Prefix.Len))
+ buf.EncodeUint8(m.HostIP6Prefix.Len)
buf.EncodeUint32(uint32(m.TapFlags))
buf.EncodeString(m.DevName, 64)
buf.EncodeString(m.HostIfName, 64)
@@ -183,7 +180,7 @@ func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error {
// SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'.
type SwInterfaceTapV2Dump struct {
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *SwInterfaceTapV2Dump) Reset() { *m = SwInterfaceTapV2Dump{} }
@@ -193,21 +190,18 @@ func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceTapV2Dump) Size() int {
+func (m *SwInterfaceTapV2Dump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *SwInterfaceTapV2Dump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -219,12 +213,12 @@ func (m *SwInterfaceTapV2Dump) Unmarshal(b []byte) error {
// TapCreateV2 defines message 'tap_create_v2'.
type TapCreateV2 struct {
- ID uint32 `binapi:"u32,name=id,default=%!s(float64=4.294967295e+09)" json:"id,omitempty"`
+ ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"`
UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"`
MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
- NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=%!s(float64=1)" json:"num_rx_queues,omitempty"`
- TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=%!s(float64=256)" json:"tx_ring_sz,omitempty"`
- RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=%!s(float64=256)" json:"rx_ring_sz,omitempty"`
+ NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"`
+ TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"`
+ RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"`
HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"`
HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"`
HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"`
@@ -254,11 +248,10 @@ func (*TapCreateV2) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TapCreateV2) Size() int {
+func (m *TapCreateV2) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ID
size += 1 // m.UseRandomMac
size += 1 * 6 // m.MacAddress
@@ -290,28 +283,26 @@ func (m *TapCreateV2) Size() int {
return size
}
func (m *TapCreateV2) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ID)
buf.EncodeBool(m.UseRandomMac)
buf.EncodeBytes(m.MacAddress[:], 6)
- buf.EncodeUint8(uint8(m.NumRxQueues))
- buf.EncodeUint16(uint16(m.TxRingSz))
- buf.EncodeUint16(uint16(m.RxRingSz))
+ buf.EncodeUint8(m.NumRxQueues)
+ buf.EncodeUint16(m.TxRingSz)
+ buf.EncodeUint16(m.RxRingSz)
buf.EncodeBool(m.HostMtuSet)
- buf.EncodeUint32(uint32(m.HostMtuSize))
+ buf.EncodeUint32(m.HostMtuSize)
buf.EncodeBool(m.HostMacAddrSet)
buf.EncodeBytes(m.HostMacAddr[:], 6)
buf.EncodeBool(m.HostIP4PrefixSet)
buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4)
- buf.EncodeUint8(uint8(m.HostIP4Prefix.Len))
+ buf.EncodeUint8(m.HostIP4Prefix.Len)
buf.EncodeBool(m.HostIP6PrefixSet)
buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16)
- buf.EncodeUint8(uint8(m.HostIP6Prefix.Len))
+ buf.EncodeUint8(m.HostIP6Prefix.Len)
buf.EncodeBool(m.HostIP4GwSet)
buf.EncodeBytes(m.HostIP4Gw[:], 4)
buf.EncodeBool(m.HostIP6GwSet)
@@ -372,29 +363,26 @@ func (*TapCreateV2Reply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *TapCreateV2Reply) Size() int {
+func (m *TapCreateV2Reply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *TapCreateV2Reply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *TapCreateV2Reply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -411,21 +399,18 @@ func (*TapDeleteV2) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TapDeleteV2) Size() int {
+func (m *TapDeleteV2) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *TapDeleteV2) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -447,27 +432,24 @@ func (*TapDeleteV2Reply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *TapDeleteV2Reply) Size() int {
+func (m *TapDeleteV2Reply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *TapDeleteV2Reply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/tcp/tcp.ba.go b/binapi/tcp/tcp.ba.go
index 89571c4..7ae3ecc 100644
--- a/binapi/tcp/tcp.ba.go
+++ b/binapi/tcp/tcp.ba.go
@@ -43,11 +43,10 @@ func (*TCPConfigureSrcAddresses) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TCPConfigureSrcAddresses) Size() int {
+func (m *TCPConfigureSrcAddresses) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.VrfID
size += 1 // m.FirstAddress.Af
size += 1 * 16 // m.FirstAddress.Un
@@ -56,17 +55,15 @@ func (m *TCPConfigureSrcAddresses) Size() int {
return size
}
func (m *TCPConfigureSrcAddresses) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.VrfID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.VrfID)
buf.EncodeUint8(uint8(m.FirstAddress.Af))
- buf.EncodeBytes(m.FirstAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.FirstAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.LastAddress.Af))
- buf.EncodeBytes(m.LastAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.LastAddress.Un.XXX_UnionData[:], 16)
return buf.Bytes(), nil
}
func (m *TCPConfigureSrcAddresses) Unmarshal(b []byte) error {
@@ -93,27 +90,24 @@ func (*TCPConfigureSrcAddressesReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *TCPConfigureSrcAddressesReply) Size() int {
+func (m *TCPConfigureSrcAddressesReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *TCPConfigureSrcAddressesReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *TCPConfigureSrcAddressesReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/teib/teib.ba.go b/binapi/teib/teib.ba.go
index 9c216bf..d37f391 100644
--- a/binapi/teib/teib.ba.go
+++ b/binapi/teib/teib.ba.go
@@ -51,11 +51,10 @@ func (*TeibDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *TeibDetails) Size() int {
+func (m *TeibDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Entry.SwIfIndex
size += 1 // m.Entry.Peer.Af
size += 1 * 16 // m.Entry.Peer.Un
@@ -65,18 +64,16 @@ func (m *TeibDetails) Size() int {
return size
}
func (m *TeibDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Entry.SwIfIndex))
buf.EncodeUint8(uint8(m.Entry.Peer.Af))
- buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.Nh.Af))
- buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Entry.NhTableID))
+ buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.Entry.NhTableID)
return buf.Bytes(), nil
}
func (m *TeibDetails) Unmarshal(b []byte) error {
@@ -100,20 +97,17 @@ func (*TeibDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TeibDump) Size() int {
+func (m *TeibDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *TeibDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *TeibDump) Unmarshal(b []byte) error {
@@ -133,11 +127,10 @@ func (*TeibEntryAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TeibEntryAddDel) Size() int {
+func (m *TeibEntryAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Entry.SwIfIndex
size += 1 // m.Entry.Peer.Af
@@ -148,19 +141,17 @@ func (m *TeibEntryAddDel) Size() int {
return size
}
func (m *TeibEntryAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.IsAdd))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.IsAdd)
buf.EncodeUint32(uint32(m.Entry.SwIfIndex))
buf.EncodeUint8(uint8(m.Entry.Peer.Af))
- buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Entry.Peer.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Entry.Nh.Af))
- buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Entry.NhTableID))
+ buf.EncodeBytes(m.Entry.Nh.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.Entry.NhTableID)
return buf.Bytes(), nil
}
func (m *TeibEntryAddDel) Unmarshal(b []byte) error {
@@ -187,27 +178,24 @@ func (*TeibEntryAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *TeibEntryAddDelReply) Size() int {
+func (m *TeibEntryAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *TeibEntryAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *TeibEntryAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/tls_openssl/tls_openssl.ba.go b/binapi/tls_openssl/tls_openssl.ba.go
index b4293fd..938a9df 100644
--- a/binapi/tls_openssl/tls_openssl.ba.go
+++ b/binapi/tls_openssl/tls_openssl.ba.go
@@ -43,11 +43,10 @@ func (*TLSOpensslSetEngine) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TLSOpensslSetEngine) Size() int {
+func (m *TLSOpensslSetEngine) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.AsyncEnable
size += 1 * 64 // m.Engine
size += 1 * 64 // m.Algorithm
@@ -55,24 +54,25 @@ func (m *TLSOpensslSetEngine) Size() int {
return size
}
func (m *TLSOpensslSetEngine) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.AsyncEnable))
- buf.EncodeBytes(m.Engine[:], 64)
- buf.EncodeBytes(m.Algorithm[:], 64)
- buf.EncodeBytes(m.Ciphers[:], 64)
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.AsyncEnable)
+ buf.EncodeBytes(m.Engine, 64)
+ buf.EncodeBytes(m.Algorithm, 64)
+ buf.EncodeBytes(m.Ciphers, 64)
return buf.Bytes(), nil
}
func (m *TLSOpensslSetEngine) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.AsyncEnable = buf.DecodeUint32()
- copy(m.Engine[:], buf.DecodeBytes(64))
- copy(m.Algorithm[:], buf.DecodeBytes(64))
- copy(m.Ciphers[:], buf.DecodeBytes(64))
+ m.Engine = make([]byte, 64)
+ copy(m.Engine, buf.DecodeBytes(len(m.Engine)))
+ m.Algorithm = make([]byte, 64)
+ copy(m.Algorithm, buf.DecodeBytes(len(m.Algorithm)))
+ m.Ciphers = make([]byte, 64)
+ copy(m.Ciphers, buf.DecodeBytes(len(m.Ciphers)))
return nil
}
@@ -88,27 +88,24 @@ func (*TLSOpensslSetEngineReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *TLSOpensslSetEngineReply) Size() int {
+func (m *TLSOpensslSetEngineReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *TLSOpensslSetEngineReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *TLSOpensslSetEngineReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/trace/trace.ba.go b/binapi/trace/trace.ba.go
index 25db789..9bc330b 100644
--- a/binapi/trace/trace.ba.go
+++ b/binapi/trace/trace.ba.go
@@ -44,11 +44,10 @@ func (*TraceProfileAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TraceProfileAdd) Size() int {
+func (m *TraceProfileAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.TraceType
size += 1 // m.NumElts
size += 1 // m.TraceTsp
@@ -57,17 +56,15 @@ func (m *TraceProfileAdd) Size() int {
return size
}
func (m *TraceProfileAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.TraceType))
- buf.EncodeUint8(uint8(m.NumElts))
- buf.EncodeUint8(uint8(m.TraceTsp))
- buf.EncodeUint32(uint32(m.NodeID))
- buf.EncodeUint32(uint32(m.AppData))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.TraceType)
+ buf.EncodeUint8(m.NumElts)
+ buf.EncodeUint8(m.TraceTsp)
+ buf.EncodeUint32(m.NodeID)
+ buf.EncodeUint32(m.AppData)
return buf.Bytes(), nil
}
func (m *TraceProfileAdd) Unmarshal(b []byte) error {
@@ -92,27 +89,24 @@ func (*TraceProfileAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *TraceProfileAddReply) Size() int {
+func (m *TraceProfileAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *TraceProfileAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *TraceProfileAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -126,20 +120,17 @@ func (*TraceProfileDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TraceProfileDel) Size() int {
+func (m *TraceProfileDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *TraceProfileDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *TraceProfileDel) Unmarshal(b []byte) error {
@@ -158,27 +149,24 @@ func (*TraceProfileDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *TraceProfileDelReply) Size() int {
+func (m *TraceProfileDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *TraceProfileDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *TraceProfileDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -192,20 +180,17 @@ func (*TraceProfileShowConfig) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *TraceProfileShowConfig) Size() int {
+func (m *TraceProfileShowConfig) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *TraceProfileShowConfig) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *TraceProfileShowConfig) Unmarshal(b []byte) error {
@@ -229,11 +214,10 @@ func (*TraceProfileShowConfigReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *TraceProfileShowConfigReply) Size() int {
+func (m *TraceProfileShowConfigReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 1 // m.TraceType
size += 1 // m.NumElts
@@ -243,23 +227,21 @@ func (m *TraceProfileShowConfigReply) Size() int {
return size
}
func (m *TraceProfileShowConfigReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint8(uint8(m.TraceType))
- buf.EncodeUint8(uint8(m.NumElts))
- buf.EncodeUint8(uint8(m.TraceTsp))
- buf.EncodeUint32(uint32(m.NodeID))
- buf.EncodeUint32(uint32(m.AppData))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint8(m.TraceType)
+ buf.EncodeUint8(m.NumElts)
+ buf.EncodeUint8(m.TraceTsp)
+ buf.EncodeUint32(m.NodeID)
+ buf.EncodeUint32(m.AppData)
return buf.Bytes(), nil
}
func (m *TraceProfileShowConfigReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.TraceType = buf.DecodeUint8()
m.NumElts = buf.DecodeUint8()
m.TraceTsp = buf.DecodeUint8()
diff --git a/binapi/udp/udp.ba.go b/binapi/udp/udp.ba.go
index 2582afb..7795100 100644
--- a/binapi/udp/udp.ba.go
+++ b/binapi/udp/udp.ba.go
@@ -52,11 +52,10 @@ func (*UDPEncapAdd) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *UDPEncapAdd) Size() int {
+func (m *UDPEncapAdd) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.UDPEncap.TableID
size += 2 // m.UDPEncap.SrcPort
size += 2 // m.UDPEncap.DstPort
@@ -68,20 +67,18 @@ func (m *UDPEncapAdd) Size() int {
return size
}
func (m *UDPEncapAdd) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.UDPEncap.TableID))
- buf.EncodeUint16(uint16(m.UDPEncap.SrcPort))
- buf.EncodeUint16(uint16(m.UDPEncap.DstPort))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.UDPEncap.TableID)
+ buf.EncodeUint16(m.UDPEncap.SrcPort)
+ buf.EncodeUint16(m.UDPEncap.DstPort)
buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af))
- buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af))
- buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.UDPEncap.ID))
+ buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.UDPEncap.ID)
return buf.Bytes(), nil
}
func (m *UDPEncapAdd) Unmarshal(b []byte) error {
@@ -110,29 +107,26 @@ func (*UDPEncapAddReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *UDPEncapAddReply) Size() int {
+func (m *UDPEncapAddReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.ID
return size
}
func (m *UDPEncapAddReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.ID)
return buf.Bytes(), nil
}
func (m *UDPEncapAddReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ID = buf.DecodeUint32()
return nil
}
@@ -149,22 +143,19 @@ func (*UDPEncapDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *UDPEncapDel) Size() int {
+func (m *UDPEncapDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.ID
return size
}
func (m *UDPEncapDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.ID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.ID)
return buf.Bytes(), nil
}
func (m *UDPEncapDel) Unmarshal(b []byte) error {
@@ -185,27 +176,24 @@ func (*UDPEncapDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *UDPEncapDelReply) Size() int {
+func (m *UDPEncapDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *UDPEncapDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *UDPEncapDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -221,11 +209,10 @@ func (*UDPEncapDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *UDPEncapDetails) Size() int {
+func (m *UDPEncapDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.UDPEncap.TableID
size += 2 // m.UDPEncap.SrcPort
size += 2 // m.UDPEncap.DstPort
@@ -237,20 +224,18 @@ func (m *UDPEncapDetails) Size() int {
return size
}
func (m *UDPEncapDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.UDPEncap.TableID))
- buf.EncodeUint16(uint16(m.UDPEncap.SrcPort))
- buf.EncodeUint16(uint16(m.UDPEncap.DstPort))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.UDPEncap.TableID)
+ buf.EncodeUint16(m.UDPEncap.SrcPort)
+ buf.EncodeUint16(m.UDPEncap.DstPort)
buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af))
- buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af))
- buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.UDPEncap.ID))
+ buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.UDPEncap.ID)
return buf.Bytes(), nil
}
func (m *UDPEncapDetails) Unmarshal(b []byte) error {
@@ -276,20 +261,17 @@ func (*UDPEncapDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *UDPEncapDump) Size() int {
+func (m *UDPEncapDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *UDPEncapDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *UDPEncapDump) Unmarshal(b []byte) error {
diff --git a/binapi/udp_ping/udp_ping.ba.go b/binapi/udp_ping/udp_ping.ba.go
index 98d0c9f..7247b38 100644
--- a/binapi/udp_ping/udp_ping.ba.go
+++ b/binapi/udp_ping/udp_ping.ba.go
@@ -50,11 +50,10 @@ func (*UDPPingAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *UDPPingAddDel) Size() int {
+func (m *UDPPingAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.SrcIPAddress.Af
size += 1 * 16 // m.SrcIPAddress.Un
size += 1 // m.DstIPAddress.Af
@@ -70,24 +69,22 @@ func (m *UDPPingAddDel) Size() int {
return size
}
func (m *UDPPingAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.SrcIPAddress.Af))
- buf.EncodeBytes(m.SrcIPAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.SrcIPAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.DstIPAddress.Af))
- buf.EncodeBytes(m.DstIPAddress.Un.XXX_UnionData[:], 0)
- buf.EncodeUint16(uint16(m.StartSrcPort))
- buf.EncodeUint16(uint16(m.EndSrcPort))
- buf.EncodeUint16(uint16(m.StartDstPort))
- buf.EncodeUint16(uint16(m.EndDstPort))
- buf.EncodeUint16(uint16(m.Interval))
- buf.EncodeUint8(uint8(m.Dis))
- buf.EncodeUint8(uint8(m.FaultDet))
- buf.EncodeBytes(m.Reserve[:], 3)
+ buf.EncodeBytes(m.DstIPAddress.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint16(m.StartSrcPort)
+ buf.EncodeUint16(m.EndSrcPort)
+ buf.EncodeUint16(m.StartDstPort)
+ buf.EncodeUint16(m.EndDstPort)
+ buf.EncodeUint16(m.Interval)
+ buf.EncodeUint8(m.Dis)
+ buf.EncodeUint8(m.FaultDet)
+ buf.EncodeBytes(m.Reserve, 3)
return buf.Bytes(), nil
}
func (m *UDPPingAddDel) Unmarshal(b []byte) error {
@@ -103,7 +100,8 @@ func (m *UDPPingAddDel) Unmarshal(b []byte) error {
m.Interval = buf.DecodeUint16()
m.Dis = buf.DecodeUint8()
m.FaultDet = buf.DecodeUint8()
- copy(m.Reserve[:], buf.DecodeBytes(3))
+ m.Reserve = make([]byte, 3)
+ copy(m.Reserve, buf.DecodeBytes(len(m.Reserve)))
return nil
}
@@ -119,27 +117,24 @@ func (*UDPPingAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *UDPPingAddDelReply) Size() int {
+func (m *UDPPingAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *UDPPingAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *UDPPingAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -155,21 +150,18 @@ func (*UDPPingExport) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *UDPPingExport) Size() int {
+func (m *UDPPingExport) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Enable
return size
}
func (m *UDPPingExport) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.Enable)
return buf.Bytes(), nil
}
@@ -191,27 +183,24 @@ func (*UDPPingExportReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *UDPPingExportReply) Size() int {
+func (m *UDPPingExportReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *UDPPingExportReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *UDPPingExportReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/urpf/urpf.ba.go b/binapi/urpf/urpf.ba.go
index d324bdb..c504cfb 100644
--- a/binapi/urpf/urpf.ba.go
+++ b/binapi/urpf/urpf.ba.go
@@ -78,11 +78,10 @@ func (*UrpfUpdate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *UrpfUpdate) Size() int {
+func (m *UrpfUpdate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsInput
size += 1 // m.Mode
size += 1 // m.Af
@@ -90,12 +89,10 @@ func (m *UrpfUpdate) Size() int {
return size
}
func (m *UrpfUpdate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsInput)
buf.EncodeUint8(uint8(m.Mode))
buf.EncodeUint8(uint8(m.Af))
@@ -123,27 +120,24 @@ func (*UrpfUpdateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *UrpfUpdateReply) Size() int {
+func (m *UrpfUpdateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *UrpfUpdateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *UrpfUpdateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/vhost_user/vhost_user.ba.go b/binapi/vhost_user/vhost_user.ba.go
index ea3d32b..0ca7119 100644
--- a/binapi/vhost_user/vhost_user.ba.go
+++ b/binapi/vhost_user/vhost_user.ba.go
@@ -53,11 +53,10 @@ func (*CreateVhostUserIf) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CreateVhostUserIf) Size() int {
+func (m *CreateVhostUserIf) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsServer
size += 256 // m.SockFilename
size += 1 // m.Renumber
@@ -72,12 +71,10 @@ func (m *CreateVhostUserIf) Size() int {
return size
}
func (m *CreateVhostUserIf) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsServer)
buf.EncodeString(m.SockFilename, 256)
buf.EncodeBool(m.Renumber)
@@ -85,7 +82,7 @@ func (m *CreateVhostUserIf) Marshal(b []byte) ([]byte, error) {
buf.EncodeBool(m.DisableIndirectDesc)
buf.EncodeBool(m.EnableGso)
buf.EncodeBool(m.EnablePacked)
- buf.EncodeUint32(uint32(m.CustomDevInstance))
+ buf.EncodeUint32(m.CustomDevInstance)
buf.EncodeBool(m.UseCustomMac)
buf.EncodeBytes(m.MacAddress[:], 6)
buf.EncodeString(m.Tag, 64)
@@ -120,29 +117,26 @@ func (*CreateVhostUserIfReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CreateVhostUserIfReply) Size() int {
+func (m *CreateVhostUserIfReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *CreateVhostUserIfReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *CreateVhostUserIfReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -159,21 +153,18 @@ func (*DeleteVhostUserIf) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *DeleteVhostUserIf) Size() int {
+func (m *DeleteVhostUserIf) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *DeleteVhostUserIf) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -195,27 +186,24 @@ func (*DeleteVhostUserIfReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *DeleteVhostUserIfReply) Size() int {
+func (m *DeleteVhostUserIfReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *DeleteVhostUserIfReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *DeleteVhostUserIfReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -237,11 +225,10 @@ func (*ModifyVhostUserIf) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ModifyVhostUserIf) Size() int {
+func (m *ModifyVhostUserIf) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsServer
size += 256 // m.SockFilename
@@ -252,19 +239,17 @@ func (m *ModifyVhostUserIf) Size() int {
return size
}
func (m *ModifyVhostUserIf) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsServer)
buf.EncodeString(m.SockFilename, 256)
buf.EncodeBool(m.Renumber)
buf.EncodeBool(m.EnableGso)
buf.EncodeBool(m.EnablePacked)
- buf.EncodeUint32(uint32(m.CustomDevInstance))
+ buf.EncodeUint32(m.CustomDevInstance)
return buf.Bytes(), nil
}
func (m *ModifyVhostUserIf) Unmarshal(b []byte) error {
@@ -291,27 +276,24 @@ func (*ModifyVhostUserIfReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ModifyVhostUserIfReply) Size() int {
+func (m *ModifyVhostUserIfReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *ModifyVhostUserIfReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *ModifyVhostUserIfReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -335,11 +317,10 @@ func (*SwInterfaceVhostUserDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceVhostUserDetails) Size() int {
+func (m *SwInterfaceVhostUserDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 64 // m.InterfaceName
size += 4 // m.VirtioNetHdrSz
@@ -352,21 +333,19 @@ func (m *SwInterfaceVhostUserDetails) Size() int {
return size
}
func (m *SwInterfaceVhostUserDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeString(m.InterfaceName, 64)
- buf.EncodeUint32(uint32(m.VirtioNetHdrSz))
+ buf.EncodeUint32(m.VirtioNetHdrSz)
buf.EncodeUint32(uint32(m.FeaturesFirst32))
buf.EncodeUint32(uint32(m.FeaturesLast32))
buf.EncodeBool(m.IsServer)
buf.EncodeString(m.SockFilename, 256)
- buf.EncodeUint32(uint32(m.NumRegions))
- buf.EncodeUint32(uint32(m.SockErrno))
+ buf.EncodeUint32(m.NumRegions)
+ buf.EncodeInt32(m.SockErrno)
return buf.Bytes(), nil
}
func (m *SwInterfaceVhostUserDetails) Unmarshal(b []byte) error {
@@ -379,13 +358,13 @@ func (m *SwInterfaceVhostUserDetails) Unmarshal(b []byte) error {
m.IsServer = buf.DecodeBool()
m.SockFilename = buf.DecodeString(256)
m.NumRegions = buf.DecodeUint32()
- m.SockErrno = int32(buf.DecodeUint32())
+ m.SockErrno = buf.DecodeInt32()
return nil
}
// SwInterfaceVhostUserDump defines message 'sw_interface_vhost_user_dump'.
type SwInterfaceVhostUserDump struct {
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *SwInterfaceVhostUserDump) Reset() { *m = SwInterfaceVhostUserDump{} }
@@ -395,21 +374,18 @@ func (*SwInterfaceVhostUserDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceVhostUserDump) Size() int {
+func (m *SwInterfaceVhostUserDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *SwInterfaceVhostUserDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
diff --git a/binapi/virtio/virtio.ba.go b/binapi/virtio/virtio.ba.go
index 467cc0f..b29b52f 100644
--- a/binapi/virtio/virtio.ba.go
+++ b/binapi/virtio/virtio.ba.go
@@ -48,11 +48,10 @@ func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceVirtioPciDetails) Size() int {
+func (m *SwInterfaceVirtioPciDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 2 // m.PciAddr.Domain
size += 1 // m.PciAddr.Bus
@@ -65,21 +64,19 @@ func (m *SwInterfaceVirtioPciDetails) Size() int {
return size
}
func (m *SwInterfaceVirtioPciDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint16(uint16(m.PciAddr.Domain))
- buf.EncodeUint8(uint8(m.PciAddr.Bus))
- buf.EncodeUint8(uint8(m.PciAddr.Slot))
- buf.EncodeUint8(uint8(m.PciAddr.Function))
+ buf.EncodeUint16(m.PciAddr.Domain)
+ buf.EncodeUint8(m.PciAddr.Bus)
+ buf.EncodeUint8(m.PciAddr.Slot)
+ buf.EncodeUint8(m.PciAddr.Function)
buf.EncodeBytes(m.MacAddr[:], 6)
- buf.EncodeUint16(uint16(m.TxRingSz))
- buf.EncodeUint16(uint16(m.RxRingSz))
- buf.EncodeUint64(uint64(m.Features))
+ buf.EncodeUint16(m.TxRingSz)
+ buf.EncodeUint16(m.RxRingSz)
+ buf.EncodeUint64(m.Features)
return buf.Bytes(), nil
}
func (m *SwInterfaceVirtioPciDetails) Unmarshal(b []byte) error {
@@ -106,20 +103,17 @@ func (*SwInterfaceVirtioPciDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceVirtioPciDump) Size() int {
+func (m *SwInterfaceVirtioPciDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *SwInterfaceVirtioPciDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error {
@@ -143,11 +137,10 @@ func (*VirtioPciCreate) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VirtioPciCreate) Size() int {
+func (m *VirtioPciCreate) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 2 // m.PciAddr.Domain
size += 1 // m.PciAddr.Bus
size += 1 // m.PciAddr.Slot
@@ -160,21 +153,19 @@ func (m *VirtioPciCreate) Size() int {
return size
}
func (m *VirtioPciCreate) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint16(uint16(m.PciAddr.Domain))
- buf.EncodeUint8(uint8(m.PciAddr.Bus))
- buf.EncodeUint8(uint8(m.PciAddr.Slot))
- buf.EncodeUint8(uint8(m.PciAddr.Function))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.PciAddr.Domain)
+ buf.EncodeUint8(m.PciAddr.Bus)
+ buf.EncodeUint8(m.PciAddr.Slot)
+ buf.EncodeUint8(m.PciAddr.Function)
buf.EncodeBool(m.UseRandomMac)
buf.EncodeBytes(m.MacAddress[:], 6)
buf.EncodeBool(m.GsoEnabled)
buf.EncodeBool(m.ChecksumOffloadEnabled)
- buf.EncodeUint64(uint64(m.Features))
+ buf.EncodeUint64(m.Features)
return buf.Bytes(), nil
}
func (m *VirtioPciCreate) Unmarshal(b []byte) error {
@@ -204,29 +195,26 @@ func (*VirtioPciCreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VirtioPciCreateReply) Size() int {
+func (m *VirtioPciCreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *VirtioPciCreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *VirtioPciCreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -243,21 +231,18 @@ func (*VirtioPciDelete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VirtioPciDelete) Size() int {
+func (m *VirtioPciDelete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *VirtioPciDelete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -279,27 +264,24 @@ func (*VirtioPciDeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VirtioPciDeleteReply) Size() int {
+func (m *VirtioPciDeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VirtioPciDeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
diff --git a/binapi/vmxnet3/vmxnet3.ba.go b/binapi/vmxnet3/vmxnet3.ba.go
index b975448..77937fa 100644
--- a/binapi/vmxnet3/vmxnet3.ba.go
+++ b/binapi/vmxnet3/vmxnet3.ba.go
@@ -67,11 +67,10 @@ func (*Vmxnet3Create) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Vmxnet3Create) Size() int {
+func (m *Vmxnet3Create) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.PciAddr
size += 4 // m.EnableElog
size += 2 // m.RxqSize
@@ -83,26 +82,24 @@ func (m *Vmxnet3Create) Size() int {
return size
}
func (m *Vmxnet3Create) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.PciAddr))
- buf.EncodeUint32(uint32(m.EnableElog))
- buf.EncodeUint16(uint16(m.RxqSize))
- buf.EncodeUint16(uint16(m.RxqNum))
- buf.EncodeUint16(uint16(m.TxqSize))
- buf.EncodeUint16(uint16(m.TxqNum))
- buf.EncodeUint8(uint8(m.Bind))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.PciAddr)
+ buf.EncodeInt32(m.EnableElog)
+ buf.EncodeUint16(m.RxqSize)
+ buf.EncodeUint16(m.RxqNum)
+ buf.EncodeUint16(m.TxqSize)
+ buf.EncodeUint16(m.TxqNum)
+ buf.EncodeUint8(m.Bind)
buf.EncodeBool(m.EnableGso)
return buf.Bytes(), nil
}
func (m *Vmxnet3Create) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.PciAddr = buf.DecodeUint32()
- m.EnableElog = int32(buf.DecodeUint32())
+ m.EnableElog = buf.DecodeInt32()
m.RxqSize = buf.DecodeUint16()
m.RxqNum = buf.DecodeUint16()
m.TxqSize = buf.DecodeUint16()
@@ -125,29 +122,26 @@ func (*Vmxnet3CreateReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Vmxnet3CreateReply) Size() int {
+func (m *Vmxnet3CreateReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *Vmxnet3CreateReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *Vmxnet3CreateReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -164,21 +158,18 @@ func (*Vmxnet3Delete) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Vmxnet3Delete) Size() int {
+func (m *Vmxnet3Delete) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *Vmxnet3Delete) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -200,27 +191,24 @@ func (*Vmxnet3DeleteReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Vmxnet3DeleteReply) Size() int {
+func (m *Vmxnet3DeleteReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *Vmxnet3DeleteReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *Vmxnet3DeleteReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -245,11 +233,10 @@ func (*Vmxnet3Details) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *Vmxnet3Details) Size() int {
+func (m *Vmxnet3Details) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 64 // m.IfName
size += 1 * 6 // m.HwAddr
@@ -258,84 +245,64 @@ func (m *Vmxnet3Details) Size() int {
size += 1 // m.AdminUpDown
size += 1 // m.RxCount
for j1 := 0; j1 < 16; j1++ {
- var s1 Vmxnet3RxList
- _ = s1
- if j1 < len(m.RxList) {
- s1 = m.RxList[j1]
- }
- size += 2 // s1.RxQsize
- size += 2 * 2 // s1.RxFill
- size += 2 // s1.RxNext
- size += 2 * 2 // s1.RxProduce
- size += 2 * 2 // s1.RxConsume
+ size += 2 // m.RxList[j1].RxQsize
+ size += 2 * 2 // m.RxList[j1].RxFill
+ size += 2 // m.RxList[j1].RxNext
+ size += 2 * 2 // m.RxList[j1].RxProduce
+ size += 2 * 2 // m.RxList[j1].RxConsume
}
size += 1 // m.TxCount
for j1 := 0; j1 < 8; j1++ {
- var s1 Vmxnet3TxList
- _ = s1
- if j1 < len(m.TxList) {
- s1 = m.TxList[j1]
- }
- size += 2 // s1.TxQsize
- size += 2 // s1.TxNext
- size += 2 // s1.TxProduce
- size += 2 // s1.TxConsume
+ size += 2 // m.TxList[j1].TxQsize
+ size += 2 // m.TxList[j1].TxNext
+ size += 2 // m.TxList[j1].TxProduce
+ size += 2 // m.TxList[j1].TxConsume
}
return size
}
func (m *Vmxnet3Details) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeString(m.IfName, 64)
buf.EncodeBytes(m.HwAddr[:], 6)
- buf.EncodeUint32(uint32(m.PciAddr))
- buf.EncodeUint8(uint8(m.Version))
+ buf.EncodeUint32(m.PciAddr)
+ buf.EncodeUint8(m.Version)
buf.EncodeBool(m.AdminUpDown)
- buf.EncodeUint8(uint8(m.RxCount))
+ buf.EncodeUint8(m.RxCount)
for j0 := 0; j0 < 16; j0++ {
- var v0 Vmxnet3RxList
- if j0 < len(m.RxList) {
- v0 = m.RxList[j0]
- }
- buf.EncodeUint16(uint16(v0.RxQsize))
+ buf.EncodeUint16(m.RxList[j0].RxQsize)
for i := 0; i < 2; i++ {
var x uint16
- if i < len(v0.RxFill) {
- x = uint16(v0.RxFill[i])
+ if i < len(m.RxList[j0].RxFill) {
+ x = uint16(m.RxList[j0].RxFill[i])
}
- buf.EncodeUint16(uint16(x))
+ buf.EncodeUint16(x)
}
- buf.EncodeUint16(uint16(v0.RxNext))
+ buf.EncodeUint16(m.RxList[j0].RxNext)
for i := 0; i < 2; i++ {
var x uint16
- if i < len(v0.RxProduce) {
- x = uint16(v0.RxProduce[i])
+ if i < len(m.RxList[j0].RxProduce) {
+ x = uint16(m.RxList[j0].RxProduce[i])
}
- buf.EncodeUint16(uint16(x))
+ buf.EncodeUint16(x)
}
for i := 0; i < 2; i++ {
var x uint16
- if i < len(v0.RxConsume) {
- x = uint16(v0.RxConsume[i])
+ if i < len(m.RxList[j0].RxConsume) {
+ x = uint16(m.RxList[j0].RxConsume[i])
}
- buf.EncodeUint16(uint16(x))
+ buf.EncodeUint16(x)
}
}
- buf.EncodeUint8(uint8(m.TxCount))
+ buf.EncodeUint8(m.TxCount)
for j0 := 0; j0 < 8; j0++ {
- var v0 Vmxnet3TxList
- if j0 < len(m.TxList) {
- v0 = m.TxList[j0]
- }
- buf.EncodeUint16(uint16(v0.TxQsize))
- buf.EncodeUint16(uint16(v0.TxNext))
- buf.EncodeUint16(uint16(v0.TxProduce))
- buf.EncodeUint16(uint16(v0.TxConsume))
+ buf.EncodeUint16(m.TxList[j0].TxQsize)
+ buf.EncodeUint16(m.TxList[j0].TxNext)
+ buf.EncodeUint16(m.TxList[j0].TxProduce)
+ buf.EncodeUint16(m.TxList[j0].TxConsume)
}
return buf.Bytes(), nil
}
@@ -384,20 +351,17 @@ func (*Vmxnet3Dump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Vmxnet3Dump) Size() int {
+func (m *Vmxnet3Dump) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *Vmxnet3Dump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *Vmxnet3Dump) Unmarshal(b []byte) error {
diff --git a/binapi/vpe/vpe.ba.go b/binapi/vpe/vpe.ba.go
index 59cdcad..046bd68 100644
--- a/binapi/vpe/vpe.ba.go
+++ b/binapi/vpe/vpe.ba.go
@@ -54,22 +54,19 @@ func (*AddNodeNext) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *AddNodeNext) Size() int {
+func (m *AddNodeNext) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.NodeName
size += 64 // m.NextName
return size
}
func (m *AddNodeNext) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.NodeName, 64)
buf.EncodeString(m.NextName, 64)
return buf.Bytes(), nil
@@ -94,29 +91,26 @@ func (*AddNodeNextReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *AddNodeNextReply) Size() int {
+func (m *AddNodeNextReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.NextIndex
return size
}
func (m *AddNodeNextReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.NextIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.NextIndex)
return buf.Bytes(), nil
}
func (m *AddNodeNextReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.NextIndex = buf.DecodeUint32()
return nil
}
@@ -133,22 +127,19 @@ func (*Cli) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *Cli) Size() int {
+func (m *Cli) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.CmdInShmem
return size
}
func (m *Cli) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint64(uint64(m.CmdInShmem))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint64(m.CmdInShmem)
return buf.Bytes(), nil
}
func (m *Cli) Unmarshal(b []byte) error {
@@ -169,21 +160,18 @@ func (*CliInband) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *CliInband) Size() int {
+func (m *CliInband) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 + len(m.Cmd) // m.Cmd
return size
}
func (m *CliInband) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.Cmd, 0)
return buf.Bytes(), nil
}
@@ -206,29 +194,26 @@ func (*CliInbandReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CliInbandReply) Size() int {
+func (m *CliInbandReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 + len(m.Reply) // m.Reply
return size
}
func (m *CliInbandReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeString(m.Reply, 0)
return buf.Bytes(), nil
}
func (m *CliInbandReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Reply = buf.DecodeString(0)
return nil
}
@@ -246,29 +231,26 @@ func (*CliReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *CliReply) Size() int {
+func (m *CliReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 8 // m.ReplyInShmem
return size
}
func (m *CliReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint64(uint64(m.ReplyInShmem))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint64(m.ReplyInShmem)
return buf.Bytes(), nil
}
func (m *CliReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ReplyInShmem = buf.DecodeUint64()
return nil
}
@@ -283,20 +265,17 @@ func (*ControlPing) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ControlPing) Size() int {
+func (m *ControlPing) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ControlPing) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ControlPing) Unmarshal(b []byte) error {
@@ -317,31 +296,28 @@ func (*ControlPingReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ControlPingReply) Size() int {
+func (m *ControlPingReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.ClientIndex
size += 4 // m.VpePID
return size
}
func (m *ControlPingReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.ClientIndex))
- buf.EncodeUint32(uint32(m.VpePID))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.ClientIndex)
+ buf.EncodeUint32(m.VpePID)
return buf.Bytes(), nil
}
func (m *ControlPingReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ClientIndex = buf.DecodeUint32()
m.VpePID = buf.DecodeUint32()
return nil
@@ -349,7 +325,7 @@ func (m *ControlPingReply) Unmarshal(b []byte) error {
// GetF64EndianValue defines message 'get_f64_endian_value'.
type GetF64EndianValue struct {
- F64One float64 `binapi:"f64,name=f64_one,default=%!s(float64=1)" json:"f64_one,omitempty"`
+ F64One float64 `binapi:"f64,name=f64_one,default=1" json:"f64_one,omitempty"`
}
func (m *GetF64EndianValue) Reset() { *m = GetF64EndianValue{} }
@@ -359,27 +335,24 @@ func (*GetF64EndianValue) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GetF64EndianValue) Size() int {
+func (m *GetF64EndianValue) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.F64One
return size
}
func (m *GetF64EndianValue) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeFloat64(float64(m.F64One))
+ buf := codec.NewBuffer(b)
+ buf.EncodeFloat64(m.F64One)
return buf.Bytes(), nil
}
func (m *GetF64EndianValue) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.F64One = float64(buf.DecodeFloat64())
+ m.F64One = buf.DecodeFloat64()
return nil
}
@@ -396,36 +369,33 @@ func (*GetF64EndianValueReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GetF64EndianValueReply) Size() int {
+func (m *GetF64EndianValueReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 8 // m.F64OneResult
return size
}
func (m *GetF64EndianValueReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeFloat64(float64(m.F64OneResult))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Retval)
+ buf.EncodeFloat64(m.F64OneResult)
return buf.Bytes(), nil
}
func (m *GetF64EndianValueReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Retval = buf.DecodeUint32()
- m.F64OneResult = float64(buf.DecodeFloat64())
+ m.F64OneResult = buf.DecodeFloat64()
return nil
}
// GetF64IncrementByOne defines message 'get_f64_increment_by_one'.
type GetF64IncrementByOne struct {
- F64Value float64 `binapi:"f64,name=f64_value,default=%!s(float64=1)" json:"f64_value,omitempty"`
+ F64Value float64 `binapi:"f64,name=f64_value,default=1" json:"f64_value,omitempty"`
}
func (m *GetF64IncrementByOne) Reset() { *m = GetF64IncrementByOne{} }
@@ -435,27 +405,24 @@ func (*GetF64IncrementByOne) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GetF64IncrementByOne) Size() int {
+func (m *GetF64IncrementByOne) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.F64Value
return size
}
func (m *GetF64IncrementByOne) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeFloat64(float64(m.F64Value))
+ buf := codec.NewBuffer(b)
+ buf.EncodeFloat64(m.F64Value)
return buf.Bytes(), nil
}
func (m *GetF64IncrementByOne) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.F64Value = float64(buf.DecodeFloat64())
+ m.F64Value = buf.DecodeFloat64()
return nil
}
@@ -472,30 +439,27 @@ func (*GetF64IncrementByOneReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GetF64IncrementByOneReply) Size() int {
+func (m *GetF64IncrementByOneReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 8 // m.F64Value
return size
}
func (m *GetF64IncrementByOneReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeFloat64(float64(m.F64Value))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Retval)
+ buf.EncodeFloat64(m.F64Value)
return buf.Bytes(), nil
}
func (m *GetF64IncrementByOneReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
m.Retval = buf.DecodeUint32()
- m.F64Value = float64(buf.DecodeFloat64())
+ m.F64Value = buf.DecodeFloat64()
return nil
}
@@ -512,22 +476,19 @@ func (*GetNextIndex) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GetNextIndex) Size() int {
+func (m *GetNextIndex) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.NodeName
size += 64 // m.NextName
return size
}
func (m *GetNextIndex) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.NodeName, 64)
buf.EncodeString(m.NextName, 64)
return buf.Bytes(), nil
@@ -552,29 +513,26 @@ func (*GetNextIndexReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GetNextIndexReply) Size() int {
+func (m *GetNextIndexReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.NextIndex
return size
}
func (m *GetNextIndexReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.NextIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.NextIndex)
return buf.Bytes(), nil
}
func (m *GetNextIndexReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.NextIndex = buf.DecodeUint32()
return nil
}
@@ -589,20 +547,17 @@ func (*GetNodeGraph) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GetNodeGraph) Size() int {
+func (m *GetNodeGraph) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *GetNodeGraph) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *GetNodeGraph) Unmarshal(b []byte) error {
@@ -622,29 +577,26 @@ func (*GetNodeGraphReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GetNodeGraphReply) Size() int {
+func (m *GetNodeGraphReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 8 // m.ReplyInShmem
return size
}
func (m *GetNodeGraphReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint64(uint64(m.ReplyInShmem))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint64(m.ReplyInShmem)
return buf.Bytes(), nil
}
func (m *GetNodeGraphReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.ReplyInShmem = buf.DecodeUint64()
return nil
}
@@ -661,21 +613,18 @@ func (*GetNodeIndex) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *GetNodeIndex) Size() int {
+func (m *GetNodeIndex) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 64 // m.NodeName
return size
}
func (m *GetNodeIndex) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeString(m.NodeName, 64)
return buf.Bytes(), nil
}
@@ -698,29 +647,26 @@ func (*GetNodeIndexReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *GetNodeIndexReply) Size() int {
+func (m *GetNodeIndexReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.NodeIndex
return size
}
func (m *GetNodeIndexReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
- buf.EncodeUint32(uint32(m.NodeIndex))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
+ buf.EncodeUint32(m.NodeIndex)
return buf.Bytes(), nil
}
func (m *GetNodeIndexReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.NodeIndex = buf.DecodeUint32()
return nil
}
@@ -740,11 +686,10 @@ func (*LogDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *LogDetails) Size() int {
+func (m *LogDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.Timestamp
size += 4 // m.Level
size += 32 // m.MsgClass
@@ -752,12 +697,10 @@ func (m *LogDetails) Size() int {
return size
}
func (m *LogDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeFloat64(float64(m.Timestamp))
buf.EncodeUint32(uint32(m.Level))
buf.EncodeString(m.MsgClass, 32)
@@ -785,21 +728,18 @@ func (*LogDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *LogDump) Size() int {
+func (m *LogDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 8 // m.StartTimestamp
return size
}
func (m *LogDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeFloat64(float64(m.StartTimestamp))
return buf.Bytes(), nil
}
@@ -819,20 +759,17 @@ func (*ShowThreads) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowThreads) Size() int {
+func (m *ShowThreads) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowThreads) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowThreads) Unmarshal(b []byte) error {
@@ -853,11 +790,10 @@ func (*ShowThreadsReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowThreadsReply) Size() int {
+func (m *ShowThreadsReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.Count
for j1 := 0; j1 < len(m.ThreadData); j1++ {
@@ -877,34 +813,32 @@ func (m *ShowThreadsReply) Size() int {
return size
}
func (m *ShowThreadsReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(len(m.ThreadData)))
for j0 := 0; j0 < len(m.ThreadData); j0++ {
- var v0 ThreadData
+ var v0 ThreadData // ThreadData
if j0 < len(m.ThreadData) {
v0 = m.ThreadData[j0]
}
- buf.EncodeUint32(uint32(v0.ID))
+ buf.EncodeUint32(v0.ID)
buf.EncodeString(v0.Name, 64)
buf.EncodeString(v0.Type, 64)
- buf.EncodeUint32(uint32(v0.PID))
- buf.EncodeUint32(uint32(v0.CPUID))
- buf.EncodeUint32(uint32(v0.Core))
- buf.EncodeUint32(uint32(v0.CPUSocket))
+ buf.EncodeUint32(v0.PID)
+ buf.EncodeUint32(v0.CPUID)
+ buf.EncodeUint32(v0.Core)
+ buf.EncodeUint32(v0.CPUSocket)
}
return buf.Bytes(), nil
}
func (m *ShowThreadsReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Count = buf.DecodeUint32()
- m.ThreadData = make([]ThreadData, int(m.Count))
+ m.ThreadData = make([]ThreadData, m.Count)
for j0 := 0; j0 < len(m.ThreadData); j0++ {
m.ThreadData[j0].ID = buf.DecodeUint32()
m.ThreadData[j0].Name = buf.DecodeString(64)
@@ -927,20 +861,17 @@ func (*ShowVersion) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowVersion) Size() int {
+func (m *ShowVersion) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowVersion) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowVersion) Unmarshal(b []byte) error {
@@ -963,11 +894,10 @@ func (*ShowVersionReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowVersionReply) Size() int {
+func (m *ShowVersionReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 32 // m.Program
size += 32 // m.Version
@@ -976,13 +906,11 @@ func (m *ShowVersionReply) Size() int {
return size
}
func (m *ShowVersionReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeString(m.Program, 32)
buf.EncodeString(m.Version, 32)
buf.EncodeString(m.BuildDate, 32)
@@ -991,7 +919,7 @@ func (m *ShowVersionReply) Marshal(b []byte) ([]byte, error) {
}
func (m *ShowVersionReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.Program = buf.DecodeString(32)
m.Version = buf.DecodeString(32)
m.BuildDate = buf.DecodeString(32)
@@ -1009,20 +937,17 @@ func (*ShowVpeSystemTime) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *ShowVpeSystemTime) Size() int {
+func (m *ShowVpeSystemTime) Size() (size int) {
if m == nil {
return 0
}
- var size int
return size
}
func (m *ShowVpeSystemTime) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
return buf.Bytes(), nil
}
func (m *ShowVpeSystemTime) Unmarshal(b []byte) error {
@@ -1042,29 +967,26 @@ func (*ShowVpeSystemTimeReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *ShowVpeSystemTimeReply) Size() int {
+func (m *ShowVpeSystemTimeReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 8 // m.VpeSystemTime
return size
}
func (m *ShowVpeSystemTimeReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeFloat64(float64(m.VpeSystemTime))
return buf.Bytes(), nil
}
func (m *ShowVpeSystemTimeReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.VpeSystemTime = vpe_types.Timestamp(buf.DecodeFloat64())
return nil
}
diff --git a/binapi/vrrp/vrrp.ba.go b/binapi/vrrp/vrrp.ba.go
index 297fbd8..ef34cdd 100644
--- a/binapi/vrrp/vrrp.ba.go
+++ b/binapi/vrrp/vrrp.ba.go
@@ -176,11 +176,10 @@ func (*VrrpVrAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VrrpVrAddDel) Size() int {
+func (m *VrrpVrAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.SwIfIndex
size += 1 // m.VrID
@@ -200,26 +199,24 @@ func (m *VrrpVrAddDel) Size() int {
return size
}
func (m *VrrpVrAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint8(uint8(m.IsAdd))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint8(m.IsAdd)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.VrID))
- buf.EncodeUint8(uint8(m.Priority))
- buf.EncodeUint16(uint16(m.Interval))
+ buf.EncodeUint8(m.VrID)
+ buf.EncodeUint8(m.Priority)
+ buf.EncodeUint16(m.Interval)
buf.EncodeUint32(uint32(m.Flags))
buf.EncodeUint8(uint8(len(m.Addrs)))
for j0 := 0; j0 < len(m.Addrs); j0++ {
- var v0 ip_types.Address
+ var v0 ip_types.Address // Addrs
if j0 < len(m.Addrs) {
v0 = m.Addrs[j0]
}
buf.EncodeUint8(uint8(v0.Af))
- buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -232,7 +229,7 @@ func (m *VrrpVrAddDel) Unmarshal(b []byte) error {
m.Interval = buf.DecodeUint16()
m.Flags = VrrpVrFlags(buf.DecodeUint32())
m.NAddrs = buf.DecodeUint8()
- m.Addrs = make([]ip_types.Address, int(m.NAddrs))
+ m.Addrs = make([]ip_types.Address, m.NAddrs)
for j0 := 0; j0 < len(m.Addrs); j0++ {
m.Addrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Addrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -252,27 +249,24 @@ func (*VrrpVrAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VrrpVrAddDelReply) Size() int {
+func (m *VrrpVrAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VrrpVrAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VrrpVrAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -291,11 +285,10 @@ func (*VrrpVrDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VrrpVrDetails) Size() int {
+func (m *VrrpVrDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Config.SwIfIndex
size += 1 // m.Config.VrID
size += 1 // m.Config.Priority
@@ -321,32 +314,30 @@ func (m *VrrpVrDetails) Size() int {
return size
}
func (m *VrrpVrDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.Config.SwIfIndex))
- buf.EncodeUint8(uint8(m.Config.VrID))
- buf.EncodeUint8(uint8(m.Config.Priority))
- buf.EncodeUint16(uint16(m.Config.Interval))
+ buf.EncodeUint8(m.Config.VrID)
+ buf.EncodeUint8(m.Config.Priority)
+ buf.EncodeUint16(m.Config.Interval)
buf.EncodeUint32(uint32(m.Config.Flags))
buf.EncodeUint32(uint32(m.Runtime.State))
- buf.EncodeUint16(uint16(m.Runtime.MasterAdvInt))
- buf.EncodeUint16(uint16(m.Runtime.Skew))
- buf.EncodeUint16(uint16(m.Runtime.MasterDownInt))
+ buf.EncodeUint16(m.Runtime.MasterAdvInt)
+ buf.EncodeUint16(m.Runtime.Skew)
+ buf.EncodeUint16(m.Runtime.MasterDownInt)
buf.EncodeBytes(m.Runtime.Mac[:], 6)
- buf.EncodeUint32(uint32(m.Runtime.Tracking.InterfacesDec))
- buf.EncodeUint8(uint8(m.Runtime.Tracking.Priority))
+ buf.EncodeUint32(m.Runtime.Tracking.InterfacesDec)
+ buf.EncodeUint8(m.Runtime.Tracking.Priority)
buf.EncodeUint8(uint8(len(m.Addrs)))
for j0 := 0; j0 < len(m.Addrs); j0++ {
- var v0 ip_types.Address
+ var v0 ip_types.Address // Addrs
if j0 < len(m.Addrs) {
v0 = m.Addrs[j0]
}
buf.EncodeUint8(uint8(v0.Af))
- buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -365,7 +356,7 @@ func (m *VrrpVrDetails) Unmarshal(b []byte) error {
m.Runtime.Tracking.InterfacesDec = buf.DecodeUint32()
m.Runtime.Tracking.Priority = buf.DecodeUint8()
m.NAddrs = buf.DecodeUint8()
- m.Addrs = make([]ip_types.Address, int(m.NAddrs))
+ m.Addrs = make([]ip_types.Address, m.NAddrs)
for j0 := 0; j0 < len(m.Addrs); j0++ {
m.Addrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Addrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -385,21 +376,18 @@ func (*VrrpVrDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VrrpVrDump) Size() int {
+func (m *VrrpVrDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *VrrpVrDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
@@ -425,11 +413,10 @@ func (*VrrpVrPeerDetails) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VrrpVrPeerDetails) Size() int {
+func (m *VrrpVrPeerDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.VrID
size += 1 // m.IsIPv6
@@ -446,23 +433,21 @@ func (m *VrrpVrPeerDetails) Size() int {
return size
}
func (m *VrrpVrPeerDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.VrID))
- buf.EncodeUint8(uint8(m.IsIPv6))
+ buf.EncodeUint8(m.VrID)
+ buf.EncodeUint8(m.IsIPv6)
buf.EncodeUint8(uint8(len(m.PeerAddrs)))
for j0 := 0; j0 < len(m.PeerAddrs); j0++ {
- var v0 ip_types.Address
+ var v0 ip_types.Address // PeerAddrs
if j0 < len(m.PeerAddrs) {
v0 = m.PeerAddrs[j0]
}
buf.EncodeUint8(uint8(v0.Af))
- buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -472,7 +457,7 @@ func (m *VrrpVrPeerDetails) Unmarshal(b []byte) error {
m.VrID = buf.DecodeUint8()
m.IsIPv6 = buf.DecodeUint8()
m.NPeerAddrs = buf.DecodeUint8()
- m.PeerAddrs = make([]ip_types.Address, int(m.NPeerAddrs))
+ m.PeerAddrs = make([]ip_types.Address, m.NPeerAddrs)
for j0 := 0; j0 < len(m.PeerAddrs); j0++ {
m.PeerAddrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.PeerAddrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -494,26 +479,23 @@ func (*VrrpVrPeerDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VrrpVrPeerDump) Size() int {
+func (m *VrrpVrPeerDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
size += 1 // m.VrID
return size
}
func (m *VrrpVrPeerDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.IsIPv6))
- buf.EncodeUint8(uint8(m.VrID))
+ buf.EncodeUint8(m.IsIPv6)
+ buf.EncodeUint8(m.VrID)
return buf.Bytes(), nil
}
func (m *VrrpVrPeerDump) Unmarshal(b []byte) error {
@@ -540,11 +522,10 @@ func (*VrrpVrSetPeers) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VrrpVrSetPeers) Size() int {
+func (m *VrrpVrSetPeers) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.VrID
size += 1 // m.IsIPv6
@@ -561,23 +542,21 @@ func (m *VrrpVrSetPeers) Size() int {
return size
}
func (m *VrrpVrSetPeers) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.VrID))
- buf.EncodeUint8(uint8(m.IsIPv6))
+ buf.EncodeUint8(m.VrID)
+ buf.EncodeUint8(m.IsIPv6)
buf.EncodeUint8(uint8(len(m.Addrs)))
for j0 := 0; j0 < len(m.Addrs); j0++ {
- var v0 ip_types.Address
+ var v0 ip_types.Address // Addrs
if j0 < len(m.Addrs) {
v0 = m.Addrs[j0]
}
buf.EncodeUint8(uint8(v0.Af))
- buf.EncodeBytes(v0.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(v0.Un.XXX_UnionData[:], 16)
}
return buf.Bytes(), nil
}
@@ -587,7 +566,7 @@ func (m *VrrpVrSetPeers) Unmarshal(b []byte) error {
m.VrID = buf.DecodeUint8()
m.IsIPv6 = buf.DecodeUint8()
m.NAddrs = buf.DecodeUint8()
- m.Addrs = make([]ip_types.Address, int(m.NAddrs))
+ m.Addrs = make([]ip_types.Address, m.NAddrs)
for j0 := 0; j0 < len(m.Addrs); j0++ {
m.Addrs[j0].Af = ip_types.AddressFamily(buf.DecodeUint8())
copy(m.Addrs[j0].Un.XXX_UnionData[:], buf.DecodeBytes(16))
@@ -607,27 +586,24 @@ func (*VrrpVrSetPeersReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VrrpVrSetPeersReply) Size() int {
+func (m *VrrpVrSetPeersReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VrrpVrSetPeersReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VrrpVrSetPeersReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -646,11 +622,10 @@ func (*VrrpVrStartStop) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VrrpVrStartStop) Size() int {
+func (m *VrrpVrStartStop) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.VrID
size += 1 // m.IsIPv6
@@ -658,16 +633,14 @@ func (m *VrrpVrStartStop) Size() int {
return size
}
func (m *VrrpVrStartStop) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.VrID))
- buf.EncodeUint8(uint8(m.IsIPv6))
- buf.EncodeUint8(uint8(m.IsStart))
+ buf.EncodeUint8(m.VrID)
+ buf.EncodeUint8(m.IsIPv6)
+ buf.EncodeUint8(m.IsStart)
return buf.Bytes(), nil
}
func (m *VrrpVrStartStop) Unmarshal(b []byte) error {
@@ -691,27 +664,24 @@ func (*VrrpVrStartStopReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VrrpVrStartStopReply) Size() int {
+func (m *VrrpVrStartStopReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VrrpVrStartStopReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VrrpVrStartStopReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -732,11 +702,10 @@ func (*VrrpVrTrackIfAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VrrpVrTrackIfAddDel) Size() int {
+func (m *VrrpVrTrackIfAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
size += 1 // m.VrID
@@ -754,24 +723,22 @@ func (m *VrrpVrTrackIfAddDel) Size() int {
return size
}
func (m *VrrpVrTrackIfAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.IsIPv6))
- buf.EncodeUint8(uint8(m.VrID))
- buf.EncodeUint8(uint8(m.IsAdd))
+ buf.EncodeUint8(m.IsIPv6)
+ buf.EncodeUint8(m.VrID)
+ buf.EncodeUint8(m.IsAdd)
buf.EncodeUint8(uint8(len(m.Ifs)))
for j0 := 0; j0 < len(m.Ifs); j0++ {
- var v0 VrrpVrTrackIf
+ var v0 VrrpVrTrackIf // Ifs
if j0 < len(m.Ifs) {
v0 = m.Ifs[j0]
}
buf.EncodeUint32(uint32(v0.SwIfIndex))
- buf.EncodeUint8(uint8(v0.Priority))
+ buf.EncodeUint8(v0.Priority)
}
return buf.Bytes(), nil
}
@@ -782,7 +749,7 @@ func (m *VrrpVrTrackIfAddDel) Unmarshal(b []byte) error {
m.VrID = buf.DecodeUint8()
m.IsAdd = buf.DecodeUint8()
m.NIfs = buf.DecodeUint8()
- m.Ifs = make([]VrrpVrTrackIf, int(m.NIfs))
+ m.Ifs = make([]VrrpVrTrackIf, m.NIfs)
for j0 := 0; j0 < len(m.Ifs); j0++ {
m.Ifs[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.Ifs[j0].Priority = buf.DecodeUint8()
@@ -802,27 +769,24 @@ func (*VrrpVrTrackIfAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VrrpVrTrackIfAddDelReply) Size() int {
+func (m *VrrpVrTrackIfAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VrrpVrTrackIfAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VrrpVrTrackIfAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -842,11 +806,10 @@ func (*VrrpVrTrackIfDetails) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VrrpVrTrackIfDetails) Size() int {
+func (m *VrrpVrTrackIfDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.VrID
size += 1 // m.IsIPv6
@@ -863,23 +826,21 @@ func (m *VrrpVrTrackIfDetails) Size() int {
return size
}
func (m *VrrpVrTrackIfDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.VrID))
- buf.EncodeUint8(uint8(m.IsIPv6))
+ buf.EncodeUint8(m.VrID)
+ buf.EncodeUint8(m.IsIPv6)
buf.EncodeUint8(uint8(len(m.Ifs)))
for j0 := 0; j0 < len(m.Ifs); j0++ {
- var v0 VrrpVrTrackIf
+ var v0 VrrpVrTrackIf // Ifs
if j0 < len(m.Ifs) {
v0 = m.Ifs[j0]
}
buf.EncodeUint32(uint32(v0.SwIfIndex))
- buf.EncodeUint8(uint8(v0.Priority))
+ buf.EncodeUint8(v0.Priority)
}
return buf.Bytes(), nil
}
@@ -889,7 +850,7 @@ func (m *VrrpVrTrackIfDetails) Unmarshal(b []byte) error {
m.VrID = buf.DecodeUint8()
m.IsIPv6 = buf.DecodeUint8()
m.NIfs = buf.DecodeUint8()
- m.Ifs = make([]VrrpVrTrackIf, int(m.NIfs))
+ m.Ifs = make([]VrrpVrTrackIf, m.NIfs)
for j0 := 0; j0 < len(m.Ifs); j0++ {
m.Ifs[j0].SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
m.Ifs[j0].Priority = buf.DecodeUint8()
@@ -912,11 +873,10 @@ func (*VrrpVrTrackIfDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VrrpVrTrackIfDump) Size() int {
+func (m *VrrpVrTrackIfDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
size += 1 // m.VrID
@@ -924,16 +884,14 @@ func (m *VrrpVrTrackIfDump) Size() int {
return size
}
func (m *VrrpVrTrackIfDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint8(uint8(m.IsIPv6))
- buf.EncodeUint8(uint8(m.VrID))
- buf.EncodeUint8(uint8(m.DumpAll))
+ buf.EncodeUint8(m.IsIPv6)
+ buf.EncodeUint8(m.VrID)
+ buf.EncodeUint8(m.DumpAll)
return buf.Bytes(), nil
}
func (m *VrrpVrTrackIfDump) Unmarshal(b []byte) error {
diff --git a/binapi/vxlan/vxlan.ba.go b/binapi/vxlan/vxlan.ba.go
index bec763f..048b2fa 100644
--- a/binapi/vxlan/vxlan.ba.go
+++ b/binapi/vxlan/vxlan.ba.go
@@ -44,23 +44,20 @@ func (*SwInterfaceSetVxlanBypass) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetVxlanBypass) Size() int {
+func (m *SwInterfaceSetVxlanBypass) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
size += 1 // m.Enable
return size
}
func (m *SwInterfaceSetVxlanBypass) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
buf.EncodeBool(m.Enable)
@@ -88,27 +85,24 @@ func (*SwInterfaceSetVxlanBypassReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetVxlanBypassReply) Size() int {
+func (m *SwInterfaceSetVxlanBypassReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetVxlanBypassReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetVxlanBypassReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -131,11 +125,10 @@ func (*VxlanAddDelTunnel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanAddDelTunnel) Size() int {
+func (m *VxlanAddDelTunnel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Instance
size += 1 // m.SrcAddress.Af
@@ -149,22 +142,20 @@ func (m *VxlanAddDelTunnel) Size() int {
return size
}
func (m *VxlanAddDelTunnel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Instance))
+ buf.EncodeUint32(m.Instance)
buf.EncodeUint8(uint8(m.SrcAddress.Af))
- buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.DstAddress.Af))
- buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.EncapVrfID))
- buf.EncodeUint32(uint32(m.DecapNextIndex))
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.EncapVrfID)
+ buf.EncodeUint32(m.DecapNextIndex)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *VxlanAddDelTunnel) Unmarshal(b []byte) error {
@@ -195,29 +186,26 @@ func (*VxlanAddDelTunnelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanAddDelTunnelReply) Size() int {
+func (m *VxlanAddDelTunnelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *VxlanAddDelTunnelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *VxlanAddDelTunnelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -236,23 +224,20 @@ func (*VxlanOffloadRx) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanOffloadRx) Size() int {
+func (m *VxlanOffloadRx) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.HwIfIndex
size += 4 // m.SwIfIndex
size += 1 // m.Enable
return size
}
func (m *VxlanOffloadRx) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.HwIfIndex))
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.Enable)
@@ -278,27 +263,24 @@ func (*VxlanOffloadRxReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanOffloadRxReply) Size() int {
+func (m *VxlanOffloadRxReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VxlanOffloadRxReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VxlanOffloadRxReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -321,11 +303,10 @@ func (*VxlanTunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanTunnelDetails) Size() int {
+func (m *VxlanTunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 4 // m.Instance
size += 1 // m.SrcAddress.Af
@@ -339,22 +320,20 @@ func (m *VxlanTunnelDetails) Size() int {
return size
}
func (m *VxlanTunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
- buf.EncodeUint32(uint32(m.Instance))
+ buf.EncodeUint32(m.Instance)
buf.EncodeUint8(uint8(m.SrcAddress.Af))
- buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.DstAddress.Af))
- buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.EncapVrfID))
- buf.EncodeUint32(uint32(m.DecapNextIndex))
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.EncapVrfID)
+ buf.EncodeUint32(m.DecapNextIndex)
+ buf.EncodeUint32(m.Vni)
return buf.Bytes(), nil
}
func (m *VxlanTunnelDetails) Unmarshal(b []byte) error {
@@ -384,21 +363,18 @@ func (*VxlanTunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanTunnelDump) Size() int {
+func (m *VxlanTunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *VxlanTunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
diff --git a/binapi/vxlan_gbp/vxlan_gbp.ba.go b/binapi/vxlan_gbp/vxlan_gbp.ba.go
index d5c3f32..886d30a 100644
--- a/binapi/vxlan_gbp/vxlan_gbp.ba.go
+++ b/binapi/vxlan_gbp/vxlan_gbp.ba.go
@@ -88,23 +88,20 @@ func (*SwInterfaceSetVxlanGbpBypass) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetVxlanGbpBypass) Size() int {
+func (m *SwInterfaceSetVxlanGbpBypass) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
size += 1 // m.Enable
return size
}
func (m *SwInterfaceSetVxlanGbpBypass) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
buf.EncodeBool(m.Enable)
@@ -132,27 +129,24 @@ func (*SwInterfaceSetVxlanGbpBypassReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetVxlanGbpBypassReply) Size() int {
+func (m *SwInterfaceSetVxlanGbpBypassReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetVxlanGbpBypassReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetVxlanGbpBypassReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -169,11 +163,10 @@ func (*VxlanGbpTunnelAddDel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGbpTunnelAddDel) Size() int {
+func (m *VxlanGbpTunnelAddDel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsAdd
size += 4 // m.Tunnel.Instance
size += 1 // m.Tunnel.Src.Af
@@ -188,21 +181,19 @@ func (m *VxlanGbpTunnelAddDel) Size() int {
return size
}
func (m *VxlanGbpTunnelAddDel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsAdd)
- buf.EncodeUint32(uint32(m.Tunnel.Instance))
+ buf.EncodeUint32(m.Tunnel.Instance)
buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
- buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
- buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.Tunnel.EncapTableID))
- buf.EncodeUint32(uint32(m.Tunnel.Vni))
+ buf.EncodeUint32(m.Tunnel.EncapTableID)
+ buf.EncodeUint32(m.Tunnel.Vni)
buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
buf.EncodeUint32(uint32(m.Tunnel.Mode))
return buf.Bytes(), nil
@@ -236,29 +227,26 @@ func (*VxlanGbpTunnelAddDelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGbpTunnelAddDelReply) Size() int {
+func (m *VxlanGbpTunnelAddDelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *VxlanGbpTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *VxlanGbpTunnelAddDelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -275,11 +263,10 @@ func (*VxlanGbpTunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGbpTunnelDetails) Size() int {
+func (m *VxlanGbpTunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Tunnel.Instance
size += 1 // m.Tunnel.Src.Af
size += 1 * 16 // m.Tunnel.Src.Un
@@ -293,20 +280,18 @@ func (m *VxlanGbpTunnelDetails) Size() int {
return size
}
func (m *VxlanGbpTunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Tunnel.Instance))
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint32(m.Tunnel.Instance)
buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
- buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
- buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.Tunnel.EncapTableID))
- buf.EncodeUint32(uint32(m.Tunnel.Vni))
+ buf.EncodeUint32(m.Tunnel.EncapTableID)
+ buf.EncodeUint32(m.Tunnel.Vni)
buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
buf.EncodeUint32(uint32(m.Tunnel.Mode))
return buf.Bytes(), nil
@@ -328,7 +313,7 @@ func (m *VxlanGbpTunnelDetails) Unmarshal(b []byte) error {
// VxlanGbpTunnelDump defines message 'vxlan_gbp_tunnel_dump'.
type VxlanGbpTunnelDump struct {
- SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=%!s(float64=4.294967295e+09)" json:"sw_if_index,omitempty"`
+ SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
}
func (m *VxlanGbpTunnelDump) Reset() { *m = VxlanGbpTunnelDump{} }
@@ -338,21 +323,18 @@ func (*VxlanGbpTunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGbpTunnelDump) Size() int {
+func (m *VxlanGbpTunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *VxlanGbpTunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
diff --git a/binapi/vxlan_gpe/vxlan_gpe.ba.go b/binapi/vxlan_gpe/vxlan_gpe.ba.go
index 9da919d..0858ada 100644
--- a/binapi/vxlan_gpe/vxlan_gpe.ba.go
+++ b/binapi/vxlan_gpe/vxlan_gpe.ba.go
@@ -46,23 +46,20 @@ func (*SwInterfaceSetVxlanGpeBypass) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *SwInterfaceSetVxlanGpeBypass) Size() int {
+func (m *SwInterfaceSetVxlanGpeBypass) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.IsIPv6
size += 1 // m.Enable
return size
}
func (m *SwInterfaceSetVxlanGpeBypass) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeBool(m.IsIPv6)
buf.EncodeBool(m.Enable)
@@ -90,27 +87,24 @@ func (*SwInterfaceSetVxlanGpeBypassReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *SwInterfaceSetVxlanGpeBypassReply) Size() int {
+func (m *SwInterfaceSetVxlanGpeBypassReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *SwInterfaceSetVxlanGpeBypassReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *SwInterfaceSetVxlanGpeBypassReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}
@@ -133,11 +127,10 @@ func (*VxlanGpeAddDelTunnel) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGpeAddDelTunnel) Size() int {
+func (m *VxlanGpeAddDelTunnel) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.Local.Af
size += 1 * 16 // m.Local.Un
size += 1 // m.Remote.Af
@@ -151,21 +144,19 @@ func (m *VxlanGpeAddDelTunnel) Size() int {
return size
}
func (m *VxlanGpeAddDelTunnel) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint8(uint8(m.Local.Af))
- buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Remote.Af))
- buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 16)
buf.EncodeUint32(uint32(m.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.EncapVrfID))
- buf.EncodeUint32(uint32(m.DecapVrfID))
+ buf.EncodeUint32(m.EncapVrfID)
+ buf.EncodeUint32(m.DecapVrfID)
buf.EncodeUint8(uint8(m.Protocol))
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeUint32(m.Vni)
buf.EncodeBool(m.IsAdd)
return buf.Bytes(), nil
}
@@ -197,29 +188,26 @@ func (*VxlanGpeAddDelTunnelReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGpeAddDelTunnelReply) Size() int {
+func (m *VxlanGpeAddDelTunnelReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
size += 4 // m.SwIfIndex
return size
}
func (m *VxlanGpeAddDelTunnelReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
func (m *VxlanGpeAddDelTunnelReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
return nil
}
@@ -244,11 +232,10 @@ func (*VxlanGpeTunnelDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGpeTunnelDetails) Size() int {
+func (m *VxlanGpeTunnelDetails) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
size += 1 // m.Local.Af
size += 1 * 16 // m.Local.Un
@@ -263,22 +250,20 @@ func (m *VxlanGpeTunnelDetails) Size() int {
return size
}
func (m *VxlanGpeTunnelDetails) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
buf.EncodeUint8(uint8(m.Local.Af))
- buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 0)
+ buf.EncodeBytes(m.Local.Un.XXX_UnionData[:], 16)
buf.EncodeUint8(uint8(m.Remote.Af))
- buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 0)
- buf.EncodeUint32(uint32(m.Vni))
+ buf.EncodeBytes(m.Remote.Un.XXX_UnionData[:], 16)
+ buf.EncodeUint32(m.Vni)
buf.EncodeUint8(uint8(m.Protocol))
buf.EncodeUint32(uint32(m.McastSwIfIndex))
- buf.EncodeUint32(uint32(m.EncapVrfID))
- buf.EncodeUint32(uint32(m.DecapVrfID))
+ buf.EncodeUint32(m.EncapVrfID)
+ buf.EncodeUint32(m.DecapVrfID)
buf.EncodeBool(m.IsIPv6)
return buf.Bytes(), nil
}
@@ -310,21 +295,18 @@ func (*VxlanGpeTunnelDump) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGpeTunnelDump) Size() int {
+func (m *VxlanGpeTunnelDump) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.SwIfIndex
return size
}
func (m *VxlanGpeTunnelDump) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeUint32(uint32(m.SwIfIndex))
return buf.Bytes(), nil
}
diff --git a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go
index 5a25905..8820fab 100644
--- a/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go
+++ b/binapi/vxlan_gpe_ioam_export/vxlan_gpe_ioam_export.ba.go
@@ -45,23 +45,20 @@ func (*VxlanGpeIoamExportEnableDisable) GetMessageType() api.MessageType {
return api.RequestMessage
}
-func (m *VxlanGpeIoamExportEnableDisable) Size() int {
+func (m *VxlanGpeIoamExportEnableDisable) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 1 // m.IsDisable
size += 1 * 4 // m.CollectorAddress
size += 1 * 4 // m.SrcAddress
return size
}
func (m *VxlanGpeIoamExportEnableDisable) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
+ buf := codec.NewBuffer(b)
buf.EncodeBool(m.IsDisable)
buf.EncodeBytes(m.CollectorAddress[:], 4)
buf.EncodeBytes(m.SrcAddress[:], 4)
@@ -89,27 +86,24 @@ func (*VxlanGpeIoamExportEnableDisableReply) GetMessageType() api.MessageType {
return api.ReplyMessage
}
-func (m *VxlanGpeIoamExportEnableDisableReply) Size() int {
+func (m *VxlanGpeIoamExportEnableDisableReply) Size() (size int) {
if m == nil {
return 0
}
- var size int
size += 4 // m.Retval
return size
}
func (m *VxlanGpeIoamExportEnableDisableReply) Marshal(b []byte) ([]byte, error) {
- var buf *codec.Buffer
if b == nil {
- buf = codec.NewBuffer(make([]byte, m.Size()))
- } else {
- buf = codec.NewBuffer(b)
+ b = make([]byte, m.Size())
}
- buf.EncodeUint32(uint32(m.Retval))
+ buf := codec.NewBuffer(b)
+ buf.EncodeInt32(m.Retval)
return buf.Bytes(), nil
}
func (m *VxlanGpeIoamExportEnableDisableReply) Unmarshal(b []byte) error {
buf := codec.NewBuffer(b)
- m.Retval = int32(buf.DecodeUint32())
+ m.Retval = buf.DecodeInt32()
return nil
}