Rename crypt-xxx to xxx
[obnox/wireshark/wip.git] / epan / tcap-persistentdata.h
1 /*
2  * tcap-persistentdata.h
3  * Definitions for lists and hash tables used in wireshark's tcap dissector
4  * for calculation of delays in tcap-transactions
5  * Copyright 2006 Florent Drouin (based on h225-persistentdata from Lars Roland)
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
11  * $Id$
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 __tcapsrt_HASH__
29 #define __tcapsrt_HASH__
30
31 #include <epan/packet.h>
32 #include <epan/conversation.h>
33 #include <epan/dissectors/packet-tcap.h>
34 /** @file
35  * lists and hash tables used in wireshark's tcap dissector
36  * for calculation of delays in tcap-calls
37  */
38
39 #define LENGTH_OID 23
40 struct tcaphash_context_t {
41   struct tcaphash_context_key_t * key;
42   guint32 session_id;
43   guint32 first_frame;
44   guint32 last_frame;
45   nstime_t begin_time;  /**< time of arrival of TC_BEGIN */
46   nstime_t end_time;    /**< time of closing message */
47   gboolean responded;   /**< true, if request has been responded */
48   gboolean closed;
49   gboolean upper_dissector;
50   gboolean oid_present;
51   gchar oid[LENGTH_OID+1];
52   gboolean subdissector_present;
53   dissector_handle_t subdissector_handle;
54   void (* callback) (tvbuff_t *,packet_info *, proto_tree *, struct tcaphash_context_t *);
55   struct tcaphash_begincall_t * begincall;
56   struct tcaphash_contcall_t * contcall;
57   struct tcaphash_endcall_t * endcall;
58   struct tcaphash_ansicall_t * ansicall;
59 };
60
61 struct tcaphash_begincall_t {
62   struct tcaphash_begin_info_key_t * beginkey;
63   struct tcaphash_context_t * context;
64   gboolean father;
65   struct tcaphash_begincall_t * next_begincall;
66   struct tcaphash_begincall_t * previous_begincall;
67 };
68
69 struct tcaphash_contcall_t {
70   struct tcaphash_cont_info_key_t * contkey;
71   struct tcaphash_context_t * context;
72   gboolean father;
73   struct tcaphash_contcall_t * next_contcall;
74   struct tcaphash_contcall_t * previous_contcall;
75 };
76
77 struct tcaphash_endcall_t {
78   struct tcaphash_end_info_key_t * endkey;
79   struct tcaphash_context_t * context;
80   gboolean father;
81   struct tcaphash_endcall_t * next_endcall;
82   struct tcaphash_endcall_t * previous_endcall;
83 };
84
85 struct tcaphash_ansicall_t {
86   struct tcaphash_ansi_info_key_t * ansikey;
87   struct tcaphash_context_t * context;
88   gboolean father;
89   struct tcaphash_ansicall_t * next_ansicall;
90   struct tcaphash_ansicall_t * previous_ansicall;
91 };
92
93 /** The Key for the hash table is the TCAP origine transaction identifier
94    of the TC_BEGIN containing the InitialDP */
95
96 struct tcaphash_context_key_t {
97   guint32 session_id;
98 };
99
100 struct tcaphash_begin_info_key_t {
101   guint32 hashKey;
102   guint32 tid;
103   guint32 opc_hash;
104   guint32 dpc_hash;
105 };
106
107 struct tcaphash_cont_info_key_t {
108   guint32 hashKey;
109   guint32 src_tid;
110   guint32 dst_tid;
111   guint32 opc_hash;
112   guint32 dpc_hash;
113 };
114
115 struct tcaphash_end_info_key_t {
116   guint32 hashKey;
117   guint32 tid;
118   guint32 opc_hash;
119   guint32 dpc_hash;
120 };
121
122 struct tcaphash_ansi_info_key_t {
123   guint32 hashKey;
124   guint32 tid;
125   guint32 opc_hash;
126   guint32 dpc_hash;
127 };
128
129
130 /** List of infos to store for the analyse */
131 struct tcapsrt_info_t {
132   guint32 tcap_session_id;
133   guint32 src_tid;
134   guint32 dst_tid;
135   guint8 ope;
136 };
137
138 /**
139  * Routine called when the TAP is initialized.
140  * so hash table are (re)created
141  */
142 void tcapsrt_init_routine(void);
143
144 /**
145  * Initialize the Message Info used by the main dissector
146  * Data are linked to a TCAP transaction
147  */
148 struct tcapsrt_info_t * tcapsrt_razinfo(void);
149
150 void tcapsrt_close(struct tcaphash_context_t * p_tcaphash_context,
151                    packet_info * pinfo _U_);
152
153 /**
154  * Service Response Time analyze
155  * Called just after dissector call
156  * Associate a TCAP context to a tcap session and display session related infomations
157  * like the first frame, the last, the session duration,
158  * and a uniq session identifier for the filtering
159  *
160  * For ETSI tcap, the TCAP context can be reached through three keys
161  * - a key (BEGIN) identifying the session according to the tcap source identifier
162  * - a key (CONT) identifying the established session (src_id and dst_id)
163  * - a key (END) identifying the session according to the tcap destination identifier
164  *
165  * For ANSI tcap, the TCAP context is reached through a uniq key
166  * - a key (ANSI) identifying the session according to the tcap identifier
167 */
168 struct tcaphash_context_t * tcapsrt_call_matching(tvbuff_t *tvb,
169                                                   packet_info * pinfo _U_,
170                                                   proto_tree *tree,
171                                                   struct tcapsrt_info_t * p_tcap_info);
172
173 WS_VAR_IMPORT gboolean gtcap_StatSRT;
174
175 #endif /* __tcapsrt_HASH__*/