Add $Id$
[obnox/wireshark/wip.git] / epan / camel-persistentdata.h
1 /*
2  * camel-persistentdata.h
3  * Definitions for lists and hash tables used in wireshark's camel dissector
4  * for calculation of delays in camel-transactions
5  * Copyright 2006 Florent Drouin
6  *
7  * $Id$
8  *
9  * Wireshark - Network traffic analyzer
10  * By Gerald Combs <gerald@wireshark.org>
11  * Copyright 1998 Gerald Combs
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26  */
27
28 #ifndef __CAMEL_PERSISTENTDATA_H__
29 #define __CAMEL_PERSISTENTDATA_H__
30
31 #include <epan/packet.h>
32 #include <epan/conversation.h>
33 #include <epan/dissectors/packet-camel.h>
34 #include <epan/tcap-persistentdata.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39
40 #define NB_CAMELSRT_CATEGORY 9+1 /* Number of type of message */
41 /* for example TC_BEGIN with InitalDP, and TC_CONT with RequestReportBCSMEvent
42    is a category, we want to measure the delay between the two messages */ 
43
44 #define CAMELSRT_SESSION 1
45
46 #define CAMELSRT_VOICE_INITIALDP 2
47 #define CAMELSRT_VOICE_ACR1 3
48 #define CAMELSRT_VOICE_ACR2 4
49 #define CAMELSRT_VOICE_ACR3 5
50 #define CAMELSRT_VOICE_DISC 6
51
52 #define CAMELSRT_GPRS_INITIALDP 7
53 #define CAMELSRT_GPRS_REPORT 8
54
55 #define CAMELSRT_SMS_INITIALDP 9
56
57 WS_VAR_IMPORT const value_string  camelSRTtype_naming[];
58
59 /* If we have a request message and its response,
60    (eg: ApplyCharging, ApplyChargingReport)
61    the frames numbers are stored in this structure */ 
62
63 struct camelsrt_category_t {
64   guint32 req_num;      /* frame number request seen */
65   guint32 rsp_num;      /* frame number response seen */
66   nstime_t req_time;    /* arrival time of request */
67   gboolean responded;   /* true, if request has been responded */
68 };
69
70 /* List of stored parameters for a Camel dialogue
71    All this parameters are linked to the hash table key below (use of Tid)
72    In case of same Tid reused, the Camel parameters are chained.
73    The right dialogue will be identified with the arrival time of the InitialDP */
74
75 struct camelsrt_call_t {
76   guint32 session_id;    /* Identify the session, with an internal number */
77   struct tcaphash_context_t * tcap_context;
78   struct camelsrt_category_t category[NB_CAMELSRT_CATEGORY];
79 };
80
81
82 /* The Key for the hash table is the TCAP origine transaction identifier 
83    of the TC_BEGIN containing the InitialDP */
84
85 struct camelsrt_call_info_key_t {
86   guint32 SessionIdKey;
87 };
88
89 /* Info for a couple of messages (or category)
90    The request must be available, not duplicated, 
91    and once the corresponding response received, 
92    we can deduce the Delta Time between Request/response */
93
94 struct camelsrt_msginfo_t {
95   gboolean request_available;
96   gboolean is_duplicate;
97   gboolean is_delta_time;
98   nstime_t req_time;
99   nstime_t delta_time;
100 };
101
102 /* List of infos to store for the analyse */
103
104 struct camelsrt_info_t { 
105   guint32 tcap_session_id;
106   void * tcap_context;
107   guint8 opcode; /* operation code of message received */
108   guint8 bool_msginfo[NB_CAMELSRT_CATEGORY]; /* category for the received message */
109   struct camelsrt_msginfo_t msginfo[NB_CAMELSRT_CATEGORY];
110 };
111
112 void camelsrt_init_routine(void);
113
114 struct camelsrt_info_t * camelsrt_razinfo(void);
115
116 void camelsrt_call_matching(tvbuff_t *tvb,
117                             packet_info * pinfo _U_,
118                             proto_tree *tree,
119                             struct camelsrt_info_t * p_camel_info);
120
121 WS_VAR_IMPORT gboolean gcamel_StatSRT;
122
123 #ifdef __cplusplus
124 }
125 #endif /* __cplusplus */
126
127 #endif /* camel-persistentdata.h */