Class TCP
The TCP Layer, inherits from Base_Object
-
TCP.new_args
-
Constructor arguments
Fields:
- src
num
the source port
- dst
num
the destination port
- seq
num
the sequence number
- ack
num
the acknowledgment number
- win
num
the window size
- flags
num
the flags (all at once)
-
TCP.FIN
-
The TCP FIN flag value
-
TCP.SYN
-
The TCP SYN flag value
-
TCP.RST
-
The TCP RST flag value
-
TCP.PSH
-
The TCP PSH flag value
-
TCP.ACK
-
The TCP ACK flag value
-
TCP.URG
-
The TCP URG flag value
-
TCP.ECE
-
The TCP ECE flag value
-
TCP.CWR
-
The TCP CWR flag value
-
TCP:new ([args])
-
Constructor for a TCP Layer
Parameters:
- args
table
arguments, all grouped inside a table, see new_args
(optional)
Returns:
TCP
a new TCP object
Usage:
TCP.new{
dst=80,
flags=18
}
-
TCP:hasflags (flags)
-
Check if the TCP Layer has the given flag combination
Parameters:
Returns:
num
r 0 if the layer doesn't have the flags
Usage:
tcp:hasflags(TCP.SYN + TCP.ACK)
-
TCP:offset ()
-
Get the TCP data offset value
Returns:
num
offset
-
TCP:setsource (source)
-
Set the TCP source port
Parameters:
- source
num
the TCP source port
-
TCP:getsource ()
-
Get the TCP source port
Returns:
num
source the TCP source port
-
TCP:sedest (dest)
-
Set the TCP destination port
Parameters:
- dest
num
the TCP destination port
-
TCP:gedest ()
-
Get the TCP destination port
Returns:
num
dest the TCP destination port
-
TCP:setseq (seq)
-
Set the TCP sequence number
Parameters:
- seq
num
the TCP sequence number
-
TCP:getseq ()
-
Get the TCP sequence number
Returns:
num
seq the TCP sequence number
-
TCP:setack (ack)
-
Set the TCP acknowledgment number
Parameters:
- ack
num
the TCP acknowledgment number
-
TCP:getack ()
-
Get the TCP acknowledgment number
Returns:
num
ack the TCP acknowledgment number
-
TCP:setwin (win)
-
Set the TCP window size
Parameters:
- win
num
the TCP window size
-
TCP:getwin ()
-
Get the TCP window size
Returns:
num
win the TCP window size
-
TCP:setflags (flags)
-
Set the TCP flags
Parameters:
Usage:
tcp:setflags(TCP.SYN + TCP.ACK)
-
TCP:getflags ()
-
Get the TCP flags
Returns:
num
flags the TCP flags