icmp

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package icmp implements the ICMP header support in Lucius.

Package icmp implements the ICMP header support in Lucius.

Package icmp implements the ICMP header support in Lucius.

Index

Constants

View Source
const (
	ICMP6RouterSolicitation    = uint8(133)
	ICMP6RouterAdvertisement   = uint8(134)
	ICMP6NeighborSolicitation  = uint8(135)
	ICMP6NeighborAdvertisement = uint8(136)
	ICMP6NeighborRedirect      = uint8(137)
)

Set of supported ICMP6 message types.

View Source
const (
	ICMP6SLL = uint8(1)
	ICMP6TLL = uint8(2)
)

Set of supported ICMPv6 options

Variables

This section is empty.

Functions

This section is empty.

Types

type ICMP

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

An ICMP represents the ICMP header in the packet. Its state and functions handle parts of ICMP that are common to IPv4 and IPv6.

func (*ICMP) Header

func (i *ICMP) Header() []byte

Header returns the ICMP header.

func (ICMP) Modify

func (ICMP) Modify(fwdpb.PacketHeaderId) error

Modify returns an error as the ICMP header does not support adding extensions.

func (ICMP) Remove

func (ICMP) Remove(fwdpb.PacketHeaderId) error

Remove returns an error as the ICMP header cannot be removed.

func (ICMP) Trailer

func (ICMP) Trailer() []byte

Trailer returns the no trailing bytes.

type ICMP4

type ICMP4 struct {
	ICMP
	// contains filtered or unexported fields
}

An ICMP4 represents an ICMP4 header in the packet. It can update the ICMP header but it cannot add or remove an ICMP header. The ICMP message is assumed to contain the ICMP header and all bytes following it.

func (*ICMP4) Field

func (i *ICMP4) Field(id fwdpacket.FieldID) ([]byte, error)

Field returns a copy of the bytes for the specfied field in the ICMP header.

func (ICMP4) ID

ID returns the ICMP protocol header ID.

func (*ICMP4) Rebuild

func (i *ICMP4) Rebuild() error

Rebuild updates the ICMP checksum if it is dirty.

func (*ICMP4) UpdateField

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

UpdateField sets bytes within the ICMP header.

type ICMP6

type ICMP6 struct {
	ICMP
	// contains filtered or unexported fields
}

An ICMP6 represents an ICMP header in the packet. It can update the ICMP header but it cannot add or remove an ICMP header. The ICMP message is assumed to contain the ICMP header and all bytes following it.

Note that the ICMP tracks only one instance of each optional field.

func (*ICMP6) Field

func (i *ICMP6) Field(id fwdpacket.FieldID) ([]byte, error)

Field returns a copy of the bytes for the specfied field in the ICMP header.

func (ICMP6) ID

ID returns the ICMP protocol header ID.

func (*ICMP6) Rebuild

func (i *ICMP6) Rebuild() error

Rebuild updates the ICMP checksum. The checksum is computed over the ICMP message and the IPv6 pseudo-header. The checksum is recomputed only if the envelope and/or ICMP header are dirty.

func (*ICMP6) UpdateField

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

UpdateField sets bytes within the ICMP header.

Jump to

Keyboard shortcuts

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