// ReadFrom implements io.ReaderFrom interface. It deserializes the
// table modification message from the wire format.
348667
func (t *TableMod) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &t.Table, &pad3{}, &t.Config)
}
1120246
func (t *TablePropInstructions) ReadFrom(r io.Reader) (int64, error) {
	header, limrd, n, err := yieldTableProp(r, &t.Miss)
	if err != nil {
		return n, err
	}

	// Truncate the list of instructions, but leave the underlying
	// allocated memory, thereby decoded instructions will be saved
	// without memory allocation overhead.
	t.Instructions = t.Instructions[:0]

	maker := encoding.ReaderMakerOf(instruction{})
	join := func(r io.ReaderFrom) {
		t.Instructions = append(
			t.Instructions, r.(*instruction).Type)
	}

	// Read slice of instructions and append them to the slice.
	nn, err := encoding.ReadFunc(limrd, maker, join)
	if n += nn; err != nil {
		return n, err
	}

	nn, err = encoding.ReadFrom(r, makePad(int(header.Len)))
	return n + nn, err
}
670076
func (t *TableFeatures) ReadFrom(r io.Reader) (int64, error) {
	var name [maxTableNameLen]byte
	var length uint16

	n, err := encoding.ReadFrom(r, &length, &t.Table,
		&defaultPad5, &name, &t.MetadataMatch, &t.MetadataWrite,
		&t.Config, &t.MaxEntries)

	if err != nil {
		return n, err
	}

	t.Name = string(name[:])
	t.Properties = nil

	var tablePropType TablePropType

	rm := func() (io.ReaderFrom, error) {
		if rm, ok := tablePropMap[tablePropType]; ok {
			rd, err := rm.MakeReader()
			t.Properties = append(t.Properties, rd.(TableProp))
			return rd, err
		}

		return nil, fmt.Errorf("ofp: unknown table property type: %s", tablePropType)
	}

	limrd := io.LimitReader(r, int64(length)-n)
	nn, err := encoding.ScanFrom(limrd, &tablePropType,
		encoding.ReaderMakerFunc(rm))

	return n + nn, err
}
42651
func (m *MeterBandDrop) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &meterBand{},
		&m.Rate, &m.BurstSize, &defaultPad4)
}
14626
func (q *QueueStatsRequest) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &q.Port, &q.Queue)
}
591918
func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error) {
	b.Lock()
	defer b.Unlock()
	return b.b.ReadFrom(r)
}
34900
func (g *GroupFeatures) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &g.Types, &g.Capabilities,
		&g.MaxGroups, &g.Actions)
}
278710
func (t *TablePropExperimenter) ReadFrom(r io.Reader) (int64, error) {
	var header tableProp

	n, err := encoding.ReadFrom(r, &header, &t.Experimenter, &t.ExpType)
	if err != nil {
		return n, err
	}

	limrd := io.LimitReader(r, int64(header.Len-tablePropLen-8))
	t.Data, err = ioutil.ReadAll(limrd)
	n += int64(len(t.Data))

	if err != nil {
		return n, err
	}

	padding := make([]byte, (header.Len+7)/8*8-header.Len)
	nn, err := encoding.ReadFrom(r, padding)

	return n + nn, err
}
1090477
func (h *DBHashes) readFrom(r io.Reader) error {
	return binary.Read(r, binary.LittleEndian, h)
}
1135270
func (i *RawVInt) ReadFrom(r Reader, l int) error {
	if l < 0 {
		return errorsp.WithStacksAndMessage(ErrBadFormat, "l = %d", l)
	}
	var v RawVInt
	n := uint(0)
	for ; l > 0; l-- {
		b, err := r.ReadByte()
		if err != nil {
			return errorsp.WithStacks(err)
		}
		v |= (RawVInt(b) & 0xff) << n
		n += 8
	}
	*i = v
	return nil
}
1357622
func (s *Chan) ReadFrom(r io.Reader) {
	s.readFrom(NewReader(r))
}
832814
func (p *PortMod) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &p.PortNo, &defaultPad4, &p.HWAddr,
		&defaultPad2, &p.Config, &p.Mask, &p.Advertise, &defaultPad4,
	)
}
909927
func (c *Conn) ReadFrom(b []byte) (int, net.Addr, error) {
	return c.p.ReadFrom(b)
}
539036
func (p *packetConn) ReadFrom(b []byte) (int, net.Addr, error) {
	return 0, nil, ErrNotImplemented
}
224576
func (p *PortStatsRequest) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &p.PortNo, &defaultPad4)
}
1121381
func (g *GroupStatsRequest) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &g.Group, &defaultPad4)
}
173382
func (m *MeterMod) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &m.Command, &m.Flags, &m.Meter, m.Bands)
}