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  uint16_t th_flags;
43  uint32_t th_win; /* make it 32 bits so we can handle some scaling */
44  uint32_t th_seglen;
45  uint16_t th_sport;
46  uint16_t th_dport;
47  address ip_src;
48  address ip_dst;
49 
50  uint8_t num_sack_ranges;
51  uint32_t sack_left_edge[MAX_TCP_SACK_RANGES];
52  uint32_t sack_right_edge[MAX_TCP_SACK_RANGES];
53 };
54 
55 struct tcp_graph {
56  tcp_graph_type type;
57 
58  /* The stream this graph will show */
59  address src_address;
60  uint16_t src_port;
61  address dst_address;
62  uint16_t dst_port;
63  uint32_t stream;
64  /* Should this be a map or tree instead? */
65  struct segment *segments;
66 };
67 
76 void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg);
77 void graph_segment_list_free(struct tcp_graph * );
78 
79 /* for compare_headers() */
80 /* segment went the same direction as the currently selected one */
81 #define COMPARE_CURR_DIR 0
82 #define COMPARE_ANY_DIR 1
83 
84 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);
85 
86 int get_num_dsegs(struct tcp_graph * );
87 int get_num_acks(struct tcp_graph *, int * );
88 
89 uint32_t select_tcpip_session(capture_file *);
90 
91 /* This is used by rtt module only */
92 struct rtt_unack {
93  struct rtt_unack *next;
94  double time;
95  unsigned int seqno;
96  unsigned int end_seqno;
97 };
98 
99 int rtt_is_retrans(struct rtt_unack * , unsigned int );
100 struct rtt_unack *rtt_get_new_unack(double , unsigned int , unsigned int );
101 void rtt_put_unack_on_list(struct rtt_unack ** , struct rtt_unack * );
102 void rtt_delete_unack_from_list(struct rtt_unack ** , struct rtt_unack * );
103 void rtt_destroy_unack_list(struct rtt_unack ** );
104 
105 static inline int
106 tcp_seq_before(uint32_t s1, uint32_t s2) {
107  return (int32_t)(s1 - s2) < 0;
108 }
109 
110 static inline int
111 tcp_seq_eq_or_after(uint32_t s1, uint32_t s2) {
112  return !tcp_seq_before(s1, s2);
113 }
114 
115 static inline int
116 tcp_seq_after(uint32_t s1, uint32_t s2) {
117  return (int32_t)(s1 - s2) > 0;
118 }
119 
120 static inline int tcp_seq_before_or_eq(uint32_t s1, uint32_t s2) {
121  return !tcp_seq_after(s1, s2);
122 }
123 
124 #ifdef __cplusplus
125 }
126 #endif /* __cplusplus */
127 
128 #endif /* __TAP_TCP_STREAM_H__ */
Definition: address.h:56
Definition: cfile.h:67
Definition: tap-tcp-stream.h:92
Definition: tap-tcp-stream.h:30
Definition: stream.c:41
Definition: tap-tcp-stream.h:55
void graph_segment_list_get(capture_file *cf, struct tcp_graph *tg)
Definition: tap-tcp-stream.c:129