|
MoonGen
|
User datagram protocol (UDP) utility. More...
Go to the source code of this file.
Functions | |
| function udpHeader | setSrcPort (int) |
| Set the source port. More... | |
| function udpHeader | getSrcPort () |
| Retrieve the UDP source port. More... | |
| function udpHeader | getSrcPortString () |
| Retrieve the UDP source port. More... | |
| function udpHeader | setDstPort (int) |
| Set the destination port. More... | |
| function udpHeader | getDstPort () |
| Retrieve the UDP destination port. More... | |
| function udpHeader | getDstPortString () |
| Retrieve the UDP destination port. More... | |
| function udpHeader | setLength (int) |
| Set the length. More... | |
| function udpHeader | getLength () |
| Retrieve the length. More... | |
| function udpHeader | getLengthString () |
| Retrieve the length. More... | |
| function udpHeader | setChecksum (int) |
| Set the checksum. More... | |
| function udpHeader | calculateChecksum (len) |
| Calculate the checksum. More... | |
| function udpHeader | getChecksum () |
| Retrieve the checksum. More... | |
| function udpHeader | getChecksumString () |
| Retrieve the checksum. More... | |
| function udpHeader | fill (args, pre) |
| Set all members of the udp header. More... | |
| function udpHeader | get (pre) |
| Retrieve the values of all members. More... | |
| function udpHeader | getString () |
| Retrieve the values of all members. More... | |
| function udpHeader | resolveNextHeader () |
| Resolve which header comes after this one (in a packet). More... | |
| function udpHeader | setDefaultNamedArgs (pre, namedArgs, nextHeader, accumulatedLength) |
| Change the default values for namedArguments (for fill/get). More... | |
Variables | |
| local | udp = {} |
| Udp protocol constants. | |
| udp | PORT_PTP_EVENTS = 319 |
| Well known port for Ptp event message. | |
| udp | PORT_PTP_GENERAL_MESSAGES = 320 |
| Well known port for Ptp general message. | |
| local | udpHeader = {} |
| Module for udp_header struct (see headers.lua). | |
| pkt | getUdp4Packet = packetCreate("eth", "ip4", "udp") |
| Cast the packet to an Udp (IP4) packet. | |
| pkt | getUdp6Packet = packetCreate("eth", "ip6", "udp") |
| Cast the packet to an Udp (IP6) packet. | |
| pkt | getUdpPacket = function(self, ip4) |
| Cast the packet to an Udp packet, either using IP4 (nil/true) or IP6 (false), depending on the passed boolean. | |
User datagram protocol (UDP) utility.
Utility functions for udp_header struct defined in headers.lua .
Includes:
Definition in file udp.lua.
| function udpHeader fill | ( | args | , |
| pre | |||
| ) |
Set all members of the udp 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: udpSrc, udpDst, udpLength, udpChecksum |
| pre | prefix for namedArgs. Default 'udp'. |
| function udpHeader get | ( | pre | ) |
| function udpHeader getChecksum | ( | ) |
Retrieve the checksum.
| function udpHeader getChecksumString | ( | ) |
Retrieve the checksum.
| function udpHeader getDstPort | ( | ) |
Retrieve the UDP destination port.
| function udpHeader getDstPortString | ( | ) |
Retrieve the UDP destination port.
| function udpHeader getLength | ( | ) |
Retrieve the length.
| function udpHeader getLengthString | ( | ) |
Retrieve the length.
| function udpHeader getSrcPort | ( | ) |
Retrieve the UDP source port.
| function udpHeader getSrcPortString | ( | ) |
Retrieve the UDP source port.
| function udpHeader getString | ( | ) |
Retrieve the values of all members.
| function udpHeader 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 udpHeader setChecksum | ( | int | ) |
Set the checksum.
| int | Checksum of the udp header as 16 bit integer. |
| function udpHeader 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. 'udp' |
| 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 udpHeader setDstPort | ( | int | ) |
Set the destination port.
| int | Destination port of the udp header as 16 bit integer. |
| function udpHeader setLength | ( | int | ) |
Set the length.
| int | Length of the udp header plus payload (excluding l2 and l3). 16 bit integer. |
| function udpHeader setSrcPort | ( | int | ) |
Set the source port.
| int | Source port of the udp header as 16 bit integer. |