Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
mcast_stream.h
Go to the documentation of this file.
1
18#ifndef __MCAST_STREAM_H__
19#define __MCAST_STREAM_H__
20
21#include <epan/tap.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif /* __cplusplus */
26
27#define MAX_SPEED 200000
28
29/* typedefs for sliding window and buffer size */
30typedef 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 */
44} t_buffer;
45
46
47/* defines an mcast stream */
48/* XXX - Not all of these seem to be used? */
49typedef struct _mcast_stream_info {
50 address src_addr;
51 uint16_t src_port;
52 address dest_addr;
53 uint16_t dest_port;
54 uint32_t npackets;
55 double apackets;
56 uint64_t total_bytes;
57 double average_bw; /* Bits/s */
58
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 */
64
65 /*for the sliding window */
66 t_buffer element;
67
69
71
72typedef void (*mcaststream_tap_reset_cb)(mcaststream_tapinfo_t *tapinfo);
73typedef 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 void *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 uint32_t npackets; /* total number of mcast packets of all streams */
83 mcast_stream_info_t* allstreams; /* structure holding information common for all streams */
84
85 bool is_registered; /* if the tap listener is currently registered or not */
86};
87
88
89extern int32_t mcast_stream_trigger;
90extern int32_t mcast_stream_bufferalarm;
91extern uint16_t mcast_stream_burstint;
92extern int32_t mcast_stream_emptyspeed;
93extern int32_t 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*/
105GString * 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*/
111void remove_tap_listener_mcast_stream(mcaststream_tapinfo_t *tapinfo);
112
113/*
114* Cleans up memory of mcast streams tap.
115*/
116void mcaststream_reset(mcaststream_tapinfo_t *tapinfo);
117
118/*
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.
122*/
123tap_packet_status mcaststream_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const void *data, tap_flags_t flags);
124
125#ifdef __cplusplus
126}
127#endif /* __cplusplus */
128
129#endif /* __MCAST_STREAM_H__ */
Definition address.h:56
Definition mcast_stream.h:49
Definition mcast_stream.h:77
mcaststream_tap_draw_cb tap_draw
Definition mcast_stream.h:80
mcaststream_tap_reset_cb tap_reset
Definition mcast_stream.h:79
Definition packet_info.h:43
Definition mcast_stream.h:30
Definition epan_dissect.h:28
Definition nstime.h:26
tap_packet_status
Definition tap.h:25