func SerializeLayers(w SerializeBuffer, opts SerializeOptions, layers ...SerializableLayer) error {
	w.Clear()
	for i := len(layers) - 1; i >= 0; i-- {
		layer := layers[i]
		err := layer.SerializeTo(w, opts)
		if err != nil {
			return err
		}
	}
	return nil
}
SerializeLayers clears the given write buffer, then writes all layers into it so
they correctly wrap each other.  Note that by clearing the buffer, it
invalidates all slices previously returned by w.Bytes()

Example:
buf := gopacket.NewSerializeBuffer()
opts := gopacket.SerializeOptions{}
gopacket.SerializeLayers(buf, opts, a, b, c)
firstPayload := buf.Bytes()  // contains byte representation of a(b(c))
gopacket.SerializeLayers(buf, opts, d, e, f)
secondPayload := buf.Bytes()  // contains byte representation of d(e(f)). firstPayload is now invalidated, since the SerializeLayers call Clears buf.
package gopacket
import ()
type SerializableLayer interface {
	SerializeTo(b SerializeBuffer, opts SerializeOptions) error
}
type SerializeOptions struct {
	FixLengths bool
	ComputeChecksums bool
}
type SerializeBuffer interface {
	Bytes() []byte
	PrependBytes(num int) ([]byte, error)
	AppendBytes(num int) ([]byte, error)
	Clear() error
}
type serializeBuffer struct {
	data                []byte
	start               int
	prepended, appended int
}
func NewSerializeBuffer() SerializeBuffer {
	return &serializeBuffer{}
}
func NewSerializeBufferExpectedSize(expectedPrependLength, expectedAppendLength int) SerializeBuffer {
	return &serializeBuffer{
		data:      make([]byte, expectedPrependLength, expectedPrependLength+expectedAppendLength),
		start:     expectedPrependLength,
		prepended: expectedPrependLength,
		appended:  expectedAppendLength,
	}
}
func (w *serializeBuffer) Bytes() []byte {
	return w.data[w.start:]
}
func (w *serializeBuffer) PrependBytes(num int) ([]byte, error) {
	if num < 0 {
		panic("num < 0")
	}
	if w.start < num {
		toPrepend := w.prepended
		if toPrepend < num {
			toPrepend = num
		}
		w.prepended += toPrepend
		length := cap(w.data) + toPrepend
		newData := make([]byte, length)
		newStart := w.start + toPrepend
		copy(newData[newStart:], w.data[w.start:])
		w.start = newStart
		w.data = newData[:toPrepend+len(w.data)]
	}
	w.start -= num
	return w.data[w.start : w.start+num], nil
}
func (w *serializeBuffer) AppendBytes(num int) ([]byte, error) {
	if num < 0 {
		panic("num < 0")
	}
	initialLength := len(w.data)
	if cap(w.data)-initialLength < num {
		toAppend := w.appended
		if toAppend < num {
			toAppend = num
		}
		w.appended += toAppend
		newData := make([]byte, cap(w.data)+toAppend)
		copy(newData[w.start:], w.data[w.start:])
		w.data = newData[:initialLength]
	}
	w.data = w.data[:initialLength+num]
	return w.data[initialLength:], nil
}
func (w *serializeBuffer) Clear() error {
	w.start = w.prepended
	w.data = w.data[:w.start]
	return nil
}