| MoonGen
    | 
Transmission control protocol (TCP) utility. More...
Go to the source code of this file.
| Functions | |
| function tcpHeader | setSrcPort (int) | 
| Set the source port.  More... | |
| function tcpHeader | getSrcPort () | 
| Retrieve the source port.  More... | |
| function tcpHeader | getSrcPortString () | 
| Retrieve the source port.  More... | |
| function tcpHeader | setDstPort (int) | 
| Set the destination port.  More... | |
| function tcpHeader | getDstPort () | 
| Retrieve the destination port.  More... | |
| function tcpHeader | getDstPortString () | 
| Retrieve the destination port.  More... | |
| function tcpHeader | setSeqNumber (int) | 
| Set the sequence number.  More... | |
| function tcpHeader | getSeqNumber () | 
| Retrieve the sequence number.  More... | |
| function tcpHeader | getSeqNumberString () | 
| Retrieve the sequence number.  More... | |
| function tcpHeader | setAckNumber (int) | 
| Set the acknowledgement number.  More... | |
| function tcpHeader | getAckNumber () | 
| Retrieve the acknowledgement number.  More... | |
| function tcpHeader | getAckNumberString () | 
| Retrieve the acknowledgement number.  More... | |
| function tcpHeader | setDataOffset (int) | 
| Set the data offset.  More... | |
| function tcpHeader | getDataOffset () | 
| Retrieve the data offset.  More... | |
| function tcpHeader | getDataOffsetString () | 
| Retrieve the data offset.  More... | |
| function tcpHeader | setReserved (int) | 
| Set the reserved field.  More... | |
| function tcpHeader | getReserved () | 
| Retrieve the reserved field.  More... | |
| function tcpHeader | getReservedString () | 
| Retrieve the reserved field.  More... | |
| function tcpHeader | setFlags (int) | 
| Set the flags.  More... | |
| function tcpHeader | getFlags () | 
| Retrieve the flags.  More... | |
| function tcpHeader | getFlagsString () | 
| Retrieve the flags.  More... | |
| function tcpHeader | setUrg () | 
| Set the Urg flag. | |
| function tcpHeader | unsetUrg () | 
| Unset the Urg flag. | |
| function tcpHeader | getUrg () | 
| Retrieve the Urg flag.  More... | |
| function tcpHeader | getUrgString () | 
| Retrieve the Urg flag.  More... | |
| function tcpHeader | setAck () | 
| Set the Ack flag. | |
| function tcpHeader | unsetAck () | 
| Unset the Ack flag. | |
| function tcpHeader | getAck () | 
| Retrieve the Ack flag.  More... | |
| function tcpHeader | getAckString () | 
| Retrieve the Ack flag.  More... | |
| function tcpHeader | setPsh () | 
| Set the Psh flag. | |
| function tcpHeader | unsetPsh () | 
| Unset the Psh flag. | |
| function tcpHeader | getPsh () | 
| Retrieve the Psh flag.  More... | |
| function tcpHeader | getPshString () | 
| Retrieve the Psh flag.  More... | |
| function tcpHeader | setRst () | 
| Set the Rst flag. | |
| function tcpHeader | unsetRst () | 
| Unset the Rst flag. | |
| function tcpHeader | getRst () | 
| Retrieve the Rst flag.  More... | |
| function tcpHeader | getRstString () | 
| Retrieve the Rst flag.  More... | |
| function tcpHeader | setSyn () | 
| Set the Syn flag. | |
| function tcpHeader | unsetSyn () | 
| Unset the Syn flag. | |
| function tcpHeader | getSyn () | 
| Retrieve the Syn flag.  More... | |
| function tcpHeader | getSynString () | 
| Retrieve the Syn flag.  More... | |
| function tcpHeader | setFin () | 
| Set the Fin flag. | |
| function tcpHeader | unsetFin () | 
| Unset the Fin flag. | |
| function tcpHeader | getFin () | 
| Retrieve the Fin flag.  More... | |
| function tcpHeader | getFinString () | 
| Retrieve the Fin flag.  More... | |
| function tcpHeader | setWindow (int) | 
| Set the window field.  More... | |
| function tcpHeader | getWindow () | 
| Retrieve the window field.  More... | |
| function tcpHeader | getWindowString () | 
| Retrieve the window field.  More... | |
| function tcpHeader | setChecksum (int) | 
| Set the checksum.  More... | |
| function tcpHeader | calculateChecksum (len) | 
| Calculate the checksum.  More... | |
| function tcpHeader | getChecksum () | 
| Retrieve the checksum.  More... | |
| function tcpHeader | getChecksumString () | 
| Retrieve the checksum.  More... | |
| function tcpHeader | setUrgentPointer (int) | 
| Set the urgent pointer.  More... | |
| function tcpHeader | getUrgentPointer () | 
| Retrieve the urgent pointer.  More... | |
| function tcpHeader | getUrgentPointerString () | 
| Retrieve the urgent pointer.  More... | |
| function tcpHeader | fill (args, pre) | 
| Set all members of the ip header.  More... | |
| function tcpHeader | get (pre) | 
| Retrieve the values of all members.  More... | |
| function tcpHeader | getString () | 
| Retrieve the values of all members.  More... | |
| function tcpHeader | resolveNextHeader () | 
| Resolve which header comes after this one (in a packet).  More... | |
| function tcpHeader | setDefaultNamedArgs (pre, namedArgs, nextHeader, accumulatedLength) | 
| Change the default values for namedArguments (for fill/get).  More... | |
| Variables | |
| local | tcpHeader = {} | 
| Module for tcp_header struct (see headers.lua). | |
| pkt | getTcp4Packet = packetCreate("eth", "ip4", "tcp") | 
| Cast the packet to a Tcp (IP4) packet. | |
| pkt | getTcp6Packet = packetCreate("eth", "ip6", "tcp") | 
| Cast the packet to a Tcp (IP6) packet. | |
| pkt | getTcpPacket = function(self, ip4) | 
| Cast the packet to a Tcp packet, either using IP4 (nil/true) or IP6 (false), depending on the passed boolean. | |
Transmission control protocol (TCP) utility.
Utility functions for the tcp_header struct defined in headers.lua . 
Includes:
Definition in file tcp.lua.
| function tcpHeader calculateChecksum | ( | len | ) | 
Calculate the checksum.
| len | Number of bytes to calculate the checksum over. | 
| function tcpHeader 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: Src, Dst, SeqNumber, AckNumber, DataOffset, Reserved, Flags, Urg, Ack, Psh, Rst, Syn, Fin, Window, Checksum, UrgentPointer | 
| pre | prefix for namedArgs. Default 'tcp'. | 
| function tcpHeader get | ( | pre | ) | 
| function tcpHeader getAck | ( | ) | 
Retrieve the Ack flag.
| function tcpHeader getAckNumber | ( | ) | 
Retrieve the acknowledgement number.
| function tcpHeader getAckNumberString | ( | ) | 
Retrieve the acknowledgement number.
| function tcpHeader getAckString | ( | ) | 
Retrieve the Ack flag.
| function tcpHeader getChecksum | ( | ) | 
Retrieve the checksum.
| function tcpHeader getChecksumString | ( | ) | 
Retrieve the checksum.
| function tcpHeader getDataOffset | ( | ) | 
Retrieve the data offset.
| function tcpHeader getDataOffsetString | ( | ) | 
Retrieve the data offset.
| function tcpHeader getDstPort | ( | ) | 
Retrieve the destination port.
| function tcpHeader getDstPortString | ( | ) | 
Retrieve the destination port.
| function tcpHeader getFin | ( | ) | 
Retrieve the Fin flag.
| function tcpHeader getFinString | ( | ) | 
Retrieve the Fin flag.
| function tcpHeader getFlags | ( | ) | 
Retrieve the flags.
| function tcpHeader getFlagsString | ( | ) | 
Retrieve the flags.
| function tcpHeader getPsh | ( | ) | 
Retrieve the Psh flag.
| function tcpHeader getPshString | ( | ) | 
Retrieve the Psh flag.
| function tcpHeader getReserved | ( | ) | 
Retrieve the reserved field.
| function tcpHeader getReservedString | ( | ) | 
Retrieve the reserved field.
| function tcpHeader getRst | ( | ) | 
Retrieve the Rst flag.
| function tcpHeader getRstString | ( | ) | 
Retrieve the Rst flag.
| function tcpHeader getSeqNumber | ( | ) | 
Retrieve the sequence number.
| function tcpHeader getSeqNumberString | ( | ) | 
Retrieve the sequence number.
| function tcpHeader getSrcPort | ( | ) | 
Retrieve the source port.
| function tcpHeader getSrcPortString | ( | ) | 
Retrieve the source port.
| function tcpHeader getString | ( | ) | 
Retrieve the values of all members.
| function tcpHeader getSyn | ( | ) | 
Retrieve the Syn flag.
| function tcpHeader getSynString | ( | ) | 
Retrieve the Syn flag.
| function tcpHeader getUrg | ( | ) | 
Retrieve the Urg flag.
| function tcpHeader getUrgentPointer | ( | ) | 
Retrieve the urgent pointer.
| function tcpHeader getUrgentPointerString | ( | ) | 
Retrieve the urgent pointer.
| function tcpHeader getUrgString | ( | ) | 
Retrieve the Urg flag.
| function tcpHeader getWindow | ( | ) | 
Retrieve the window field.
| function tcpHeader getWindowString | ( | ) | 
Retrieve the window field.
| function tcpHeader 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 tcpHeader setAckNumber | ( | int | ) | 
Set the acknowledgement number.
| int | Ack number as 8 bit integer. | 
| function tcpHeader setChecksum | ( | int | ) | 
Set the checksum.
| int | Checksum as 16 bit integer. | 
| function tcpHeader setDataOffset | ( | int | ) | 
Set the data offset.
| int | Offset as 4 bit integer. Header size is counted in 32 bit words (min. 5 (no options), max. 15) | 
| function tcpHeader 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. 'tcp' | 
| 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 tcpHeader setDstPort | ( | int | ) | 
Set the destination port.
| int | Port as 16 bit integer. | 
| function tcpHeader setFlags | ( | int | ) | 
Set the flags.
| int | Flags as 6 bit integer. | 
| function tcpHeader setReserved | ( | int | ) | 
Set the reserved field.
| int | Reserved field as 6 bit integer. | 
| function tcpHeader setSeqNumber | ( | int | ) | 
Set the sequence number.
| int | Sequence number as 8 bit integer. | 
| function tcpHeader setSrcPort | ( | int | ) | 
Set the source port.
| int | Port as 16 bit integer. | 
| function tcpHeader setUrgentPointer | ( | int | ) | 
Set the urgent pointer.
| int | Urgent pointer as 16 bit integer. | 
| function tcpHeader setWindow | ( | int | ) | 
Set the window field.
| int | Window as 16 bit integer. |