summaryrefslogtreecommitdiffstats
path: root/binapi/cop/cop.ba.go
diff options
context:
space:
mode:
Diffstat (limited to 'binapi/cop/cop.ba.go')
-rw-r--r--binapi/cop/cop.ba.go46
1 files changed, 17 insertions, 29 deletions
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
}