ethernet

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package ethernet implements the Ethernet header.

Index

Constants

View Source
const (
	Reserved = nextReserved // Opaque data.
)

Constants defined for various ether types in network byte order.

Variables

HeaderNext maps packet headers to ether-types.

View Source
var NextHeader = map[uint16]fwdpb.PacketHeaderId{}

NextHeader maps ether-types to packet header.

Functions

This section is empty.

Types

type Ethernet

type Ethernet struct {
	// contains filtered or unexported fields
}

An Ethernet presents a ethernet header. It can parse, query, add, remove and operate on Ethernet headers in the packet with zero, one and two vlan tags.

func (*Ethernet) Field

func (eth *Ethernet) Field(id fwdpacket.FieldID) ([]byte, error)

Field copies the specified bytes from the ethernet header.

func (*Ethernet) Header

func (eth *Ethernet) Header() []byte

Header returns the ethernet header as a slice of bytes.

func (*Ethernet) ID

func (eth *Ethernet) ID(int) fwdpb.PacketHeaderId

ID returns the ethernet header's ID.

func (*Ethernet) Modify

func (eth *Ethernet) Modify(id fwdpb.PacketHeaderId) error

Modify modifies an existing ethernet header by adding vlan tags.

func (*Ethernet) Rebuild

func (eth *Ethernet) Rebuild() error

Rebuild updates the ethernet header's next field.

func (*Ethernet) Remove

func (eth *Ethernet) Remove(id fwdpb.PacketHeaderId) error

Remove removes the ethernet header. Depending on the header id, it can remove just the vlan tags or it can remove the entire header.

func (Ethernet) Trailer

func (Ethernet) Trailer() []byte

Trailer returns the no trailing bytes.

func (*Ethernet) UpdateField

func (eth *Ethernet) UpdateField(id fwdpacket.FieldID, op int, arg []byte) (bool, error)

UpdateField sets bytes within the ethernet header.

Jump to

Keyboard shortcuts

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