Qt: Add version check for setTextInteractionFlags
[metze/wireshark/wip.git] / ui / mcast_stream.h
1 /* mcast_stream.h
2  *
3  * Copyright 2006, Iskratel , Slovenia
4  * By Jakob Bratkovic <j.bratkovic@iskratel.si> and
5  * Miha Jemec <m.jemec@iskratel.si>
6  *
7  * based on rtp_stream.h
8  * Copyright 2003, Alcatel Business Systems
9  * By Lars Ruoff <lars.ruoff@gmx.net>
10  *
11  * Wireshark - Network traffic analyzer
12  * By Gerald Combs <gerald@wireshark.org>
13  * Copyright 1998 Gerald Combs
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation,  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28  */
29
30 #ifndef __MCAST_STREAM_H__
31 #define __MCAST_STREAM_H__
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
36
37 #include <epan/tap.h>
38
39 #define MAX_SPEED 200000
40
41 /* typedefs for sliding window and buffer size */
42 typedef struct buffer{
43     nstime_t *buff;            /* packet times */
44     gint32 first;              /* pointer to the first element */
45     gint32 last;               /* pointer to the last element */
46     gint32 burstsize;          /* current burst */
47     gint32 topburstsize;       /* maximum burst in the refresh interval*/
48     gint32 count;              /* packet counter */
49     gint32 burststatus;        /* burst status */
50     gint32 numbursts;          /* number of bursts */
51     gint32 buffusage;          /* buffer usage */
52     gint32 buffstatus;         /* buffer status */
53     gint32 numbuffalarms;      /* number of alarms triggered by buffer underruns */
54     gint32 topbuffusage;       /* top buffer usage in refresh interval */
55     double maxbw;              /* Maximum bandwidth usage. Bits/s */
56 } t_buffer;
57
58
59 /* defines an mcast stream */
60 typedef struct _mcast_stream_info {
61     address src_addr;
62     guint16 src_port;
63     address dest_addr;
64     guint16 dest_port;
65     guint32 npackets;
66     double  apackets;
67     guint32 total_bytes;
68     double  average_bw;         /* Bits/s */
69
70     guint32 first_frame_num; /* frame number of first frame */
71     /* start of recording (GMT) of this stream */
72     nstime_t start_abs;        /* absolute stream start time */
73     nstime_t start_rel;        /* stream start time relative to first packet in capture */
74     nstime_t stop_rel;         /* stream stop time relative to first packet in capture */
75     guint16 vlan_id;
76
77     /*for the sliding window */
78     t_buffer element;
79
80 } mcast_stream_info_t;
81
82 typedef struct _mcaststream_tapinfo mcaststream_tapinfo_t;
83
84 typedef void (*mcaststream_tap_reset_cb)(mcaststream_tapinfo_t *tapinfo);
85 typedef void (*mcaststream_tap_draw_cb)(mcaststream_tapinfo_t *tapinfo);
86
87 /* structure that holds the information about all detected streams */
88 /* struct holding all information of the tap */
89 struct _mcaststream_tapinfo {
90     gpointer user_data;     /* User data pointer */
91     mcaststream_tap_reset_cb tap_reset; /**< tap reset callback */
92     mcaststream_tap_draw_cb tap_draw;   /**< tap draw callback */
93     GList*  strinfo_list;   /* list of mcast_stream_info_t */
94     guint32 npackets;       /* total number of mcast packets of all streams */
95     mcast_stream_info_t* allstreams; /* structure holding information common for all streams */
96
97     gboolean is_registered; /* if the tap listener is currently registered or not */
98 };
99
100
101 extern gint32  mcast_stream_trigger;
102 extern gint32  mcast_stream_bufferalarm;
103 extern guint16 mcast_stream_burstint;
104 extern gint32  mcast_stream_emptyspeed;
105 extern gint32  mcast_stream_cumulemptyspeed;
106
107 /****************************************************************************/
108 /* INTERFACE */
109
110 /*
111 * Registers the mcast_streams tap listener (if not already done).
112 * From that point on, the Mcast streams list will be updated with every redissection.
113 * This function is also the entry point for the initialization routine of the tap system.
114 * So whenever mcast_stream.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup.
115 * If not, it will be registered on demand by the mcast_streams and mcast_analysis functions that need it.
116 */
117 void register_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo);
118
119 /*
120 * Removes the mcast_streams tap listener (if not already done)
121 * From that point on, the Mcast streams list won't be updated any more.
122 */
123 void remove_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo);
124
125 /*
126 * Cleans up memory of mcast streams tap.
127 */
128 void mcaststream_reset(mcaststream_tapinfo_t *tapinfo);
129
130 /*
131 * Scans all packets for Mcast streams and updates the Mcast streams list.
132 * (redissects all packets)
133 */
134 void mcaststream_scan(mcaststream_tapinfo_t *tapinfo, capture_file *cap_file);
135
136 #ifdef __cplusplus
137 }
138 #endif /* __cplusplus */
139
140 #endif /* __MCAST_STREAM_H__ */
141
142 /*
143  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
144  *
145  * Local variables:
146  * c-basic-offset: 4
147  * tab-width: 8
148  * indent-tabs-mode: nil
149  * End:
150  *
151  * vi: set shiftwidth=4 tabstop=8 expandtab:
152  * :indentSize=4:tabSize=8:noTabs=true:
153  */