last round to replace SIGNAL_CONNECT with g_signal_connect
[obnox/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_INCLUDED
33 #define Mcast_STREAM_H_INCLUDED
34
35 #include <glib.h>
36 #include <stdio.h>
37 #include <epan/address.h>
38
39 /** @file
40  *  ??? 
41  *  @ingroup dialog_group
42  *  @todo what's this?
43  */
44
45 #define INTERFACE        2
46 #define FILTER           3
47 #define TRIGGER          4
48 #define TIMER            5
49 #define REFRESHTIMER     6
50 #define EMPTYSPEED       7
51 #define BUFFERALARM      8
52 #define CUMULEMPTYSPEED  9
53
54 #define MAX_SPEED 200000
55
56 /* typedefs for sliding window and buffer size */
57 typedef struct buffer{
58     struct timeval *buff;   /* packet times */
59     gint32 first;              /* pointer to the first element */
60     gint32 last;               /* pointer to the last element */
61     gint32 burstsize;          /* current burst */
62     gint32 topburstsize;       /* maximum burst in the refresh interval*/
63     gint32 count;              /* packet counter */
64     gint32 burststatus;        /* burst status */
65     gint32 numbursts;          /* number of bursts */
66     gint32 buffusage;         /* buffer usage */
67     gint32 buffstatus;        /* buffer status */
68     gint32 numbuffalarms;      /* number of alarms triggered by buffer underruns */
69     gint32 topbuffusage;      /* top buffer usage in refresh interval */
70     float  maxbw;            /* maximum bandwidth usage */
71 } t_buffer;
72
73
74 /* defines an mcast stream */
75 typedef struct _mcast_stream_info {
76         address src_addr;
77         guint16 src_port;
78         address dest_addr;
79         guint16 dest_port;
80         guint32 npackets;
81         guint32 apackets;
82         guint32 total_bytes;
83         float   average_bw;
84
85         guint32 first_frame_num; /* frame number of first frame */
86         /* start of recording (GMT) of this stream */
87         guint32 start_sec;         /* seconds */
88         guint32 start_usec;        /* microseconds */
89         guint32 start_rel_sec;         /* start stream rel seconds */
90         guint32 start_rel_usec;        /* start stream rel microseconds */
91         guint32 stop_rel_sec;         /* stop stream rel seconds */
92         guint32 stop_rel_usec;        /* stop stream rel microseconds */
93         guint16 vlan_id;
94         
95         /*for the sliding window */
96         t_buffer element;
97
98 } mcast_stream_info_t;
99
100
101 /* structure that holds the information about all detected streams */
102 /* struct holding all information of the tap */
103 typedef struct _mcaststream_tapinfo {
104         int     nstreams;       /* number of streams in the list */
105         GList*  strinfo_list;   /* list with all streams */
106         guint32 npackets;       /* total number of mcast packets of all streams */
107         mcast_stream_info_t* allstreams; /* structure holding information common for all streams */
108
109         guint32 launch_count;   /* number of times the tap has been run */
110         gboolean is_registered; /* if the tap listener is currently registered or not */
111 } mcaststream_tapinfo_t;
112
113 /****************************************************************************/
114 /* INTERFACE */
115
116 /*
117 * Registers the mcast_streams tap listener (if not already done).
118 * From that point on, the Mcast streams list will be updated with every redissection.
119 * This function is also the entry point for the initialization routine of the tap system.
120 * So whenever mcast_stream.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup.
121 * If not, it will be registered on demand by the mcast_streams and mcast_analysis functions that need it.
122 */
123 void register_tap_listener_mcast_stream(void);
124
125 /*
126 * Removes the mcast_streams tap listener (if not already done)
127 * From that point on, the Mcast streams list won't be updated any more.
128 */
129 void remove_tap_listener_mcast_stream(void);
130
131 /*
132 * Retrieves a constant reference to the unique info structure of the mcast_streams tap listener.
133 * The user should not modify the data pointed to.
134 */
135 const mcaststream_tapinfo_t* mcaststream_get_info(void);
136
137 /*
138 * Cleans up memory of mcast streams tap.
139 */
140 void mcaststream_reset(mcaststream_tapinfo_t *tapinfo);
141
142 /*
143 * Scans all packets for Mcast streams and updates the Mcast streams list.
144 * (redissects all packets)
145 */
146 void mcaststream_scan(void);
147
148 #endif /*Mcast_STREAM_H_INCLUDED*/