arp

package
v0.0.0-...-11c6e6d Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(tp ethernet.EtherType, arppd ProtocolDealer) error

Register registers a ProtocolDealer to be the ARP manager for a specific EtherType.

func Request

Request will send an ARP request for a given EtherType and ProtocolAddress. It will then block until it receives a response, or until a timeout occurs. To function properly, a ProtocolDealer must be Registered for the EtherType.

Types

type ProtocolAddress

type ProtocolAddress interface {
	Marshal() ([]byte, error)
	Len() uint8
	ARPEqual(ProtocolAddress) bool
}

The ProtocolAddress represents a protocol address.

type ProtocolDealer

type ProtocolDealer interface {
	Lookup(ProtocolAddress) (*ethernet.MACAddress, error)
	Request(ProtocolAddress) (*ethernet.MACAddress, error)
	// TODO add discover (probe) function to broadcast ARP requests
	// TODO support ARP announcements
	Add(ProtocolAddress, *ethernet.MACAddress) error
	GetReplyNotifier() *notifiers.Notifier
	Unmarshal([]byte) ProtocolAddress
	GetAddress() ProtocolAddress
}

The ProtocolDealer is provided by a client during Registration for an EtherType. It provides this ARP package with all the EtherType specific address settings and functions.

Jump to

Keyboard shortcuts

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