1TCP(3) tcp 1.7 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
24 class Option(baseobj.BaseObj)
25 Option object
26
27
28 Methods defined here:
29 ---------------------
30
31 __init__(self, unpack)
32 Constructor which takes an unpack object as input
33
34 class Stream(baseobj.BaseObj)
35 TCP stream buffer object
36
37
38 Methods defined here:
39 ---------------------
40
41 __init__(self, seqno)
42 Constructor
43
44 Initialize object's private data according to the arguments given.
45 Arguments can be given as positional, named arguments or a
46 combination of both.
47
48 add_fragment(self, data, seq)
49 Add fragment data to stream buffer
50
51 missing_fragment(self, seq)
52 Check if given sequence number is within a missing fragment
53
54 class TCP(baseobj.BaseObj)
55 TCP object
56
57 Usage:
58 from packet.transport.tcp import TCP
59
60 x = TCP(pktt)
61
62 Object definition:
63
64 TCP(
65 src_port = int, # Source port
66 dst_port = int, # Destination port
67 seq_number = int, # Sequence number
68 ack_number = int, # Acknowledgment number
69 hl = int, # Data offset or header length (32bit words)
70 header_size = int, # Data offset or header length in bytes
71 flags = Flags( # TCP flags:
72 rawflags = int,# Raw flags
73 FIN = int, # No more data from sender
74 SYN = int, # Synchronize sequence numbers
75 RST = int, # Synchronize sequence numbers
76 PSH = int, # Push function. Asks to push the buffered
77 # data to the receiving application
78 ACK = int, # Acknowledgment field is significant
79 URG = int, # Urgent pointer field is significant
80 ECE = int, # ECN-Echo has a dual role:
81 # SYN=1, the TCP peer is ECN capable.
82 # SYN=0, packet with Congestion Experienced
83 # flag in IP header set is received during
84 # normal transmission
85 CWR = int, # Congestion Window Reduced
86 NS = int, # ECN-nonce concealment protection
87 ),
88 window_size = int, # Window size
89 checksum = int, # Checksum
90 urgent_ptr = int, # Urgent pointer
91 seq = int, # Relative sequence number
92 options = list, # List of TCP options
93 psize = int, # Payload data size
94 data = string, # Raw data of payload if unable to decode
95 )
96
97
98 Methods defined here:
99 ---------------------
100
101 __init__(self, pktt)
102 Constructor
103
104 Initialize object's private data.
105
106
107 pktt: Packet trace object (packet.pktt.Pktt) so this layer has
108 access to the parent layers.
109
110 __str__(self)
111 String representation of object
112
113 The representation depends on the verbose level set by debug_repr().
114 If set to 0 the generic object representation is returned.
115 If set to 1 the representation of the object is condensed:
116 'TCP 708 -> 2049, seq: 0xc4592255, ack: 0xca66dda1, ACK,FIN'
117
118 If set to 2 the representation of the object also includes the
119 length of payload and a little bit more verbose:
120 'src port 708 -> dst port 2049, seq: 0xc4592255, ack: 0xca66dda1, len: 0, flags: FIN,ACK'
121
123 baseobj(3), packet.application.dns(3), packet.application.krb5(3),
124 packet.application.rpc(3), packet.transport.mpa(3), packet.unpack(3),
125 packet.utils(3)
126
127
129 No known bugs.
130
132 Jorge Mora (mora@netapp.com)
133
134
135
136NFStest 3.2 21 March 2023 TCP(3)