name change
[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  * 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  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation,  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28  */
29
30 #ifndef Mcast_STREAM_H_INCLUDED
31 #define Mcast_STREAM_H_INCLUDED
32
33 #include <glib.h>
34 #include <stdio.h>
35 #include <epan/address.h>
36
37 /** @file
38  *  ??? 
39  *  @ingroup dialog_group
40  *  @todo what's this?
41  */
42
43 #define INTERFACE        2
44 #define FILTER           3
45 #define TRIGGER          4
46 #define TIMER            5
47 #define REFRESHTIMER     6
48 #define EMPTYSPEED       7
49 #define BUFFERALARM      8
50 #define CUMULEMPTYSPEED  9
51
52 #define MAX_SPEED 200000
53
54 /* typedefs for sliding window and buffer size */
55 typedef struct buffer{
56     struct timeval *buff;   /* packet times */
57     gint32 first;              /* pointer to the first element */
58     gint32 last;               /* pointer to the last element */
59     gint32 burstsize;          /* current burst */
60     gint32 topburstsize;       /* maximum burst in the refresh interval*/
61     gint32 count;              /* packet counter */
62     gint32 burststatus;        /* burst status */
63     gint32 numbursts;          /* number of bursts */
64     gint32 buffusage;         /* buffer usage */
65     gint32 buffstatus;        /* buffer status */
66     gint32 numbuffalarms;      /* number of alarms triggered by buffer underruns */
67     gint32 topbuffusage;      /* top buffer usage in refresh interval */
68     float  maxbw;            /* maximum bandwidth usage */
69 } t_buffer;
70
71
72 /* defines an mcast stream */
73 typedef struct _mcast_stream_info {
74         address src_addr;
75         guint16 src_port;
76         address dest_addr;
77         guint16 dest_port;
78         guint32 npackets;
79         guint32 apackets;
80         guint32 total_bytes;
81         float   average_bw;
82
83         guint32 first_frame_num; /* frame number of first frame */
84         /* start of recording (GMT) of this stream */
85         guint32 start_sec;         /* seconds */
86         guint32 start_usec;        /* microseconds */
87         guint32 start_rel_sec;         /* start stream rel seconds */
88         guint32 start_rel_usec;        /* start stream rel microseconds */
89         guint32 stop_rel_sec;         /* stop stream rel seconds */
90         guint32 stop_rel_usec;        /* stop stream rel microseconds */
91         guint16 vlan_id;
92         
93         /*for the sliding window */
94         t_buffer element;
95
96 } mcast_stream_info_t;
97
98
99 /* structure that holds the information about all detected streams */
100 /* struct holding all information of the tap */
101 typedef struct _mcaststream_tapinfo {
102         int     nstreams;       /* number of streams in the list */
103         GList*  strinfo_list;   /* list with all streams */
104         guint32 npackets;       /* total number of mcast packets of all streams */
105         mcast_stream_info_t* allstreams; /* structure holding information common for all streams */
106
107         guint32 launch_count;   /* number of times the tap has been run */
108         gboolean is_registered; /* if the tap listener is currently registered or not */
109 } mcaststream_tapinfo_t;
110
111 /****************************************************************************/
112 /* INTERFACE */
113
114 /*
115 * Registers the mcast_streams tap listener (if not already done).
116 * From that point on, the Mcast streams list will be updated with every redissection.
117 * This function is also the entry point for the initialization routine of the tap system.
118 * So whenever mcast_stream.c is added to the list of ETHEREAL_TAP_SRCs, the tap will be registered on startup.
119 * If not, it will be registered on demand by the mcast_streams and mcast_analysis functions that need it.
120 */
121 void register_tap_listener_mcast_stream(void);
122
123 /*
124 * Removes the mcast_streams tap listener (if not already done)
125 * From that point on, the Mcast streams list won't be updated any more.
126 */
127 void remove_tap_listener_mcast_stream(void);
128
129 /*
130 * Retrieves a constant reference to the unique info structure of the mcast_streams tap listener.
131 * The user should not modify the data pointed to.
132 */
133 const mcaststream_tapinfo_t* mcaststream_get_info(void);
134
135 /*
136 * Cleans up memory of mcast streams tap.
137 */
138 void mcaststream_reset(mcaststream_tapinfo_t *tapinfo);
139
140 /*
141 * Scans all packets for Mcast streams and updates the Mcast streams list.
142 * (redissects all packets)
143 */
144 void mcaststream_scan(void);
145
146 #endif /*Mcast_STREAM_H_INCLUDED*/