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  guint32 num;
33  guint32 rel_secs;
34  guint32 rel_usecs;
35  /* Currently unused.
36  time_t abs_secs;
37  guint32 abs_usecs;
38  */
39 
40  guint32 th_seq;
41  guint32 th_ack;
42  guint16 th_flags;
43  guint32 th_win; /* make it 32 bits so we can handle some scaling */
44  guint32 th_seglen;
45  guint16 th_sport;
46  guint16 th_dport;
47  address ip_src;
48  address ip_dst;
49 
50  guint8 num_sack_ranges;
51  guint32 sack_left_edge[MAX_TCP_SACK_RANGES];
52  guint32 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  guint16 src_port;
61  address dst_address;
62  guint16 dst_port;
63  guint32 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, guint16 sport1, guint16 dport1, const address *saddr2, const address *daddr2, guint16 sport2, guint16 dport2, int dir);
85 
86 int get_num_dsegs(struct tcp_graph * );
87 int get_num_acks(struct tcp_graph *, int * );
88 
89 guint32 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(guint32 s1, guint32 s2) {
107  return (gint32)(s1 - s2) < 0;
108 }
109 
110 static inline int
111 tcp_seq_eq_or_after(guint32 s1, guint32 s2) {
112  return !tcp_seq_before(s1, s2);
113 }
114 
115 static inline int
116 tcp_seq_after(guint32 s1, guint32 s2) {
117  return (gint32)(s1 - s2) > 0;
118 }
119 
120 static inline int tcp_seq_before_or_eq(guint32 s1, guint32 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:55
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:103