icmp

package
v0.0.0-...-94a1d89 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ARP__PHANTOM_ = ARP_STATE(iota)

	ARP_INCOMPLETE
	ARP_COMPLETE
)
View Source
const (
	/*
	 * This states indicates, that the Entry is a 'phantom-Entry' which
	 * means, that it behaves like a non-existing Entry in the context of
	 * the means of RFC-4861 (or any other specification).
	 *
	 * Phantom-Entries are used, for example, to represent entries in the
	 * Default Router List, for which no Neigbor-Cache-Entry had been
	 * created.
	 *
	 * In order to create an RFC-4861-compliant Entry over an existing
	 * Phantom-Entry, the code MUST alter it's state into one of the states
	 * as defined by RFC 4861.
	 * Code creating Entries by eighter allocating new Entries or overwriting
	 * Phantom-Entries MUST NOT differ it's behavoir depending on wether a
	 * Phantom-Entry exists or not.
	 */
	ND6_NC__PHANTOM_ = ND6_NC_STATE(iota)

	/* RFC 4861 NC-Entry states */
	ND6_NC_INCOMPLETE
	ND6_NC_REACHABLE
	ND6_NC_STALE
	ND6_NC_DELAY
	ND6_NC_PROBE
)

Variables

View Source
var EInvalid = fmt.Errorf("Protocol violation")
View Source
var ENoGateway = fmt.Errorf("No Gateway")
View Source
var ENotSupp = fmt.Errorf("Protocol not supported")

Functions

This section is empty.

Types

type ARP_STATE

type ARP_STATE uint8

type ArpCache

type ArpCache struct {
	Entries List
	Maxsize int

	Ipmap map[IPv4Addr]*ArpCe

	/*
	 * Arp cache timeout = Timeout
	 * Arp cache soft timeout = Timeout - SoftTmoDiff
	 */
	Timeout     time.Duration
	SoftTmoDiff time.Duration /* Soft Timeout Difference */
	// contains filtered or unexported fields
}

func (*ArpCache) Init

func (a *ArpCache) Init() *ArpCache

func (*ArpCache) Lookup

func (n *ArpCache) Lookup(ip net.IP) *ArpCe

func (*ArpCache) LookupOrCreate

func (n *ArpCache) LookupOrCreate(ip net.IP) *ArpCe

The returned *ArpCe is locked.

func (*ArpCache) LookupValidOnly

func (n *ArpCache) LookupValidOnly(ip net.IP) *ArpCe

type ArpCe

type ArpCe struct {
	sync.RWMutex

	State  ARP_STATE
	IPAddr IPv4Addr
	HWAddr net.HardwareAddr

	Tstamp time.Time

	Entry Member

	Sendchain *list.List
}

func (*ArpCe) Init

func (a *ArpCe) Init() *ArpCe

type Echo

type Echo struct {
	Head, Body []byte
	Addr       net.IP
}

type Host

type Host struct {
	NetN       Notifyable
	NetNv6     Notifyable
	EchoSocket Notifyable
	NC6        *Nd6Cache
	ARP        *ArpCache
	Host       *ip.IPHost
	Mac        net.HardwareAddr
	Vlan       uint16

	/* IPv6 */
	CurHopLimit                      uint8
	BaseReachableTime, ReachableTime uint32
	IPv6MTU                          uint32
	RetransTimer                     uint32
}

func (*Host) Input

func (h *Host) Input(e *eth.EthLayer2, i *ip.IPLayerPart, po PacketOutput) error

func (*Host) ResolutionV4

func (h *Host) ResolutionV4(l *list.List, srcIP, destIP net.IP, po PacketOutput) error

func (*Host) ResolutionV6

func (h *Host) ResolutionV6(l *list.List, srcIP, destIP net.IP, po PacketOutput) error

type IP6Unreachable

type IP6Unreachable struct {
	FailType layers.ICMPv6TypeCode
	Addr     net.IP
}

type IPProtocolControlMessage

type IPProtocolControlMessage struct {
	Protocol              layers.IPProtocol
	RemoteIP, LocalIP     net.IP
	RemotePort, LocalPort uint16
	FailType              layers.ICMPv4TypeCode
}

type IPUnreachable

type IPUnreachable struct {
	FailType layers.ICMPv4TypeCode
	Addr     net.IP
}

type IPv4Addr

type IPv4Addr uint32

func NewIPv4Addr

func NewIPv4Addr(i net.IP) (s IPv4Addr)

func (IPv4Addr) IP

func (s IPv4Addr) IP() net.IP

type IPv6Addr

type IPv6Addr struct {
	Array [16]byte
}

func NewIPv6Addr

func NewIPv6Addr(i net.IP) (s IPv6Addr)

type List

type List struct {
	Value interface{} /* Should point to the object holding this List */
	// contains filtered or unexported fields
}

func (*List) Back

func (l *List) Back() *Member

func (*List) Copy

func (l *List) Copy() []interface{}

func (*List) CopyRaw

func (l *List) CopyRaw(ol *list.List)

func (*List) Front

func (l *List) Front() *Member

func (*List) Init

func (l *List) Init() *List

func (*List) Len

func (l *List) Len() int

func (*List) MoveFrontToBack

func (l *List) MoveFrontToBack() *Member

func (*List) PushBack

func (l *List) PushBack(m *Member) bool

func (*List) PushFront

func (l *List) PushFront(m *Member) bool

type Member

type Member struct {
	Value interface{}
	// contains filtered or unexported fields
}

func (*Member) Container

func (m *Member) Container() *List

func (*Member) MoveToBack

func (m *Member) MoveToBack()

func (*Member) MoveToFront

func (m *Member) MoveToFront()

func (*Member) Parent

func (m *Member) Parent() interface{}

func (*Member) Remove

func (m *Member) Remove()

func (*Member) Swap

func (m *Member) Swap(other *Member)

type ND6_NC_STATE

type ND6_NC_STATE uint8

* RFC 4861: * 5.1. Conceptual Data Structures * * INCOMPLETE Address resolution is in progress and the link-layer * address of the neighbor has not yet been determined. * * REACHABLE Roughly speaking, the neighbor is known to have been * reachable recently (within tens of seconds ago). * * STALE The neighbor is no longer known to be reachable but * until traffic is sent to the neighbor, no attempt * should be made to verify its reachability. * * DELAY The neighbor is no longer known to be reachable, and * traffic has recently been sent to the neighbor. * Rather than probe the neighbor immediately, however, * delay sending probes for a short while in order to * give upper-layer protocols a chance to provide * reachability confirmation. * * PROBE The neighbor is no longer known to be reachable, and * unicast Neighbor Solicitation probes are being sent to * verify reachability. *

type Nd6Cache

type Nd6Cache struct {
	Entries List
	Routers List

	/*
	 * Delay : Entries in DELAY-State
	 * Retrans : Entries in PROBE-State or INCOMPLETE-State
	 */
	Delay, Retrans, Reachable List

	Maxsize int

	Ipmap map[IPv6Addr]*Nd6Nce
	// contains filtered or unexported fields
}

func (*Nd6Cache) AddRedirect

func (n *Nd6Cache) AddRedirect(target, dest IPv6Addr)

func (*Nd6Cache) Init

func (n *Nd6Cache) Init() *Nd6Cache

func (*Nd6Cache) Lookup

func (n *Nd6Cache) Lookup(ip net.IP) *Nd6Nce

func (*Nd6Cache) LookupOrCreate

func (n *Nd6Cache) LookupOrCreate(ip net.IP) *Nd6Nce

func (*Nd6Cache) LookupValidOnly

func (n *Nd6Cache) LookupValidOnly(ip net.IP) *Nd6Nce

func (*Nd6Cache) Redirect

func (n *Nd6Cache) Redirect(i *IPv6Addr)

func (*Nd6Cache) SelectRouter

func (n *Nd6Cache) SelectRouter() *IPv6Addr

func (*Nd6Cache) TimerEvent

func (n *Nd6Cache) TimerEvent(h *Host, e *eth.EthLayer2, po PacketOutput, NOW time.Time)

type Nd6Nce

type Nd6Nce struct {
	sync.RWMutex

	State  ND6_NC_STATE
	IPAddr IPv6Addr
	HWAddr net.HardwareAddr

	LocalIPAddr IPv6Addr /* Use as Source IP address, when sending ND6 packets. */

	Tstamp, RouterTstamp time.Time

	RouterLifetime          uint16
	SolicitationSendCounter int

	IsRouter bool

	Entry, RouterEntry Member /* Router-List-Entry */

	PlusEntry Member

	Sendchain *list.List
}

* Neighbor-Cache Entry. * * RFC-4861 5.1. Conceptual Data Structures * Neighbor Cache (one for each interface) * A set of entries about individual neighbors to * which traffic has been sent recently. Entries are * keyed on the neighbor's on-link unicast IP address * and contain such information as its link-layer * address, a flag indicating whether the neighbor is * a router or a host (called IsRouter in this * document), a pointer to any queued packets waiting * for address resolution to complete, etc. A * Neighbor Cache entry also contains information used * by the Neighbor Unreachability Detection algorithm, * including the reachability state, the number of * unanswered probes, and the time the next Neighbor * Unreachability Detection event is scheduled to take * place.

func (*Nd6Nce) Init

func (n *Nd6Nce) Init() *Nd6Nce

type Notifyable

type Notifyable interface {
	Notify(i interface{})
}

type PacketOutput

type PacketOutput interface {
	WritePacketData(data []byte) error
}

Jump to

Keyboard shortcuts

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