Fix warnings introduced by "Qt: Initial RTP playback"
[metze/wireshark/wip.git] / ui / voip_calls.h
1 /* voip_calls.h
2  * VoIP calls summary addition for Wireshark
3  *
4  * Copyright 2004, Ericsson , Spain
5  * By Francisco Alcoba <francisco.alcoba@ericsson.com>
6  *
7  * based on h323_calls.h
8  * Copyright 2004, Iskratel, Ltd, Kranj
9  * By Miha Jemec <m.jemec@iskratel.si>
10  *
11  * H323, RTP and Graph Support
12  * By Alejandro Vaquero, alejandro.vaquero@verso.com
13  * Copyright 2005, Verso Technologies Inc.
14  *
15  * Wireshark - Network traffic analyzer
16  * By Gerald Combs <gerald@wireshark.org>
17  * Copyright 1998 Gerald Combs
18  *
19  * This program is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License
21  * as published by the Free Software Foundation; either version 2
22  * of the License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program; if not, write to the Free Software
31  * Foundation,  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
32  */
33
34 #ifndef __VOIP_CALLS_H__
35 #define __VOIP_CALLS_H__
36
37 /** @file
38  *  "VoIP Calls" dialog box common routines.
39  *  @ingroup main_ui_group
40  */
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif /* __cplusplus */
45
46 #include <glib.h>
47 #include <stdio.h>
48
49 #include "epan/address.h"
50 #include "epan/packet.h"
51 #include "epan/guid-utils.h"
52 #include "epan/tap.h"
53 #include "epan/tap-voip.h"
54
55 #include "ui/tap-sequence-analysis.h"
56
57 /****************************************************************************/
58 extern const char *voip_call_state_name[8];
59
60 typedef enum _voip_protocol {
61     VOIP_SIP,
62     VOIP_ISUP,
63     VOIP_H323,
64     VOIP_MGCP,
65     VOIP_AC_ISDN,
66     VOIP_AC_CAS,
67     MEDIA_T38,
68     TEL_H248,
69     TEL_SCCP,
70     TEL_BSSMAP,
71     TEL_RANAP,
72     VOIP_UNISTIM,
73     VOIP_SKINNY,
74     VOIP_IAX2,
75     VOIP_COMMON
76 } voip_protocol;
77
78 typedef enum _hash_indexes {
79     SIP_HASH=0
80 } hash_indexes;
81
82 extern const char *voip_protocol_name[];
83
84 typedef enum _flow_show_options
85 {
86     FLOW_ALL,
87     FLOW_ONLY_INVITES
88 } flow_show_options;
89
90 /** defines specific SIP data */
91
92 typedef enum _sip_call_state {
93     SIP_INVITE_SENT,
94     SIP_200_REC,
95     SIP_CANCEL_SENT
96 } sip_call_state;
97
98 typedef struct _sip_calls_info {
99     gchar *call_identifier;
100     guint32 invite_cseq;
101     sip_call_state sip_state;
102 } sip_calls_info_t;
103
104 /** defines specific ISUP data */
105 typedef struct _isup_calls_info {
106     guint16 cic;
107     guint32 opc, dpc;
108     guint8  ni;
109 } isup_calls_info_t;
110
111 /* defines specific H245 data */
112 typedef struct _h245_address {
113     address h245_address;
114     guint16 h245_port;
115 } h245_address_t;
116
117 /** defines specific H323 data */
118 typedef struct _h323_calls_info {
119     e_guid_t *guid;               /* Call ID to identify a H225 */
120     GList*    h245_list;          /**< list of H245 Address and ports for tunneling off calls*/
121     address   h225SetupAddr;      /**< we use the SETUP H225 IP to determine if packets are forward or reverse */
122     gboolean  is_h245;
123     gboolean  is_faststart_Setup; /**< if faststart field is included in Setup*/
124     gboolean  is_faststart_Proc;  /**< if faststart field is included in Proce, Alerting, Progress or Connect*/
125     gboolean  is_h245Tunneling;
126     gint32    q931_crv;
127     gint32    q931_crv2;
128     guint     requestSeqNum;
129 } h323_calls_info_t;
130
131 /**< defines specific MGCP data */
132 typedef struct _mgcp_calls_info {
133     gchar *endpointId;
134     gboolean fromEndpoint; /**< true if the call was originated from the Endpoint, false for calls from MGC */
135 } mgcp_calls_info_t;
136
137 /** defines specific ACTRACE ISDN data */
138 typedef struct _actrace_isdn_calls_info {
139     gint32 crv;
140     int trunk;
141 } actrace_isdn_calls_info_t;
142
143 /** defines specific ACTRACE CAS data */
144 typedef struct _actrace_cas_calls_info {
145     gint32 bchannel;
146     int trunk;
147 } actrace_cas_calls_info_t;
148
149 /** defines specific SKINNY data */
150 typedef struct _skinny_calls_info {
151     guint32 callId;
152 } skinny_calls_info_t;
153
154 /** defines a voip call */
155 typedef struct _voip_calls_info {
156     voip_call_state         call_state;
157     voip_call_active_state  call_active_state;
158     gchar                  *call_id;
159     gchar                  *from_identity;
160     gchar                  *to_identity;
161     gpointer                prot_info;
162     void (*free_prot_info)(gpointer);
163     address                 initial_speaker;
164     guint32                 npackets;
165     voip_protocol           protocol;
166     gchar                  *protocol_name;
167     gchar                  *call_comment;
168     guint16                 call_num;
169     /**> The frame_data struct holds the frame number and timing information needed. */
170     frame_data             *start_fd;
171     nstime_t                start_rel_ts;
172     frame_data             *stop_fd;
173     nstime_t                stop_rel_ts;
174     gboolean                selected; /* GTK+ only */
175
176 } voip_calls_info_t;
177
178 /**
179  * structure that holds the information about all detected calls */
180 /* struct holding all information of the tap */
181 /*
182  * XXX Most of these are private to voip_calls.c. We might want to
183  * make them private.
184  */
185 struct _h245_labels;
186 typedef struct _voip_calls_tapinfo {
187     tap_reset_cb          tap_reset; /**< tap reset callback */
188     tap_packet_cb         tap_packet; /**< tap per-packet callback */
189     tap_draw_cb           tap_draw; /**< tap draw callback */
190     void                 *tap_data; /**< data for tap callbacks */
191     int                   ncalls; /**< number of call */
192     GQueue*               callsinfos; /**< queue with all calls (voip_calls_info_t) */
193     GHashTable*           callsinfo_hashtable[1]; /**< array of hashes per voip protocol (voip_calls_info_t); currently only the one for SIP is used */
194     int                   npackets; /**< total number of packets of all calls */
195     voip_calls_info_t    *filter_calls_fwd; /**< used as filter in some tap modes */
196     int                   start_packets;
197     int                   completed_calls;
198     int                   rejected_calls;
199     seq_analysis_info_t  *graph_analysis;
200     epan_t               *session; /**< epan session */
201     int                   nrtp_streams; /**< number of rtp streams */
202     GList*                rtp_stream_list; /**< list of rtp_stream_info_t */
203     guint32               rtp_evt_frame_num;
204     guint8                rtp_evt;
205     gboolean              rtp_evt_end;
206     gchar                *sdp_summary;
207     guint32               sdp_frame_num;
208     guint32               mtp3_opc;
209     guint32               mtp3_dpc;
210     guint8                mtp3_ni;
211     guint32               mtp3_frame_num;
212     struct _h245_labels  *h245_labels; /**< H.245 labels */
213     gchar                *q931_calling_number;
214     gchar                *q931_called_number;
215     guint8                q931_cause_value;
216     gint32                q931_crv;
217     guint32               q931_frame_num;
218     guint32               h225_frame_num;
219     guint16               h225_call_num;
220     int                   h225_cstype; /* XXX actually an enum */
221     gboolean              h225_is_faststart;
222     guint32               sip_frame_num;
223     guint32               actrace_frame_num;
224     gint32                actrace_trunk;
225     gint32                actrace_direction;
226     flow_show_options     fs_option;
227     gboolean              redraw;
228 } voip_calls_tapinfo_t;
229
230 #if 0
231 #define VOIP_CALLS_DEBUG(...) { \
232     char *VOIP_CALLS_DEBUG_MSG = g_strdup_printf(__VA_ARGS__); \
233     g_warning("voip_calls: %s:%d %s", G_STRFUNC, __LINE__, VOIP_CALLS_DEBUG_MSG); \
234     g_free(VOIP_CALLS_DEBUG_MSG); \
235 }
236 #else
237 #define VOIP_CALLS_DEBUG()
238 #endif
239
240 /****************************************************************************/
241 /* INTERFACE */
242
243 /**
244  * Registers the voip_calls tap listeners (if not already done).
245  * From that point on, the calls list will be updated with every redissection.
246  * This function is also the entry point for the initialization routine of the tap system.
247  * So whenever voip_calls.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup.
248  * If not, it will be registered on demand by the voip_calls functions that need it.
249  */
250 void voip_calls_init_all_taps(voip_calls_tapinfo_t *tap_id_base);
251
252 /**
253  * Removes the voip_calls tap listener (if not already done)
254  * From that point on, the voip calls list won't be updated any more.
255  */
256 void voip_calls_remove_all_tap_listeners(voip_calls_tapinfo_t *tap_id_base);
257
258 /**
259  * Cleans up memory of voip calls tap.
260  */
261 void voip_calls_reset_all_taps(voip_calls_tapinfo_t *tapinfo);
262
263 #ifdef __cplusplus
264 }
265 #endif /* __cplusplus */
266
267 #endif /* __VOIP_CALLS_H__ */
268
269 /*
270  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
271  *
272  * Local Variables:
273  * c-basic-offset: 4
274  * tab-width: 8
275  * indent-tabs-mode: nil
276  * End:
277  *
278  * ex: set shiftwidth=4 tabstop=8 expandtab:
279  * :indentSize=4:tabSize=8:noTabs=true:
280  */