|
MoonGen
|
Internet control message protocol utility. More...
Go to the source code of this file.
Functions | |
| function icmpHeader | setType (int) |
| Set the type. More... | |
| function icmpHeader | getType () |
| Retrieve the type. More... | |
| function icmpHeader | getTypeString () |
| Retrieve the type. More... | |
| function icmpHeader | setCode (int) |
| Set the code. More... | |
| function icmpHeader | getCode () |
| Retrieve the code. More... | |
| function icmpHeader | getCodeString () |
| Retrieve the code. More... | |
| function icmpHeader | setChecksum (int) |
| Set the checksum. More... | |
| function icmpHeader | calculateChecksum (len) |
| Calculate the checksum. More... | |
| function icmpHeader | getChecksum () |
| Retrieve the checksum. More... | |
| function icmpHeader | getChecksumString () |
| Retrieve the checksum. More... | |
| function icmpHeader | setMessageBody (body) |
| Set the message body. More... | |
| function icmpHeader | getMessageBody () |
| Retrieve the message body. More... | |
| function icmpHeader | getMessageBodyString () |
| Retrieve the message body. More... | |
| function icmpHeader | fill (args, pre) |
| Set all members of the icmp header. More... | |
| function icmpHeader | get (pre) |
| Retrieve the values of all members. More... | |
| function icmpHeader | getString () |
| Retrieve the values of all members. More... | |
| function icmpHeader | resolveNextHeader () |
| Resolve which header comes after this one (in a packet). More... | |
| function icmpHeader | setDefaultNamedArgs (pre, namedArgs, nextHeader, accumulatedLength) |
| Change the default values for namedArguments (for fill/get). More... | |
Variables | |
| local | icmp = {} |
| Icmp4 protocol constants. | |
| icmp | ECHO_REPLY = { type = 0, code = 0 } |
| Icmp4 type-code pair: echo reply. More... | |
| icmp | ECHO_REQUEST = { type = 8, code = 0 } |
| Icmp4 type-code pair: echo request. More... | |
| icmp | DST_UNR_PORT_UNR = { type = 3, code = 3 } |
| Icmp4 type-code pair: destination unreachable - port unreachable. | |
| icmp | TIME_EXCEEDED_TTL_EXPIRED = { type = 11, code = 0 } |
| Icmp4 type-code pair: time exceeded - TTL exceeded. | |
| local | icmp6 = {} |
| Icmp6 protocol constants. | |
| local | icmpHeader = {} |
| Module for icmp_header struct (see headers.lua). | |
| pkt | getIcmp4Packet = packetCreate("eth", "ip4", "icmp") |
| Cast the packet to an Icmp4 packet. | |
| pkt | getIcmp6Packet = packetCreate("eth", "ip6", "icmp") |
| Cast the packet to an Icmp6 packet. | |
Internet control message protocol utility.
Utility functions for the icmp_header struct defined in headers.lua .
Includes:
Definition in file icmp.lua.
| function icmpHeader calculateChecksum | ( | len | ) |
Calculate the checksum.
| len | Number of bytes that the checksum will be computed over |
| function icmpHeader fill | ( | args | , |
| pre | |||
| ) |
Set all members of the icmp 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: Type, Code, Checksum, MessageBody |
| pre | prefix for namedArgs. Default 'icmp'. |
| function icmpHeader get | ( | pre | ) |
Retrieve the values of all members.
| pre | prefix for namedArgs. Default 'icmp'. |
| function icmpHeader getChecksum | ( | ) |
Retrieve the checksum.
| function icmpHeader getChecksumString | ( | ) |
Retrieve the checksum.
| function icmpHeader getCode | ( | ) |
Retrieve the code.
| function icmpHeader getCodeString | ( | ) |
Retrieve the code.
does not work for ICMPv6
| function icmpHeader getMessageBody | ( | ) |
Retrieve the message body.
| function icmpHeader getMessageBodyString | ( | ) |
Retrieve the message body.
| function icmpHeader getString | ( | ) |
Retrieve the values of all members.
Does not work correctly for ICMPv6 packets
| function icmpHeader getType | ( | ) |
Retrieve the type.
| function icmpHeader getTypeString | ( | ) |
Retrieve the type.
does not work for ICMPv6 (ICMPv6 uses different values)
| function icmpHeader 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 icmpHeader setChecksum | ( | int | ) |
Set the checksum.
| int | Checksum of the icmp header as 16 bit integer. |
| function icmpHeader setCode | ( | int | ) |
Set the code.
| int | Code of the icmp header as 8 bit integer. |
| function icmpHeader 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. 'icmp' |
| 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 icmpHeader setMessageBody | ( | body | ) |
Set the message body.
| int | Message body of the icmp header as TODO. |
| function icmpHeader setType | ( | int | ) |
Set the type.
| int | Type of the icmp header as 8 bit integer. |
| icmp6 ECHO_REPLY = { type = 0, code = 0 } |