voip_calls: Move to ui.
[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 #include <glib.h>
38 #include <stdio.h>
39
40 #include "epan/address.h"
41 #include "epan/guid-utils.h"
42 #include "epan/tap-voip.h"
43
44 #include "ui/tap-sequence-analysis.h"
45
46 /****************************************************************************/
47 extern const char *voip_call_state_name[8];
48
49 typedef enum _voip_protocol {
50     VOIP_SIP,
51     VOIP_ISUP,
52     VOIP_H323,
53     VOIP_MGCP,
54     VOIP_AC_ISDN,
55     VOIP_AC_CAS,
56     MEDIA_T38,
57     TEL_H248,
58     TEL_SCCP,
59     TEL_BSSMAP,
60     TEL_RANAP,
61     VOIP_UNISTIM,
62     VOIP_SKINNY,
63     VOIP_IAX2,
64     VOIP_COMMON
65 } voip_protocol;
66
67 typedef enum _hash_indexes {
68     SIP_HASH=0
69 } hash_indexes;
70
71 extern const char *voip_protocol_name[];
72
73 typedef enum _flow_show_options
74 {
75     FLOW_ALL,
76     FLOW_ONLY_INVITES
77 } flow_show_options;
78
79 /** defines specific SIP data */
80
81 typedef enum _sip_call_state {
82     SIP_INVITE_SENT,
83     SIP_200_REC,
84     SIP_CANCEL_SENT
85 } sip_call_state;
86
87 typedef struct _sip_calls_info {
88     gchar *call_identifier;
89     guint32 invite_cseq;
90     sip_call_state sip_state;
91 } sip_calls_info_t;
92
93 /** defines specific ISUP data */
94 typedef struct _isup_calls_info {
95     guint16                     cic;
96     guint32                     opc, dpc;
97     guint8                      ni;
98 } isup_calls_info_t;
99
100 /* defines specific H245 data */
101 typedef struct _h245_address {
102     address h245_address;
103     guint16 h245_port;
104 } h245_address_t;
105
106 /** defines specific H323 data */
107 typedef struct _h323_calls_info {
108     e_guid_t *guid;     /* Call ID to identify a H225 */
109     GList*  h245_list;                          /**< list of H245 Address and ports for tunneling off calls*/
110     address h225SetupAddr;                      /**< we use the SETUP H225 IP to determine if packets are forward or reverse */
111     gboolean is_h245;
112     gboolean is_faststart_Setup;        /**< if faststart field is included in Setup*/
113     gboolean is_faststart_Proc;         /**< if faststart field is included in Proce, Alerting, Progress or Connect*/
114     gboolean is_h245Tunneling;
115     gint32 q931_crv;
116     gint32 q931_crv2;
117     guint requestSeqNum;
118 } h323_calls_info_t;
119
120 /**< defines specific MGCP data */
121 typedef struct _mgcp_calls_info {
122     gchar *endpointId;
123     gboolean fromEndpoint; /**< true if the call was originated from the Endpoint, false for calls from MGC */
124 } mgcp_calls_info_t;
125
126 /** defines specific ACTRACE ISDN data */
127 typedef struct _actrace_isdn_calls_info {
128     gint32 crv;
129     int trunk;
130 } actrace_isdn_calls_info_t;
131
132 /** defines specific ACTRACE CAS data */
133 typedef struct _actrace_cas_calls_info {
134     gint32 bchannel;
135     int trunk;
136 } actrace_cas_calls_info_t;
137
138 /** defines specific SKINNY data */
139 typedef struct _skinny_calls_info {
140     guint32 callId;
141 } skinny_calls_info_t;
142
143 /** defines a voip call */
144 typedef struct _voip_calls_info {
145     voip_call_state call_state;
146     voip_call_active_state call_active_state;
147     gchar *call_id;
148     gchar *from_identity;
149     gchar *to_identity;
150     gpointer prot_info;
151     void(*free_prot_info)(gpointer);
152     address initial_speaker;
153     guint32 npackets;
154     voip_protocol protocol;
155     gchar *protocol_name;
156     gchar *call_comment;
157     guint16 call_num;
158     /**> The frame_data struct holds the frame number and timing information needed. */
159     frame_data *start_fd;
160     nstime_t start_rel_ts;
161     frame_data *stop_fd;
162     nstime_t stop_rel_ts;
163     gboolean selected;
164
165 } voip_calls_info_t;
166
167 /**
168  * structure that holds the information about all detected calls */
169 /* struct holding all information of the tap */
170 /*
171  * XXX Most of these are private to voip_calls.c. We might want to
172  * make them private.
173  */
174 struct _h245_labels;
175 typedef struct _voip_calls_tapinfo {
176     tap_reset_cb tap_reset;                 /**< tap reset callback */
177     tap_packet_cb tap_packet;               /**< tap per-packet callback */
178     tap_draw_cb tap_draw;                   /**< tap draw callback */
179     int ncalls;                             /**< number of call */
180     GQueue* callsinfos;                     /**< queue with all calls */
181     GHashTable* callsinfo_hashtable[1];     /**< array of hashes per voip protocol; currently only the one for SIP is used */
182     int npackets;                           /**< total number of packets of all calls */
183     voip_calls_info_t* filter_calls_fwd;    /**< used as filter in some tap modes */
184     int start_packets;
185     int completed_calls;
186     int rejected_calls;
187     seq_analysis_info_t* graph_analysis;
188     epan_t *session;                        /**< epan session */
189     int nrtp_streams;                       /**< number of rtp streams */
190     GList* rtp_stream_list;                 /**< list with the rtp streams */
191     guint32 rtp_evt_frame_num;
192     guint8 rtp_evt;
193     gboolean rtp_evt_end;
194     gchar *sdp_summary;
195     guint32 sdp_frame_num;
196     guint32 mtp3_opc;
197     guint32 mtp3_dpc;
198     guint8 mtp3_ni;
199     guint32 mtp3_frame_num;
200     struct _h245_labels *h245_labels;       /**< H.245 labels */
201     gchar *q931_calling_number;
202     gchar *q931_called_number;
203     guint8 q931_cause_value;
204     gint32 q931_crv;
205     guint32 q931_frame_num;
206     guint32 h225_frame_num;
207     guint16 h225_call_num;
208     int h225_cstype;                        /* XXX actually an enum */
209     gboolean h225_is_faststart;
210     guint32 actrace_frame_num;
211     gint32 actrace_trunk;
212     gint32 actrace_direction;
213     flow_show_options fs_option;
214     gboolean redraw;
215 } voip_calls_tapinfo_t;
216
217 /****************************************************************************/
218 /* INTERFACE */
219
220 /**
221  * Registers the voip_calls tap listeners (if not already done).
222  * From that point on, the calls list will be updated with every redissection.
223  * This function is also the entry point for the initialization routine of the tap system.
224  * So whenever voip_calls.c is added to the list of WIRESHARK_TAP_SRCs, the tap will be registered on startup.
225  * If not, it will be registered on demand by the voip_calls functions that need it.
226  */
227 void voip_calls_init_all_taps(voip_calls_tapinfo_t *tap_id_base);
228
229 /**
230  * Removes the voip_calls tap listener (if not already done)
231  * From that point on, the voip calls list won't be updated any more.
232  */
233 void voip_calls_remove_all_tap_listeners(voip_calls_tapinfo_t *tap_id_base);
234
235 /**
236  * Cleans up memory of voip calls tap.
237  */
238 void voip_calls_reset(voip_calls_tapinfo_t *tapinfo);
239
240 #endif /* __VOIP_CALLS_H__ */
241
242 /*
243  * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
244  *
245  * Local Variables:
246  * c-basic-offset: 4
247  * tab-width: 8
248  * indent-tabs-mode: nil
249  * End:
250  *
251  * ex: set shiftwidth=4 tabstop=8 expandtab:
252  * :indentSize=4:tabSize=8:noTabs=true:
253  */
254