eth

package
v0.0.0-...-c228989 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2018 License: GPL-3.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	IPv4_MSG = 0x0800
	ARP_MSG  = 0x0806
	LLDP_MSG = 0x88cc
	WOL_MSG  = 0x0842
	RARP_MSG = 0x8035
	VLAN_MSG = 0x8100

	IPv6_MSG     = 0x86DD
	STP_MSG      = 0x4242
	STP_BPDU_MSG = 0xAAAA
)

see http://en.wikipedia.org/wiki/EtherType

View Source
const (
	PCP_MASK = 0xe000
	DEI_MASK = 0x1000
	VID_MASK = 0x0fff
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ethernet

type Ethernet struct {
	Delimiter uint8
	HWDst     net.HardwareAddr
	HWSrc     net.HardwareAddr
	VLANID    VLAN
	Ethertype uint16
	Data      util.Message
}

func New

func New() *Ethernet

func (*Ethernet) Len

func (e *Ethernet) Len() (n uint16)

func (*Ethernet) MarshalBinary

func (e *Ethernet) MarshalBinary() (data []byte, err error)

func (*Ethernet) UnmarshalBinary

func (e *Ethernet) UnmarshalBinary(data []byte) error

type VLAN

type VLAN struct {
	TPID uint16
	PCP  uint8
	DEI  uint8
	VID  uint8
}

func NewVLAN

func NewVLAN() *VLAN

func (*VLAN) Len

func (v *VLAN) Len() (n uint16)

func (*VLAN) MarshalBinary

func (v *VLAN) MarshalBinary() (data []byte, err error)

func (*VLAN) UnmarshalBinary

func (v *VLAN) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL