// UnmarshalBinary unmarshals a raw byte slice into an URL.
//
// If the byte slice is not an URLv6 address, io.ErrUnexpectedEOF is
// returned.
325760
func (u *URL) UnmarshalBinary(b []byte) error {
	uu, err := url.Parse(string(b))
	if err != nil {
		return err
	}

	*u = URL(*uu)
	return nil
}
158959
func (u *Uint16) UnmarshalBinary(p []byte) error {
	b := uio.NewBigEndianBuffer(p)
	*u = Uint16(b.Read16())
	return b.FinError()
}
826937
func (p *NewChannelAnsPayload) UnmarshalBinary(data []byte) error {
	if len(data) != 1 {
		return errors.New("lorawan: 1 byte of data is expected")
	}
	p.ChannelFrequencyOK = data[0]&(1<<0) > 0
	p.DataRateRangeOK = data[0]&(1<<1) > 0
	return nil
}
30064
func (p *DeviceModeIndPayload) UnmarshalBinary(data []byte) error {
	if len(data) != 1 {
		return errors.New("lorawan: 1 byte of data is expected")
	}

	p.Class = DeviceModeClass(data[0])

	return nil
}
696228
func (p *ResetIndPayload) UnmarshalBinary(data []byte) error {
	return p.DevLoRaWANVersion.UnmarshalBinary(data)
}
955201
func (p *ResetConfPayload) UnmarshalBinary(data []byte) error {
	return p.ServLoRaWANVersion.UnmarshalBinary(data)
}
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
}
1275951
func (p *Prefix) UnmarshalBinary(b []byte) error {
	if p.IP.To4() != nil {
		binary.BigEndian.PutUint32(p.Mask, mask32(int(b[0])))
		copy(p.IP, net.IPv4zero)
		copy(p.IP.To4(), b[1:])
	}
	if p.IP.To16() != nil && p.IP.To4() == nil {
		var m ipv6Int
		m.mask(int(b[0]))
		binary.BigEndian.PutUint64(p.Mask[:8], m[0])
		binary.BigEndian.PutUint64(p.Mask[8:16], m[1])
		copy(p.IP, net.IPv6unspecified)
		copy(p.IP, b[1:])
	}
	return nil
}
408405
func (a *DevAddr) UnmarshalBinary(data []byte) error {
	if len(data) != len(a) {
		return fmt.Errorf("lorawan: %d bytes of data are expected", len(a))
	}
	for i, v := range data {
		// little endian
		a[len(a)-i-1] = v
	}
	return nil
}
668239
func (r *RequestWriteV3) UnmarshalBinary(data []byte) error {
	return UnmarshalBinary(data, &r.Handle, &r.WriteFlags, &r.Offset, &r.RequiredSize, &r.Reserved, &r.Payload)
}
497801
func (r *InitiateFileTransferToGuestRequest) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)

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

	name := buf.Next(int(r.Body.GuestPathNameLength))
	r.GuestPathName = string(bytes.TrimRight(name, "\x00"))

	return nil
}
1374794
func (p *RXParamSetupReqPayload) UnmarshalBinary(data []byte) error {
	if len(data) != 4 {
		return errors.New("lorawan: 4 bytes of data are expected")
	}
	if err := p.DLSettings.UnmarshalBinary(data[0:1]); err != nil {
		return err
	}
	// append one block of empty bits at the end of the slice since the
	// binary to uint32 expects 32 bits.
	b := make([]byte, len(data))
	copy(b, data)
	b = append(b, byte(0))
	p.Frequency = binary.LittleEndian.Uint32(b[1:5]) * 100
	return nil
}
1235638
func (n *NetID) UnmarshalBinary(data []byte) error {
	if len(data) != len(n) {
		return fmt.Errorf("lorawan: %d bytes of data are expected", len(n))
	}

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

	return nil
}
46972
func (t *UnixTime) UnmarshalBinary(raw []byte) error {
	var nanosecondsSinceEpoch int64

	if err := binary.Read(bytes.NewReader(raw), binary.LittleEndian, &nanosecondsSinceEpoch); err != nil {
		return err
	}
	*t = NewUnixTimeFromNanoseconds(nanosecondsSinceEpoch)
	return nil
}
224753
func (l *mvccLock) UnmarshalBinary(data []byte) error {
	var mh marshalHelper
	buf := bytes.NewBuffer(data)
	mh.ReadNumber(buf, &l.startTS)
	mh.ReadSlice(buf, &l.primary)
	mh.ReadSlice(buf, &l.value)
	mh.ReadNumber(buf, &l.op)
	mh.ReadNumber(buf, &l.ttl)
	return errors.Trace(mh.err)
}
1311366
func (p *McGroupStatusReqPayload) UnmarshalBinary(data []byte) error {
	if len(data) < p.Size() {
		return fmt.Errorf("lorawan/applayer/multicastsetup: %d bytes are expected", p.Size())
	}

	for i := range p.CmdMask.RegGroupMask {
		p.CmdMask.RegGroupMask[i] = data[0]&(1<<uint8(i)) != 0
	}

	return nil
}
983675
func (im *Image) UnmarshalBinary(data []byte) error {
	dataCopy := make([]byte, len(data))
	copy(dataCopy, data)
	return im.UnmarshalBinaryNoCopy(dataCopy)
}