arp

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const PacketLen = 28 // byte

Variables

This section is empty.

Functions

func Receive

func Receive(packet []byte, dev mw.IDevice) psErr.E

func SendReply

func SendReply(tha mw.EthAddr, tpa mw.V4Addr, iface *mw.Iface) psErr.E

func SendRequest

func SendRequest(iface *mw.Iface, ip mw.IP) psErr.E

func Start

func Start(wg *sync.WaitGroup) psErr.E

func Stop

func Stop()

Types

type Hdr

type Hdr struct {
	HT     HwType     // hardware type
	PT     mw.EthType // protocol type
	HAL    uint8      // hardware address length
	PAL    uint8      // protocol address length
	Opcode Opcode
}

type HwType

type HwType uint16
const Ethernet HwType = 0x0001

func (HwType) String

func (v HwType) String() string

type Opcode

type Opcode uint16
const Reply Opcode = 0x0002
const Request Opcode = 0x0001

func (Opcode) String

func (v Opcode) String() string

type Packet

type Packet struct {
	Hdr
	SHA mw.EthAddr // sender hardware address
	SPA mw.V4Addr  // sender protocol address
	THA mw.EthAddr // target hardware address
	TPA mw.V4Addr  // target protocol address
}

type Status

type Status int
const (
	Complete Status = iota
	Incomplete
	Error
)

func Resolve

func Resolve(iface *mw.Iface, ip mw.IP) (mw.EthAddr, Status)

Jump to

Keyboard shortcuts

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