Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

tap-tcp-stream.h
1 /* tap-tcp-stream.h
2 * TCP stream statistics
3 * Originally from tcp_graph.c by Pavel Mores <pvl@uh.cz>
4 * Win32 port: rwh@unifiedtech.com
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13 #ifndef __TAP_TCP_STREAM_H__
14 #define __TAP_TCP_STREAM_H__
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19
20 typedef enum tcp_graph_type_ {
21 GRAPH_TSEQ_STEVENS,
22 GRAPH_TSEQ_TCPTRACE,
23 GRAPH_THROUGHPUT,
24 GRAPH_RTT,
25 GRAPH_WSCALE,
26 GRAPH_UNDEFINED
27 } tcp_graph_type;
28
29 struct segment {
30 struct segment *next;
31 guint32 num;
32 guint32 rel_secs;
33 guint32 rel_usecs;
34 /* Currently unused.
35 guint32 abs_secs;
36 guint32 abs_usecs;
37 */
38
39 guint32 th_seq;
40 guint32 th_ack;
41 guint16 th_flags;
42 guint32 th_win; /* make it 32 bits so we can handle some scaling */
43 guint32 th_seglen;
44 guint16 th_sport;
45 guint16 th_dport;
46 address ip_src;
47 address ip_dst;
48
49 guint8 num_sack_ranges;
50 guint32 sack_left_edge[MAX_TCP_SACK_RANGES];
51 guint32 sack_right_edge[MAX_TCP_SACK_RANGES];
52 };
53
54 struct tcp_graph {
55 tcp_graph_type type;
56
57 /* The stream this graph will show */
58 address src_address;
59 guint16 src_port;
60 address dst_address;
61 guint16 dst_port;
62 guint32 stream;
63 /* Should this be a map or tree instead? */
64 struct segment *segments;
65 };
66
78 void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg, gboolean stream_known );
79 void graph_segment_list_free(struct tcp_graph * );
80
81 /* for compare_headers() */
82 /* segment went the same direction as the currently selected one */
83 #define COMPARE_CURR_DIR 0
84 #define COMPARE_ANY_DIR 1
85
86 int compare_headers(address *saddr1, address *daddr1, guint16 sport1, guint16 dport1, const address *saddr2, const address *daddr2, guint16 sport2, guint16 dport2, int dir);
87
88 int get_num_dsegs(struct tcp_graph * );
89 int get_num_acks(struct tcp_graph *, int * );
90
91 struct tcpheader *select_tcpip_session(capture_file *, struct segment * );
92
93 /* This is used by rtt module only */
94 struct rtt_unack {
95 struct rtt_unack *next;
96 double time;
97 unsigned int seqno;
98 unsigned int end_seqno;
99 };
100
101 int rtt_is_retrans(struct rtt_unack * , unsigned int );
102 struct rtt_unack *rtt_get_new_unack(double , unsigned int , unsigned int );
103 void rtt_put_unack_on_list(struct rtt_unack ** , struct rtt_unack * );
104 void rtt_delete_unack_from_list(struct rtt_unack ** , struct rtt_unack * );
105 void rtt_destroy_unack_list(struct rtt_unack ** );
106
107 static inline int
108 tcp_seq_before(guint32 s1, guint32 s2) {
109 return (gint32)(s1 - s2) < 0;
110 }
111
112 static inline int
113 tcp_seq_eq_or_after(guint32 s1, guint32 s2) {
114 return !tcp_seq_before(s1, s2);
115 }
116
117 static inline int
118 tcp_seq_after(guint32 s1, guint32 s2) {
119 return (gint32)(s1 - s2) > 0;
120 }
121
122 static inline int tcp_seq_before_or_eq(guint32 s1, guint32 s2) {
123 return !tcp_seq_after(s1, s2);
124 }
125
126 #ifdef __cplusplus
127 }
128 #endif /* __cplusplus */
129
130 #endif /* __TAP_TCP_STREAM_H__ */
131
132 /*
133 * Editor modelines
134 *
135 * Local Variables:
136 * c-basic-offset: 4
137 * tab-width: 8
138 * indent-tabs-mode: nil
139 * End:
140 *
141 * ex: set shiftwidth=4 tabstop=8 expandtab:
142 * :indentSize=4:tabSize=8:noTabs=true:
143 */
tcp_graph
Definition: tap-tcp-stream.h:54
segment
Definition: tap-tcp-stream.h:29
rtt_unack
Definition: tap-tcp-stream.h:94
stream
Definition: stream.c:40
_capture_file
Definition: cfile.h:58
_address
Definition: address.h:47
tcpheader
Definition: packet-tcp.h:76