Wireshark 4.5.0
The Wireshark network protocol analyzer
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
21typedef enum tcp_graph_type_ {
22 GRAPH_TSEQ_STEVENS,
23 GRAPH_TSEQ_TCPTRACE,
24 GRAPH_THROUGHPUT,
25 GRAPH_RTT,
26 GRAPH_WSCALE,
27 GRAPH_UNDEFINED
28} tcp_graph_type;
29
30#define RTT_ALL 0x0001
31#define RTT_SAK 0x0002
32#define RTT_RTT 0x0004
33#define RTT_KRN 0x0008
34
35typedef enum rtt_sampling_method_ {
36 SAMPLING_ALL,
37 SAMPLING_ALL_SACK,
38 SAMPLING_RTT,
39 SAMPLING_KARN,
40 SAMPLING_UNDEFINED
41} rtt_sampling_method;
42
43struct segment {
44 struct segment *next;
45 uint32_t num;
46 uint32_t rel_secs;
47 uint32_t rel_usecs;
48 /* Currently unused.
49 time_t abs_secs;
50 uint32_t abs_usecs;
51 */
52
53 uint32_t th_seq;
54 uint32_t th_ack;
55 uint32_t th_rawseq;
56 uint32_t th_rawack;
57 uint16_t th_flags;
58 uint32_t th_win; /* make it 32 bits so we can handle some scaling */
59 uint32_t th_seglen;
60 uint16_t th_sport;
61 uint16_t th_dport;
62 address ip_src;
63 address ip_dst;
64
65 bool ack_karn; /* true when ambiguous according to Karn's algo */
66
67 uint8_t num_sack_ranges;
68 uint32_t sack_left_edge[MAX_TCP_SACK_RANGES];
69 uint32_t sack_right_edge[MAX_TCP_SACK_RANGES];
70};
71
72struct tcp_graph {
73 tcp_graph_type type;
74
75 /* RTT sampling method (for RTT graphs only) */
76 uint8_t rtt_sampling;
77
78 /* The stream this graph will show */
79 address src_address;
80 uint16_t src_port;
81 address dst_address;
82 uint16_t dst_port;
83 uint32_t stream;
84 /* Should this be a map or tree instead? */
85 struct segment *segments;
86 struct segment *last;
87};
88
98void graph_segment_list_free(struct tcp_graph * );
99
100/* for compare_headers() */
101/* segment went the same direction as the currently selected one */
102#define COMPARE_CURR_DIR 0
103#define COMPARE_ANY_DIR 1
104
105int 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);
106
107int get_num_dsegs(struct tcp_graph * );
108int get_num_acks(struct tcp_graph *, int * );
109
110uint32_t select_tcpip_session(capture_file *);
111
112/* This is used by rtt module only */
113struct rtt_unack {
114 struct rtt_unack *next;
115 double time;
116 unsigned int seqno;
117 unsigned int end_seqno;
118};
119
130bool rtt_is_retrans(struct rtt_unack *list, unsigned int seqno);
131
132struct rtt_unack *rtt_get_new_unack(double , unsigned int , unsigned int );
133void rtt_put_unack_on_list(struct rtt_unack ** , struct rtt_unack * );
134void rtt_delete_unack_from_list(struct rtt_unack ** , struct rtt_unack * );
135void rtt_destroy_unack_list(struct rtt_unack ** );
136
137static inline int
138tcp_seq_eq(uint32_t s1, uint32_t s2) {
139 return (int32_t)(s1 - s2) == 0;
140}
141
142static inline int
143tcp_seq_before(uint32_t s1, uint32_t s2) {
144 return (int32_t)(s1 - s2) < 0;
145}
146
147static inline int
148tcp_seq_eq_or_after(uint32_t s1, uint32_t s2) {
149 return !tcp_seq_before(s1, s2);
150}
151
152static inline int
153tcp_seq_after(uint32_t s1, uint32_t s2) {
154 return (int32_t)(s1 - s2) > 0;
155}
156
157static inline int
158tcp_seq_before_or_eq(uint32_t s1, uint32_t s2) {
159 return !tcp_seq_after(s1, s2);
160}
161
162#ifdef __cplusplus
163}
164#endif /* __cplusplus */
165
166#endif /* __TAP_TCP_STREAM_H__ */
Definition address.h:56
Definition cfile.h:67
Definition tap-tcp-stream.h:113
Definition tap-tcp-stream.h:43
Definition stream.c:41
Definition tap-tcp-stream.h:72
bool rtt_is_retrans(struct rtt_unack *list, unsigned int seqno)
Definition tap-tcp-stream.c:360
void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg)
Definition tap-tcp-stream.c:138