diff options
Diffstat (limited to 'binapi/l2e/l2e.ba.go')
-rw-r--r-- | binapi/l2e/l2e.ba.go | 22 |
1 files changed, 8 insertions, 14 deletions
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 } |