Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
tap-tcp-stream.h
Go to the documentation of this file.
1
14#ifndef __TAP_TCP_STREAM_H__
15#define __TAP_TCP_STREAM_H__
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
32
34#define RTT_ALL 0x0001
36#define RTT_SAK 0x0002
38#define RTT_RTT 0x0004
40#define RTT_KRN 0x0008
41
52
56struct segment {
57 struct segment *next;
58 uint32_t num;
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;
73 bool ack_karn;
76 uint32_t sack_left_edge[MAX_TCP_SACK_RANGES];
77 uint32_t sack_right_edge[MAX_TCP_SACK_RANGES];
78};
79
83struct tcp_graph {
86 uint8_t rtt_sampling;
88 /* --- Stream identity --- */
90 uint16_t src_port;
92 uint16_t dst_port;
93 uint32_t stream;
95 /* --- Segment list --- */
96 struct segment *segments;
97 struct segment *last;
98};
99
109void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg);
110
119void 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
139int 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
146int get_num_dsegs(struct tcp_graph *tg);
147
154int get_num_acks(struct tcp_graph *tg, int *num_sack_ranges);
155
165
166/* This is used by rtt module only */
167struct rtt_unack {
168 struct rtt_unack *next;
169 double time;
170 unsigned int seqno;
171 unsigned int end_seqno;
172};
173
184bool rtt_is_retrans(struct rtt_unack *list, unsigned int seqno);
185
194struct rtt_unack *rtt_get_new_unack(double time_val, unsigned int seqno, unsigned int seglen);
195
202void rtt_put_unack_on_list(struct rtt_unack **l, struct rtt_unack *new_unack);
203
210void rtt_delete_unack_from_list(struct rtt_unack **l, struct rtt_unack *dead);
211
217void rtt_destroy_unack_list(struct rtt_unack **l);
218
226static inline int
227tcp_seq_eq(uint32_t s1, uint32_t s2) {
228 return (int32_t)(s1 - s2) == 0;
229}
230
238static inline int
239tcp_seq_before(uint32_t s1, uint32_t s2) {
240 return (int32_t)(s1 - s2) < 0;
241}
242
250static inline int
251tcp_seq_eq_or_after(uint32_t s1, uint32_t s2) {
252 return !tcp_seq_before(s1, s2);
253}
254
262static inline int
263tcp_seq_after(uint32_t s1, uint32_t s2) {
264 return (int32_t)(s1 - s2) > 0;
265}
266
275static inline int
276tcp_seq_before_or_eq(uint32_t s1, uint32_t s2) {
277 return !tcp_seq_after(s1, s2);
278}
279
280#ifdef __cplusplus
281}
282#endif /* __cplusplus */
283
284#endif /* __TAP_TCP_STREAM_H__ */
Holds a network or link-layer address of any supported type.
Definition address.h:62
Represents a capture file and its associated metadata.
Definition cfile.h:84
Definition nstime.h:26
Definition tap-tcp-stream.h:167
Represents a single decoded TCP segment extracted from a captured frame for graph analysis.
Definition tap-tcp-stream.h:56
uint32_t sack_right_edge[MAX_TCP_SACK_RANGES]
Definition tap-tcp-stream.h:77
uint32_t num
Definition tap-tcp-stream.h:58
uint32_t th_ack
Definition tap-tcp-stream.h:62
uint32_t sack_left_edge[MAX_TCP_SACK_RANGES]
Definition tap-tcp-stream.h:76
uint32_t th_rawseq
Definition tap-tcp-stream.h:63
nstime_t rel_ts
Definition tap-tcp-stream.h:59
struct segment * next
Definition tap-tcp-stream.h:57
uint32_t th_rawack
Definition tap-tcp-stream.h:64
uint32_t th_seq
Definition tap-tcp-stream.h:61
uint16_t th_flags
Definition tap-tcp-stream.h:65
uint8_t num_sack_ranges
Definition tap-tcp-stream.h:75
address ip_dst
Definition tap-tcp-stream.h:71
uint16_t th_dport
Definition tap-tcp-stream.h:69
uint16_t th_sport
Definition tap-tcp-stream.h:68
address ip_src
Definition tap-tcp-stream.h:70
uint32_t th_win
Definition tap-tcp-stream.h:66
bool ack_karn
Definition tap-tcp-stream.h:73
uint32_t th_seglen
Definition tap-tcp-stream.h:67
Describes a TCP stream graph, including the stream identity, graph type, and collected segment list.
Definition tap-tcp-stream.h:83
struct segment * segments
Definition tap-tcp-stream.h:96
address src_address
Definition tap-tcp-stream.h:89
tcp_graph_type type
Definition tap-tcp-stream.h:84
struct segment * last
Definition tap-tcp-stream.h:97
address dst_address
Definition tap-tcp-stream.h:91
uint8_t rtt_sampling
Definition tap-tcp-stream.h:86
uint16_t src_port
Definition tap-tcp-stream.h:90
uint32_t stream
Definition tap-tcp-stream.h:93
uint16_t dst_port
Definition tap-tcp-stream.h:92
enum rtt_sampling_method_ rtt_sampling_method
Selects which ACK events are used as RTT sample points in the RTT graph.
bool rtt_is_retrans(struct rtt_unack *list, unsigned int seqno)
Definition tap-tcp-stream.c:358
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
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
uint32_t select_tcpip_session(capture_file *cf)
Selects a TCP/IP session based on capture file.
Definition tap-tcp-stream.c:283
enum tcp_graph_type_ tcp_graph_type
Selects the plot type displayed in the TCP Stream Graph dialog.
tcp_graph_type_
Selects the plot type displayed in the TCP Stream Graph dialog.
Definition tap-tcp-stream.h:24
@ GRAPH_UNDEFINED
Definition tap-tcp-stream.h:30
@ GRAPH_THROUGHPUT
Definition tap-tcp-stream.h:27
@ GRAPH_WSCALE
Definition tap-tcp-stream.h:29
@ GRAPH_TSEQ_TCPTRACE
Definition tap-tcp-stream.h:26
@ GRAPH_TSEQ_STEVENS
Definition tap-tcp-stream.h:25
@ GRAPH_RTT
Definition tap-tcp-stream.h:28
int get_num_dsegs(struct tcp_graph *tg)
Gets the number of data segments in a TCP graph.
Definition tap-tcp-stream.c:199
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
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
void rtt_destroy_unack_list(struct rtt_unack **l)
Destroys the unacknowledged list of TCP sequences.
Definition tap-tcp-stream.c:422
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
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_
Selects which ACK events are used as RTT sample points in the RTT graph.
Definition tap-tcp-stream.h:45
@ SAMPLING_ALL
Definition tap-tcp-stream.h:46
@ SAMPLING_UNDEFINED
Definition tap-tcp-stream.h:50
@ SAMPLING_RTT
Definition tap-tcp-stream.h:48
@ SAMPLING_ALL_SACK
Definition tap-tcp-stream.h:47
@ SAMPLING_KARN
Definition tap-tcp-stream.h:49
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