func (f *PacketRateStatusFields) SetDLFlag() {
	f.Flags |= 0x02
}
SetDLFlag sets DL flag in PacketRateStatus.
package ie
import (
	"encoding/binary"
	"io"
	"time"
)
func NewPacketRateStatus(flags uint8, ul, aul, dl, adl uint16, vtime time.Time) *IE {
	f := NewPacketRateStatusFields(flags, ul, aul, dl, adl, vtime)
	b, err := f.Marshal()
	if err != nil {
		return nil
	}
	return New(PacketRateStatus, b)
}
func (i *IE) PacketRateStatus() (*PacketRateStatusFields, error) {
	switch i.Type {
	case PacketRateStatus:
		f, err := ParsePacketRateStatusFields(i.Payload)
		if err != nil {
			return nil, err
		}
		return f, nil
	case CreateQER:
		ies, err := i.CreateQER()
		if err != nil {
			return nil, err
		}
		for _, x := range ies {
			if x.Type == PacketRateStatus {
				return x.PacketRateStatus()
			}
		}
		return nil, ErrIENotFound
	case UpdateQER:
		ies, err := i.UpdateQER()
		if err != nil {
			return nil, err
		}
		for _, x := range ies {
			if x.Type == PacketRateStatus {
				return x.PacketRateStatus()
			}
		}
		return nil, ErrIENotFound
	case PacketRateStatusReport:
		ies, err := i.PacketRateStatusReport()
		if err != nil {
			return nil, err
		}
		for _, x := range ies {
			if x.Type == PacketRateStatus {
				return x.PacketRateStatus()
			}
		}
		return nil, ErrIENotFound
	default:
		return nil, &InvalidTypeError{Type: i.Type}
	}
}
type PacketRateStatusFields struct {
	Flags                                             uint8
	NumberOfRemainingUplinkPacketsAllowed             uint16
	NumberOfRemainingAdditionalUplinkPacketsAllowed   uint16
	NumberOfRemainingDownlinkPacketsAllowed           uint16
	NumberOfRemainingAdditionalDownlinkPacketsAllowed uint16
	RateControlStatusValidityTime                     time.Time
}
func NewPacketRateStatusFields(flags uint8, ul, aul, dl, adl uint16, vtime time.Time) *PacketRateStatusFields {
	f := &PacketRateStatusFields{
		Flags:                         flags,
		RateControlStatusValidityTime: vtime,
	}
	if f.HasUL() {
		f.NumberOfRemainingUplinkPacketsAllowed = ul
		if f.HasAPR() {
			f.NumberOfRemainingAdditionalUplinkPacketsAllowed = aul
		}
	}
	if f.HasDL() {
		f.NumberOfRemainingDownlinkPacketsAllowed = dl
		if f.HasAPR() {
			f.NumberOfRemainingAdditionalDownlinkPacketsAllowed = adl
		}
	}
	return f
}
func (f *PacketRateStatusFields) HasAPR() bool {
	return has3rdBit(f.Flags)
}
func (f *PacketRateStatusFields) SetAPRFlag() {
	f.Flags |= 0x04
}
func (f *PacketRateStatusFields) HasDL() bool {
	return has2ndBit(f.Flags)
}