Documentation
¶
Index ¶
- type Frame
- func (afrm Frame) ClearHeader()
- func (afrm Frame) Clip() Frame
- func (afrm Frame) Hardware() (Type uint16, length uint8)
- func (afrm Frame) Operation() Operation
- func (afrm Frame) Protocol() (Type ethernet.Type, length uint8)
- func (afrm Frame) RawData() []byte
- func (afrm Frame) Sender() (hardwareAddr []byte, proto []byte)
- func (afrm Frame) Sender16() (hardwareAddr *[6]byte, proto *[16]byte)
- func (afrm Frame) Sender4() (hardwareAddr *[6]byte, proto *[4]byte)
- func (afrm Frame) SetHardware(Type uint16, length uint8)
- func (afrm Frame) SetOperation(op Operation)
- func (afrm Frame) SetProtocol(Type ethernet.Type, length uint8)
- func (afrm Frame) String() string
- func (afrm Frame) SwapTargetSender()
- func (afrm Frame) Target() (hardwareAddr []byte, proto []byte)
- func (afrm Frame) Target16() (hardwareAddr *[6]byte, proto *[16]byte)
- func (afrm Frame) Target4() (hardwareAddr *[6]byte, proto *[4]byte)
- func (afrm Frame) ValidateSize(v *lneto2.Validator)
- type Handler
- type HandlerConfig
- type Operation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame encapsulates the raw data of an ARP packet and provides methods for manipulating, validating and retrieving fields and payload data. See RFC826.
func NewFrame ¶
NewARPFrame returns a ARPFrame with data set to buf. An error is returned if the buffer size is smaller than 28 (IPv4 min size). Users should still call [ARPFrame.ValidateSize] before working with payload/options of frames to avoid panics.
func (Frame) ClearHeader ¶
func (afrm Frame) ClearHeader()
ClearHeader zeros out the fixed(non-variable) header contents.
func (Frame) Hardware ¶
HardwareType specifies the network link protocol type. Example: Ethernet is 1.
func (Frame) Protocol ¶
Protocol returns the internet protocol type and length. See ethernet.Type.
func (Frame) Sender ¶
Sender returns the hardware (MAC) and protocol addresses of sender of ARP packet. In an ARP request MAC address is used to indicate the address of the host sending the request. In an ARP reply MAC address is used to indicate the address of the host that the request was looking for.
func (Frame) Sender16 ¶
Sender6 returns the IPv6 sender addresses. See Frame.Sender.
func (Frame) Sender4 ¶
Sender4 returns the IPv4 sender addresses. See Frame.Sender.
func (Frame) SetHardware ¶
SetHardware sets the networl link protocol type. See Frame.SetHardware.
func (Frame) SetOperation ¶
SetOperation sets the ARP header operation field. See Operation.
func (Frame) SetProtocol ¶
SetProtocol sets the protocol type and length fields of the ARP frame. See Frame.Protocol and ethernet.Type.
func (Frame) SwapTargetSender ¶
func (afrm Frame) SwapTargetSender()
func (Frame) Target ¶
Target returns the hardware (MAC) and protocol addresses of target of ARP packet. In an ARP request MAC target is ignored. In ARP reply MAC is used to indicate the address of host that originated request.
func (Frame) Target16 ¶
Target6 returns the IPv6 target addresses. See Frame.Sender.
func (Frame) Target4 ¶
Target4 returns the IPv4 target addresses. See Frame.Sender.
func (Frame) ValidateSize ¶
Validation API
ValidateSize checks the frame's size fields and compares with the actual buffer the frame. It returns a non-nil error on finding an inconsistency.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(cfg HandlerConfig) (*Handler, error)
func (*Handler) QueryResult ¶
func (*Handler) ResetState ¶
func (c *Handler) ResetState()
ResetState drops pending queries and incoming requests.