1TCP(3) tcp 1.5 TCP(3)
2
3
4
6 packet.transport.tcp - TCP module
7
9 Decode TCP layer.
10
11 RFC 793 TRANSMISSION CONTROL PROTOCOL RFC 2018 TCP Selective Acknowl‐
12 edgment Options RFC 7323 TCP Extensions for High Performance
13
15 class Flags(packet.utils.OptionFlags)
16 TCP Option flags
17
18
19 Methods defined here:
20 ---------------------
21
22 __str__ = str_flags(self)
23 Display the flag names which are set, e.g., in the above example
24 the output will be "bit1,bit3" (bit1=1, bit3=1)
25 Use "__str__ = OptionFlags.str_flags" to have it as the default
26 string representation
27
28 class Option(baseobj.BaseObj)
29 Option object
30
31
32 Methods defined here:
33 ---------------------
34
35 __init__(self, unpack)
36 Constructor which takes an unpack object as input
37
38 class Stream(baseobj.BaseObj)
39 TCP stream buffer object
40
41
42 Methods defined here:
43 ---------------------
44
45 __init__(self, seqno)
46
47 add_fragment(self, data, seq)
48 Add fragment data to stream buffer
49
50 missing_fragment(self, seq)
51 Check if given sequence number is within a missing fragment
52
53 class TCP(baseobj.BaseObj)
54 TCP object
55
56 Usage:
57 from packet.transport.tcp import TCP
58
59 x = TCP(pktt)
60
61 Object definition:
62
63 TCP(
64 src_port = int, # Source port
65 dst_port = int, # Destination port
66 seq_number = int, # Sequence number
67 ack_number = int, # Acknowledgment number
68 hl = int, # Data offset or header length (32bit words)
69 header_size = int, # Data offset or header length in bytes
70 flags = Flags( # TCP flags:
71 rawflags = int,# Raw flags
72 FIN = int, # No more data from sender
73 SYN = int, # Synchronize sequence numbers
74 RST = int, # Synchronize sequence numbers
75 PSH = int, # Push function. Asks to push the buffered
76 # data to the receiving application
77 ACK = int, # Acknowledgment field is significant
78 URG = int, # Urgent pointer field is significant
79 ECE = int, # ECN-Echo has a dual role:
80 # SYN=1, the TCP peer is ECN capable.
81 # SYN=0, packet with Congestion Experienced
82 # flag in IP header set is received during
83 # normal transmission
84 CWR = int, # Congestion Window Reduced
85 NS = int, # ECN-nonce concealment protection
86 ),
87 window_size = int, # Window size
88 checksum = int, # Checksum
89 urgent_ptr = int, # Urgent pointer
90 seq = int, # Relative sequence number
91 options = list, # List of TCP options
92 data = string, # Raw data of payload if unable to decode
93 )
94
95
96 Methods defined here:
97 ---------------------
98
99 __init__(self, pktt)
100 Constructor
101
102 Initialize object's private data.
103
104
105 pktt: Packet trace object (packet.pktt.Pktt) so this layer has
106 access to the parent layers.
107
108 __str__(self)
109 String representation of object
110
111 The representation depends on the verbose level set by debug_repr().
112 If set to 0 the generic object representation is returned.
113 If set to 1 the representation of the object is condensed:
114 'TCP 708 -> 2049, seq: 3294175829, ack: 3395739041, ACK,FIN'
115
116 If set to 2 the representation of the object also includes the
117 length of payload and a little bit more verbose:
118 'src port 708 -> dst port 2049, seq: 3294175829, ack: 3395739041, len: 0, flags: FIN,ACK'
119
121 baseobj(3), packet.application.dns(3), packet.application.krb5(3),
122 packet.application.rpc(3), packet.unpack(3), packet.utils(3)
123
124
126 No known bugs.
127
129 Jorge Mora (mora@netapp.com)
130
131
132
133NFStest 2.1.5 14 February 2017 TCP(3)