diff options
author | 2020-07-22 04:40:55 +0200 | |
---|---|---|
committer | 2020-07-22 04:40:55 +0200 | |
commit | 58da9ac6e691a8c660eb8ca838a154e11da0db68 (patch) | |
tree | a1bbda04c6d0621ce0fc20779276620f1820190b /internal/testbinapi/binapi2001/memif | |
parent | a155cd438c6558da266c1c5931361ea088b35653 (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 'internal/testbinapi/binapi2001/memif')
-rw-r--r-- | internal/testbinapi/binapi2001/memif/memif.ba.go | 908 | ||||
-rw-r--r-- | internal/testbinapi/binapi2001/memif/memif_rpc.ba.go | 130 |
2 files changed, 414 insertions, 624 deletions
diff --git a/internal/testbinapi/binapi2001/memif/memif.ba.go b/internal/testbinapi/binapi2001/memif/memif.ba.go index 4964117..d3a0963 100644 --- a/internal/testbinapi/binapi2001/memif/memif.ba.go +++ b/internal/testbinapi/binapi2001/memif/memif.ba.go @@ -1,48 +1,38 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: // binapi-generator: v0.4.0-dev -// VPP: 20.01-45~g7a071e370~b63 -// source: /usr/share/vpp/api/plugins/memif.api.json - -/* -Package memif contains generated code for VPP binary API defined by memif.api (version 3.0.0). - -It consists of: - 2 aliases - 8 enums - 10 messages -*/ +// VPP: 20.01 +// source: .vppapi/plugins/memif.api.json + +// Package memif contains generated bindings for API file memif.api. +// +// Contents: +// 2 aliases +// 8 enums +// 10 messages +// package memif import ( - "bytes" - "context" - "encoding/binary" - "io" - "math" - "strconv" - api "git.fd.io/govpp.git/api" codec "git.fd.io/govpp.git/codec" - struc "github.com/lunixbochs/struc" + "net" + "strconv" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the GoVPP api package it is being compiled against. // A compilation error at this line likely means your copy of the // GoVPP api package needs to be updated. -const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package +const _ = api.GoVppAPIPackageIsVersion2 const ( - // ModuleName is the name of this module. - ModuleName = "memif" - // APIVersion is the API version of this module. + APIFile = "memif" APIVersion = "3.0.0" - // VersionCrc is the CRC of this module. VersionCrc = 0x88dc56c9 ) -// IfStatusFlags represents VPP binary API enum 'if_status_flags'. +// IfStatusFlags defines enum 'if_status_flags'. type IfStatusFlags uint32 const ( @@ -66,10 +56,29 @@ func (x IfStatusFlags) String() string { if ok { return s } - return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")" + str := func(n uint32) string { + s, ok := IfStatusFlags_name[uint32(n)] + if ok { + return s + } + return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s } -// IfType represents VPP binary API enum 'if_type'. +// IfType defines enum 'if_type'. type IfType uint32 const ( @@ -102,7 +111,7 @@ func (x IfType) String() string { return "IfType(" + strconv.Itoa(int(x)) + ")" } -// LinkDuplex represents VPP binary API enum 'link_duplex'. +// LinkDuplex defines enum 'link_duplex'. type LinkDuplex uint32 const ( @@ -132,7 +141,7 @@ func (x LinkDuplex) String() string { return "LinkDuplex(" + strconv.Itoa(int(x)) + ")" } -// MemifMode represents VPP binary API enum 'memif_mode'. +// MemifMode defines enum 'memif_mode'. type MemifMode uint32 const ( @@ -162,7 +171,7 @@ func (x MemifMode) String() string { return "MemifMode(" + strconv.Itoa(int(x)) + ")" } -// MemifRole represents VPP binary API enum 'memif_role'. +// MemifRole defines enum 'memif_role'. type MemifRole uint32 const ( @@ -189,7 +198,7 @@ func (x MemifRole) String() string { return "MemifRole(" + strconv.Itoa(int(x)) + ")" } -// MtuProto represents VPP binary API enum 'mtu_proto'. +// MtuProto defines enum 'mtu_proto'. type MtuProto uint32 const ( @@ -225,7 +234,7 @@ func (x MtuProto) String() string { return "MtuProto(" + strconv.Itoa(int(x)) + ")" } -// RxMode represents VPP binary API enum 'rx_mode'. +// RxMode defines enum 'rx_mode'. type RxMode uint32 const ( @@ -261,7 +270,7 @@ func (x RxMode) String() string { return "RxMode(" + strconv.Itoa(int(x)) + ")" } -// SubIfFlags represents VPP binary API enum 'sub_if_flags'. +// SubIfFlags defines enum 'sub_if_flags'. type SubIfFlags uint32 const ( @@ -309,16 +318,62 @@ func (x SubIfFlags) String() string { if ok { return s } - return "SubIfFlags(" + strconv.Itoa(int(x)) + ")" + str := func(n uint32) string { + s, ok := SubIfFlags_name[uint32(n)] + if ok { + return s + } + return "SubIfFlags(" + strconv.Itoa(int(n)) + ")" + } + for i := uint32(0); i <= 32; i++ { + val := uint32(x) + if val&(1<<i) != 0 { + if s != "" { + s += "|" + } + s += str(1 << i) + } + } + if s == "" { + return str(uint32(x)) + } + return s } -// InterfaceIndex represents VPP binary API alias 'interface_index'. +// InterfaceIndex defines alias 'interface_index'. type InterfaceIndex uint32 -// MacAddress represents VPP binary API alias 'mac_address'. +// MacAddress defines alias 'mac_address'. type MacAddress [6]uint8 -// MemifCreate represents VPP binary API message 'memif_create'. +func ParseMacAddress(s string) (MacAddress, error) { + var macaddr MacAddress + mac, err := net.ParseMAC(s) + if err != nil { + return macaddr, err + } + copy(macaddr[:], mac[:]) + return macaddr, nil +} +func (x MacAddress) ToMAC() net.HardwareAddr { + return net.HardwareAddr(x[:]) +} +func (x MacAddress) String() string { + return x.ToMAC().String() +} +func (x *MacAddress) MarshalText() ([]byte, error) { + return []byte(x.String()), nil +} +func (x *MacAddress) UnmarshalText(text []byte) error { + mac, err := ParseMacAddress(string(text)) + if err != nil { + return err + } + *x = mac + return nil +} + +// MemifCreate defines message 'memif_create'. type MemifCreate struct { Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"` Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"` @@ -330,291 +385,171 @@ type MemifCreate struct { BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"` HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` - Secret string `binapi:"string[24],name=secret" json:"secret,omitempty" struc:"[24]byte"` + Secret string `binapi:"string[24],name=secret" json:"secret,omitempty"` } -func (m *MemifCreate) Reset() { *m = MemifCreate{} } -func (*MemifCreate) GetMessageName() string { return "memif_create" } -func (*MemifCreate) GetCrcString() string { return "b1b25061" } -func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemifCreate) Reset() { *m = MemifCreate{} } +func (*MemifCreate) GetMessageName() string { return "memif_create" } +func (*MemifCreate) GetCrcString() string { return "b1b25061" } +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 - // field[1] m.Role - size += 4 - // field[1] m.Mode - size += 4 - // field[1] m.RxQueues - size += 1 - // field[1] m.TxQueues - size += 1 - // field[1] m.ID - size += 4 - // field[1] m.SocketID - size += 4 - // field[1] m.RingSize - size += 4 - // field[1] m.BufferSize - size += 2 - // field[1] m.NoZeroCopy - size += 1 - // field[1] m.HwAddr - size += 6 - // field[1] m.Secret - size += 24 + size += 4 // m.Role + size += 4 // m.Mode + size += 1 // m.RxQueues + size += 1 // m.TxQueues + size += 4 // m.ID + size += 4 // m.SocketID + size += 4 // m.RingSize + size += 2 // m.BufferSize + size += 1 // m.NoZeroCopy + size += 1 * 6 // m.HwAddr + size += 24 // m.Secret return size } func (m *MemifCreate) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.Role - o.PutUint32(buf[pos:pos+4], uint32(m.Role)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - // field[1] m.RxQueues - buf[pos] = uint8(m.RxQueues) - pos += 1 - // field[1] m.TxQueues - buf[pos] = uint8(m.TxQueues) - pos += 1 - // field[1] m.ID - o.PutUint32(buf[pos:pos+4], uint32(m.ID)) - pos += 4 - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.RingSize - o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) - pos += 4 - // field[1] m.BufferSize - o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) - pos += 2 - // field[1] m.NoZeroCopy - if m.NoZeroCopy { - buf[pos] = 1 - } - pos += 1 - // field[1] m.HwAddr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.HwAddr) { - x = uint8(m.HwAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.Secret - copy(buf[pos:pos+24], m.Secret) - pos += 24 - return buf, nil -} -func (m *MemifCreate) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Role - m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.RxQueues - m.RxQueues = uint8(tmp[pos]) - pos += 1 - // field[1] m.TxQueues - m.TxQueues = uint8(tmp[pos]) - pos += 1 - // field[1] m.ID - m.ID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.RingSize - m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.BufferSize - m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.NoZeroCopy - m.NoZeroCopy = tmp[pos] != 0 - pos += 1 - // field[1] m.HwAddr - for i := 0; i < len(m.HwAddr); i++ { - m.HwAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.Secret - { - nul := bytes.Index(tmp[pos:pos+24], []byte{0x00}) - m.Secret = codec.DecodeString(tmp[pos : pos+nul]) - pos += 24 - } + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.Role)) + buf.EncodeUint32(uint32(m.Mode)) + 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) + return buf.Bytes(), nil +} +func (m *MemifCreate) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Role = MemifRole(buf.DecodeUint32()) + m.Mode = MemifMode(buf.DecodeUint32()) + m.RxQueues = buf.DecodeUint8() + m.TxQueues = buf.DecodeUint8() + m.ID = buf.DecodeUint32() + m.SocketID = buf.DecodeUint32() + m.RingSize = buf.DecodeUint32() + m.BufferSize = buf.DecodeUint16() + m.NoZeroCopy = buf.DecodeBool() + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.Secret = buf.DecodeString(24) return nil } -// MemifCreateReply represents VPP binary API message 'memif_create_reply'. +// MemifCreateReply defines message 'memif_create_reply'. type MemifCreateReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } -func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} } -func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" } -func (*MemifCreateReply) GetCrcString() string { return "5383d31f" } -func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} } +func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" } +func (*MemifCreateReply) GetCrcString() string { return "5383d31f" } +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 - // field[1] m.Retval - size += 4 - // field[1] m.SwIfIndex - size += 4 + size += 4 // m.Retval + size += 4 // m.SwIfIndex return size } func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b + b = make([]byte, m.Size()) } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *MemifCreateReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 + 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 = buf.DecodeInt32() + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) return nil } -// MemifDelete represents VPP binary API message 'memif_delete'. +// MemifDelete defines message 'memif_delete'. type MemifDelete struct { SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` } -func (m *MemifDelete) Reset() { *m = MemifDelete{} } -func (*MemifDelete) GetMessageName() string { return "memif_delete" } -func (*MemifDelete) GetCrcString() string { return "f9e6675e" } -func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemifDelete) Reset() { *m = MemifDelete{} } +func (*MemifDelete) GetMessageName() string { return "memif_delete" } +func (*MemifDelete) GetCrcString() string { return "f9e6675e" } +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 - // field[1] m.SwIfIndex - size += 4 + size += 4 // m.SwIfIndex return size } func (m *MemifDelete) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b + b = make([]byte, m.Size()) } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - return buf, nil -} -func (m *MemifDelete) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *MemifDelete) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) return nil } -// MemifDeleteReply represents VPP binary API message 'memif_delete_reply'. +// MemifDeleteReply defines message 'memif_delete_reply'. type MemifDeleteReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } -func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} } -func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" } -func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" } -func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} } +func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" } +func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" } +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 - // field[1] m.Retval - size += 4 + size += 4 // m.Retval return size } func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b + b = make([]byte, m.Size()) } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MemifDeleteReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 + 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 = buf.DecodeInt32() return nil } -// MemifDetails represents VPP binary API message 'memif_details'. +// MemifDetails defines message 'memif_details'. type MemifDetails struct { SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` @@ -626,249 +561,136 @@ type MemifDetails struct { RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"` BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"` Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"` - IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"` + IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty"` } -func (m *MemifDetails) Reset() { *m = MemifDetails{} } -func (*MemifDetails) GetMessageName() string { return "memif_details" } -func (*MemifDetails) GetCrcString() string { return "d0382c4c" } -func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemifDetails) Reset() { *m = MemifDetails{} } +func (*MemifDetails) GetMessageName() string { return "memif_details" } +func (*MemifDetails) GetCrcString() string { return "d0382c4c" } +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 - // field[1] m.SwIfIndex - size += 4 - // field[1] m.HwAddr - size += 6 - // field[1] m.ID - size += 4 - // field[1] m.Role - size += 4 - // field[1] m.Mode - size += 4 - // field[1] m.ZeroCopy - size += 1 - // field[1] m.SocketID - size += 4 - // field[1] m.RingSize - size += 4 - // field[1] m.BufferSize - size += 2 - // field[1] m.Flags - size += 4 - // field[1] m.IfName - size += 64 + size += 4 // m.SwIfIndex + size += 1 * 6 // m.HwAddr + size += 4 // m.ID + size += 4 // m.Role + size += 4 // m.Mode + size += 1 // m.ZeroCopy + size += 4 // m.SocketID + size += 4 // m.RingSize + size += 2 // m.BufferSize + size += 4 // m.Flags + size += 64 // m.IfName return size } func (m *MemifDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SwIfIndex - o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex)) - pos += 4 - // field[1] m.HwAddr - for i := 0; i < 6; i++ { - var x uint8 - if i < len(m.HwAddr) { - x = uint8(m.HwAddr[i]) - } - buf[pos] = uint8(x) - pos += 1 - } - // field[1] m.ID - o.PutUint32(buf[pos:pos+4], uint32(m.ID)) - pos += 4 - // field[1] m.Role - o.PutUint32(buf[pos:pos+4], uint32(m.Role)) - pos += 4 - // field[1] m.Mode - o.PutUint32(buf[pos:pos+4], uint32(m.Mode)) - pos += 4 - // field[1] m.ZeroCopy - if m.ZeroCopy { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.RingSize - o.PutUint32(buf[pos:pos+4], uint32(m.RingSize)) - pos += 4 - // field[1] m.BufferSize - o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize)) - pos += 2 - // field[1] m.Flags - o.PutUint32(buf[pos:pos+4], uint32(m.Flags)) - pos += 4 - // field[1] m.IfName - copy(buf[pos:pos+64], m.IfName) - pos += 64 - return buf, nil -} -func (m *MemifDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SwIfIndex - m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.HwAddr - for i := 0; i < len(m.HwAddr); i++ { - m.HwAddr[i] = uint8(tmp[pos]) - pos += 1 - } - // field[1] m.ID - m.ID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Role - m.Role = MemifRole(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.Mode - m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.ZeroCopy - m.ZeroCopy = tmp[pos] != 0 - pos += 1 - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.RingSize - m.RingSize = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.BufferSize - m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2])) - pos += 2 - // field[1] m.Flags - m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.IfName - { - nul := bytes.Index(tmp[pos:pos+64], []byte{0x00}) - m.IfName = codec.DecodeString(tmp[pos : pos+nul]) - pos += 64 - } + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeBytes(m.HwAddr[:], 6) + buf.EncodeUint32(m.ID) + buf.EncodeUint32(uint32(m.Role)) + buf.EncodeUint32(uint32(m.Mode)) + buf.EncodeBool(m.ZeroCopy) + 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 +} +func (m *MemifDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = InterfaceIndex(buf.DecodeUint32()) + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.ID = buf.DecodeUint32() + m.Role = MemifRole(buf.DecodeUint32()) + m.Mode = MemifMode(buf.DecodeUint32()) + m.ZeroCopy = buf.DecodeBool() + m.SocketID = buf.DecodeUint32() + m.RingSize = buf.DecodeUint32() + m.BufferSize = buf.DecodeUint16() + m.Flags = IfStatusFlags(buf.DecodeUint32()) + m.IfName = buf.DecodeString(64) return nil } -// MemifDump represents VPP binary API message 'memif_dump'. +// MemifDump defines message 'memif_dump'. type MemifDump struct{} -func (m *MemifDump) Reset() { *m = MemifDump{} } -func (*MemifDump) GetMessageName() string { return "memif_dump" } -func (*MemifDump) GetCrcString() string { return "51077d14" } -func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemifDump) Reset() { *m = MemifDump{} } +func (*MemifDump) GetMessageName() string { return "memif_dump" } +func (*MemifDump) GetCrcString() string { return "51077d14" } +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) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b + b = make([]byte, m.Size()) } - return buf, nil + buf := codec.NewBuffer(b) + return buf.Bytes(), nil } -func (m *MemifDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos +func (m *MemifDump) Unmarshal(b []byte) error { return nil } -// MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'. +// MemifSocketFilenameAddDel defines message 'memif_socket_filename_add_del'. type MemifSocketFilenameAddDel struct { IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"` } -func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} } -func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" } -func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" } -func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} } +func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" } +func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" } +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 - // field[1] m.IsAdd - size += 1 - // field[1] m.SocketID - size += 4 - // field[1] m.SocketFilename - size += 108 + size += 1 // m.IsAdd + size += 4 // m.SocketID + size += 108 // m.SocketFilename return size } func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.IsAdd - if m.IsAdd { - buf[pos] = 1 - } - pos += 1 - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.SocketFilename - copy(buf[pos:pos+108], m.SocketFilename) - pos += 108 - return buf, nil -} -func (m *MemifSocketFilenameAddDel) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.IsAdd - m.IsAdd = tmp[pos] != 0 - pos += 1 - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SocketFilename - { - nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) - m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) - pos += 108 - } + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBool(m.IsAdd) + buf.EncodeUint32(m.SocketID) + buf.EncodeString(m.SocketFilename, 108) + return buf.Bytes(), nil +} +func (m *MemifSocketFilenameAddDel) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SocketID = buf.DecodeUint32() + m.SocketFilename = buf.DecodeString(108) return nil } -// MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'. +// MemifSocketFilenameAddDelReply defines message 'memif_socket_filename_add_del_reply'. type MemifSocketFilenameAddDelReply struct { Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` } @@ -877,151 +699,108 @@ func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDe func (*MemifSocketFilenameAddDelReply) GetMessageName() string { return "memif_socket_filename_add_del_reply" } -func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" } -func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage } +func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" } +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 - // field[1] m.Retval - size += 4 + size += 4 // m.Retval return size } func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b + b = make([]byte, m.Size()) } - // field[1] m.Retval - o.PutUint32(buf[pos:pos+4], uint32(m.Retval)) - pos += 4 - return buf, nil -} -func (m *MemifSocketFilenameAddDelReply) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.Retval - m.Retval = int32(o.Uint32(tmp[pos : pos+4])) - pos += 4 + 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 = buf.DecodeInt32() return nil } -// MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'. +// MemifSocketFilenameDetails defines message 'memif_socket_filename_details'. type MemifSocketFilenameDetails struct { SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"` - SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"` + SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty"` } -func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} } -func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" } -func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" } -func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage } +func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} } +func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" } +func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" } +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 - // field[1] m.SocketID - size += 4 - // field[1] m.SocketFilename - size += 108 + size += 4 // m.SocketID + size += 108 // m.SocketFilename return size } func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b - } - // field[1] m.SocketID - o.PutUint32(buf[pos:pos+4], uint32(m.SocketID)) - pos += 4 - // field[1] m.SocketFilename - copy(buf[pos:pos+108], m.SocketFilename) - pos += 108 - return buf, nil -} -func (m *MemifSocketFilenameDetails) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - // field[1] m.SocketID - m.SocketID = uint32(o.Uint32(tmp[pos : pos+4])) - pos += 4 - // field[1] m.SocketFilename - { - nul := bytes.Index(tmp[pos:pos+108], []byte{0x00}) - m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul]) - pos += 108 + b = make([]byte, m.Size()) } + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.SocketID) + buf.EncodeString(m.SocketFilename, 108) + return buf.Bytes(), nil +} +func (m *MemifSocketFilenameDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SocketID = buf.DecodeUint32() + m.SocketFilename = buf.DecodeString(108) return nil } -// MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'. +// MemifSocketFilenameDump defines message 'memif_socket_filename_dump'. type MemifSocketFilenameDump struct{} -func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} } -func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" } -func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" } -func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage } +func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} } +func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" } +func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" } +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) { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos - var buf []byte if b == nil { - buf = make([]byte, m.Size()) - } else { - buf = b + b = make([]byte, m.Size()) } - return buf, nil + buf := codec.NewBuffer(b) + return buf.Bytes(), nil } -func (m *MemifSocketFilenameDump) Unmarshal(tmp []byte) error { - o := binary.BigEndian - _ = o - pos := 0 - _ = pos +func (m *MemifSocketFilenameDump) Unmarshal(b []byte) error { return nil } func init() { file_memif_binapi_init() } func file_memif_binapi_init() { - api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate") - api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply") - api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete") - api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply") - api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails") - api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump") - api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel") - api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply") - api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails") - api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump") + api.RegisterMessage((*MemifCreate)(nil), "memif_create_b1b25061") + api.RegisterMessage((*MemifCreateReply)(nil), "memif_create_reply_5383d31f") + api.RegisterMessage((*MemifDelete)(nil), "memif_delete_f9e6675e") + api.RegisterMessage((*MemifDeleteReply)(nil), "memif_delete_reply_e8d4e804") + api.RegisterMessage((*MemifDetails)(nil), "memif_details_d0382c4c") + api.RegisterMessage((*MemifDump)(nil), "memif_dump_51077d14") + api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif_socket_filename_add_del_a2ce1a10") + api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif_socket_filename_add_del_reply_e8d4e804") + api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif_socket_filename_details_7ff326f7") + api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif_socket_filename_dump_51077d14") } // Messages returns list of all messages in this module. @@ -1039,14 +818,3 @@ func AllMessages() []api.Message { (*MemifSocketFilenameDump)(nil), } } - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = codec.DecodeString -var _ = bytes.NewBuffer -var _ = context.Background -var _ = io.Copy -var _ = strconv.Itoa -var _ = struc.Pack -var _ = binary.BigEndian -var _ = math.Float32bits diff --git a/internal/testbinapi/binapi2001/memif/memif_rpc.ba.go b/internal/testbinapi/binapi2001/memif/memif_rpc.ba.go index 8eda8f1..8e6c7bc 100644 --- a/internal/testbinapi/binapi2001/memif/memif_rpc.ba.go +++ b/internal/testbinapi/binapi2001/memif/memif_rpc.ba.go @@ -4,108 +4,130 @@ package memif import ( "context" - "io" - + "fmt" api "git.fd.io/govpp.git/api" + vpe "git.fd.io/govpp.git/internal/testbinapi/binapi2001/vpe" + "io" ) -// RPCService represents RPC service API for memif module. +// RPCService defines RPC service memif. type RPCService interface { - DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) - DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) + MemifDump(ctx context.Context, in *MemifDump) (RPCService_MemifDumpClient, error) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) + MemifSocketFilenameDump(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_MemifSocketFilenameDumpClient, error) } type serviceClient struct { - ch api.Channel + conn api.Connection } -func NewServiceClient(ch api.Channel) RPCService { - return &serviceClient{ch} +func NewServiceClient(conn api.Connection) RPCService { + return &serviceClient{conn} } -func (c *serviceClient) DumpMemif(ctx context.Context, in *MemifDump) (RPCService_DumpMemifClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMemifClient{stream} - return x, nil -} - -type RPCService_DumpMemifClient interface { - Recv() (*MemifDetails, error) +func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { + out := new(MemifCreateReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil } -type serviceClient_DumpMemifClient struct { - api.MultiRequestCtx +func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { + out := new(MemifDeleteReply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, nil } -func (c *serviceClient_DumpMemifClient) Recv() (*MemifDetails, error) { - m := new(MemifDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) +func (c *serviceClient) MemifDump(ctx context.Context, in *MemifDump) (RPCService_MemifDumpClient, error) { + stream, err := c.conn.NewStream(ctx) if err != nil { return nil, err } - if stop { - return nil, io.EOF + x := &serviceClient_MemifDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err } - return m, nil -} - -func (c *serviceClient) DumpMemifSocketFilename(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_DumpMemifSocketFilenameClient, error) { - stream := c.ch.SendMultiRequest(in) - x := &serviceClient_DumpMemifSocketFilenameClient{stream} return x, nil } -type RPCService_DumpMemifSocketFilenameClient interface { - Recv() (*MemifSocketFilenameDetails, error) +type RPCService_MemifDumpClient interface { + Recv() (*MemifDetails, error) + api.Stream } -type serviceClient_DumpMemifSocketFilenameClient struct { - api.MultiRequestCtx +type serviceClient_MemifDumpClient struct { + api.Stream } -func (c *serviceClient_DumpMemifSocketFilenameClient) Recv() (*MemifSocketFilenameDetails, error) { - m := new(MemifSocketFilenameDetails) - stop, err := c.MultiRequestCtx.ReceiveReply(m) +func (c *serviceClient_MemifDumpClient) Recv() (*MemifDetails, error) { + msg, err := c.Stream.RecvMsg() if err != nil { return nil, err } - if stop { + switch m := msg.(type) { + case *MemifDetails: + return m, nil + case *vpe.ControlPingReply: return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) } - return m, nil } -func (c *serviceClient) MemifCreate(ctx context.Context, in *MemifCreate) (*MemifCreateReply, error) { - out := new(MemifCreateReply) - err := c.ch.SendRequest(in).ReceiveReply(out) +func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { + out := new(MemifSocketFilenameAddDelReply) + err := c.conn.Invoke(ctx, in, out) if err != nil { return nil, err } return out, nil } -func (c *serviceClient) MemifDelete(ctx context.Context, in *MemifDelete) (*MemifDeleteReply, error) { - out := new(MemifDeleteReply) - err := c.ch.SendRequest(in).ReceiveReply(out) +func (c *serviceClient) MemifSocketFilenameDump(ctx context.Context, in *MemifSocketFilenameDump) (RPCService_MemifSocketFilenameDumpClient, error) { + stream, err := c.conn.NewStream(ctx) if err != nil { return nil, err } - return out, nil + x := &serviceClient_MemifSocketFilenameDumpClient{stream} + if err := x.Stream.SendMsg(in); err != nil { + return nil, err + } + if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + return nil, err + } + return x, nil } -func (c *serviceClient) MemifSocketFilenameAddDel(ctx context.Context, in *MemifSocketFilenameAddDel) (*MemifSocketFilenameAddDelReply, error) { - out := new(MemifSocketFilenameAddDelReply) - err := c.ch.SendRequest(in).ReceiveReply(out) +type RPCService_MemifSocketFilenameDumpClient interface { + Recv() (*MemifSocketFilenameDetails, error) + api.Stream +} + +type serviceClient_MemifSocketFilenameDumpClient struct { + api.Stream +} + +func (c *serviceClient_MemifSocketFilenameDumpClient) Recv() (*MemifSocketFilenameDetails, error) { + msg, err := c.Stream.RecvMsg() if err != nil { return nil, err } - return out, nil + switch m := msg.(type) { + case *MemifSocketFilenameDetails: + return m, nil + case *vpe.ControlPingReply: + return nil, io.EOF + default: + return nil, fmt.Errorf("unexpected message: %T %v", m, m) + } } - -// Reference imports to suppress errors if they are not otherwise used. -var _ = api.RegisterMessage -var _ = context.Background -var _ = io.Copy |