// UnmarshalBinary implementation to handle variable length Data
330698
func (r *SystemBootOptionsResponse) UnmarshalBinary(buf []byte) error {
	if len(buf) < 3 {
		return ErrShortPacket
	}
	r.CompletionCode = CompletionCode(buf[0])
	r.Version = buf[1]
	r.Param = buf[2]
	r.Data = buf[3:]
	return nil
}
172963
func (f *FileNameV3) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)

	fields := []interface{}{
		&f.Length, &f.Flags, &f.CaseType, &f.ID,
	}

	for _, p := range fields {
		if err := binary.Read(buf, binary.LittleEndian, p); err != nil {
			return err
		}
	}

	f.Name = string(buf.Next(int(f.Length)))

	return nil
}
1249398
func (v *mvccValue) UnmarshalBinary(data []byte) error {
	var mh marshalHelper
	buf := bytes.NewBuffer(data)
	var vt int64
	mh.ReadNumber(buf, &vt)
	v.valueType = mvccValueType(vt)
	mh.ReadNumber(buf, &v.startTS)
	mh.ReadNumber(buf, &v.commitTS)
	mh.ReadSlice(buf, &v.value)
	return errors.Trace(mh.err)
}
522878
func (o *UUID) UnmarshalBinary(bytes []byte) error {
	if len(bytes) != o.Size() {
		return errors.New("uuid: invalid length")
	}
	o.unmarshal(bytes)
	return nil
}
1357129
func (r *CommandHgfsSendPacket) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)

	err := binary.Read(buf, binary.LittleEndian, &r.Body)
	if err != nil {
		return err
	}

	r.Packet = buf.Next(int(r.Body.PacketSize))

	return nil
}
586419
func (u *UUID) UnmarshalBinary(data []byte) (err error) {
	if len(data) != Size {
		err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data))
		return
	}
	copy(u[:], data)

	return
}
167515
func (d *DHCPMessageType) UnmarshalBinary(p []byte) error {
	buf := uio.NewBigEndianBuffer(p)
	*d = DHCPMessageType(buf.Read8())
	return buf.FinError()
}
199568
func (addr *DevAddr) UnmarshalBinary(data []byte) error {
	if len(data) != 4 {
		return errors.New("ttn/core: Invalid length for DevAddr")
	}
	copy(addr[:], data)
	return nil
}
417911
func (k *AES128Key) UnmarshalBinary(data []byte) error {
	if len(data) != len(k) {
		return fmt.Errorf("lorawan: %d bytes of data are expected", len(k))
	}

	for i, v := range data {
		// little endian
		k[len(k)-i-1] = v
	}

	return nil
}
474428
func (h *Hash) UnmarshalBinary(data []byte) error {
	if len(data) == 0 {
		*h = Hash{}
		return nil
	}

	h.h = string(data)
	if !h.IsValid() {
		err := InvalidHashError{*h}
		*h = Hash{}
		return errors.WithStack(err)
	}

	return nil
}
183517
func (r *RequestCreateSessionV4) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)

	fields := []*uint32{
		&r.NumCapabilities,
		&r.MaxPacketSize,
		&r.Flags,
		&r.Reserved,
	}

	for _, p := range fields {
		err := binary.Read(buf, binary.LittleEndian, p)
		if err != nil {
			return err
		}
	}

	for i := uint32(0); i < r.NumCapabilities; i++ {
		var cap Capability
		err := binary.Read(buf, binary.LittleEndian, &cap)
		if err != nil {
			return err
		}

		r.Capabilities = append(r.Capabilities, cap)
	}

	return nil
}
1263313
func (p *ProprietaryMACCommandPayload) UnmarshalBinary(data []byte) error {
	p.Bytes = data
	return nil
}
325760
func (u *URL) UnmarshalBinary(b []byte) error {
	uu, err := url.Parse(string(b))
	if err != nil {
		return err
	}

	*u = URL(*uu)
	return nil
}
1201231
func (r *Registration) UnmarshalBinary(data []byte) error {
	reg, _, err := parseRegistration(data)
	if err != nil {
		return err
	}
	*r = *reg
	return nil
}
424340
func (p *ADRParamSetupReqPayload) UnmarshalBinary(data []byte) error {
	return p.ADRParam.UnmarshalBinary(data)
}
1366620
func (p *RXTimingSetupReqPayload) UnmarshalBinary(data []byte) error {
	if len(data) != 1 {
		return errors.New("lorawan: 1 byte of data is expected")
	}
	p.Delay = data[0]
	return nil
}
343724
func (prefix *DevAddrPrefix) UnmarshalBinary(data []byte) error {
	if len(data) != 5 {
		return errors.New("ttn/core: Invalid length for DevAddrPrefix")
	}
	copy(prefix.DevAddr[:], data[1:])
	prefix.Length = int(data[0])
	prefix.DevAddr = prefix.DevAddr.Mask(prefix.Length)
	return nil
}