3 * Copyright 2006, Iskratel , Slovenia
4 * By Jakob Bratkovic <j.bratkovic@iskratel.si> and
5 * Miha Jemec <m.jemec@iskratel.si>
7 * based on rtp_stream.h
8 * Copyright 2003, Alcatel Business Systems
9 * By Lars Ruoff <lars.ruoff@gmx.net>
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
15 * SPDX-License-Identifier: GPL-2.0-or-later */
17 #ifndef __MCAST_STREAM_H__
18 #define __MCAST_STREAM_H__
22 #endif /* __cplusplus */
26 #define MAX_SPEED 200000
28 /* typedefs for sliding window and buffer size */
29 typedef struct buffer{
30 nstime_t *buff; /* packet times */
31 gint32 first; /* pointer to the first element */
32 gint32 last; /* pointer to the last element */
33 gint32 burstsize; /* current burst */
34 gint32 topburstsize; /* maximum burst in the refresh interval*/
35 gint32 count; /* packet counter */
36 gint32 burststatus; /* burst status */
37 gint32 numbursts; /* number of bursts */
38 gint32 buffusage; /* buffer usage */
39 gint32 buffstatus; /* buffer status */
40 gint32 numbuffalarms; /* number of alarms triggered by buffer underruns */
41 gint32 topbuffusage; /* top buffer usage in refresh interval */
42 double maxbw; /* Maximum bandwidth usage. Bits/s */
46 /* defines an mcast stream */
47 typedef struct _mcast_stream_info {
55 double average_bw; /* Bits/s */
57 guint32 first_frame_num; /* frame number of first frame */
58 /* start of recording (GMT) of this stream */
59 nstime_t start_abs; /* absolute stream start time */
60 nstime_t start_rel; /* stream start time relative to first packet in capture */
61 nstime_t stop_rel; /* stream stop time relative to first packet in capture */
64 /*for the sliding window */
67 } mcast_stream_info_t;
69 typedef struct _mcaststream_tapinfo mcaststream_tapinfo_t;
71 typedef void (*mcaststream_tap_reset_cb)(mcaststream_tapinfo_t *tapinfo);
72 typedef void (*mcaststream_tap_draw_cb)(mcaststream_tapinfo_t *tapinfo);
74 /* structure that holds the information about all detected streams */
75 /* struct holding all information of the tap */
76 struct _mcaststream_tapinfo {
77 gpointer user_data; /* User data pointer */
78 mcaststream_tap_reset_cb tap_reset; /**< tap reset callback */
79 mcaststream_tap_draw_cb tap_draw; /**< tap draw callback */
80 GList* strinfo_list; /* list of mcast_stream_info_t */
81 guint32 npackets; /* total number of mcast packets of all streams */
82 mcast_stream_info_t* allstreams; /* structure holding information common for all streams */
84 gboolean is_registered; /* if the tap listener is currently registered or not */
88 extern gint32 mcast_stream_trigger;
89 extern gint32 mcast_stream_bufferalarm;
90 extern guint16 mcast_stream_burstint;
91 extern gint32 mcast_stream_emptyspeed;
92 extern gint32 mcast_stream_cumulemptyspeed;
94 /****************************************************************************/
98 * Registers the mcast_streams tap listener (if not already done).
99 * From that point on, the Mcast streams list will be updated with every redissection.
100 * This function is also the entry point for the initialization routine of the tap system.
101 * So whenever mcast_stream.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup.
102 * If not, it will be registered on demand by the mcast_streams and mcast_analysis functions that need it.
104 void register_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo);
107 * Removes the mcast_streams tap listener (if not already done)
108 * From that point on, the Mcast streams list won't be updated any more.
110 void remove_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo);
113 * Cleans up memory of mcast streams tap.
115 void mcaststream_reset(mcaststream_tapinfo_t *tapinfo);
118 * Scans all packets for Mcast streams and updates the Mcast streams list.
119 * (redissects all packets)
121 void mcaststream_scan(mcaststream_tapinfo_t *tapinfo, capture_file *cap_file);
125 #endif /* __cplusplus */
127 #endif /* __MCAST_STREAM_H__ */
130 * Editor modelines - http://www.wireshark.org/tools/modelines.html
135 * indent-tabs-mode: nil
138 * vi: set shiftwidth=4 tabstop=8 expandtab:
139 * :indentSize=4:tabSize=8:noTabs=true: