MoonGen
|
Address resolution protocol (ARP) utility. More...
Go to the source code of this file.
Functions | |
function arpHeader | setHardwareAddressType (int) |
Set the hardware address type. More... | |
function arpHeader | getHardwareAddressType () |
Retrieve the hardware address type. More... | |
function arpHeader | getHardwareAddressTypeString () |
Retrieve the hardware address type. More... | |
function arpHeader | setProtoAddressType (int) |
Set the protocol address type. More... | |
function arpHeader | getProtoAddressType () |
Retrieve the protocol address type. More... | |
function arpHeader | getProtoAddressTypeString () |
Retrieve the protocol address type. More... | |
function arpHeader | setHardwareAddressLength (int) |
Set the hardware address length. More... | |
function arpHeader | getHardwareAddressLength () |
Retrieve the hardware address length. More... | |
function arpHeader | getHardwareAddressLengthString () |
Retrieve the hardware address length. More... | |
function arpHeader | setProtoAddressLength (int) |
Set the protocol address length. More... | |
function arpHeader | getProtoAddressLength () |
Retrieve the protocol address length. More... | |
function arpHeader | getProtoAddressLengthString () |
Retrieve the protocol address length. More... | |
function arpHeader | setOperation (int) |
Set the operation. More... | |
function arpHeader | getOperation () |
Retrieve the operation. More... | |
function arpHeader | getOperationString () |
Retrieve the operation. More... | |
function arpHeader | setHardwareSrc (addr) |
Set the hardware source address. More... | |
function arpHeader | getHardwareSrc () |
Retrieve the hardware source address. More... | |
function arpHeader | setHardwareSrcString (addr) |
Set the hardware source address. More... | |
function arpHeader | getHardwareSrcString () |
Retrieve the hardware source address. More... | |
function arpHeader | setHardwareDst (addr) |
Set the hardware destination address. More... | |
function arpHeader | getHardwareDst () |
Retrieve the hardware destination address. More... | |
function arpHeader | setHardwareDstString (addr) |
Set the hardware destination address. More... | |
function arpHeader | getHardwareDstString () |
Retrieve the hardware destination address. More... | |
function arpHeader | setProtoSrc (addr) |
Set the protocol source address. More... | |
function arpHeader | getProtoSrc () |
Retrieve the protocol source address. More... | |
function arpHeader | setProtoSrcString (addr) |
Set the protocol source address. More... | |
function arpHeader | getProtoSrcString () |
Retrieve the protocol source address. More... | |
function arpHeader | setProtoDst (addr) |
Set the protocol destination address. More... | |
function arpHeader | getProtoDst () |
Retrieve the protocol destination address. More... | |
function arpHeader | setProtoDstString (addr) |
Set the protocol destination address. More... | |
function arpHeader | getProtoDstString () |
Retrieve the protocol destination address. More... | |
function arpHeader | fill (args, pre) |
Set all members of the ip header. More... | |
function arpHeader | get (pre) |
Retrieve the values of all members. More... | |
function arpHeader | getString () |
Retrieve the values of all members. More... | |
function arpHeader | resolveNextHeader () |
Resolve which header comes after this one (in a packet). More... | |
function arpHeader | setDefaultNamedArgs (pre, namedArgs, nextHeader, accumulatedLength) |
Change the default values for namedArguments (for fill/get). More... | |
local function | arpTask (qs) |
Arp handler task. More... | |
function arp | lookup (ip) |
Perform a lookup in the ARP table. More... | |
function arp | blockingLookup (ip, timeout) |
Perform a non-blocking lookup in the ARP table. More... | |
Variables | |
local | arp = {} |
Arp protocol constants. | |
arp | HARDWARE_ADDRESS_TYPE_ETHERNET = 1 |
Hardware address type for ethernet. | |
arp | PROTO_ADDRESS_TYPE_IP = 0x0800 |
Proto address type for IP (for ethernet based protocols uses etherType numbers ethernet.lua) | |
arp | OP_REQUEST = 1 |
Operation: request. | |
arp | OP_REPLY = 2 |
Operation: reply. | |
local | arpHeader = {} |
Module for arp_header struct (see headers.lua). | |
pkt | getArpPacket = packetCreate("eth", "arp") |
Cast the packet to an Arp packet. | |
arp | arpTask = "__MG_ARP_TASK" |
Arp handler task, responds to ARP queries for given IPs and performs arp lookups. More... | |
local | arpTable = ns:get() |
Arp table TODO docu. | |
Address resolution protocol (ARP) utility.
Utility functions for the arp_header struct defined in headers.lua .
Includes:
Definition in file arp.lua.
local function arpTask | ( | qs | ) |
Perform a non-blocking lookup in the ARP table.
ip | The ip address in string or cdata format to look up. |
timeout | TODO |
function arpHeader fill | ( | args | , |
pre | |||
) |
Set all members of the ip header.
Per default, all members are set to default values specified in the respective set function. Optional named arguments can be used to set a member to a user-provided value.
args | Table of named arguments. Available arguments: HardwareAddressType, ProtoAddressType, HardwareAddressLength, ProtoAddressLength, Operation, HardwareSrc, HardwareDst, ProtoSrc, ProtoDst |
pre | prefix for namedArgs. Default 'arp'. |
function arpHeader get | ( | pre | ) |
function arpHeader getHardwareAddressLength | ( | ) |
Retrieve the hardware address length.
function arpHeader getHardwareAddressLengthString | ( | ) |
Retrieve the hardware address length.
function arpHeader getHardwareAddressType | ( | ) |
Retrieve the hardware address type.
function arpHeader getHardwareAddressTypeString | ( | ) |
Retrieve the hardware address type.
function arpHeader getHardwareDst | ( | ) |
Retrieve the hardware destination address.
function arpHeader getHardwareDstString | ( | ) |
Retrieve the hardware destination address.
function arpHeader getHardwareSrc | ( | ) |
Retrieve the hardware source address.
function arpHeader getHardwareSrcString | ( | ) |
Retrieve the hardware source address.
function arpHeader getOperation | ( | ) |
Retrieve the operation.
function arpHeader getOperationString | ( | ) |
Retrieve the operation.
function arpHeader getProtoAddressLength | ( | ) |
Retrieve the protocol address length.
function arpHeader getProtoAddressLengthString | ( | ) |
Retrieve the protocol address length.
function arpHeader getProtoAddressType | ( | ) |
Retrieve the protocol address type.
function arpHeader getProtoAddressTypeString | ( | ) |
Retrieve the protocol address type.
function arpHeader getProtoDst | ( | ) |
Retrieve the protocol destination address.
function arpHeader getProtoDstString | ( | ) |
Retrieve the protocol destination address.
function arpHeader getProtoSrc | ( | ) |
Retrieve the protocol source address.
function arpHeader getProtoSrcString | ( | ) |
Retrieve the protocol source address.
function arpHeader getString | ( | ) |
Retrieve the values of all members.
Perform a lookup in the ARP table.
Lookup the MAC address for a given IP. Blocks for up to 1 second if the arp task is not yet running Caution: this function uses locks and namespaces, must not be used in the fast path
ip | The ip address in string or cdata format to look up. |
function arpHeader resolveNextHeader | ( | ) |
Resolve which header comes after this one (in a packet).
For instance: in tcp/udp based on the ports. This function must exist and is only used when get/dump is executed on an unknown (mbuf not yet casted to e.g. tcpv6 packet) packet (mbuf)
function arpHeader setDefaultNamedArgs | ( | pre | , |
namedArgs | , | ||
nextHeader | , | ||
accumulatedLength | |||
) |
Change the default values for namedArguments (for fill/get).
This can be used to for instance calculate a length value based on the total packet length. See proto/ip4.setDefaultNamedArgs as an example. This function must exist and is only used by packet.fill.
pre | The prefix used for the namedArgs, e.g. 'arp' |
namedArgs | Table of named arguments (see See Also) |
nextHeader | The header following after this header in a packet |
accumulatedLength | The so far accumulated length for previous headers in a packet |
function arpHeader setHardwareAddressLength | ( | int | ) |
Set the hardware address length.
int | Length as 8 bit integer. |
function arpHeader setHardwareAddressType | ( | int | ) |
Set the hardware address type.
int | Type as 16 bit integer. |
function arpHeader setHardwareDst | ( | addr | ) |
Set the hardware destination address.
addr | Address in 'struct mac_address' format. |
function arpHeader setHardwareDstString | ( | addr | ) |
Set the hardware destination address.
addr | Address in string format. |
function arpHeader setHardwareSrc | ( | addr | ) |
Set the hardware source address.
addr | Address in 'struct mac_address' format. |
function arpHeader setHardwareSrcString | ( | addr | ) |
Set the hardware source address.
addr | Address in string format. |
function arpHeader setOperation | ( | int | ) |
Set the operation.
int | Operation as 16 bit integer. |
function arpHeader setProtoAddressLength | ( | int | ) |
Set the protocol address length.
int | Length as 8 bit integer. |
function arpHeader setProtoAddressType | ( | int | ) |
Set the protocol address type.
int | Type as 16 bit integer. |
function arpHeader setProtoDst | ( | addr | ) |
Set the protocol destination address.
addr | Address in 'struct ip4_address' format. |
function arpHeader setProtoDstString | ( | addr | ) |
Set the protocol destination address.
addr | Address in string format. |
function arpHeader setProtoSrc | ( | addr | ) |
Set the protocol source address.
addr | Address in 'struct ip4_address' format. |
function arpHeader setProtoSrcString | ( | addr | ) |
Set the protocol source address.
addr | Address in source format. |
arp arpTask = "__MG_ARP_TASK" |