Use val_to_str_const().
[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 /** @file
41 */
42 #define NB_CAMELSRT_CATEGORY 9+1 /**< Number of type of message */
43 /* for example TC_BEGIN with InitalDP, and TC_CONT with RequestReportBCSMEvent
44    is a category, we want to measure the delay between the two messages */ 
45
46 #define CAMELSRT_SESSION 1
47
48 #define CAMELSRT_VOICE_INITIALDP 2
49 #define CAMELSRT_VOICE_ACR1 3
50 #define CAMELSRT_VOICE_ACR2 4
51 #define CAMELSRT_VOICE_ACR3 5
52 #define CAMELSRT_VOICE_DISC 6
53
54 #define CAMELSRT_GPRS_INITIALDP 7
55 #define CAMELSRT_GPRS_REPORT 8
56
57 #define CAMELSRT_SMS_INITIALDP 9
58
59 WS_VAR_IMPORT const value_string  camelSRTtype_naming[];
60
61 /** If we have a request message and its response,
62    (eg: ApplyCharging, ApplyChargingReport)
63    the frames numbers are stored in this structure */ 
64
65 struct camelsrt_category_t {
66   guint32 req_num;              /**< frame number request seen */
67   guint32 rsp_num;              /**< frame number response seen */
68   nstime_t req_time;    /**< arrival time of request */
69   gboolean responded;   /**< true, if request has been responded */
70 };
71
72 /** List of stored parameters for a Camel dialogue
73    All this parameters are linked to the hash table key below (use of Tid)
74    In case of same Tid reused, the Camel parameters are chained.
75    The right dialogue will be identified with the arrival time of the InitialDP */
76
77 struct camelsrt_call_t {
78   guint32 session_id;    /**< Identify the session, with an internal number */
79   struct tcaphash_context_t * tcap_context;
80   struct camelsrt_category_t category[NB_CAMELSRT_CATEGORY];
81 };
82
83
84 /** The Key for the hash table is the TCAP origine transaction identifier 
85    of the TC_BEGIN containing the InitialDP */
86
87 struct camelsrt_call_info_key_t {
88   guint32 SessionIdKey;
89 };
90
91 /** Info for a couple of messages (or category)
92    The request must be available, not duplicated, 
93    and once the corresponding response received, 
94    we can deduce the Delta Time between Request/response */
95
96 struct camelsrt_msginfo_t {
97   gboolean request_available;
98   gboolean is_duplicate;
99   gboolean is_delta_time;
100   nstime_t req_time;
101   nstime_t delta_time;
102 };
103
104 /** List of infos to store for the analyse */
105
106 struct camelsrt_info_t { 
107   guint32 tcap_session_id;
108   void * tcap_context;
109   guint8 opcode; /**< operation code of message received */
110   guint8 bool_msginfo[NB_CAMELSRT_CATEGORY]; /**< category for the received message */
111   struct camelsrt_msginfo_t msginfo[NB_CAMELSRT_CATEGORY];
112 };
113
114 /**
115  * Routine called when the TAP is initialized.
116  * so hash table are (re)created
117  */
118 void camelsrt_init_routine(void);
119
120 /**
121  * Initialize the Message Info used by the main dissector
122  * Data are linked to a TCAP transaction
123  */
124 struct camelsrt_info_t * camelsrt_razinfo(void);
125
126 /**
127  * Service Response Time analyze, called just after the camel dissector
128  * According to the camel operation, we
129  * - open/close a context for the camel session
130  * - look for a request, or look for the corresponding response
131  */
132 void camelsrt_call_matching(tvbuff_t *tvb,
133                             packet_info * pinfo _U_,
134                             proto_tree *tree,
135                             struct camelsrt_info_t * p_camel_info);
136
137 WS_VAR_IMPORT gboolean gcamel_StatSRT;
138
139 #ifdef __cplusplus
140 }
141 #endif /* __cplusplus */
142
143 #endif /* camel-persistentdata.h */