func (m *Generic) MarshalTo(b []byte) error {
	if m.Header.Payload != nil {
		m.Header.Payload = nil
	}
	m.Header.Payload = make([]byte, m.MarshalLen()-m.Header.MarshalLen())
	offset := 0
	for _, ie := range m.IEs {
		if ie == nil {
			continue
		}
		if err := ie.MarshalTo(m.Header.Payload[offset:]); err != nil {
			return err
		}
		offset += ie.MarshalLen()
	}
	m.Header.SetLength()
	return m.Header.MarshalTo(b)
}
MarshalTo puts the byte sequence in the byte array given as b.
package message
import (
	"fmt"
	"github.com/wmnsk/go-pfcp/ie"
)
type Generic struct {
	*Header
	IEs []*ie.IE
}
func NewGeneric(msgType uint8, seid uint64, seq uint32, ies ...*ie.IE) *Generic {
	m := &Generic{
		Header: NewHeader(
			1, 0, 0, 1,
			msgType, seid, seq, 0,
			nil,
		),
		IEs: ies,
	}
	m.SetLength()
	return m
}
func NewGenericWithoutSEID(msgType uint8, seq uint32, ies ...*ie.IE) *Generic {
	m := &Generic{
		Header: NewHeader(
			1, 0, 0, 0,
			msgType, 0, seq, 0,
			nil,
		),
		IEs: ies,
	}
	m.SetLength()
	return m
}
func (m *Generic) Marshal() ([]byte, error) {
	b := make([]byte, m.MarshalLen())
	if err := m.MarshalTo(b); err != nil {
		return nil, err
	}
	return b, nil
}