Have the time field in the Graph Analyzis windos use the same time format as used...
[metze/wireshark/wip.git] / gtk / 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  * $Id$
8  *
9  * based on rtp_stream.h
10  * Copyright 2003, Alcatel Business Systems
11  * By Lars Ruoff <lars.ruoff@gmx.net>
12  *
13  * Wireshark - Network traffic analyzer
14  * By Gerald Combs <gerald@wireshark.org>
15  * Copyright 1998 Gerald Combs
16  *
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU General Public License
19  * as published by the Free Software Foundation; either version 2
20  * of the License, or (at your option) any later version.
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation,  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
30  */
31
32 #ifndef __MCAST_STREAM_H__
33 #define __MCAST_STREAM_H__
34
35 #define MAX_SPEED 200000
36
37 /* typedefs for sliding window and buffer size */
38 typedef struct buffer{
39         struct timeval *buff;   /* packet times */
40         gint32 first;              /* pointer to the first element */
41         gint32 last;               /* pointer to the last element */
42         gint32 burstsize;          /* current burst */
43         gint32 topburstsize;       /* maximum burst in the refresh interval*/
44         gint32 count;              /* packet counter */
45         gint32 burststatus;        /* burst status */
46         gint32 numbursts;          /* number of bursts */
47         gint32 buffusage;          /* buffer usage */
48         gint32 buffstatus;         /* buffer status */
49         gint32 numbuffalarms;      /* number of alarms triggered by buffer underruns */
50         gint32 topbuffusage;       /* top buffer usage in refresh interval */
51         float  maxbw;              /* maximum bandwidth usage */
52 } t_buffer;
53
54
55 /* defines an mcast stream */
56 typedef struct _mcast_stream_info {
57         address src_addr;
58         guint16 src_port;
59         address dest_addr;
60         guint16 dest_port;
61         guint32 npackets;
62         guint32 apackets;
63         guint32 total_bytes;
64         float   average_bw;
65
66         guint32 first_frame_num; /* frame number of first frame */
67         /* start of recording (GMT) of this stream */
68         guint32 start_sec;         /* seconds */
69         guint32 start_usec;        /* microseconds */
70         guint32 start_rel_sec;     /* start stream rel seconds */
71         guint32 start_rel_usec;    /* start stream rel microseconds */
72         guint32 stop_rel_sec;      /* stop stream rel seconds */
73         guint32 stop_rel_usec;     /* stop stream rel microseconds */
74         guint16 vlan_id;
75
76         /*for the sliding window */
77         t_buffer element;
78
79 } mcast_stream_info_t;
80
81
82 /* structure that holds the information about all detected streams */
83 /* struct holding all information of the tap */
84 typedef struct _mcaststream_tapinfo {
85         int     nstreams;       /* number of streams in the list */
86         GList*  strinfo_list;   /* list with all streams */
87         guint32 npackets;       /* total number of mcast packets of all streams */
88         mcast_stream_info_t* allstreams; /* structure holding information common for all streams */
89
90         guint32 launch_count;   /* number of times the tap has been run */
91         gboolean is_registered; /* if the tap listener is currently registered or not */
92 } mcaststream_tapinfo_t;
93
94
95 extern gint32  mcast_stream_trigger;
96 extern gint32  mcast_stream_bufferalarm;
97 extern guint16 mcast_stream_burstint;
98 extern gint32  mcast_stream_emptyspeed;
99 extern gint32  mcast_stream_cumulemptyspeed;
100
101 /****************************************************************************/
102 /* INTERFACE */
103
104 /*
105 * Registers the mcast_streams tap listener (if not already done).
106 * From that point on, the Mcast streams list will be updated with every redissection.
107 * This function is also the entry point for the initialization routine of the tap system.
108 * So whenever mcast_stream.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup.
109 * If not, it will be registered on demand by the mcast_streams and mcast_analysis functions that need it.
110 */
111 void register_tap_listener_mcast_stream(void);
112
113 /*
114 * Removes the mcast_streams tap listener (if not already done)
115 * From that point on, the Mcast streams list won't be updated any more.
116 */
117 void remove_tap_listener_mcast_stream(void);
118
119 /*
120 * Retrieves a constant reference to the unique info structure of the mcast_streams tap listener.
121 * The user should not modify the data pointed to.
122 */
123 const mcaststream_tapinfo_t* mcaststream_get_info(void);
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(void);
135
136 #endif /* __MCAST_STREAM_H__ */