MoonGen
|
Internet protocol (v6) utility. More...
Go to the source code of this file.
Functions | |
function ip6Addr | get () |
Retrieve the IPv6 address. More... | |
function ip6Addr | set (addr) |
Set the IPv6 address. More... | |
function ip6Addr | setString (ip) |
Set the IPv6 address. More... | |
function ip6Addr | __eq (lhs, rhs) |
Test equality of two IPv6 addresses. More... | |
function ip6Addr | __add (lhs, rhs) |
Add a number to an IPv6 address. More... | |
function ip6Addr | add (val) |
Add a number to an IPv6 address in-place. More... | |
function ip6Addr | __sub (val) |
Subtract a number from an IPv6 address. More... | |
function ip6Addr | getString (doByteSwap) |
Retrieve the string representation of an IPv6 address. More... | |
function ip6Header | setVersion (int) |
Set the version. More... | |
function ip6Header | getVersion () |
Retrieve the version. More... | |
function ip6Header | getVersionString () |
Retrieve the version. More... | |
function ip6Header | setTrafficClass (int) |
Set the traffic class. More... | |
function ip6Header | getTrafficClass () |
Retrieve the traffic class. More... | |
function ip6Header | getTrafficClassString () |
Retrieve the traffic class. More... | |
function ip6Header | setFlowLabel (int) |
Set the flow label. More... | |
function ip6Header | getFlowLabel () |
Retrieve the flow label. More... | |
function ip6Header | getFlowLabelString () |
Retrieve the flow label. More... | |
function ip6Header | setLength (int) |
Set the payload length. More... | |
function ip6Header | getLength () |
Retrieve the length. More... | |
function ip6Header | getLengthString () |
Retrieve the length. More... | |
function ip6Header | setNextHeader (int) |
Set the next header. More... | |
function ip6Header | getNextHeader () |
Retrieve the next header. More... | |
function ip6Header | getNextHeaderString () |
Retrieve the next header. More... | |
function ip6Header | setTTL (int) |
Set the time-to-live (TTL). More... | |
function ip6Header | getTTL () |
Retrieve the time-to-live. More... | |
function ip6Header | getTTLString () |
Retrieve the time-to-live. More... | |
function ip6Header | setDst (addr) |
Set the destination address. More... | |
function ip6Header | getDst () |
Retrieve the IP6 destination address. More... | |
function ip6Header | setSrc (addr) |
Set the source address. More... | |
function ip6Header | getSrc () |
Retrieve the IP6 source address. More... | |
function ip6Header | setDstString (str) |
Set the destination address. More... | |
function ip6Header | getDstString () |
Retrieve the IP6 destination address. More... | |
function ip6Header | setSrcString (str) |
Set the source address. More... | |
function ip6Header | getSrcString () |
Retrieve the IP6 source address. More... | |
function ip6Header | fill (args, pre) |
Set all members of the ip6 header. More... | |
function ip6Header | get (pre) |
Retrieve the values of all members. More... | |
function ip6Header | getString () |
Retrieve the values of all members. More... | |
function ip6Header | resolveNextHeader () |
Resolve which header comes after this one (in a packet). More... | |
function ip6Header | setDefaultNamedArgs (pre, namedArgs, nextHeader, accumulatedLength) |
Change the default values for namedArguments (for fill/get). More... | |
Variables | |
local | ip6 = {} |
IP6 protocol constants. | |
ip6 | PROTO_TCP = 0x06 |
NextHeader field value for Tcp. | |
ip6 | PROTO_UDP = 0x11 |
NextHeader field value for Udp. | |
ip6 | PROTO_ICMP = 0x3a |
NextHeader field value for Icmp. | |
local | ip6Addr = {} |
Module for ip6_address struct (see headers.lua). | |
local | ip6Header = {} |
Module for ip6_header struct (see headers.lua). | |
pkt | getIP6Packet = packetCreate("eth", "ip6") |
Cast the packet to an IP6 packet. | |
Internet protocol (v6) utility.
Utility functions for the ip6_address and ip6_header structs defined in headers.lua .
Includes:
Definition in file ip6.lua.
function ip6Addr __add | ( | lhs | , |
rhs | |||
) |
Add a number to an IPv6 address.
Max. 64bit, commutative.
lhs | Address in 'union ip6_address' format. |
rhs | Number to add (64 bit integer). |
function ip6Addr __eq | ( | lhs | , |
rhs | |||
) |
Test equality of two IPv6 addresses.
lhs | Address in 'union ip6_address' format. |
rhs | Address in 'union ip6_address' format. |
function ip6Addr __sub | ( | val | ) |
Subtract a number from an IPv6 address.
Max. 64 bit.
val | Number to substract (64 bit integer). |
function ip6Addr add | ( | val | ) |
Add a number to an IPv6 address in-place.
Max 64 bit.
val | Number to add (64 bit integer). |
function ip6Header fill | ( | args | , |
pre | |||
) |
Set all members of the ip6 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: ip6Version, ip6TrafficClass, ip6FlowLabel, ip6Length, ip6NextHeader, ip6TTL, ip6Src, ip6Dst |
pre | prefix for namedArgs. Default 'ip6'. |
function ip6Addr get | ( | ) |
Retrieve the IPv6 address.
function ip6Header get | ( | pre | ) |
function ip6Header getDst | ( | ) |
Retrieve the IP6 destination address.
function ip6Header getDstString | ( | ) |
Retrieve the IP6 destination address.
function ip6Header getFlowLabel | ( | ) |
Retrieve the flow label.
function ip6Header getFlowLabelString | ( | ) |
Retrieve the flow label.
function ip6Header getLength | ( | ) |
Retrieve the length.
function ip6Header getLengthString | ( | ) |
Retrieve the length.
function ip6Header getNextHeader | ( | ) |
Retrieve the next header.
function ip6Header getNextHeaderString | ( | ) |
Retrieve the next header.
function ip6Header getSrc | ( | ) |
Retrieve the IP6 source address.
function ip6Header getSrcString | ( | ) |
Retrieve the IP6 source address.
function ip6Addr getString | ( | doByteSwap | ) |
Retrieve the string representation of an IPv6 address.
Assumes 'union ip6_address' is in network byteorder.
doByteSwap | Optional change the byteorder of the ip6 address before returning the string representation. |
function ip6Header getString | ( | ) |
Retrieve the values of all members.
function ip6Header getTrafficClass | ( | ) |
Retrieve the traffic class.
function ip6Header getTrafficClassString | ( | ) |
Retrieve the traffic class.
function ip6Header getTTL | ( | ) |
Retrieve the time-to-live.
function ip6Header getTTLString | ( | ) |
Retrieve the time-to-live.
function ip6Header getVersion | ( | ) |
Retrieve the version.
function ip6Header getVersionString | ( | ) |
Retrieve the version.
function ip6Header 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 ip6Addr set | ( | addr | ) |
Set the IPv6 address.
addr | Address in 'union ip6_address' format. |
function ip6Header 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. 'ip6' |
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 ip6Header setDst | ( | addr | ) |
Set the destination address.
addr | Address in 'union ip6_address' format. |
function ip6Header setDstString | ( | str | ) |
Set the destination address.
str | Address in string format. |
function ip6Header setFlowLabel | ( | int | ) |
Set the flow label.
int | Flow label of the ip6 header as 20 bit integer. |
function ip6Header setLength | ( | int | ) |
Set the payload length.
int | Length of the ip6 header payload (hence, excluding l2 and l3 headers). 16 bit integer. |
function ip6Header setNextHeader | ( | int | ) |
Set the next header.
int | Next header of the ip6 header as 8 bit integer. |
function ip6Header setSrc | ( | addr | ) |
Set the source address.
addr | Address in 'union ip6_address' format. |
function ip6Header setSrcString | ( | str | ) |
Set the source address.
str | Address in string format. |
function ip6Header setTrafficClass | ( | int | ) |
Set the traffic class.
int | Traffic class of the ip6 header as 8 bit integer. |
function ip6Header setTTL | ( | int | ) |
Set the time-to-live (TTL).
int | TTL of the ip6 header as 8 bit integer. |
function ip6Header setVersion | ( | int | ) |
Set the version.
int | IP6 header version as 4 bit integer. Should always be '6'. |