packet interface now requires both un/marshal

It only required unmarshal before. Needed to add stub method to extended
packet so all packets would implement the interface.

This allows packet interface to be used for both incoming and outgoing
packets.
This commit is contained in:
John Eikenberry 2016-07-11 12:57:32 -07:00
parent ad74a75b7a
commit c8f76e52c6
1 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
// all incoming packets
type packet interface {
encoding.BinaryMarshaler
encoding.BinaryUnmarshaler
id() uint32
}
@ -47,6 +48,11 @@ func (p sshFxpReaddirPacket) getHandle() string { return p.Handle }
// this has a handle, but is only used for close
func (p sshFxpClosePacket) getHandle() string { return p.Handle }
// for packet struct uniformity, so they all implement packet interface
func (s *sshFxpExtendedPacket) MarshalBinary() ([]byte, error) {
return []byte{}, nil
}
// take raw incoming packet data and build packet objects
func makePacket(p rxPacket) (packet, error) {
var pkt packet