X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=binapi%2Fl2e%2Fl2e.ba.go;h=c1b2a767a8791ee3b6ac90e555ca8cce410df3db;hb=58da9ac6e691a8c660eb8ca838a154e11da0db68;hp=ebfb464d15d5782ea47c7e9f75cc3d2e3f667dde;hpb=a155cd438c6558da266c1c5931361ea088b35653;p=govpp.git 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 }