| 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
18 extern "C" {
19#endif /* __cplusplus */
20
21 typedef 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
35 typedef 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
43 struct 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
72 struct 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
97 void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg);
98 void 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
105 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);
106
107 int get_num_dsegs(struct tcp_graph * );
108 int get_num_acks(struct tcp_graph *, int * );
109
110uint32_t select_tcpip_session(capture_file *);
111
112/* This is used by rtt module only */
113 struct rtt_unack {
114 struct rtt_unack *next;
115 double time;
116 unsigned int seqno;
117 unsigned int end_seqno;
118};
119
130 bool rtt_is_retrans(struct rtt_unack *list, unsigned int seqno);
131
132 struct rtt_unack *rtt_get_new_unack(double , unsigned int , unsigned int );
133 void rtt_put_unack_on_list(struct rtt_unack ** , struct rtt_unack * );
134 void rtt_delete_unack_from_list(struct rtt_unack ** , struct rtt_unack * );
135 void rtt_destroy_unack_list(struct rtt_unack ** );
136
137 static inline int
138tcp_seq_eq(uint32_t s1, uint32_t s2) {
139 return (int32_t)(s1 - s2) == 0;
140}
141
142 static inline int
143tcp_seq_before(uint32_t s1, uint32_t s2) {
144 return (int32_t)(s1 - s2) < 0;
145}
146
147 static inline int
148tcp_seq_eq_or_after(uint32_t s1, uint32_t s2) {
149 return !tcp_seq_before(s1, s2);
150}
151
152 static inline int
153tcp_seq_after(uint32_t s1, uint32_t s2) {
154 return (int32_t)(s1 - s2) > 0;
155}
156
157 static 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__ */
_address
Definition address.h:58
_capture_file
Definition cfile.h:67
rtt_unack
Definition tap-tcp-stream.h:113
segment
Definition tap-tcp-stream.h:43
stream
Definition stream.c:41
tcp_graph
Definition tap-tcp-stream.h:72
rtt_is_retrans
bool rtt_is_retrans(struct rtt_unack *list, unsigned int seqno)
Definition tap-tcp-stream.c:360
graph_segment_list_get
void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg)
Definition tap-tcp-stream.c:138