// ReadFrom implements io.ReaderFrom interface. It deserializes the
// port description from the wire format.
429902
func (p *Port) ReadFrom(r io.Reader) (int64, error) {
	p.HWAddr = make(net.HardwareAddr, 6)
	var name [portNameLen]byte

	n, err := encoding.ReadFrom(r, &p.PortNo, &defaultPad4, &p.HWAddr,
		&defaultPad2, &name, &p.Config, &p.State, &p.Curr, &p.Advertised,
		&p.Supported, &p.Peer, &p.CurrSpeed, &p.MaxSpeed,
	)

	p.Name = string(name[:])
	return n, err
}
830467
func (m *MeterConfig) ReadFrom(r io.Reader) (int64, error) {
	var length uint16

	// Read the header of the message, so we could use
	// the rest of the reader to unmarshal list of bands.
	n, err := encoding.ReadFrom(r, &length, &m.Flags, &m.Meter)
	if err != nil {
		return n, err
	}

	// Use the rest of bytes to decode the bands.
	limrd := io.LimitReader(r, int64(length-meterConfigLen))
	nn, err := m.Bands.ReadFrom(limrd)
	return n + nn, err
}
1000682
func (s *SwitchFeatures) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r,
		&s.DatapathID, &s.NumBuffers, &s.NumTables, &s.AuxiliaryID,
		&defaultPad2, &s.Capabilities, &s.Reserved)
}
539036
func (p *packetConn) ReadFrom(b []byte) (int, net.Addr, error) {
	return 0, nil, ErrNotImplemented
}
528645
func (a *p2SHScript) ReadFrom(r io.Reader) (n int64, err error) {
	//read length
	var lenBytes [4]byte

	read, err := io.ReadFull(r, lenBytes[:])
	n += int64(read)
	if err != nil {
		return n, err
	}

	length := binary.LittleEndian.Uint32(lenBytes[:])

	script := make([]byte, length)

	read, err = io.ReadFull(r, script)
	n += int64(read)
	if err != nil {
		return n, err
	}

	*a = script

	return n, nil
}
352759
func (l *List) ReadFrom(r io.Reader) (n int64, err error) {
	var nn int64

	// Read TagType
	nn, err = l.Typ.ReadFrom(r)
	if err != nil {
		return
	}
	n += nn

	// Read length-prefix
	var length Int32
	nn, err = length.ReadFrom(r)
	if err != nil {
		return
	}
	n += nn

	// Read list items
	if length.Int32 > 0 {
		l.Value = make([]Tag, length.Int32)
		for index, elem := range l.Value {
			elem = l.Typ.New()
			nn, err = elem.ReadFrom(r)
			if err != nil {
				return
			}
			l.Value[index] = elem
			n += nn
		}

	}

	return
}
1218256
func (e *End) ReadFrom(r io.Reader) (n int64, err error) {
	var tid byte

	err = binary.Read(r, binary.BigEndian, &tid)
	if err != nil {
		return
	}
	n = 1
	return
}
95918
func (b *Buffer) ReadFrom(r io.Reader) (int64, error) {
	version := b.preOp()
	n, err := b.buf.ReadFrom(r)
	b.postOp(version)
	return n, err
}
351666
func (m *MeterStats) ReadFrom(r io.Reader) (int64, error) {
	var length uint16

	// Unmarshal all elements from the reader except
	// of the list of meter band statistics.
	n, err := encoding.ReadFrom(r, &m.Meter, &length,
		&defaultPad6, &m.FlowCount, &m.PacketInCount,
		&m.ByteInCount, &m.DurationSec, &m.DurationNSec)

	limrd := io.LimitReader(r, int64(length-meterStatsLen))
	statsMaker := encoding.ReaderMakerOf(MeterBandStats{})

	nn, err := encoding.ReadSliceFrom(limrd, statsMaker, m.BandStats)
	return n + nn, err
}
224576
func (p *PortStatsRequest) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &p.PortNo, &defaultPad4)
}
1090477
func (h *DBHashes) readFrom(r io.Reader) error {
	return binary.Read(r, binary.LittleEndian, h)
}
1306353
func (i *VInt) ReadFrom(r Reader, l int) error {
	var v VInt
	b, err := r.ReadByte()
	if err != nil {
		return errorsp.WithStacks(err)
	}
	v = VInt(b & 0x7f)
	for n := uint(7); b&0x80 != 0; n += 7 {
		if b, err = r.ReadByte(); err != nil {
			if errorsp.Cause(err) == io.EOF {
				return errorsp.WithStacks(io.ErrUnexpectedEOF)
			}
			return errorsp.WithStacks(err)
		}
		v |= VInt(b&0x7f) << n
	}
	*i = v
	return nil
}
678926
func (p *PacketIn) ReadFrom(r io.Reader) (int64, error) {
	// Read the Packet-In header, list of match rules
	// that used to match the processing packet,
	// then the original frame, if any.
	n, err := encoding.ReadFrom(r, &p.Buffer, &p.Length,
		&p.Reason, &p.Table, &p.Cookie, &p.Match, &defaultPad2)
	if err != nil {
		return n, err
	}
	p.Data, err = ioutil.ReadAll(r)
	if err != nil {
		return n + int64(len(p.Data)), err
	}

	return n + int64(len(p.Data)), nil
}
1002164
func (m *MeterFeatures) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &m.MaxMeter, &m.BandTypes,
		&m.Capabilities, &m.MaxBands, &m.MaxColor, &defaultPad2)
}
591918
func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error) {
	b.Lock()
	defer b.Unlock()
	return b.b.ReadFrom(r)
}
547097
func (q *PacketQueue) ReadFrom(r io.Reader) (int64, error) {
	var length uint16
	n, err := encoding.ReadFrom(r, &q.Queue, &q.Port,
		&length, &defaultPad6)

	if err != nil {
		return n, err
	}

	limrd := io.LimitReader(r, int64(length-packetQueueLen))
	nn, err := q.Properties.ReadFrom(limrd)
	return n + nn, err
}
1287339
func (t *Time) ReadFrom(r Reader, l int) error {
	var bytes ByteSlice
	if err := (&bytes).ReadFrom(r, l); err != nil {
		return errorsp.WithStacks(err)
	}
	return errorsp.WithStacks(((*time.Time)(t)).UnmarshalBinary(bytes))
}