// UnmarshalBinary reads a list of IPs from binary.
357204
func (i *IPs) UnmarshalBinary(p []byte) error {
	b := uio.NewBigEndianBuffer(p)

	*i = make([]net.IP, 0, b.Len()/net.IPv4len)
	for b.Has(net.IPv4len) {
		*i = append(*i, net.IP(b.CopyN(net.IPv4len)))
	}
	return b.FinError()
}
382985
func (p *FragSessionSetupAnsPayload) UnmarshalBinary(data []byte) error {
	if len(data) < p.Size() {
		return fmt.Errorf("lorawan/applayer/fragmentation: %d byte is expected", p.Size())
	}

	p.StatusBitMask.EncodingUnsupported = data[0]&0x01 != 0
	p.StatusBitMask.NotEnoughMemory = data[0]&0x02 != 0
	p.StatusBitMask.FragSessionIndexNotSupported = data[0]&0x04 != 0
	p.StatusBitMask.WrongDescriptor = data[0]&0x08 != 0
	p.StatusBitMask.FragIndex = (data[0] >> 6) & 0x03

	return nil
}
189396
func (p *Preference) UnmarshalBinary(b []byte) error {
	if len(b) != 1 {
		return io.ErrUnexpectedEOF
	}

	*p = Preference(b[0])
	return nil
}
740051
func (r *ReadEnvironmentVariablesRequest) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)

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

	for i := 0; i < int(r.Body.NumNames); i++ {
		env, rerr := buf.ReadString(0)
		if rerr != nil {
			return rerr
		}

		env = env[:len(env)-1] // discard NULL terminator
		r.Names = append(r.Names, env)
	}

	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
}
951704
func (c *Cid) UnmarshalBinary(data []byte) error {
	casted, err := Cast(data)
	if err != nil {
		return err
	}
	c.str = casted.str
	return nil
}
1256912
func (u *Array) UnmarshalBinary(data []byte) error {
	if len(data) != 16 {
		return fmt.Errorf("invalid UUID (got %d bytes)", len(data))
	}
	copy(u[:], data)
	return nil
}
100219
func (f *FileName) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)

	_ = binary.Read(buf, binary.LittleEndian, &f.Length)

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

	return nil
}
138664
func (n *DevNonce) UnmarshalBinary(data []byte) error {
	if len(data) != 2 {
		return errors.New("lorawan: 2 bytes are expected")
	}
	*n = DevNonce(binary.LittleEndian.Uint16(data))
	return nil
}
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
}
97655
func (o *OptionCodes) UnmarshalBinary(p []byte) error {
	b := uio.NewBigEndianBuffer(p)
	*o = make(OptionCodes, 0, b.Len())
	for b.Has(1) {
		*o = append(*o, dhcp4.OptionCode(b.Read8()))
	}
	return b.FinError()
}
647332
func (p *FragSessionDeleteAnsPayload) UnmarshalBinary(data []byte) error {
	if len(data) < p.Size() {
		return fmt.Errorf("lorawan/applayer/fragmentation: %d byte is expected", p.Size())
	}

	p.Status.FragIndex = data[0] & 0x03
	p.Status.SessionDoesNotExist = data[0]&0x04 != 0

	return nil
}
348591
func (s *StatusCode) UnmarshalBinary(p []byte) error {
	b := buffer.New(p)
	// Too short to contain valid StatusCode
	if b.Len() < 2 {
		return io.ErrUnexpectedEOF
	}

	s.Code = dhcp6.Status(b.Read16())
	s.Message = string(b.Remaining())
	return nil
}
983675
func (im *Image) UnmarshalBinary(data []byte) error {
	dataCopy := make([]byte, len(data))
	copy(dataCopy, data)
	return im.UnmarshalBinaryNoCopy(dataCopy)
}
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
}
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
}
921581
func (p *RekeyConfPayload) UnmarshalBinary(data []byte) error {
	return p.ServLoRaWANVersion.UnmarshalBinary(data)
}