Wireshark  4.3.0
The Wireshark network protocol analyzer
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 struct segment {
31  struct segment *next;
32  uint32_t num;
33  uint32_t rel_secs;
34  uint32_t rel_usecs;
35  /* Currently unused.
36  time_t abs_secs;
37  uint32_t abs_usecs;
38  */
39 
40  uint32_t th_seq;
41  uint32_t th_ack;
42  uint32_t th_rawseq;
43  uint32_t th_rawack;
44  uint16_t th_flags;
45  uint32_t th_win; /* make it 32 bits so we can handle some scaling */
46  uint32_t th_seglen;
47  uint16_t th_sport;
48  uint16_t th_dport;
49  address ip_src;
50  address ip_dst;
51 
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];
55 };
56 
57 struct tcp_graph {
58  tcp_graph_type type;
59 
60  /* The stream this graph will show */
61  address src_address;
62  uint16_t src_port;
63  address dst_address;
64  uint16_t dst_port;
65  uint32_t stream;
66  /* Should this be a map or tree instead? */
67  struct segment *segments;
68 };
69 
78 void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg);
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, uint16_t sport1, uint16_t dport1, const address *saddr2, const address *daddr2, uint16_t sport2, uint16_t dport2, int dir);
87 
88 int get_num_dsegs(struct tcp_graph * );
89 int get_num_acks(struct tcp_graph *, int * );
90 
91 uint32_t select_tcpip_session(capture_file *);
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(uint32_t s1, uint32_t s2) {
109  return (int32_t)(s1 - s2) < 0;
110 }
111 
112 static inline int
113 tcp_seq_eq_or_after(uint32_t s1, uint32_t s2) {
114  return !tcp_seq_before(s1, s2);
115 }
116 
117 static inline int
118 tcp_seq_after(uint32_t s1, uint32_t s2) {
119  return (int32_t)(s1 - s2) > 0;
120 }
121 
122 static inline int tcp_seq_before_or_eq(uint32_t s1, uint32_t s2) {
123  return !tcp_seq_after(s1, s2);
124 }
125 
126 #ifdef __cplusplus
127 }
128 #endif /* __cplusplus */
129 
130 #endif /* __TAP_TCP_STREAM_H__ */
Definition: address.h:56
Definition: cfile.h:67
Definition: tap-tcp-stream.h:94
Definition: tap-tcp-stream.h:30
Definition: stream.c:41
Definition: tap-tcp-stream.h:57
void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg)
Definition: tap-tcp-stream.c:138