| Wireshark 4.7.3 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
tap-tcp-stream.h
Go to the documentation of this file.
1
13
14#ifndef __TAP_TCP_STREAM_H__
15#define __TAP_TCP_STREAM_H__
16
17#ifdef __cplusplus
18 extern "C" {
19#endif /* __cplusplus */
20
24 typedef enum tcp_graph_type_ {
25 GRAPH_TSEQ_STEVENS,
26 GRAPH_TSEQ_TCPTRACE,
27 GRAPH_THROUGHPUT,
28 GRAPH_RTT,
29 GRAPH_WSCALE,
30 GRAPH_UNDEFINED
31} tcp_graph_type;
32
34#define RTT_ALL 0x0001
36#define RTT_SAK 0x0002
38#define RTT_RTT 0x0004
40#define RTT_KRN 0x0008
41
45 typedef enum rtt_sampling_method_ {
46 SAMPLING_ALL,
47 SAMPLING_ALL_SACK,
48 SAMPLING_RTT,
49 SAMPLING_KARN,
50 SAMPLING_UNDEFINED
51} rtt_sampling_method;
52
56 struct segment {
57 struct segment *next;
58 uint32_t num;
59 nstime_t rel_ts;
60
61 uint32_t th_seq;
62 uint32_t th_ack;
63 uint32_t th_rawseq;
64 uint32_t th_rawack;
65 uint16_t th_flags;
66 uint32_t th_win;
67 uint32_t th_seglen;
68 uint16_t th_sport;
69 uint16_t th_dport;
70 address ip_src;
71 address ip_dst;
72
73 bool ack_karn;
74
75 uint8_t num_sack_ranges;
76 uint32_t sack_left_edge[MAX_TCP_SACK_RANGES];
77 uint32_t sack_right_edge[MAX_TCP_SACK_RANGES];
78};
79
83 struct tcp_graph {
84 tcp_graph_type type;
85
86 uint8_t rtt_sampling;
87
88 /* --- Stream identity --- */
89 address src_address;
90 uint16_t src_port;
91 address dst_address;
92 uint16_t dst_port;
93 uint32_t stream;
94
95 /* --- Segment list --- */
96 struct segment *segments;
97 struct segment *last;
98};
99
109 void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg);
110
119 void graph_segment_list_free(struct tcp_graph *tg);
120
121/* for compare_headers() */
122/* segment went the same direction as the currently selected one */
123#define COMPARE_CURR_DIR 0
124#define COMPARE_ANY_DIR 1
125
139 int compare_headers(address *saddr1, address *daddr1, uint16_t sport1, uint16_t dport1, const address *saddr2, const address *daddr2, uint16_t sport2, uint16_t dport2, int dir);
140
146 int get_num_dsegs(struct tcp_graph *tg);
147
154 int get_num_acks(struct tcp_graph *tg, int *num_sack_ranges);
155
164uint32_t select_tcpip_session(capture_file *cf);
165
169 struct rtt_unack {
170 struct rtt_unack *next;
171 double time;
172 unsigned int seqno;
173 unsigned int end_seqno;
174};
175
186 bool rtt_is_retrans(struct rtt_unack *list, unsigned int seqno);
187
196 struct rtt_unack *rtt_get_new_unack(double time_val, unsigned int seqno, unsigned int seglen);
197
204 void rtt_put_unack_on_list(struct rtt_unack **l, struct rtt_unack *new_unack);
205
212 void rtt_delete_unack_from_list(struct rtt_unack **l, struct rtt_unack *dead);
213
219 void rtt_destroy_unack_list(struct rtt_unack **l);
220
228 static inline int
229tcp_seq_eq(uint32_t s1, uint32_t s2) {
230 return (int32_t)(s1 - s2) == 0;
231}
232
240 static inline int
241tcp_seq_before(uint32_t s1, uint32_t s2) {
242 return (int32_t)(s1 - s2) < 0;
243}
244
252 static inline int
253tcp_seq_eq_or_after(uint32_t s1, uint32_t s2) {
254 return !tcp_seq_before(s1, s2);
255}
256
264 static inline int
265tcp_seq_after(uint32_t s1, uint32_t s2) {
266 return (int32_t)(s1 - s2) > 0;
267}
268
277 static inline int
278tcp_seq_before_or_eq(uint32_t s1, uint32_t s2) {
279 return !tcp_seq_after(s1, s2);
280}
281
282#ifdef __cplusplus
283}
284#endif /* __cplusplus */
285
286#endif /* __TAP_TCP_STREAM_H__ */
address
struct _address address
Holds a network or link-layer address of any supported type.
capture_file
struct _capture_file capture_file
Represents a capture file and its associated metadata.
nstime_t
Definition nstime.h:26
rtt_unack
Represents a single unacknowledged segment in the RTT tracking linked list.
Definition tap-tcp-stream.h:169
rtt_unack::seqno
unsigned int seqno
Definition tap-tcp-stream.h:172
rtt_unack::next
struct rtt_unack * next
Definition tap-tcp-stream.h:170
rtt_unack::time
double time
Definition tap-tcp-stream.h:171
rtt_unack::end_seqno
unsigned int end_seqno
Definition tap-tcp-stream.h:173
segment
Represents a single decoded TCP segment extracted from a captured frame for graph analysis.
Definition tap-tcp-stream.h:56
segment::sack_right_edge
uint32_t sack_right_edge[MAX_TCP_SACK_RANGES]
Definition tap-tcp-stream.h:77
segment::num
uint32_t num
Definition tap-tcp-stream.h:58
segment::th_ack
uint32_t th_ack
Definition tap-tcp-stream.h:62
segment::sack_left_edge
uint32_t sack_left_edge[MAX_TCP_SACK_RANGES]
Definition tap-tcp-stream.h:76
segment::th_rawseq
uint32_t th_rawseq
Definition tap-tcp-stream.h:63
segment::rel_ts
nstime_t rel_ts
Definition tap-tcp-stream.h:59
segment::next
struct segment * next
Definition tap-tcp-stream.h:57
segment::th_rawack
uint32_t th_rawack
Definition tap-tcp-stream.h:64
segment::th_seq
uint32_t th_seq
Definition tap-tcp-stream.h:61
segment::th_flags
uint16_t th_flags
Definition tap-tcp-stream.h:65
segment::num_sack_ranges
uint8_t num_sack_ranges
Definition tap-tcp-stream.h:75
segment::ip_dst
address ip_dst
Definition tap-tcp-stream.h:71
segment::th_dport
uint16_t th_dport
Definition tap-tcp-stream.h:69
segment::th_sport
uint16_t th_sport
Definition tap-tcp-stream.h:68
segment::ip_src
address ip_src
Definition tap-tcp-stream.h:70
segment::th_win
uint32_t th_win
Definition tap-tcp-stream.h:66
segment::ack_karn
bool ack_karn
Definition tap-tcp-stream.h:73
segment::th_seglen
uint32_t th_seglen
Definition tap-tcp-stream.h:67
tcp_graph
Describes a TCP stream graph, including the stream identity, graph type, and collected segment list.
Definition tap-tcp-stream.h:83
tcp_graph::segments
struct segment * segments
Definition tap-tcp-stream.h:96
tcp_graph::src_address
address src_address
Definition tap-tcp-stream.h:89
tcp_graph::type
tcp_graph_type type
Definition tap-tcp-stream.h:84
tcp_graph::last
struct segment * last
Definition tap-tcp-stream.h:97
tcp_graph::dst_address
address dst_address
Definition tap-tcp-stream.h:91
tcp_graph::rtt_sampling
uint8_t rtt_sampling
Definition tap-tcp-stream.h:86
tcp_graph::src_port
uint16_t src_port
Definition tap-tcp-stream.h:90
tcp_graph::stream
uint32_t stream
Definition tap-tcp-stream.h:93
tcp_graph::dst_port
uint16_t dst_port
Definition tap-tcp-stream.h:92
rtt_sampling_method
enum rtt_sampling_method_ rtt_sampling_method
Selects which ACK events are used as RTT sample points in the RTT graph.
rtt_is_retrans
bool rtt_is_retrans(struct rtt_unack *list, unsigned int seqno)
Definition tap-tcp-stream.c:358
compare_headers
int compare_headers(address *saddr1, address *daddr1, uint16_t sport1, uint16_t dport1, const address *saddr2, const address *daddr2, uint16_t sport2, uint16_t dport2, int dir)
Compares the headers of two TCP segments.
Definition tap-tcp-stream.c:178
rtt_put_unack_on_list
void rtt_put_unack_on_list(struct rtt_unack **l, struct rtt_unack *new_unack)
Adds a new unacknowledged packet to the list.
Definition tap-tcp-stream.c:384
select_tcpip_session
uint32_t select_tcpip_session(capture_file *cf)
Selects a TCP/IP session based on capture file.
Definition tap-tcp-stream.c:283
tcp_graph_type
enum tcp_graph_type_ tcp_graph_type
Selects the plot type displayed in the TCP Stream Graph dialog.
tcp_graph_type_
tcp_graph_type_
Selects the plot type displayed in the TCP Stream Graph dialog.
Definition tap-tcp-stream.h:24
GRAPH_UNDEFINED
@ GRAPH_UNDEFINED
Definition tap-tcp-stream.h:30
GRAPH_THROUGHPUT
@ GRAPH_THROUGHPUT
Definition tap-tcp-stream.h:27
GRAPH_WSCALE
@ GRAPH_WSCALE
Definition tap-tcp-stream.h:29
GRAPH_TSEQ_TCPTRACE
@ GRAPH_TSEQ_TCPTRACE
Definition tap-tcp-stream.h:26
GRAPH_TSEQ_STEVENS
@ GRAPH_TSEQ_STEVENS
Definition tap-tcp-stream.h:25
GRAPH_RTT
@ GRAPH_RTT
Definition tap-tcp-stream.h:28
get_num_dsegs
int get_num_dsegs(struct tcp_graph *tg)
Gets the number of data segments in a TCP graph.
Definition tap-tcp-stream.c:199
graph_segment_list_get
void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg)
Fill in the segment list for a TCP graph.
Definition tap-tcp-stream.c:136
get_num_acks
int get_num_acks(struct tcp_graph *tg, int *num_sack_ranges)
Gets the number of ACKs in a TCP graph.
Definition tap-tcp-stream.c:217
rtt_destroy_unack_list
void rtt_destroy_unack_list(struct rtt_unack **l)
Destroys the unacknowledged list of TCP sequences.
Definition tap-tcp-stream.c:422
rtt_get_new_unack
struct rtt_unack * rtt_get_new_unack(double time_val, unsigned int seqno, unsigned int seglen)
Creates a new RTT unacknowledged packet structure.
Definition tap-tcp-stream.c:372
graph_segment_list_free
void graph_segment_list_free(struct tcp_graph *tg)
Frees the memory allocated for a TCP graph segment list.
Definition tap-tcp-stream.c:160
rtt_sampling_method_
rtt_sampling_method_
Selects which ACK events are used as RTT sample points in the RTT graph.
Definition tap-tcp-stream.h:45
SAMPLING_ALL
@ SAMPLING_ALL
Definition tap-tcp-stream.h:46
SAMPLING_UNDEFINED
@ SAMPLING_UNDEFINED
Definition tap-tcp-stream.h:50
SAMPLING_RTT
@ SAMPLING_RTT
Definition tap-tcp-stream.h:48
SAMPLING_ALL_SACK
@ SAMPLING_ALL_SACK
Definition tap-tcp-stream.h:47
SAMPLING_KARN
@ SAMPLING_KARN
Definition tap-tcp-stream.h:49
rtt_delete_unack_from_list
void rtt_delete_unack_from_list(struct rtt_unack **l, struct rtt_unack *dead)
Removes a specific RTT unacknowledged packet from the list.
Definition tap-tcp-stream.c:400