func (f *SDFFilterFields) Marshal() ([]byte, error) {
	b := make([]byte, f.MarshalLen())
	if err := f.MarshalTo(b); err != nil {
		return nil, err
	}
	return b, nil
}
Marshal returns the serialized bytes of SDFFilterFields.
package ie
import (
	"encoding/binary"
	"io"
)
func NewSDFFilter(fd, ttc, spi, fl string, fid uint32) *IE {
	f := NewSDFFilterFields(fd, ttc, spi, fl, fid)
	b, err := f.Marshal()
	if err != nil {
		return nil
	}
	return New(SDFFilter, b)
}
func (i *IE) SDFFilter() (*SDFFilterFields, error) {
	switch i.Type {
	case SDFFilter:
		fields, err := ParseSDFFilterFields(i.Payload)
		if err != nil {
			return nil, err
		}
		return fields, nil
	case CreatePDR:
		ies, err := i.CreatePDR()
		if err != nil {
			return nil, err
		}
		for _, x := range ies {
			if x.Type == PDI {
				return x.SDFFilter()
			}
		}
		return nil, ErrIENotFound
	case PDI:
		ies, err := i.PDI()
		if err != nil {
			return nil, err
		}
		for _, x := range ies {
			if x.Type == SDFFilter {
				return x.SDFFilter()
			}
		}
		return nil, ErrIENotFound
	case EthernetPacketFilter:
		ies, err := i.EthernetPacketFilter()
		if err != nil {
			return nil, err
		}
		for _, x := range ies {
			if x.Type == SDFFilter {
				return x.SDFFilter()
			}
		}
		return nil, ErrIENotFound
	default:
		return nil, &InvalidTypeError{Type: i.Type}
	}
}
type SDFFilterFields struct {
	Flags                  uint8
	FDLength               uint16
	FlowDescription        string
	ToSTrafficClass        string  
	SecurityParameterIndex string  
	FlowLabel              string  
	SDFFilterID            uint32
}
func NewSDFFilterFields(fd, ttc, spi, fl string, fid uint32) *SDFFilterFields {
	f := &SDFFilterFields{}
	if fd != "" {
		f.FlowDescription = fd
		f.FDLength = uint16(len([]byte(fd)))
		f.SetFDFlag()
	}
	if ttc != "" {
		f.ToSTrafficClass = ttc
		f.SetTTCFlag()
	}
	if spi != "" {
		f.SecurityParameterIndex = spi
		f.SetSPIFlag()
	}
	if fl != "" {
		f.FlowLabel = fl
		f.SetFLFlag()
	}
	if fid != 0 {
		f.SDFFilterID = fid
		f.SetBIDFlag()
	}
	return f
}
func (f *SDFFilterFields) HasBID() bool {
	return has5thBit(f.Flags)
}
func (f *SDFFilterFields) SetBIDFlag() {
	f.Flags |= 0x10
}
func (f *SDFFilterFields) HasFL() bool {
	return has4thBit(f.Flags)
}
func (f *SDFFilterFields) SetFLFlag() {
	f.Flags |= 0x08
}
func (f *SDFFilterFields) HasSPI() bool {
	return has3rdBit(f.Flags)
}
func (f *SDFFilterFields) SetSPIFlag() {
	f.Flags |= 0x04
}
func (f *SDFFilterFields) HasTTC() bool {
	return has2ndBit(f.Flags)
}
func (f *SDFFilterFields) SetTTCFlag() {
	f.Flags |= 0x02
}
func (f *SDFFilterFields) HasFD() bool {
	return has1stBit(f.Flags)
}
func (f *SDFFilterFields) SetFDFlag() {
	f.Flags |= 0x01
}
func ParseSDFFilterFields(b []byte) (*SDFFilterFields, error) {
	f := &SDFFilterFields{}
	if err := f.UnmarshalBinary(b); err != nil {
		return nil, err
	}
	return f, nil
}
func (f *SDFFilterFields) UnmarshalBinary(b []byte) error {
	l := len(b)
	if l < 3 {
		return io.ErrUnexpectedEOF
	}
	f.Flags = b[0]
	offset := 2  
	if f.HasFD() {
		if len(b[offset:]) < 3 {
			return io.ErrUnexpectedEOF
		}
		f.FDLength = binary.BigEndian.Uint16(b[offset : offset+2])
		f.FlowDescription = string(b[offset+2 : offset+2+int(f.FDLength)])
		offset += 2 + int(f.FDLength)
	}
	if f.HasTTC() {
		if len(b[offset:]) < 2 {
			return io.ErrUnexpectedEOF
		}
		f.ToSTrafficClass = string(b[offset : offset+2])
		offset += 2
	}
	if f.HasSPI() {
		if len(b[offset:]) < 4 {
			return io.ErrUnexpectedEOF
		}
		f.SecurityParameterIndex = string(b[offset : offset+4])
		offset += 4
	}
	if f.HasFL() {
		if len(b[offset:]) < 3 {
			return io.ErrUnexpectedEOF
		}
		f.FlowLabel = string(b[offset : offset+3])
		offset += 3
	}
	if f.HasBID() {
		if len(b[offset:]) < 4 {
			return io.ErrUnexpectedEOF
		}
		f.SDFFilterID = binary.BigEndian.Uint32(b[offset : offset+4])
	}
	return nil
}