func (ef *ETHFrame) GetFrameBuf() []byte {
	return ef.framebuf
}
header contents will be undefined if you do not call WriteDown() before.
package ecfr
import (
	"errors"
	"fmt"
)
type ETHAddr [6]byte
func (ea ETHAddr) String() string {
	return fmt.Sprintf("%02x:%02x:%02x:%02x:%02x:%02x", ea[0], ea[1], ea[2], ea[3], ea[4], ea[5])
}
func sliceToETHADDR(s []byte) ETHAddr {
	var e ETHAddr
	e[0] = s[0]
	e[1] = s[1]
	e[2] = s[2]
	e[3] = s[3]
	e[4] = s[4]
	e[5] = s[5]
	return e
}
type ETHFrame struct {
	Destination, Source ETHAddr
	Type                uint16
	UseVlan bool
	VLANTCI uint16
	framebuf []byte
}
func OverlayETHFrame(fb []byte) (*ETHFrame, error) {
	if len(fb) == 0 {
		fb = make([]byte, max_framelen)
	}
	if len(fb) < min_framelen_with_fcs {
		return nil, fmt.Errorf(
			"NewETHFrame: buffer too small, need at least %d bytes",
			min_headerandpayload)
	}
	ef := &ETHFrame{}
	ef.framebuf = fb
	ef.Destination = sliceToETHADDR(fb[offsetDestination:offsetSource])
	ef.Source = sliceToETHADDR(fb[offsetSource:offsetVLANOrType])
	ef.Type, _ = getUint16BE(fb[offsetVLANOrType:])
	if ef.Type == etherTypeVLAN {
		ef.UseVlan = true
		ef.VLANTCI, _ = getUint16BE(fb[offsetVLANTCI:])
	}
	return ef, nil
}
func (ef *ETHFrame) GetHeaderLen() int {
	vlanlen := 0
	if ef.UseVlan {
		vlanlen = 4
	}
	l := 6 + 6 + 2 + vlanlen
	return l
}
func (ef *ETHFrame) GetFooterLen() int {
	return fcs_len
}