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
18 #ifndef __MCAST_STREAM_H__
19 #define __MCAST_STREAM_H__
25 #endif /* __cplusplus */
27 #define MAX_SPEED 200000
29 /* typedefs for sliding window and buffer size */
30 typedef struct buffer
{
31 nstime_t
*buff
; /* packet times */
32 int32_t first
; /* pointer to the first element */
33 int32_t last
; /* pointer to the last element */
34 int32_t burstsize
; /* current burst */
35 int32_t topburstsize
; /* maximum burst in the refresh interval*/
36 int32_t count
; /* packet counter */
37 int32_t burststatus
; /* burst status */
38 int32_t numbursts
; /* number of bursts */
39 int32_t buffusage
; /* buffer usage */
40 int32_t buffstatus
; /* buffer status */
41 int32_t numbuffalarms
; /* number of alarms triggered by buffer underruns */
42 int32_t topbuffusage
; /* top buffer usage in refresh interval */
43 double maxbw
; /* Maximum bandwidth usage. Bits/s */
47 /* defines an mcast stream */
48 /* XXX - Not all of these seem to be used? */
49 typedef struct _mcast_stream_info
{
57 double average_bw
; /* Bits/s */
59 uint32_t first_frame_num
; /* frame number of first frame */
60 /* start of recording (GMT) of this stream */
61 nstime_t start_abs
; /* absolute stream start time */
62 nstime_t start_rel
; /* stream start time relative to first packet in capture */
63 nstime_t stop_rel
; /* stream stop time relative to first packet in capture */
65 /*for the sliding window */
68 } mcast_stream_info_t
;
70 typedef struct _mcaststream_tapinfo mcaststream_tapinfo_t
;
72 typedef void (*mcaststream_tap_reset_cb
)(mcaststream_tapinfo_t
*tapinfo
);
73 typedef void (*mcaststream_tap_draw_cb
)(mcaststream_tapinfo_t
*tapinfo
);
75 /* structure that holds the information about all detected streams */
76 /* struct holding all information of the tap */
77 struct _mcaststream_tapinfo
{
78 void *user_data
; /* User data pointer */
79 mcaststream_tap_reset_cb tap_reset
; /**< tap reset callback */
80 mcaststream_tap_draw_cb tap_draw
; /**< tap draw callback */
81 GList
* strinfo_list
; /* list of mcast_stream_info_t */
82 uint32_t npackets
; /* total number of mcast packets of all streams */
83 mcast_stream_info_t
* allstreams
; /* structure holding information common for all streams */
85 bool is_registered
; /* if the tap listener is currently registered or not */
89 extern int32_t mcast_stream_trigger
;
90 extern int32_t mcast_stream_bufferalarm
;
91 extern uint16_t mcast_stream_burstint
;
92 extern int32_t mcast_stream_emptyspeed
;
93 extern int32_t mcast_stream_cumulemptyspeed
;
95 /****************************************************************************/
99 * Registers the mcast_streams tap listener (if not already done).
100 * From that point on, the Mcast streams list will be updated with every redissection.
101 * This function is also the entry point for the initialization routine of the tap system.
102 * So whenever mcast_stream.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup.
103 * If not, it will be registered on demand by the mcast_streams and mcast_analysis functions that need it.
105 GString
* register_tap_listener_mcast_stream(mcaststream_tapinfo_t
*tapinfo
);
108 * Removes the mcast_streams tap listener (if not already done)
109 * From that point on, the Mcast streams list won't be updated any more.
111 void remove_tap_listener_mcast_stream(mcaststream_tapinfo_t
*tapinfo
);
114 * Cleans up memory of mcast streams tap.
116 void mcaststream_reset(mcaststream_tapinfo_t
*tapinfo
);
119 * Tap callback (tap_packet_cb) for Mcast stream tap updates. Useful if for
120 * some reason you can't register the default listener, but want to make use
121 * of the existing Mcast calculations.
123 tap_packet_status
mcaststream_packet(void *tapdata
, packet_info
*pinfo
, epan_dissect_t
*edt
, const void *data
, tap_flags_t flags
);
127 #endif /* __cplusplus */
129 #endif /* __MCAST_STREAM_H__ */