## Transport Layer Decodes

### Class TCP

Provides access to fields in a TCP header.

Instance Variables
src_port | tcp.src_port -> anInteger
| Source Port (16-bit)
dst_port | tcp.dst_port -> anInteger
| Destination Port (16-bit)
seq_nbr | tcp.seq_nbr -> anInteger
| Sequence Number (32-bit)
ack_nbr | tcp.ack_nbr -> anInteger
| Acknowledgement Number (32-bit)
doff | tcp.doff -> anInteger
| Data Offset (4-byte units); header is doff*4 bytes long
flags | tcp.flags -> anInteger
| 12-bit integer, with the 6 flags below in its 6 low-order bits
urg_flag | tcp.urg_flag -> true or false
| True if 'Urgent' flag is 1
ack_flag | tcp.ack_flag -> true or false
| True if 'Acknowledge' flag is 1
psh_flag | tcp.psh_flag -> true or false
| True if 'Push' flag is 1
rst_flag | tcp.rst_flag -> true or false
| True if 'Reset'' flag is 1
syn_flag | tcp.syn_flag -> true or false
| True if 'Synchronise' flag is 1
fin_flag | tcp.fin_flag -> true or false
| True if 'Finish' flag is 1
window | tcp.window-> anInteger
| Receive Window size
checksum | tcp.checksum -> anInteger
| TCP Checksum
options_data | tcp.options_data-> aByteArray | False
| Bytearray containing the bytes of the TCP options part of the TCP header. Returns False if header has no TCP options
option_numbers | tcp.option_numbers -> aCFFIArray | False
| Byterray containing the option numbers of all this header's TCP options. Returns False if header has no TCP options
urg_ptr | tcp.urgent -> anInteger
| TCP Urgent Pointer
payload | tcp.payload -> aPayloadObject
| None if tcp had no payload, otherwise an object containing the packet's TCP payload

Instance Function
option(n) | tcp.option(n) -> aByteArray | True | False
| Bytearray containing option n's value bytes. Returns True if option n is present but has no value, or False if option n is not present in the header

Nevil Brownlee
Mon, 17 Jan 2017 (NZDT)