Trying to get buildbot Ubuntu-5.10-x86 to build again.
[obnox/wireshark/wip.git] / gtk / voip_calls.h
1 /* voip_calls.h
2  * VoIP calls summary addition for Wireshark
3  *
4  * $Id$
5  *
6  * Copyright 2004, Ericsson , Spain
7  * By Francisco Alcoba <francisco.alcoba@ericsson.com>
8  *
9  * based on h323_calls.h
10  * Copyright 2004, Iskratel, Ltd, Kranj
11  * By Miha Jemec <m.jemec@iskratel.si>
12  *
13  * H323, RTP and Graph Support
14  * By Alejandro Vaquero, alejandro.vaquero@verso.com
15  * Copyright 2005, Verso Technologies Inc.
16  *
17  * Wireshark - Network traffic analyzer
18  * By Gerald Combs <gerald@wireshark.org>
19  * Copyright 1998 Gerald Combs
20  *
21  * This program is free software; you can redistribute it and/or
22  * modify it under the terms of the GNU General Public License
23  * as published by the Free Software Foundation; either version 2
24  * of the License, or (at your option) any later version.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29  * GNU General Public License for more details.
30  *
31  * You should have received a copy of the GNU General Public License
32  * along with this program; if not, write to the Free Software
33  * Foundation,  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
34  */
35
36 #ifndef VOIP_CALLS_H_INCLUDED
37 #define VOIP_CALLS_H_INCLUDED
38
39 #include <glib.h>
40 #include <stdio.h>
41 #include <epan/address.h>
42 #include <epan/guid-utils.h>
43
44 /****************************************************************************/
45 /* defines voip call state */
46 typedef enum _voip_call_state {
47         VOIP_CALL_SETUP,
48         VOIP_RINGING,
49         VOIP_IN_CALL,
50         VOIP_CANCELLED,
51         VOIP_COMPLETED,
52         VOIP_REJECTED,
53         VOIP_UNKNOWN
54 } voip_call_state;
55
56 extern const char *voip_call_state_name[7];
57
58 typedef enum _voip_call_active_state {
59         VOIP_ACTIVE,
60         VOIP_INACTIVE
61 } voip_call_active_state;
62
63 typedef enum _voip_protocol {
64                 VOIP_SIP,
65                 VOIP_ISUP,
66                 VOIP_H323,
67                 VOIP_MGCP,
68                 VOIP_AC_ISDN,
69                 VOIP_AC_CAS,
70                 MEDIA_T38
71 } voip_protocol;
72
73 extern const char *voip_protocol_name[7];
74
75 /* defines specific SIP data */
76
77 typedef enum _sip_call_state {
78         SIP_INVITE_SENT,
79         SIP_200_REC,
80         SIP_CANCEL_SENT
81 } sip_call_state;
82
83 typedef struct _sip_calls_info {
84         gchar *call_identifier;
85         guint32 invite_cseq;
86         sip_call_state sip_state;
87 } sip_calls_info_t;
88
89 /* defines specific ISUP data */
90 typedef struct _isup_calls_info {
91         guint16                 cic;
92         guint32                 opc, dpc;
93         guint8                  ni;
94 } isup_calls_info_t;
95
96 /* defines specific H245 data */
97 typedef struct _h245_address {
98         address h245_address;
99         guint16 h245_port;
100 } h245_address_t;
101
102 /* defines specific H323 data */
103 typedef struct _h323_calls_info {
104         e_guid_t *guid; /* Call ID to identify a H225 */
105         GList*  h245_list;   /* list of H245 Address and ports for tunneling off calls*/
106         address h225SetupAddr; /* we use the SETUP H225 IP to determine if packets are forward or reverse */                                    
107         gboolean is_h245;
108         gboolean is_faststart_Setup;    /* if faststart field is included in Setup*/
109         gboolean is_faststart_Proc;             /* if faststart field is included in Proce, Alerting, Progress or Connect*/
110         gboolean is_h245Tunneling;
111         gint32 q931_crv;
112         gint32 q931_crv2;
113         guint requestSeqNum;
114 } h323_calls_info_t;
115
116 /* defines specific MGCP data */
117 typedef struct _mgcp_calls_info {
118         gchar *endpointId;
119         gboolean fromEndpoint; /* true if the call was originated from the Endpoint, false for calls from MGC */
120 } mgcp_calls_info_t;
121
122 /* defines specific ACTRACE ISDN data */
123 typedef struct _actrace_isdn_calls_info {
124         gint32 crv;
125         int trunk;
126 } actrace_isdn_calls_info_t;
127
128 /* defines specific ACTRACE CAS data */
129 typedef struct _actrace_cas_calls_info {
130         gint32 bchannel;
131         int trunk;
132 } actrace_cas_calls_info_t;
133
134 /* defines a voip call */
135 typedef struct _voip_calls_info {
136         voip_call_state call_state;
137         voip_call_active_state call_active_state;
138         gchar *from_identity;
139         gchar *to_identity;
140         gpointer prot_info;
141         address initial_speaker;
142         guint32 npackets;
143         guint32 first_frame_num; /* frame number of first frame */
144         guint32 last_frame_num; 
145         voip_protocol protocol;
146         guint16 call_num;
147         gint32 start_sec, start_usec, stop_sec, stop_usec;
148         gboolean selected;
149
150 } voip_calls_info_t;
151
152 /* structure that holds the information about all detected calls */
153 /* struct holding all information of the tap */
154
155 typedef struct _voip_calls_tapinfo {
156         int     ncalls;       /* number of call */
157         GList*  strinfo_list;   /* list with all calls */
158         int     npackets;       /* total number of packets of all calls */
159         voip_calls_info_t* filter_calls_fwd;  /* used as filter in some tap modes */
160         guint32 launch_count;   /* number of times the tap has been run */
161         int start_packets;
162         int completed_calls;
163         int rejected_calls;
164         graph_analysis_info_t* graph_analysis;
165         gboolean redraw;
166         /* 
167          * Now add dummy variables, one for each tap listener.
168          * Their address will be used to distinguish between them.
169          */
170         int sip_dummy;
171         int sdp_dummy;
172         int h225_dummy;
173         int h245dg_dummy;
174         int mtp3_dummy;
175         int isup_dummy;
176         int q931_dummy;
177         int mgcp_dummy;
178         int actrace_dummy;
179         int t38_dummy;
180 } voip_calls_tapinfo_t;
181
182
183 /* defines a RTP stream */
184 typedef struct _voip_rtp_stream_info {
185         address src_addr;
186         guint16 src_port;
187         address dest_addr;
188         guint16 dest_port;
189         guint32 ssrc;
190         guint32  pt;
191         gchar *pt_str;
192         guint32 npackets;
193         gboolean end_stream;
194
195         guint32 first_frame_num; /* frame number of first frame */
196         guint32 setup_frame_number; /* frame number of setup message */
197         /* start of recording (GMT) of this stream */
198         guint32 start_rel_sec;         /* start stream rel seconds */
199         guint32 start_rel_usec;        /* start stream rel microseconds */
200         guint32 stop_rel_sec;         /* stop stream rel seconds */
201         guint32 stop_rel_usec;        /* stop stream rel microseconds */
202         gint32 rtp_event;
203 } voip_rtp_stream_info_t;
204
205 /* structure that holds the information about all RTP streams associated with the calls */
206 /* struct holding all information of the RTP tap */
207 typedef struct _voip_rtp_tapinfo {
208         int     nstreams;       /* number of rtp streams */
209         GList*  list;                   /* list with the rtp streams */
210         int rtp_dummy;
211         int rtp_event_dummy;
212 } voip_rtp_tapinfo_t;
213
214 /****************************************************************************/
215 /* INTERFACE */
216
217 /*
218 * Registers the voip_calls tap listeners (if not already done).
219 * From that point on, the calls list will be updated with every redissection.
220 * This function is also the entry point for the initialization routine of the tap system.
221 * So whenever voip_calls.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup.
222 * If not, it will be registered on demand by the voip_calls functions that need it.
223 */
224 void sip_calls_init_tap(void);
225 void isup_calls_init_tap(void);
226 void mtp3_calls_init_tap(void);
227 void h225_calls_init_tap(void);
228 void h245dg_calls_init_tap(void);
229 void q931_calls_init_tap(void);
230 void sdp_calls_init_tap(void);
231 void rtp_init_tap(void);
232 void rtp_event_init_tap(void);
233 void mgcp_calls_init_tap(void);
234 void actrace_calls_init_tap(void);
235 void t38_init_tap(void);
236
237 /*
238 * Removes the voip_calls tap listener (if not already done)
239 * From that point on, the voip calls list won't be updated any more.
240 */
241 void remove_tap_listener_sip_calls(void);
242 void remove_tap_listener_isup_calls(void);
243 void remove_tap_listener_mtp3_calls(void);
244 void remove_tap_listener_h225_calls(void);
245 void remove_tap_listener_h245dg_calls(void);
246 void remove_tap_listener_q931_calls(void);
247 void remove_tap_listener_sdp_calls(void);
248 void remove_tap_listener_rtp(void);
249 void remove_tap_listener_rtp_event(void);
250 void remove_tap_listener_mgcp_calls(void);
251 void remove_tap_listener_actrace_calls(void);
252 void remove_tap_listener_t38(void);
253
254 /*
255 * Retrieves a constant reference to the unique info structure of the voip_calls tap listener.
256 * The user should not modify the data pointed to.
257 */
258 voip_calls_tapinfo_t* voip_calls_get_info(void);
259
260 /*
261 * Cleans up memory of voip calls tap.
262 */
263 void voip_calls_reset(voip_calls_tapinfo_t *tapinfo);
264 void isup_calls_reset(voip_calls_tapinfo_t *tapinfo);
265 void mtp3_calls_reset(voip_calls_tapinfo_t *tapinfo);
266 void q931_calls_reset(voip_calls_tapinfo_t *tapinfo);
267
268 void graph_analysis_data_init(void);
269
270 #endif /*VOIP_CALLS_H_INCLUDED*/