3 * TCP stream statistics
4 * Originally from tcp_graph.c by Pavel Mores <pvl@uh.cz>
5 * Win32 port: rwh@unifiedtech.com
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 #ifndef __TAP_TCP_STREAM_H__
15 #define __TAP_TCP_STREAM_H__
19 #endif /* __cplusplus */
21 typedef enum tcp_graph_type_
{
45 uint32_t th_win
; /* make it 32 bits so we can handle some scaling */
52 uint8_t num_sack_ranges
;
53 uint32_t sack_left_edge
[MAX_TCP_SACK_RANGES
];
54 uint32_t sack_right_edge
[MAX_TCP_SACK_RANGES
];
60 /* The stream this graph will show */
66 /* Should this be a map or tree instead? */
67 struct segment
*segments
;
70 /** Fill in the segment list for a TCP graph
72 * @param cf Capture file to scan
73 * @param tg TCP graph. A valid stream must be set. If either the source or
74 * destination address types are AT_NONE the address and port
75 * information will be filled in using the first packet in the
78 void graph_segment_list_get(capture_file
*cf
, struct tcp_graph
*tg
);
79 void graph_segment_list_free(struct tcp_graph
* );
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
86 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
);
88 int get_num_dsegs(struct tcp_graph
* );
89 int get_num_acks(struct tcp_graph
*, int * );
91 uint32_t select_tcpip_session(capture_file
*);
93 /* This is used by rtt module only */
95 struct rtt_unack
*next
;
98 unsigned int end_seqno
;
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
** );
108 tcp_seq_before(uint32_t s1
, uint32_t s2
) {
109 return (int32_t)(s1
- s2
) < 0;
113 tcp_seq_eq_or_after(uint32_t s1
, uint32_t s2
) {
114 return !tcp_seq_before(s1
, s2
);
118 tcp_seq_after(uint32_t s1
, uint32_t s2
) {
119 return (int32_t)(s1
- s2
) > 0;
122 static inline int tcp_seq_before_or_eq(uint32_t s1
, uint32_t s2
) {
123 return !tcp_seq_after(s1
, s2
);
128 #endif /* __cplusplus */
130 #endif /* __TAP_TCP_STREAM_H__ */