Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
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  * SPDX-License-Identifier: GPL-2.0-or-later
16  */
17 
18 #ifndef __MCAST_STREAM_H__
19 #define __MCAST_STREAM_H__
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 #include <epan/tap.h>
26 
27 #define MAX_SPEED 200000
28 
29 /* typedefs for sliding window and buffer size */
30 typedef struct buffer{
31  nstime_t *buff; /* packet times */
32  gint32 first; /* pointer to the first element */
33  gint32 last; /* pointer to the last element */
34  gint32 burstsize; /* current burst */
35  gint32 topburstsize; /* maximum burst in the refresh interval*/
36  gint32 count; /* packet counter */
37  gint32 burststatus; /* burst status */
38  gint32 numbursts; /* number of bursts */
39  gint32 buffusage; /* buffer usage */
40  gint32 buffstatus; /* buffer status */
41  gint32 numbuffalarms; /* number of alarms triggered by buffer underruns */
42  gint32 topbuffusage; /* top buffer usage in refresh interval */
43  double maxbw; /* Maximum bandwidth usage. Bits/s */
44 } t_buffer;
45 
46 
47 /* defines an mcast stream */
48 typedef struct _mcast_stream_info {
49  address src_addr;
50  guint16 src_port;
51  address dest_addr;
52  guint16 dest_port;
53  guint32 npackets;
54  double apackets;
55  guint32 total_bytes;
56  double average_bw; /* Bits/s */
57 
58  guint32 first_frame_num; /* frame number of first frame */
59  /* start of recording (GMT) of this stream */
60  nstime_t start_abs; /* absolute stream start time */
61  nstime_t start_rel; /* stream start time relative to first packet in capture */
62  nstime_t stop_rel; /* stream stop time relative to first packet in capture */
63  guint16 vlan_id;
64 
65  /*for the sliding window */
66  t_buffer element;
67 
69 
70 typedef struct _mcaststream_tapinfo mcaststream_tapinfo_t;
71 
72 typedef void (*mcaststream_tap_reset_cb)(mcaststream_tapinfo_t *tapinfo);
73 typedef void (*mcaststream_tap_draw_cb)(mcaststream_tapinfo_t *tapinfo);
74 
75 /* structure that holds the information about all detected streams */
76 /* struct holding all information of the tap */
78  gpointer user_data; /* User data pointer */
79  mcaststream_tap_reset_cb tap_reset;
80  mcaststream_tap_draw_cb tap_draw;
81  GList* strinfo_list; /* list of mcast_stream_info_t */
82  guint32 npackets; /* total number of mcast packets of all streams */
83  mcast_stream_info_t* allstreams; /* structure holding information common for all streams */
84 
85  gboolean is_registered; /* if the tap listener is currently registered or not */
86 };
87 
88 
89 extern gint32 mcast_stream_trigger;
90 extern gint32 mcast_stream_bufferalarm;
91 extern guint16 mcast_stream_burstint;
92 extern gint32 mcast_stream_emptyspeed;
93 extern gint32 mcast_stream_cumulemptyspeed;
94 
95 /****************************************************************************/
96 /* INTERFACE */
97 
98 /*
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.
104 */
105 void register_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo);
106 
107 /*
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.
110 */
111 void remove_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo);
112 
113 /*
114 * Cleans up memory of mcast streams tap.
115 */
116 void mcaststream_reset(mcaststream_tapinfo_t *tapinfo);
117 
118 /*
119 * Scans all packets for Mcast streams and updates the Mcast streams list.
120 * (redissects all packets)
121 */
122 void mcaststream_scan(mcaststream_tapinfo_t *tapinfo, capture_file *cap_file);
123 
124 #ifdef __cplusplus
125 }
126 #endif /* __cplusplus */
127 
128 #endif /* __MCAST_STREAM_H__ */
129 
130 /*
131  * Editor modelines - http://www.wireshark.org/tools/modelines.html
132  *
133  * Local variables:
134  * c-basic-offset: 4
135  * tab-width: 8
136  * indent-tabs-mode: nil
137  * End:
138  *
139  * vi: set shiftwidth=4 tabstop=8 expandtab:
140  * :indentSize=4:tabSize=8:noTabs=true:
141  */
mcaststream_tap_reset_cb tap_reset
Definition: mcast_stream.h:79
Definition: nstime.h:27
Definition: mcast_stream.h:30
Definition: mcast_stream.h:48
Definition: cfile.h:58
Definition: mcast_stream.h:77
mcaststream_tap_draw_cb tap_draw
Definition: mcast_stream.h:80
Definition: address.h:47