2 * TCP stream statistics
3 * Originally from tcp_graph.c by Pavel Mores <pvl@uh.cz>
4 * Win32 port: rwh@unifiedtech.com
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __TAP_TCP_STREAM_H__
26 #define __TAP_TCP_STREAM_H__
30 #endif /* __cplusplus */
32 typedef enum tcp_graph_type_ {
54 guint32 th_win; /* make it 32 bits so we can handle some scaling */
61 guint8 num_sack_ranges;
62 guint32 sack_left_edge[MAX_TCP_SACK_RANGES];
63 guint32 sack_right_edge[MAX_TCP_SACK_RANGES];
69 /* The stream this graph will show */
75 /* Should this be a map or tree instead? */
76 struct segment *segments;
79 /** Fill in the segment list for a TCP graph
81 * @param cf Capture file to scan
82 * @param tg TCP graph. A valid stream must be set. If either the source or
83 * destination address types are AT_NONE the address and port
84 * information will be filled in using the first packet in the
86 * @param stream_known If FALSE, session information will be filled in using
87 * the currently selected packet. If FALSE, session information will
88 * be matched against tg.
90 void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg, gboolean stream_known );
91 void graph_segment_list_free(struct tcp_graph * );
93 /* for compare_headers() */
94 /* segment went the same direction as the currently selected one */
95 #define COMPARE_CURR_DIR 0
96 #define COMPARE_ANY_DIR 1
98 int compare_headers(address *saddr1, address *daddr1, guint16 sport1, guint16 dport1, const address *saddr2, const address *daddr2, guint16 sport2, guint16 dport2, int dir);
100 int get_num_dsegs(struct tcp_graph * );
101 int get_num_acks(struct tcp_graph *, int * );
103 struct tcpheader *select_tcpip_session(capture_file *, struct segment * );
105 /* This is used by rtt module only */
107 struct rtt_unack *next;
110 unsigned int end_seqno;
113 int rtt_is_retrans(struct rtt_unack * , unsigned int );
114 struct rtt_unack *rtt_get_new_unack(double , unsigned int , unsigned int );
115 void rtt_put_unack_on_list(struct rtt_unack ** , struct rtt_unack * );
116 void rtt_delete_unack_from_list(struct rtt_unack ** , struct rtt_unack * );
117 void rtt_destroy_unack_list(struct rtt_unack ** );
120 tcp_seq_before(guint32 s1, guint32 s2) {
121 return (gint32)(s1 - s2) < 0;
125 tcp_seq_eq_or_after(guint32 s1, guint32 s2) {
126 return !tcp_seq_before(s1, s2);
130 tcp_seq_after(guint32 s1, guint32 s2) {
131 return (gint32)(s1 - s2) > 0;
134 static inline int tcp_seq_before_or_eq(guint32 s1, guint32 s2) {
135 return !tcp_seq_after(s1, s2);
140 #endif /* __cplusplus */
142 #endif /* __TAP_TCP_STREAM_H__ */
150 * indent-tabs-mode: nil
153 * ex: set shiftwidth=4 tabstop=8 expandtab:
154 * :indentSize=4:tabSize=8:noTabs=true: