From Florent Drouin:
[obnox/wireshark/wip.git] / epan / dissectors / packet-tcap.c
1 /* Do not modify this file.                                                   */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler   */
3 /* .\packet-tcap.c                                                            */
4 /* ../../tools/asn2wrs.py -b -e -p tcap -c tcap.cnf -s packet-tcap-template tcap.asn */
5
6 /* Input file: packet-tcap-template.c */
7
8 #line 1 "packet-tcap-template.c"
9 /* packet-tcap-template.c
10  * Routines for  TCAP
11  * Copyright 2004 - 2005, Tim Endean <endeant@hotmail.com>
12  * Built from the gsm-map dissector Copyright 2004 - 2005, Anders Broman <anders.broman@ericsson.com>
13  *
14  * $Id$
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
32  * References: ETSI 300 374
33  */
34
35 #ifdef HAVE_CONFIG_H
36 # include "config.h"
37 #endif
38
39 #include <glib.h>
40 #include <epan/packet.h>
41 #include <epan/prefs.h>
42 #include <epan/conversation.h>
43 #include <epan/oid_resolv.h>
44 #include <epan/emem.h>
45
46 #include <stdio.h>
47 #include <string.h>
48 #include "packet-ber.h"
49 #include "packet-tcap.h"
50 #include "epan/tcap-persistentdata.h"
51
52 #define PNAME  "Transaction Capabilities Application Part"
53 #define PSNAME "TCAP"
54 #define PFNAME "tcap"
55
56 /* Initialize the protocol and registered fields */
57 int proto_tcap = -1;
58 static int hf_tcap_tag = -1; 
59 static int hf_tcap_length = -1; 
60 static int hf_tcap_data = -1;
61 static int hf_tcap_tid = -1;
62
63 int hf_tcapsrt_SessionId=-1;
64 int hf_tcapsrt_Duplicate=-1;
65 int hf_tcapsrt_BeginSession=-1;
66 int hf_tcapsrt_EndSession=-1;
67 int hf_tcapsrt_SessionTime=-1;
68
69
70 /*--- Included file: packet-tcap-hf.c ---*/
71 #line 1 "packet-tcap-hf.c"
72 static int hf_tcap_dialogueRequest = -1;          /* AARQ_apdu */
73 static int hf_tcap_dialogueResponse = -1;         /* AARE_apdu */
74 static int hf_tcap_dialogueAbort = -1;            /* ABRT_apdu */
75 static int hf_tcap_oid = -1;                      /* OBJECT_IDENTIFIER */
76 static int hf_tcap_dialog = -1;                   /* Dialog1 */
77 static int hf_tcap_useroid = -1;                  /* UserInfoOID */
78 static int hf_tcap_externuserinfo = -1;           /* ExternUserInfo */
79 static int hf_tcap_protocol_versionrq = -1;       /* T_protocol_versionrq */
80 static int hf_tcap_application_context_name = -1;  /* Applicationcontext */
81 static int hf_tcap_user_information = -1;         /* User_information */
82 static int hf_tcap_protocol_versionre = -1;       /* T_protocol_versionre */
83 static int hf_tcap_result = -1;                   /* Associate_result */
84 static int hf_tcap_result_source_diagnostic = -1;  /* Associate_source_diagnostic */
85 static int hf_tcap_reasonrq = -1;                 /* Release_request_reason */
86 static int hf_tcap_reasonre = -1;                 /* Release_response_reason */
87 static int hf_tcap_abort_source = -1;             /* ABRT_source */
88 static int hf_tcap_dialogue_service_user = -1;    /* T_dialogue_service_user */
89 static int hf_tcap_dialogue_service_provider = -1;  /* T_dialogue_service_provider */
90 static int hf_tcap_unidialoguePDU = -1;           /* AUDT_apdu */
91 static int hf_tcap_protocol_version3 = -1;        /* T_protocol_version3 */
92 static int hf_tcap_unidirectional = -1;           /* Unidirectional */
93 static int hf_tcap_begin = -1;                    /* Begin */
94 static int hf_tcap_end = -1;                      /* End */
95 static int hf_tcap_continue = -1;                 /* Continue */
96 static int hf_tcap_abort = -1;                    /* Abort */
97 static int hf_tcap_ansiunidirectional = -1;       /* UniTransactionPDU */
98 static int hf_tcap_ansiqueryWithPerm = -1;        /* TransactionPDU */
99 static int hf_tcap_ansiqueryWithoutPerm = -1;     /* TransactionPDU */
100 static int hf_tcap_ansiresponse = -1;             /* TransactionPDU */
101 static int hf_tcap_ansiconversationWithPerm = -1;  /* TransactionPDU */
102 static int hf_tcap_ansiconversationWithoutPerm = -1;  /* TransactionPDU */
103 static int hf_tcap_ansiabort = -1;                /* AbortPDU */
104 static int hf_tcap_dialoguePortion = -1;          /* DialoguePortion */
105 static int hf_tcap_components = -1;               /* ComponentPortion */
106 static int hf_tcap_otid = -1;                     /* OrigTransactionID */
107 static int hf_tcap_dtid = -1;                     /* DestTransactionID */
108 static int hf_tcap_reason = -1;                   /* Reason */
109 static int hf_tcap_p_abortCause = -1;             /* P_AbortCause */
110 static int hf_tcap_u_abortCause = -1;             /* DialoguePortion */
111 static int hf_tcap_ComponentPortion_item = -1;    /* Component */
112 static int hf_tcap_invoke = -1;                   /* Invoke */
113 static int hf_tcap_returnResultLast = -1;         /* ReturnResult */
114 static int hf_tcap_returnError = -1;              /* ReturnError */
115 static int hf_tcap_reject = -1;                   /* Reject */
116 static int hf_tcap_returnResultNotLast = -1;      /* ReturnResult */
117 static int hf_tcap_invokeID = -1;                 /* InvokeIdType */
118 static int hf_tcap_linkedID = -1;                 /* InvokeIdType */
119 static int hf_tcap_opCode = -1;                   /* OPERATION */
120 static int hf_tcap_parameter = -1;                /* Parameter */
121 static int hf_tcap_resultretres = -1;             /* T_resultretres */
122 static int hf_tcap_errorCode = -1;                /* ErrorCode */
123 static int hf_tcap_invokeIDRej = -1;              /* T_invokeIDRej */
124 static int hf_tcap_derivable = -1;                /* InvokeIdType */
125 static int hf_tcap_not_derivable = -1;            /* NULL */
126 static int hf_tcap_problem = -1;                  /* T_problem */
127 static int hf_tcap_generalProblem = -1;           /* GeneralProblem */
128 static int hf_tcap_invokeProblem = -1;            /* InvokeProblem */
129 static int hf_tcap_returnResultProblem = -1;      /* ReturnResultProblem */
130 static int hf_tcap_returnErrorProblem = -1;       /* ReturnErrorProblem */
131 static int hf_tcap_localValue = -1;               /* INTEGER */
132 static int hf_tcap_globalValue = -1;              /* OBJECT_IDENTIFIER */
133 static int hf_tcap_identifier = -1;               /* TransactionID */
134 static int hf_tcap_dialoguePortionansi = -1;      /* DialoguePortionANSI */
135 static int hf_tcap_componentPortion = -1;         /* ComponentSequence */
136 static int hf_tcap_causeInformation = -1;         /* T_causeInformation */
137 static int hf_tcap_abortCause = -1;               /* P_Abort_cause */
138 static int hf_tcap_userInformation = -1;          /* UserInformation */
139 static int hf_tcap_version = -1;                  /* ProtocolVersion */
140 static int hf_tcap_applicationContext = -1;       /* T_applicationContext */
141 static int hf_tcap_integerApplicationId = -1;     /* IntegerApplicationContext */
142 static int hf_tcap_objectApplicationId = -1;      /* ObjectIDApplicationContext */
143 static int hf_tcap_securityContext = -1;          /* T_securityContext */
144 static int hf_tcap_integerSecurityId = -1;        /* INTEGER */
145 static int hf_tcap_objectSecurityId = -1;         /* OBJECT_IDENTIFIER */
146 static int hf_tcap_confidentiality = -1;          /* Confidentiality */
147 static int hf_tcap_confidentialityId = -1;        /* T_confidentialityId */
148 static int hf_tcap_integerConfidentialityId = -1;  /* INTEGER */
149 static int hf_tcap_objectConfidentialityId = -1;  /* OBJECT_IDENTIFIER */
150 static int hf_tcap_ComponentSequence_item = -1;   /* ComponentPDU */
151 static int hf_tcap_invokeLastansi = -1;           /* InvokePDU */
152 static int hf_tcap_returnResultLastansi = -1;     /* ReturnResultPDU */
153 static int hf_tcap_returnErroransi = -1;          /* ReturnErrorPDU */
154 static int hf_tcap_rejectansi = -1;               /* RejectPDU */
155 static int hf_tcap_invokeNotLastansi = -1;        /* InvokePDU */
156 static int hf_tcap_returnResultNotLastansi = -1;  /* ReturnResultPDU */
157 static int hf_tcap_componentIDs = -1;             /* OCTET_STRING_SIZE_0_2 */
158 static int hf_tcap_operationCode = -1;            /* OperationCode */
159 static int hf_tcap_parameterinv = -1;             /* ANSIparamch */
160 static int hf_tcap_ansiparams = -1;               /* ANSIParameters */
161 static int hf_tcap_ansiparams1 = -1;              /* ANSIParameters */
162 static int hf_tcap_ansiparams2 = -1;              /* ANSIParameters */
163 static int hf_tcap_ansiparams3 = -1;              /* ANSIParameters */
164 static int hf_tcap_ansiparams4 = -1;              /* ANSIParameters */
165 static int hf_tcap_ansiparams5 = -1;              /* ANSIParameters */
166 static int hf_tcap_ansiparams6 = -1;              /* ANSIParameters */
167 static int hf_tcap_ansiparams7 = -1;              /* ANSIParameters */
168 static int hf_tcap_ansiparams8 = -1;              /* ANSIParameters */
169 static int hf_tcap_ansiparams9 = -1;              /* ANSIParameters */
170 static int hf_tcap_ansiparams10 = -1;             /* ANSIParameters */
171 static int hf_tcap_ansiparams11 = -1;             /* ANSIParameters */
172 static int hf_tcap_ansiparams12 = -1;             /* ANSIParameters */
173 static int hf_tcap_ansiparams13 = -1;             /* ANSIParameters */
174 static int hf_tcap_ansiparams14 = -1;             /* ANSIParameters */
175 static int hf_tcap_ansiparams15 = -1;             /* ANSIParameters */
176 static int hf_tcap_ansiparams16 = -1;             /* ANSIParameters */
177 static int hf_tcap_ansiparams17 = -1;             /* ANSIParameters */
178 static int hf_tcap_ansiparams18 = -1;             /* ANSIParameters */
179 static int hf_tcap_ansiparams19 = -1;             /* ANSIParameters */
180 static int hf_tcap_ansiparams20 = -1;             /* ANSIParameters */
181 static int hf_tcap_ansiparams21 = -1;             /* ANSIParameters */
182 static int hf_tcap_componentID = -1;              /* ComponentID */
183 static int hf_tcap_parameterrr = -1;              /* ANSIparamch */
184 static int hf_tcap_parameterre = -1;              /* ANSIparamch */
185 static int hf_tcap_rejectProblem = -1;            /* ProblemPDU */
186 static int hf_tcap_parameterrj = -1;              /* ANSIparamch */
187 static int hf_tcap_national = -1;                 /* INTEGER_M32768_32767 */
188 static int hf_tcap_private = -1;                  /* INTEGER */
189 static int hf_tcap_nationaler = -1;               /* INTEGER_M32768_32767 */
190 static int hf_tcap_privateer = -1;                /* INTEGER */
191 /* named bits */
192 static int hf_tcap_T_protocol_versionrq_version1 = -1;
193 static int hf_tcap_T_protocol_versionre_version1 = -1;
194 static int hf_tcap_T_protocol_version3_version1 = -1;
195
196 /*--- End of included file: packet-tcap-hf.c ---*/
197 #line 62 "packet-tcap-template.c"
198
199 /* Initialize the subtree pointers */
200 static gint ett_tcap = -1;
201 static gint ett_param = -1;
202
203 static gint ett_otid = -1;
204 static gint ett_dtid = -1;
205 gint ett_tcap_stat = -1;
206
207 static struct tcapsrt_info_t * gp_tcapsrt_info;
208 static gboolean tcap_subdissector_used=FALSE;
209 static struct tcaphash_context_t * gp_tcap_context=NULL;
210
211
212 /*--- Included file: packet-tcap-ett.c ---*/
213 #line 1 "packet-tcap-ett.c"
214 static gint ett_tcap_DialoguePDU = -1;
215 static gint ett_tcap_ExternalPDU = -1;
216 static gint ett_tcap_UserInformation = -1;
217 static gint ett_tcap_AARQ_apdu = -1;
218 static gint ett_tcap_T_protocol_versionrq = -1;
219 static gint ett_tcap_AARE_apdu = -1;
220 static gint ett_tcap_T_protocol_versionre = -1;
221 static gint ett_tcap_RLRQ_apdu = -1;
222 static gint ett_tcap_RLRE_apdu = -1;
223 static gint ett_tcap_ABRT_apdu = -1;
224 static gint ett_tcap_Associate_source_diagnostic = -1;
225 static gint ett_tcap_UniDialoguePDU = -1;
226 static gint ett_tcap_AUDT_apdu = -1;
227 static gint ett_tcap_T_protocol_version3 = -1;
228 static gint ett_tcap_MessageType = -1;
229 static gint ett_tcap_Unidirectional = -1;
230 static gint ett_tcap_Begin = -1;
231 static gint ett_tcap_End = -1;
232 static gint ett_tcap_Continue = -1;
233 static gint ett_tcap_Abort = -1;
234 static gint ett_tcap_Reason = -1;
235 static gint ett_tcap_ComponentPortion = -1;
236 static gint ett_tcap_Component = -1;
237 static gint ett_tcap_Invoke = -1;
238 static gint ett_tcap_ReturnResult = -1;
239 static gint ett_tcap_T_resultretres = -1;
240 static gint ett_tcap_ReturnError = -1;
241 static gint ett_tcap_Reject = -1;
242 static gint ett_tcap_T_invokeIDRej = -1;
243 static gint ett_tcap_T_problem = -1;
244 static gint ett_tcap_OPERATION = -1;
245 static gint ett_tcap_ERROR = -1;
246 static gint ett_tcap_UniTransactionPDU = -1;
247 static gint ett_tcap_TransactionPDU = -1;
248 static gint ett_tcap_AbortPDU = -1;
249 static gint ett_tcap_T_causeInformation = -1;
250 static gint ett_tcap_DialoguePortionANSI = -1;
251 static gint ett_tcap_T_applicationContext = -1;
252 static gint ett_tcap_T_securityContext = -1;
253 static gint ett_tcap_Confidentiality = -1;
254 static gint ett_tcap_T_confidentialityId = -1;
255 static gint ett_tcap_ComponentSequence = -1;
256 static gint ett_tcap_ComponentPDU = -1;
257 static gint ett_tcap_InvokePDU = -1;
258 static gint ett_tcap_ANSIparamch = -1;
259 static gint ett_tcap_ReturnResultPDU = -1;
260 static gint ett_tcap_ReturnErrorPDU = -1;
261 static gint ett_tcap_RejectPDU = -1;
262 static gint ett_tcap_OperationCode = -1;
263 static gint ett_tcap_ErrorCode = -1;
264
265 /*--- End of included file: packet-tcap-ett.c ---*/
266 #line 76 "packet-tcap-template.c"
267
268 #define MAX_SSN 254
269 static range_t *global_ssn_range;
270 static range_t *ssn_range;
271 struct tcap_private_t tcap_private;
272
273 gboolean gtcap_HandleSRT=FALSE;
274 extern gboolean gtcap_PersistentSRT;
275 extern gboolean gtcap_DisplaySRT;
276 extern guint gtcap_RepetitionTimeout;
277 extern guint gtcap_LostTimeout;
278
279 dissector_handle_t      tcap_handle = NULL;
280 static dissector_table_t ber_oid_dissector_table=NULL;
281 static const char * cur_oid;
282 static const char * tcapext_oid;
283 static proto_tree * tcap_top_tree=NULL;
284 static proto_tree * tcap_stat_tree=NULL;
285 static proto_item * tcap_stat_item=NULL;
286
287 static dissector_handle_t data_handle;
288
289 static dissector_table_t sccp_ssn_table;
290
291 static void raz_tcap_private(struct tcap_private_t * p_tcap_private);
292 static int dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset);
293 static int dissect_tcap_UserInformation(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_);
294 static int dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_);
295 static int dissect_tcap_TheExternUserInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_);
296
297 static GHashTable* ansi_sub_dissectors = NULL;
298 static GHashTable* itu_sub_dissectors = NULL;
299
300 static void dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);
301
302 extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
303     g_hash_table_insert(ansi_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
304     dissector_add("sccp.ssn",ssn,tcap_handle);
305 }
306
307 extern void add_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
308     g_hash_table_insert(itu_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
309     dissector_add("sccp.ssn",ssn,tcap_handle);
310 }
311
312 extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
313     g_hash_table_remove(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
314     dissector_delete("sccp.ssn",ssn,tcap_handle);
315 }
316 extern void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
317     g_hash_table_remove(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
318         dissector_delete("sccp.ssn", ssn,tcap_handle);
319 }
320
321 static dissector_handle_t get_ansi_tcap_subdissector(guint32 ssn) {
322     return g_hash_table_lookup(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
323 }
324
325 dissector_handle_t get_itu_tcap_subdissector(guint32 ssn) {
326     return g_hash_table_lookup(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
327 }
328
329
330
331
332 /*--- Included file: packet-tcap-fn.c ---*/
333 #line 1 "packet-tcap-fn.c"
334 /*--- Fields for imported types ---*/
335
336
337
338 static const asn_namedbit T_protocol_versionrq_bits[] = {
339   {  0, &hf_tcap_T_protocol_versionrq_version1, -1, -1, "version1", NULL },
340   { 0, NULL, 0, 0, NULL, NULL }
341 };
342
343 static int
344 dissect_tcap_T_protocol_versionrq(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
345   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
346                                     T_protocol_versionrq_bits, hf_index, ett_tcap_T_protocol_versionrq,
347                                     NULL);
348
349   return offset;
350 }
351 static int dissect_protocol_versionrq_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
352   return dissect_tcap_T_protocol_versionrq(TRUE, tvb, offset, pinfo, tree, hf_tcap_protocol_versionrq);
353 }
354
355
356
357 static int
358 dissect_tcap_Applicationcontext(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
359 #line 98 "tcap.cnf"
360   offset = dissect_ber_object_identifier_str(implicit_tag, pinfo, tree, tvb, offset, hf_index, &cur_oid);
361
362         tcap_private.oid= (void*) cur_oid; 
363         tcap_private.acv=TRUE;
364
365
366
367   return offset;
368 }
369 static int dissect_application_context_name(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
370   return dissect_tcap_Applicationcontext(FALSE, tvb, offset, pinfo, tree, hf_tcap_application_context_name);
371 }
372
373
374
375 static int
376 dissect_tcap_User_information(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
377 #line 77 "tcap.cnf"
378 tvbuff_t        *next_tvb;
379 gint8 class;
380         gboolean pc;
381         gint tag;
382         guint32 len;
383         gint ind_field;
384
385
386 offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
387 offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
388 next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), len-(2*ind_field));           
389 if (!next_tvb)
390         return offset+len; 
391 dissect_tcap_UserInformation(TRUE, next_tvb, 0, pinfo, tree, -1);
392  
393  
394 return offset+len;
395
396
397   return offset;
398 }
399 static int dissect_user_information_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
400   return dissect_tcap_User_information(TRUE, tvb, offset, pinfo, tree, hf_tcap_user_information);
401 }
402
403
404 static const ber_sequence_t AARQ_apdu_sequence[] = {
405   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_protocol_versionrq_impl },
406   { BER_CLASS_CON, 1, 0, dissect_application_context_name },
407   { BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_user_information_impl },
408   { 0, 0, 0, NULL }
409 };
410
411 static int
412 dissect_tcap_AARQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
413   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
414                                    AARQ_apdu_sequence, hf_index, ett_tcap_AARQ_apdu);
415
416   return offset;
417 }
418 static int dissect_dialogueRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
419   return dissect_tcap_AARQ_apdu(FALSE, tvb, offset, pinfo, tree, hf_tcap_dialogueRequest);
420 }
421
422
423 static const asn_namedbit T_protocol_versionre_bits[] = {
424   {  0, &hf_tcap_T_protocol_versionre_version1, -1, -1, "version1", NULL },
425   { 0, NULL, 0, 0, NULL, NULL }
426 };
427
428 static int
429 dissect_tcap_T_protocol_versionre(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
430   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
431                                     T_protocol_versionre_bits, hf_index, ett_tcap_T_protocol_versionre,
432                                     NULL);
433
434   return offset;
435 }
436 static int dissect_protocol_versionre_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
437   return dissect_tcap_T_protocol_versionre(TRUE, tvb, offset, pinfo, tree, hf_tcap_protocol_versionre);
438 }
439
440
441 static const value_string tcap_Associate_result_vals[] = {
442   {   0, "accepted" },
443   {   1, "reject-permanent" },
444   { 0, NULL }
445 };
446
447
448 static int
449 dissect_tcap_Associate_result(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
450   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
451                                   NULL);
452
453   return offset;
454 }
455 static int dissect_result(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
456   return dissect_tcap_Associate_result(FALSE, tvb, offset, pinfo, tree, hf_tcap_result);
457 }
458
459
460 static const value_string tcap_T_dialogue_service_user_vals[] = {
461   {   0, "null" },
462   {   1, "no-reason-given" },
463   {   2, "application-context-name-not-supported" },
464   { 0, NULL }
465 };
466
467
468 static int
469 dissect_tcap_T_dialogue_service_user(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
470   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
471                                   NULL);
472
473   return offset;
474 }
475 static int dissect_dialogue_service_user(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
476   return dissect_tcap_T_dialogue_service_user(FALSE, tvb, offset, pinfo, tree, hf_tcap_dialogue_service_user);
477 }
478
479
480 static const value_string tcap_T_dialogue_service_provider_vals[] = {
481   {   0, "null" },
482   {   1, "no-reason-given" },
483   {   2, "no-common-dialogue-portion" },
484   { 0, NULL }
485 };
486
487
488 static int
489 dissect_tcap_T_dialogue_service_provider(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
490   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
491                                   NULL);
492
493   return offset;
494 }
495 static int dissect_dialogue_service_provider(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
496   return dissect_tcap_T_dialogue_service_provider(FALSE, tvb, offset, pinfo, tree, hf_tcap_dialogue_service_provider);
497 }
498
499
500 static const value_string tcap_Associate_source_diagnostic_vals[] = {
501   {   1, "dialogue-service-user" },
502   {   2, "dialogue-service-provider" },
503   { 0, NULL }
504 };
505
506 static const ber_choice_t Associate_source_diagnostic_choice[] = {
507   {   1, BER_CLASS_CON, 1, 0, dissect_dialogue_service_user },
508   {   2, BER_CLASS_CON, 2, 0, dissect_dialogue_service_provider },
509   { 0, 0, 0, 0, NULL }
510 };
511
512 static int
513 dissect_tcap_Associate_source_diagnostic(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
514   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
515                                  Associate_source_diagnostic_choice, hf_index, ett_tcap_Associate_source_diagnostic,
516                                  NULL);
517
518   return offset;
519 }
520 static int dissect_result_source_diagnostic(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
521   return dissect_tcap_Associate_source_diagnostic(FALSE, tvb, offset, pinfo, tree, hf_tcap_result_source_diagnostic);
522 }
523
524
525 static const ber_sequence_t AARE_apdu_sequence[] = {
526   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_protocol_versionre_impl },
527   { BER_CLASS_CON, 1, 0, dissect_application_context_name },
528   { BER_CLASS_CON, 2, 0, dissect_result },
529   { BER_CLASS_CON, 3, BER_FLAGS_NOTCHKTAG, dissect_result_source_diagnostic },
530   { BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_user_information_impl },
531   { 0, 0, 0, NULL }
532 };
533
534 static int
535 dissect_tcap_AARE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
536   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
537                                    AARE_apdu_sequence, hf_index, ett_tcap_AARE_apdu);
538
539   return offset;
540 }
541 static int dissect_dialogueResponse(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
542   return dissect_tcap_AARE_apdu(FALSE, tvb, offset, pinfo, tree, hf_tcap_dialogueResponse);
543 }
544
545
546 static const value_string tcap_ABRT_source_vals[] = {
547   {   0, "dialogue-service-user" },
548   {   1, "dialogue-service-provider" },
549   { 0, NULL }
550 };
551
552
553 static int
554 dissect_tcap_ABRT_source(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
555   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
556                                   NULL);
557
558   return offset;
559 }
560 static int dissect_abort_source_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
561   return dissect_tcap_ABRT_source(TRUE, tvb, offset, pinfo, tree, hf_tcap_abort_source);
562 }
563
564
565 static const ber_sequence_t ABRT_apdu_sequence[] = {
566   { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_abort_source_impl },
567   { BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_user_information_impl },
568   { 0, 0, 0, NULL }
569 };
570
571 static int
572 dissect_tcap_ABRT_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
573   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
574                                    ABRT_apdu_sequence, hf_index, ett_tcap_ABRT_apdu);
575
576   return offset;
577 }
578 static int dissect_dialogueAbort(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
579   return dissect_tcap_ABRT_apdu(FALSE, tvb, offset, pinfo, tree, hf_tcap_dialogueAbort);
580 }
581
582
583 static const value_string tcap_DialoguePDU_vals[] = {
584   {   0, "dialogueRequest" },
585   {   1, "dialogueResponse" },
586   {   4, "dialogueAbort" },
587   { 0, NULL }
588 };
589
590 static const ber_choice_t DialoguePDU_choice[] = {
591   {   0, BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_dialogueRequest },
592   {   1, BER_CLASS_APP, 1, BER_FLAGS_NOOWNTAG, dissect_dialogueResponse },
593   {   4, BER_CLASS_APP, 4, BER_FLAGS_NOOWNTAG, dissect_dialogueAbort },
594   { 0, 0, 0, 0, NULL }
595 };
596
597 static int
598 dissect_tcap_DialoguePDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
599   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
600                                  DialoguePDU_choice, hf_index, ett_tcap_DialoguePDU,
601                                  NULL);
602
603   return offset;
604 }
605
606
607
608 static int
609 dissect_tcap_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
610   offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
611
612   return offset;
613 }
614 static int dissect_oid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
615   return dissect_tcap_OBJECT_IDENTIFIER(FALSE, tvb, offset, pinfo, tree, hf_tcap_oid);
616 }
617 static int dissect_globalValue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
618   return dissect_tcap_OBJECT_IDENTIFIER(FALSE, tvb, offset, pinfo, tree, hf_tcap_globalValue);
619 }
620 static int dissect_objectSecurityId_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
621   return dissect_tcap_OBJECT_IDENTIFIER(TRUE, tvb, offset, pinfo, tree, hf_tcap_objectSecurityId);
622 }
623 static int dissect_objectConfidentialityId_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
624   return dissect_tcap_OBJECT_IDENTIFIER(TRUE, tvb, offset, pinfo, tree, hf_tcap_objectConfidentialityId);
625 }
626
627
628
629 static int
630 dissect_tcap_Dialog1(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
631 #line 43 "tcap.cnf"
632 gint8 class;
633         gboolean pc;
634         gint tag;
635         guint32 len;
636         gint ind_field;
637         
638
639 offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
640 offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
641  dissect_tcap_DialoguePDU(TRUE, tvb, 0, pinfo, tree, -1);
642
643 return offset+len;
644
645
646
647   return offset;
648 }
649 static int dissect_dialog_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
650   return dissect_tcap_Dialog1(TRUE, tvb, offset, pinfo, tree, hf_tcap_dialog);
651 }
652
653
654 static const ber_sequence_t ExternalPDU_sequence[] = {
655   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_oid },
656   { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_dialog_impl },
657   { 0, 0, 0, NULL }
658 };
659
660 static int
661 dissect_tcap_ExternalPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
662   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
663                                    ExternalPDU_sequence, hf_index, ett_tcap_ExternalPDU);
664
665   return offset;
666 }
667
668
669
670 static int
671 dissect_tcap_UserInfoOID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
672 #line 103 "tcap.cnf"
673   offset = dissect_ber_object_identifier_str(implicit_tag, pinfo, tree, tvb, offset, hf_index, &tcapext_oid);
674
675         tcap_private.oid= (void*)tcapext_oid;
676         tcap_private.acv=TRUE;
677
678
679
680   return offset;
681 }
682 static int dissect_useroid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
683   return dissect_tcap_UserInfoOID(FALSE, tvb, offset, pinfo, tree, hf_tcap_useroid);
684 }
685
686
687
688 static int
689 dissect_tcap_ExternUserInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
690 #line 108 "tcap.cnf"
691 dissect_tcap_TheExternUserInfo(implicit_tag, tvb, offset, pinfo, tree, hf_index);
692
693
694
695   return offset;
696 }
697 static int dissect_externuserinfo_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
698   return dissect_tcap_ExternUserInfo(TRUE, tvb, offset, pinfo, tree, hf_tcap_externuserinfo);
699 }
700
701
702 static const ber_sequence_t UserInformation_sequence[] = {
703   { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_useroid },
704   { BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_externuserinfo_impl },
705   { 0, 0, 0, NULL }
706 };
707
708 static int
709 dissect_tcap_UserInformation(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
710   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
711                                    UserInformation_sequence, hf_index, ett_tcap_UserInformation);
712
713   return offset;
714 }
715 static int dissect_userInformation(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
716   return dissect_tcap_UserInformation(FALSE, tvb, offset, pinfo, tree, hf_tcap_userInformation);
717 }
718
719
720 static const value_string tcap_Release_request_reason_vals[] = {
721   {   0, "normal" },
722   {   1, "urgent" },
723   {  30, "user-defined" },
724   { 0, NULL }
725 };
726
727
728 static int
729 dissect_tcap_Release_request_reason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
730   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
731                                   NULL);
732
733   return offset;
734 }
735 static int dissect_reasonrq_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
736   return dissect_tcap_Release_request_reason(TRUE, tvb, offset, pinfo, tree, hf_tcap_reasonrq);
737 }
738
739
740 static const ber_sequence_t RLRQ_apdu_sequence[] = {
741   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_reasonrq_impl },
742   { BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_user_information_impl },
743   { 0, 0, 0, NULL }
744 };
745
746 static int
747 dissect_tcap_RLRQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
748   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
749                                    RLRQ_apdu_sequence, hf_index, ett_tcap_RLRQ_apdu);
750
751   return offset;
752 }
753
754
755 static const value_string tcap_Release_response_reason_vals[] = {
756   {   0, "normal" },
757   {   1, "not-finished" },
758   {  30, "user-defined" },
759   { 0, NULL }
760 };
761
762
763 static int
764 dissect_tcap_Release_response_reason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
765   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
766                                   NULL);
767
768   return offset;
769 }
770 static int dissect_reasonre_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
771   return dissect_tcap_Release_response_reason(TRUE, tvb, offset, pinfo, tree, hf_tcap_reasonre);
772 }
773
774
775 static const ber_sequence_t RLRE_apdu_sequence[] = {
776   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_reasonre_impl },
777   { BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_user_information_impl },
778   { 0, 0, 0, NULL }
779 };
780
781 static int
782 dissect_tcap_RLRE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
783   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
784                                    RLRE_apdu_sequence, hf_index, ett_tcap_RLRE_apdu);
785
786   return offset;
787 }
788
789
790 static const asn_namedbit T_protocol_version3_bits[] = {
791   {  0, &hf_tcap_T_protocol_version3_version1, -1, -1, "version1", NULL },
792   { 0, NULL, 0, 0, NULL, NULL }
793 };
794
795 static int
796 dissect_tcap_T_protocol_version3(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
797   offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset,
798                                     T_protocol_version3_bits, hf_index, ett_tcap_T_protocol_version3,
799                                     NULL);
800
801   return offset;
802 }
803 static int dissect_protocol_version3_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
804   return dissect_tcap_T_protocol_version3(TRUE, tvb, offset, pinfo, tree, hf_tcap_protocol_version3);
805 }
806
807
808 static const ber_sequence_t AUDT_apdu_sequence[] = {
809   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_protocol_version3_impl },
810   { BER_CLASS_CON, 1, 0, dissect_application_context_name },
811   { BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_user_information_impl },
812   { 0, 0, 0, NULL }
813 };
814
815 static int
816 dissect_tcap_AUDT_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
817   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
818                                    AUDT_apdu_sequence, hf_index, ett_tcap_AUDT_apdu);
819
820   return offset;
821 }
822 static int dissect_unidialoguePDU(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
823   return dissect_tcap_AUDT_apdu(FALSE, tvb, offset, pinfo, tree, hf_tcap_unidialoguePDU);
824 }
825
826
827 static const value_string tcap_UniDialoguePDU_vals[] = {
828   {   0, "unidialoguePDU" },
829   { 0, NULL }
830 };
831
832 static const ber_choice_t UniDialoguePDU_choice[] = {
833   {   0, BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_unidialoguePDU },
834   { 0, 0, 0, 0, NULL }
835 };
836
837 static int
838 dissect_tcap_UniDialoguePDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
839   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
840                                  UniDialoguePDU_choice, hf_index, ett_tcap_UniDialoguePDU,
841                                  NULL);
842
843   return offset;
844 }
845
846
847
848 static int
849 dissect_tcap_DialogueOC(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
850 #line 21 "tcap.cnf"
851 tvbuff_t        *next_tvb;
852 gint8 class;
853         gboolean pc;
854         gint tag;
855         guint32 len;
856         gint ind_field;
857         
858
859 offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
860 offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
861         next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), len-(2*ind_field));
862                                     
863  
864  if (!next_tvb)
865         return offset;
866
867   dissect_tcap_ExternalPDU(TRUE, next_tvb, 2, pinfo, tree, -1);
868
869
870 return offset+len;
871
872
873
874   return offset;
875 }
876
877
878
879 static int
880 dissect_tcap_DialoguePortion(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
881   offset = dissect_tcap_DialogueOC(implicit_tag, tvb, offset, pinfo, tree, hf_index);
882
883   return offset;
884 }
885 static int dissect_dialoguePortion(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
886   return dissect_tcap_DialoguePortion(FALSE, tvb, offset, pinfo, tree, hf_tcap_dialoguePortion);
887 }
888 static int dissect_u_abortCause(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
889   return dissect_tcap_DialoguePortion(FALSE, tvb, offset, pinfo, tree, hf_tcap_u_abortCause);
890 }
891
892
893
894 static int
895 dissect_tcap_InvokeIdType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
896   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
897                                   NULL);
898
899   return offset;
900 }
901 static int dissect_invokeID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
902   return dissect_tcap_InvokeIdType(FALSE, tvb, offset, pinfo, tree, hf_tcap_invokeID);
903 }
904 static int dissect_linkedID_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
905   return dissect_tcap_InvokeIdType(TRUE, tvb, offset, pinfo, tree, hf_tcap_linkedID);
906 }
907 static int dissect_derivable(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
908   return dissect_tcap_InvokeIdType(FALSE, tvb, offset, pinfo, tree, hf_tcap_derivable);
909 }
910
911
912
913 static int
914 dissect_tcap_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
915   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
916                                   NULL);
917
918   return offset;
919 }
920 static int dissect_localValue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
921   return dissect_tcap_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_tcap_localValue);
922 }
923 static int dissect_integerSecurityId_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
924   return dissect_tcap_INTEGER(TRUE, tvb, offset, pinfo, tree, hf_tcap_integerSecurityId);
925 }
926 static int dissect_integerConfidentialityId_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
927   return dissect_tcap_INTEGER(TRUE, tvb, offset, pinfo, tree, hf_tcap_integerConfidentialityId);
928 }
929 static int dissect_private_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
930   return dissect_tcap_INTEGER(TRUE, tvb, offset, pinfo, tree, hf_tcap_private);
931 }
932 static int dissect_privateer_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
933   return dissect_tcap_INTEGER(TRUE, tvb, offset, pinfo, tree, hf_tcap_privateer);
934 }
935
936
937 static const value_string tcap_OPERATION_vals[] = {
938   {   0, "localValue" },
939   {   1, "globalValue" },
940   { 0, NULL }
941 };
942
943 static const ber_choice_t OPERATION_choice[] = {
944   {   0, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_localValue },
945   {   1, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_globalValue },
946   { 0, 0, 0, 0, NULL }
947 };
948
949 static int
950 dissect_tcap_OPERATION(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
951   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
952                                  OPERATION_choice, hf_index, ett_tcap_OPERATION,
953                                  NULL);
954
955   return offset;
956 }
957 static int dissect_opCode(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
958   return dissect_tcap_OPERATION(FALSE, tvb, offset, pinfo, tree, hf_tcap_opCode);
959 }
960
961
962
963 static int
964 dissect_tcap_Parameter(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
965 #line 57 "tcap.cnf"
966 tvbuff_t        *next_tvb;
967 gint8 class;
968         gboolean pc;
969         gint tag;
970         guint32 len;
971         gint ind_field;
972
973
974  offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
975  offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
976         /* need to strip the EOC off the next_tvb */
977         next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), len-(2*ind_field));           
978
979 if (!next_tvb)
980         return offset; 
981  dissect_tcap_param(pinfo,tree,tvb,0);
982  offset += len;
983   return offset;
984
985
986
987   return offset;
988 }
989 static int dissect_parameter(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
990   return dissect_tcap_Parameter(FALSE, tvb, offset, pinfo, tree, hf_tcap_parameter);
991 }
992
993
994 static const ber_sequence_t Invoke_sequence[] = {
995   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_invokeID },
996   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_linkedID_impl },
997   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_opCode },
998   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_parameter },
999   { 0, 0, 0, NULL }
1000 };
1001
1002 static int
1003 dissect_tcap_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1004   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1005                                    Invoke_sequence, hf_index, ett_tcap_Invoke);
1006
1007   return offset;
1008 }
1009 static int dissect_invoke_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1010   return dissect_tcap_Invoke(TRUE, tvb, offset, pinfo, tree, hf_tcap_invoke);
1011 }
1012
1013
1014 static const ber_sequence_t T_resultretres_sequence[] = {
1015   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_opCode },
1016   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_parameter },
1017   { 0, 0, 0, NULL }
1018 };
1019
1020 static int
1021 dissect_tcap_T_resultretres(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1022   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1023                                    T_resultretres_sequence, hf_index, ett_tcap_T_resultretres);
1024
1025   return offset;
1026 }
1027 static int dissect_resultretres(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1028   return dissect_tcap_T_resultretres(FALSE, tvb, offset, pinfo, tree, hf_tcap_resultretres);
1029 }
1030
1031
1032 static const ber_sequence_t ReturnResult_sequence[] = {
1033   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_invokeID },
1034   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_resultretres },
1035   { 0, 0, 0, NULL }
1036 };
1037
1038 static int
1039 dissect_tcap_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1040   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1041                                    ReturnResult_sequence, hf_index, ett_tcap_ReturnResult);
1042
1043   return offset;
1044 }
1045 static int dissect_returnResultLast_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1046   return dissect_tcap_ReturnResult(TRUE, tvb, offset, pinfo, tree, hf_tcap_returnResultLast);
1047 }
1048 static int dissect_returnResultNotLast_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1049   return dissect_tcap_ReturnResult(TRUE, tvb, offset, pinfo, tree, hf_tcap_returnResultNotLast);
1050 }
1051
1052
1053
1054 static int
1055 dissect_tcap_INTEGER_M32768_32767(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1056   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1057                                   NULL);
1058
1059   return offset;
1060 }
1061 static int dissect_national_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1062   return dissect_tcap_INTEGER_M32768_32767(TRUE, tvb, offset, pinfo, tree, hf_tcap_national);
1063 }
1064 static int dissect_nationaler_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1065   return dissect_tcap_INTEGER_M32768_32767(TRUE, tvb, offset, pinfo, tree, hf_tcap_nationaler);
1066 }
1067
1068
1069 static const value_string tcap_ErrorCode_vals[] = {
1070   {  19, "nationaler" },
1071   {  20, "privateer" },
1072   { 0, NULL }
1073 };
1074
1075 static const ber_choice_t ErrorCode_choice[] = {
1076   {  19, BER_CLASS_PRI, 19, BER_FLAGS_IMPLTAG, dissect_nationaler_impl },
1077   {  20, BER_CLASS_PRI, 20, BER_FLAGS_IMPLTAG, dissect_privateer_impl },
1078   { 0, 0, 0, 0, NULL }
1079 };
1080
1081 static int
1082 dissect_tcap_ErrorCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1083   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1084                                  ErrorCode_choice, hf_index, ett_tcap_ErrorCode,
1085                                  NULL);
1086
1087   return offset;
1088 }
1089 static int dissect_errorCode(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1090   return dissect_tcap_ErrorCode(FALSE, tvb, offset, pinfo, tree, hf_tcap_errorCode);
1091 }
1092
1093
1094 static const ber_sequence_t ReturnError_sequence[] = {
1095   { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_invokeID },
1096   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_errorCode },
1097   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_parameter },
1098   { 0, 0, 0, NULL }
1099 };
1100
1101 static int
1102 dissect_tcap_ReturnError(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1103   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1104                                    ReturnError_sequence, hf_index, ett_tcap_ReturnError);
1105
1106   return offset;
1107 }
1108 static int dissect_returnError_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1109   return dissect_tcap_ReturnError(TRUE, tvb, offset, pinfo, tree, hf_tcap_returnError);
1110 }
1111
1112
1113
1114 static int
1115 dissect_tcap_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1116   offset = dissect_ber_null(implicit_tag, pinfo, tree, tvb, offset, hf_index);
1117
1118   return offset;
1119 }
1120 static int dissect_not_derivable(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1121   return dissect_tcap_NULL(FALSE, tvb, offset, pinfo, tree, hf_tcap_not_derivable);
1122 }
1123
1124
1125 static const value_string tcap_T_invokeIDRej_vals[] = {
1126   {   0, "derivable" },
1127   {   1, "not-derivable" },
1128   { 0, NULL }
1129 };
1130
1131 static const ber_choice_t T_invokeIDRej_choice[] = {
1132   {   0, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_derivable },
1133   {   1, BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_not_derivable },
1134   { 0, 0, 0, 0, NULL }
1135 };
1136
1137 static int
1138 dissect_tcap_T_invokeIDRej(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1139   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1140                                  T_invokeIDRej_choice, hf_index, ett_tcap_T_invokeIDRej,
1141                                  NULL);
1142
1143   return offset;
1144 }
1145 static int dissect_invokeIDRej(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1146   return dissect_tcap_T_invokeIDRej(FALSE, tvb, offset, pinfo, tree, hf_tcap_invokeIDRej);
1147 }
1148
1149
1150 static const value_string tcap_GeneralProblem_vals[] = {
1151   {   0, "unrecognizedComponent" },
1152   {   1, "mistypedComponent" },
1153   {   2, "badlyStructuredComponent" },
1154   { 0, NULL }
1155 };
1156
1157
1158 static int
1159 dissect_tcap_GeneralProblem(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1160   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1161                                   NULL);
1162
1163   return offset;
1164 }
1165 static int dissect_generalProblem_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1166   return dissect_tcap_GeneralProblem(TRUE, tvb, offset, pinfo, tree, hf_tcap_generalProblem);
1167 }
1168
1169
1170 static const value_string tcap_InvokeProblem_vals[] = {
1171   {   0, "duplicateInvokeID" },
1172   {   1, "unrecognizedOperation" },
1173   {   2, "mistypedParameter" },
1174   {   3, "resourceLimitation" },
1175   {   4, "initiatingRelease" },
1176   {   5, "unrecognizedLinkedID" },
1177   {   6, "linkedResponseUnexpected" },
1178   {   7, "unexpectedLinkedOperation" },
1179   { 0, NULL }
1180 };
1181
1182
1183 static int
1184 dissect_tcap_InvokeProblem(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1185   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1186                                   NULL);
1187
1188   return offset;
1189 }
1190 static int dissect_invokeProblem_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1191   return dissect_tcap_InvokeProblem(TRUE, tvb, offset, pinfo, tree, hf_tcap_invokeProblem);
1192 }
1193
1194
1195 static const value_string tcap_ReturnResultProblem_vals[] = {
1196   {   0, "unrecognizedInvokeID" },
1197   {   1, "returnResultUnexpected" },
1198   {   2, "mistypedParameter" },
1199   { 0, NULL }
1200 };
1201
1202
1203 static int
1204 dissect_tcap_ReturnResultProblem(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1205   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1206                                   NULL);
1207
1208   return offset;
1209 }
1210 static int dissect_returnResultProblem_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1211   return dissect_tcap_ReturnResultProblem(TRUE, tvb, offset, pinfo, tree, hf_tcap_returnResultProblem);
1212 }
1213
1214
1215 static const value_string tcap_ReturnErrorProblem_vals[] = {
1216   {   0, "unrecognizedInvokeID" },
1217   {   1, "returnErrorUnexpected" },
1218   {   2, "unrecognizedError" },
1219   {   3, "unexpectedError" },
1220   {   4, "mistypedParameter" },
1221   { 0, NULL }
1222 };
1223
1224
1225 static int
1226 dissect_tcap_ReturnErrorProblem(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1227   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1228                                   NULL);
1229
1230   return offset;
1231 }
1232 static int dissect_returnErrorProblem_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1233   return dissect_tcap_ReturnErrorProblem(TRUE, tvb, offset, pinfo, tree, hf_tcap_returnErrorProblem);
1234 }
1235
1236
1237 static const value_string tcap_T_problem_vals[] = {
1238   {   0, "generalProblem" },
1239   {   1, "invokeProblem" },
1240   {   2, "returnResultProblem" },
1241   {   3, "returnErrorProblem" },
1242   { 0, NULL }
1243 };
1244
1245 static const ber_choice_t T_problem_choice[] = {
1246   {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_generalProblem_impl },
1247   {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_invokeProblem_impl },
1248   {   2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_returnResultProblem_impl },
1249   {   3, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_returnErrorProblem_impl },
1250   { 0, 0, 0, 0, NULL }
1251 };
1252
1253 static int
1254 dissect_tcap_T_problem(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1255   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1256                                  T_problem_choice, hf_index, ett_tcap_T_problem,
1257                                  NULL);
1258
1259   return offset;
1260 }
1261 static int dissect_problem(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1262   return dissect_tcap_T_problem(FALSE, tvb, offset, pinfo, tree, hf_tcap_problem);
1263 }
1264
1265
1266 static const ber_sequence_t Reject_sequence[] = {
1267   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_invokeIDRej },
1268   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_problem },
1269   { 0, 0, 0, NULL }
1270 };
1271
1272 static int
1273 dissect_tcap_Reject(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1274   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1275                                    Reject_sequence, hf_index, ett_tcap_Reject);
1276
1277   return offset;
1278 }
1279 static int dissect_reject_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1280   return dissect_tcap_Reject(TRUE, tvb, offset, pinfo, tree, hf_tcap_reject);
1281 }
1282
1283
1284 static const value_string tcap_Component_vals[] = {
1285   {   1, "invoke" },
1286   {   2, "returnResultLast" },
1287   {   3, "returnError" },
1288   {   4, "reject" },
1289   {   7, "returnResultNotLast" },
1290   { 0, NULL }
1291 };
1292
1293 static const ber_choice_t Component_choice[] = {
1294   {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_invoke_impl },
1295   {   2, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_returnResultLast_impl },
1296   {   3, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_returnError_impl },
1297   {   4, BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_reject_impl },
1298   {   7, BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, dissect_returnResultNotLast_impl },
1299   { 0, 0, 0, 0, NULL }
1300 };
1301
1302 static int
1303 dissect_tcap_Component(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1304 #line 95 "tcap.cnf"
1305 dissect_tcap_TheComponent(implicit_tag, tvb, offset, pinfo, tree, hf_index);
1306
1307
1308
1309   return offset;
1310 }
1311 static int dissect_ComponentPortion_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1312   return dissect_tcap_Component(FALSE, tvb, offset, pinfo, tree, hf_tcap_ComponentPortion_item);
1313 }
1314
1315
1316 static const ber_sequence_t ComponentPortion_sequence_of[1] = {
1317   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ComponentPortion_item },
1318 };
1319
1320 static int
1321 dissect_tcap_ComponentPortion(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1322   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
1323                                       ComponentPortion_sequence_of, hf_index, ett_tcap_ComponentPortion);
1324
1325   return offset;
1326 }
1327 static int dissect_components(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1328   return dissect_tcap_ComponentPortion(FALSE, tvb, offset, pinfo, tree, hf_tcap_components);
1329 }
1330
1331
1332 static const ber_sequence_t Unidirectional_sequence[] = {
1333   { BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_dialoguePortion },
1334   { BER_CLASS_APP, 12, BER_FLAGS_NOOWNTAG, dissect_components },
1335   { 0, 0, 0, NULL }
1336 };
1337
1338 static int
1339 dissect_tcap_Unidirectional(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1340   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1341                                    Unidirectional_sequence, hf_index, ett_tcap_Unidirectional);
1342
1343   return offset;
1344 }
1345 static int dissect_unidirectional_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1346   return dissect_tcap_Unidirectional(TRUE, tvb, offset, pinfo, tree, hf_tcap_unidirectional);
1347 }
1348
1349
1350
1351 static int
1352 dissect_tcap_OrigTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1353 #line 139 "tcap.cnf"
1354 tvbuff_t *parameter_tvb;
1355 guint8 len, i;
1356 proto_item *tid_item;
1357 proto_tree *subtree;
1358 tid_item = proto_tree_add_text(tree, tvb, offset, -1, "Source Transaction ID");
1359 subtree = proto_item_add_subtree(tid_item, ett_otid);
1360
1361 offset = dissect_ber_octet_string(implicit_tag, pinfo, subtree, tvb, offset, hf_tcap_tid,
1362                                     &parameter_tvb);
1363
1364 if (parameter_tvb){
1365         len = tvb_length_remaining(parameter_tvb, 0);
1366         switch(len) {
1367         case 1:
1368                 gp_tcapsrt_info->src_tid=tvb_get_guint8(parameter_tvb, 0);
1369                 break;
1370         case 2:
1371                 gp_tcapsrt_info->src_tid=tvb_get_ntohs(parameter_tvb, 0);
1372                 break;
1373         case 4:
1374                 gp_tcapsrt_info->src_tid=tvb_get_ntohl(parameter_tvb, 0);
1375                 break;
1376         default:
1377                 gp_tcapsrt_info->src_tid=0;
1378                 break;
1379         }
1380
1381         if ((len)&&(check_col(pinfo->cinfo, COL_INFO))){
1382                 col_append_fstr(pinfo->cinfo, COL_INFO, "otid(");
1383                 for(i=0;i<len;i++)
1384                           col_append_fstr(pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i));
1385                 col_append_fstr(pinfo->cinfo, COL_INFO, ") ");
1386         }
1387
1388 }       
1389
1390
1391
1392
1393   return offset;
1394 }
1395 static int dissect_otid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1396   return dissect_tcap_OrigTransactionID(FALSE, tvb, offset, pinfo, tree, hf_tcap_otid);
1397 }
1398
1399
1400 static const ber_sequence_t Begin_sequence[] = {
1401   { BER_CLASS_APP, 8, BER_FLAGS_NOOWNTAG, dissect_otid },
1402   { BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_dialoguePortion },
1403   { BER_CLASS_APP, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_components },
1404   { 0, 0, 0, NULL }
1405 };
1406
1407 static int
1408 dissect_tcap_Begin(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1409 #line 212 "tcap.cnf"
1410 gp_tcapsrt_info->ope=TC_BEGIN;
1411
1412 if (check_col(pinfo->cinfo, COL_INFO))
1413                 col_append_fstr(pinfo->cinfo, COL_INFO, " Begin ");
1414   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1415                                 Begin_sequence, hf_index, ett_tcap_Begin);
1416
1417
1418   return offset;
1419 }
1420 static int dissect_begin_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1421   return dissect_tcap_Begin(TRUE, tvb, offset, pinfo, tree, hf_tcap_begin);
1422 }
1423
1424
1425
1426 static int
1427 dissect_tcap_DestTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1428 #line 177 "tcap.cnf"
1429 tvbuff_t *parameter_tvb;
1430 guint8 len , i;
1431 proto_item *tid_item;
1432 proto_tree *subtree;
1433 tid_item = proto_tree_add_text(tree, tvb, offset, -1, "Destination Transaction ID");
1434 subtree = proto_item_add_subtree(tid_item, ett_otid);
1435
1436 offset = dissect_ber_octet_string(implicit_tag, pinfo, subtree, tvb, offset, hf_tcap_tid,
1437                                     &parameter_tvb);
1438
1439 if (parameter_tvb){
1440         len = tvb_length_remaining(parameter_tvb, 0);
1441         switch(len) {
1442         case 1:
1443                 gp_tcapsrt_info->dst_tid=tvb_get_guint8(parameter_tvb, 0);
1444                 break;
1445         case 2:
1446                 gp_tcapsrt_info->dst_tid=tvb_get_ntohs(parameter_tvb, 0);
1447                 break;
1448         case 4:
1449                 gp_tcapsrt_info->dst_tid=tvb_get_ntohl(parameter_tvb, 0);
1450                 break;  
1451         default:
1452                 gp_tcapsrt_info->dst_tid=0;
1453                 break;
1454         }
1455         
1456         if ((len)&&(check_col(pinfo->cinfo, COL_INFO))){
1457                 col_append_fstr(pinfo->cinfo, COL_INFO, "dtid(");
1458                 for(i=0;i<len;i++)
1459                         col_append_fstr(pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i));
1460                 col_append_fstr(pinfo->cinfo, COL_INFO, ") ");
1461            }
1462 }
1463
1464
1465   return offset;
1466 }
1467 static int dissect_dtid(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1468   return dissect_tcap_DestTransactionID(FALSE, tvb, offset, pinfo, tree, hf_tcap_dtid);
1469 }
1470
1471
1472 static const ber_sequence_t End_sequence[] = {
1473   { BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_dtid },
1474   { BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_dialoguePortion },
1475   { BER_CLASS_APP, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_components },
1476   { 0, 0, 0, NULL }
1477 };
1478
1479 static int
1480 dissect_tcap_End(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1481 #line 219 "tcap.cnf"
1482 gp_tcapsrt_info->ope=TC_END;
1483
1484 if (check_col(pinfo->cinfo, COL_INFO))
1485                 col_append_fstr(pinfo->cinfo, COL_INFO, " End ");
1486 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1487                                 End_sequence, hf_index, ett_tcap_End);
1488
1489
1490   return offset;
1491 }
1492 static int dissect_end_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1493   return dissect_tcap_End(TRUE, tvb, offset, pinfo, tree, hf_tcap_end);
1494 }
1495
1496
1497 static const ber_sequence_t Continue_sequence[] = {
1498   { BER_CLASS_APP, 8, BER_FLAGS_NOOWNTAG, dissect_otid },
1499   { BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_dtid },
1500   { BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_dialoguePortion },
1501   { BER_CLASS_APP, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_components },
1502   { 0, 0, 0, NULL }
1503 };
1504
1505 static int
1506 dissect_tcap_Continue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1507 #line 226 "tcap.cnf"
1508 gp_tcapsrt_info->ope=TC_CONT;
1509
1510 if (check_col(pinfo->cinfo, COL_INFO))
1511                 col_append_fstr(pinfo->cinfo, COL_INFO, " Continue ");
1512 offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1513                                 Continue_sequence, hf_index, ett_tcap_Continue);
1514
1515
1516   return offset;
1517 }
1518 static int dissect_continue_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1519   return dissect_tcap_Continue(TRUE, tvb, offset, pinfo, tree, hf_tcap_continue);
1520 }
1521
1522
1523 static const value_string tcap_P_AbortCause_vals[] = {
1524   {   0, "unrecognizedMessageType" },
1525   {   1, "unrecognizedTransactionID" },
1526   {   2, "badlyFormattedTransactionPortion" },
1527   {   3, "incorrectTransactionPortion" },
1528   {   4, "resourceLimitation" },
1529   { 0, NULL }
1530 };
1531
1532
1533 static int
1534 dissect_tcap_P_AbortCause(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1535   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1536                                   NULL);
1537
1538   return offset;
1539 }
1540 static int dissect_p_abortCause(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1541   return dissect_tcap_P_AbortCause(FALSE, tvb, offset, pinfo, tree, hf_tcap_p_abortCause);
1542 }
1543
1544
1545 static const value_string tcap_Reason_vals[] = {
1546   {  10, "p-abortCause" },
1547   {  11, "u-abortCause" },
1548   { 0, NULL }
1549 };
1550
1551 static const ber_choice_t Reason_choice[] = {
1552   {  10, BER_CLASS_APP, 10, BER_FLAGS_NOOWNTAG, dissect_p_abortCause },
1553   {  11, BER_CLASS_APP, 11, BER_FLAGS_NOOWNTAG, dissect_u_abortCause },
1554   { 0, 0, 0, 0, NULL }
1555 };
1556
1557 static int
1558 dissect_tcap_Reason(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1559   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1560                                  Reason_choice, hf_index, ett_tcap_Reason,
1561                                  NULL);
1562
1563   return offset;
1564 }
1565 static int dissect_reason(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1566   return dissect_tcap_Reason(FALSE, tvb, offset, pinfo, tree, hf_tcap_reason);
1567 }
1568
1569
1570 static const ber_sequence_t Abort_sequence[] = {
1571   { BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_dtid },
1572   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_reason },
1573   { 0, 0, 0, NULL }
1574 };
1575
1576 static int
1577 dissect_tcap_Abort(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1578 #line 233 "tcap.cnf"
1579 gp_tcapsrt_info->ope=TC_ABORT;
1580
1581 if (check_col(pinfo->cinfo, COL_INFO))
1582                 col_append_fstr(pinfo->cinfo, COL_INFO, " Abort ");
1583  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1584                                 Abort_sequence, hf_index, ett_tcap_Abort); 
1585
1586
1587   return offset;
1588 }
1589 static int dissect_abort_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1590   return dissect_tcap_Abort(TRUE, tvb, offset, pinfo, tree, hf_tcap_abort);
1591 }
1592
1593
1594
1595 static int
1596 dissect_tcap_TransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1597   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1598                                        NULL);
1599
1600   return offset;
1601 }
1602 static int dissect_identifier(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1603   return dissect_tcap_TransactionID(FALSE, tvb, offset, pinfo, tree, hf_tcap_identifier);
1604 }
1605
1606
1607
1608 static int
1609 dissect_tcap_ProtocolVersion(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1610   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1611                                        NULL);
1612
1613   return offset;
1614 }
1615 static int dissect_version(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1616   return dissect_tcap_ProtocolVersion(FALSE, tvb, offset, pinfo, tree, hf_tcap_version);
1617 }
1618
1619
1620
1621 static int
1622 dissect_tcap_IntegerApplicationContext(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1623   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1624                                   NULL);
1625
1626   return offset;
1627 }
1628 static int dissect_integerApplicationId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1629   return dissect_tcap_IntegerApplicationContext(FALSE, tvb, offset, pinfo, tree, hf_tcap_integerApplicationId);
1630 }
1631
1632
1633
1634 static int
1635 dissect_tcap_ObjectIDApplicationContext(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1636   offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL);
1637
1638   return offset;
1639 }
1640 static int dissect_objectApplicationId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1641   return dissect_tcap_ObjectIDApplicationContext(FALSE, tvb, offset, pinfo, tree, hf_tcap_objectApplicationId);
1642 }
1643
1644
1645 static const value_string tcap_T_applicationContext_vals[] = {
1646   {  27, "integerApplicationId" },
1647   {  28, "objectApplicationId" },
1648   { 0, NULL }
1649 };
1650
1651 static const ber_choice_t T_applicationContext_choice[] = {
1652   {  27, BER_CLASS_PRI, 27, BER_FLAGS_NOOWNTAG, dissect_integerApplicationId },
1653   {  28, BER_CLASS_PRI, 28, BER_FLAGS_NOOWNTAG, dissect_objectApplicationId },
1654   { 0, 0, 0, 0, NULL }
1655 };
1656
1657 static int
1658 dissect_tcap_T_applicationContext(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1659   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1660                                  T_applicationContext_choice, hf_index, ett_tcap_T_applicationContext,
1661                                  NULL);
1662
1663   return offset;
1664 }
1665 static int dissect_applicationContext(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1666   return dissect_tcap_T_applicationContext(FALSE, tvb, offset, pinfo, tree, hf_tcap_applicationContext);
1667 }
1668
1669
1670 static const value_string tcap_T_securityContext_vals[] = {
1671   {   0, "integerSecurityId" },
1672   {   1, "objectSecurityId" },
1673   { 0, NULL }
1674 };
1675
1676 static const ber_choice_t T_securityContext_choice[] = {
1677   {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_integerSecurityId_impl },
1678   {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_objectSecurityId_impl },
1679   { 0, 0, 0, 0, NULL }
1680 };
1681
1682 static int
1683 dissect_tcap_T_securityContext(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1684   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1685                                  T_securityContext_choice, hf_index, ett_tcap_T_securityContext,
1686                                  NULL);
1687
1688   return offset;
1689 }
1690 static int dissect_securityContext(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1691   return dissect_tcap_T_securityContext(FALSE, tvb, offset, pinfo, tree, hf_tcap_securityContext);
1692 }
1693
1694
1695 static const value_string tcap_T_confidentialityId_vals[] = {
1696   {   0, "integerConfidentialityId" },
1697   {   1, "objectConfidentialityId" },
1698   { 0, NULL }
1699 };
1700
1701 static const ber_choice_t T_confidentialityId_choice[] = {
1702   {   0, BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_integerConfidentialityId_impl },
1703   {   1, BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_objectConfidentialityId_impl },
1704   { 0, 0, 0, 0, NULL }
1705 };
1706
1707 static int
1708 dissect_tcap_T_confidentialityId(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1709   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1710                                  T_confidentialityId_choice, hf_index, ett_tcap_T_confidentialityId,
1711                                  NULL);
1712
1713   return offset;
1714 }
1715 static int dissect_confidentialityId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1716   return dissect_tcap_T_confidentialityId(FALSE, tvb, offset, pinfo, tree, hf_tcap_confidentialityId);
1717 }
1718
1719
1720 static const ber_sequence_t Confidentiality_sequence[] = {
1721   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_confidentialityId },
1722   { 0, 0, 0, NULL }
1723 };
1724
1725 static int
1726 dissect_tcap_Confidentiality(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1727   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1728                                    Confidentiality_sequence, hf_index, ett_tcap_Confidentiality);
1729
1730   return offset;
1731 }
1732 static int dissect_confidentiality_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1733   return dissect_tcap_Confidentiality(TRUE, tvb, offset, pinfo, tree, hf_tcap_confidentiality);
1734 }
1735
1736
1737 static const ber_sequence_t DialoguePortionANSI_sequence[] = {
1738   { BER_CLASS_PRI, 26, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_version },
1739   { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_applicationContext },
1740   { BER_CLASS_UNI, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_userInformation },
1741   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_securityContext },
1742   { BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_confidentiality_impl },
1743   { 0, 0, 0, NULL }
1744 };
1745
1746 static int
1747 dissect_tcap_DialoguePortionANSI(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1748   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1749                                    DialoguePortionANSI_sequence, hf_index, ett_tcap_DialoguePortionANSI);
1750
1751   return offset;
1752 }
1753 static int dissect_dialoguePortionansi(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1754   return dissect_tcap_DialoguePortionANSI(FALSE, tvb, offset, pinfo, tree, hf_tcap_dialoguePortionansi);
1755 }
1756
1757
1758
1759 static int
1760 dissect_tcap_OCTET_STRING_SIZE_0_2(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1761   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1762                                        NULL);
1763
1764   return offset;
1765 }
1766 static int dissect_componentIDs_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1767   return dissect_tcap_OCTET_STRING_SIZE_0_2(TRUE, tvb, offset, pinfo, tree, hf_tcap_componentIDs);
1768 }
1769
1770
1771 static const value_string tcap_OperationCode_vals[] = {
1772   {  16, "national" },
1773   {  17, "private" },
1774   { 0, NULL }
1775 };
1776
1777 static const ber_choice_t OperationCode_choice[] = {
1778   {  16, BER_CLASS_PRI, 16, BER_FLAGS_IMPLTAG, dissect_national_impl },
1779   {  17, BER_CLASS_PRI, 17, BER_FLAGS_IMPLTAG, dissect_private_impl },
1780   { 0, 0, 0, 0, NULL }
1781 };
1782
1783 static int
1784 dissect_tcap_OperationCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1785   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
1786                                  OperationCode_choice, hf_index, ett_tcap_OperationCode,
1787                                  NULL);
1788
1789   return offset;
1790 }
1791 static int dissect_operationCode(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1792   return dissect_tcap_OperationCode(FALSE, tvb, offset, pinfo, tree, hf_tcap_operationCode);
1793 }
1794
1795
1796
1797 static int
1798 dissect_tcap_ANSIParameters(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1799 #line 111 "tcap.cnf"
1800 /* we are doing the ParamSet here so need to look at the tags*/
1801         guint32 len;
1802 len = tvb_length_remaining(tvb, offset);
1803 if (len > 2)  /* arghhh I dont know whether this is constructed or not! */
1804                 offset = dissect_tcap_param(pinfo,tree,tvb,offset);
1805 else
1806 offset = dissect_ber_octet_string(TRUE, pinfo, tree, tvb, 0, hf_index,
1807                                     NULL);
1808
1809
1810
1811
1812   return offset;
1813 }
1814 static int dissect_ansiparams(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1815   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams);
1816 }
1817 static int dissect_ansiparams1(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1818   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams1);
1819 }
1820 static int dissect_ansiparams2(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1821   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams2);
1822 }
1823 static int dissect_ansiparams3(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1824   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams3);
1825 }
1826 static int dissect_ansiparams4(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1827   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams4);
1828 }
1829 static int dissect_ansiparams5(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1830   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams5);
1831 }
1832 static int dissect_ansiparams6(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1833   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams6);
1834 }
1835 static int dissect_ansiparams7(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1836   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams7);
1837 }
1838 static int dissect_ansiparams8(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1839   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams8);
1840 }
1841 static int dissect_ansiparams9(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1842   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams9);
1843 }
1844 static int dissect_ansiparams10(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1845   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams10);
1846 }
1847 static int dissect_ansiparams11(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1848   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams11);
1849 }
1850 static int dissect_ansiparams12(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1851   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams12);
1852 }
1853 static int dissect_ansiparams13(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1854   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams13);
1855 }
1856 static int dissect_ansiparams14(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1857   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams14);
1858 }
1859 static int dissect_ansiparams15(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1860   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams15);
1861 }
1862 static int dissect_ansiparams16(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1863   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams16);
1864 }
1865 static int dissect_ansiparams17(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1866   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams17);
1867 }
1868 static int dissect_ansiparams18(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1869   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams18);
1870 }
1871 static int dissect_ansiparams19(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1872   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams19);
1873 }
1874 static int dissect_ansiparams20(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1875   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams20);
1876 }
1877 static int dissect_ansiparams21(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1878   return dissect_tcap_ANSIParameters(FALSE, tvb, offset, pinfo, tree, hf_tcap_ansiparams21);
1879 }
1880
1881
1882 static const ber_sequence_t ANSIparamch_sequence[] = {
1883   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams },
1884   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams1 },
1885   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams2 },
1886   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams3 },
1887   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams4 },
1888   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams5 },
1889   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams6 },
1890   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams7 },
1891   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams8 },
1892   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams9 },
1893   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams10 },
1894   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams11 },
1895   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams12 },
1896   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams13 },
1897   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams14 },
1898   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams15 },
1899   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams16 },
1900   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams17 },
1901   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams18 },
1902   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams19 },
1903   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams20 },
1904   { BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ansiparams21 },
1905   { 0, 0, 0, NULL }
1906 };
1907
1908 static int
1909 dissect_tcap_ANSIparamch(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1910   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1911                                    ANSIparamch_sequence, hf_index, ett_tcap_ANSIparamch);
1912
1913   return offset;
1914 }
1915 static int dissect_parameterinv(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1916   return dissect_tcap_ANSIparamch(FALSE, tvb, offset, pinfo, tree, hf_tcap_parameterinv);
1917 }
1918 static int dissect_parameterrr(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1919   return dissect_tcap_ANSIparamch(FALSE, tvb, offset, pinfo, tree, hf_tcap_parameterrr);
1920 }
1921 static int dissect_parameterre(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1922   return dissect_tcap_ANSIparamch(FALSE, tvb, offset, pinfo, tree, hf_tcap_parameterre);
1923 }
1924 static int dissect_parameterrj(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1925   return dissect_tcap_ANSIparamch(FALSE, tvb, offset, pinfo, tree, hf_tcap_parameterrj);
1926 }
1927
1928
1929 static const ber_sequence_t InvokePDU_sequence[] = {
1930   { BER_CLASS_PRI, 15, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_componentIDs_impl },
1931   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_operationCode },
1932   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_parameterinv },
1933   { 0, 0, 0, NULL }
1934 };
1935
1936 static int
1937 dissect_tcap_InvokePDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1938   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1939                                    InvokePDU_sequence, hf_index, ett_tcap_InvokePDU);
1940
1941   return offset;
1942 }
1943 static int dissect_invokeLastansi_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1944   return dissect_tcap_InvokePDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_invokeLastansi);
1945 }
1946 static int dissect_invokeNotLastansi_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1947   return dissect_tcap_InvokePDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_invokeNotLastansi);
1948 }
1949
1950
1951
1952 static int
1953 dissect_tcap_ComponentID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1954   offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
1955                                        NULL);
1956
1957   return offset;
1958 }
1959 static int dissect_componentID(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1960   return dissect_tcap_ComponentID(FALSE, tvb, offset, pinfo, tree, hf_tcap_componentID);
1961 }
1962
1963
1964 static const ber_sequence_t ReturnResultPDU_sequence[] = {
1965   { BER_CLASS_PRI, 15, BER_FLAGS_NOOWNTAG, dissect_componentID },
1966   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_parameterrr },
1967   { 0, 0, 0, NULL }
1968 };
1969
1970 static int
1971 dissect_tcap_ReturnResultPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1972   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1973                                    ReturnResultPDU_sequence, hf_index, ett_tcap_ReturnResultPDU);
1974
1975   return offset;
1976 }
1977 static int dissect_returnResultLastansi_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1978   return dissect_tcap_ReturnResultPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_returnResultLastansi);
1979 }
1980 static int dissect_returnResultNotLastansi_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
1981   return dissect_tcap_ReturnResultPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_returnResultNotLastansi);
1982 }
1983
1984
1985 static const ber_sequence_t ReturnErrorPDU_sequence[] = {
1986   { BER_CLASS_PRI, 15, BER_FLAGS_NOOWNTAG, dissect_componentID },
1987   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_errorCode },
1988   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_parameterre },
1989   { 0, 0, 0, NULL }
1990 };
1991
1992 static int
1993 dissect_tcap_ReturnErrorPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
1994   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
1995                                    ReturnErrorPDU_sequence, hf_index, ett_tcap_ReturnErrorPDU);
1996
1997   return offset;
1998 }
1999 static int dissect_returnErroransi_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2000   return dissect_tcap_ReturnErrorPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_returnErroransi);
2001 }
2002
2003
2004 static const value_string tcap_ProblemPDU_vals[] = {
2005   { 257, "general-unrecognisedComponentType" },
2006   { 258, "general-incorrectComponentPortion" },
2007   { 259, "general-badlyStructuredCompPortion" },
2008   { 0, NULL }
2009 };
2010
2011
2012 static int
2013 dissect_tcap_ProblemPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2014   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
2015                                   NULL);
2016
2017   return offset;
2018 }
2019 static int dissect_rejectProblem_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2020   return dissect_tcap_ProblemPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_rejectProblem);
2021 }
2022
2023
2024 static const ber_sequence_t RejectPDU_sequence[] = {
2025   { BER_CLASS_PRI, 15, BER_FLAGS_NOOWNTAG, dissect_componentID },
2026   { BER_CLASS_PRI, 21, BER_FLAGS_IMPLTAG, dissect_rejectProblem_impl },
2027   { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_parameterrj },
2028   { 0, 0, 0, NULL }
2029 };
2030
2031 static int
2032 dissect_tcap_RejectPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2033   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
2034                                    RejectPDU_sequence, hf_index, ett_tcap_RejectPDU);
2035
2036   return offset;
2037 }
2038 static int dissect_rejectansi_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2039   return dissect_tcap_RejectPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_rejectansi);
2040 }
2041
2042
2043 static const value_string tcap_ComponentPDU_vals[] = {
2044   {   9, "invokeLastansi" },
2045   {  10, "returnResultLastansi" },
2046   {  11, "returnErroransi" },
2047   {  12, "rejectansi" },
2048   {  13, "invokeNotLastansi" },
2049   {  14, "returnResultNotLastansi" },
2050   { 0, NULL }
2051 };
2052
2053 static const ber_choice_t ComponentPDU_choice[] = {
2054   {   9, BER_CLASS_PRI, 9, BER_FLAGS_IMPLTAG, dissect_invokeLastansi_impl },
2055   {  10, BER_CLASS_PRI, 10, BER_FLAGS_IMPLTAG, dissect_returnResultLastansi_impl },
2056   {  11, BER_CLASS_PRI, 11, BER_FLAGS_IMPLTAG, dissect_returnErroransi_impl },
2057   {  12, BER_CLASS_PRI, 12, BER_FLAGS_IMPLTAG, dissect_rejectansi_impl },
2058   {  13, BER_CLASS_PRI, 13, BER_FLAGS_IMPLTAG, dissect_invokeNotLastansi_impl },
2059   {  14, BER_CLASS_PRI, 14, BER_FLAGS_IMPLTAG, dissect_returnResultNotLastansi_impl },
2060   { 0, 0, 0, 0, NULL }
2061 };
2062
2063 static int
2064 dissect_tcap_ComponentPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2065 #line 122 "tcap.cnf"
2066 tvbuff_t *next_tvb;
2067 dissector_handle_t subdissector_handle;
2068
2069 next_tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), tvb_length_remaining(tvb, offset));           
2070
2071 if (! (subdissector_handle = get_ansi_tcap_subdissector(pinfo->match_port))) {
2072     subdissector_handle = data_handle;
2073
2074   
2075     tcap_subdissector_used=TRUE;
2076
2077 call_dissector(subdissector_handle, next_tvb, pinfo, tcap_top_tree);
2078     
2079 offset = dissect_ber_choice(pinfo, tree, tvb, offset,
2080                               ComponentPDU_choice, hf_index, ett_tcap_ComponentPDU,NULL);
2081         
2082
2083
2084   return offset;
2085 }
2086 static int dissect_ComponentSequence_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2087   return dissect_tcap_ComponentPDU(FALSE, tvb, offset, pinfo, tree, hf_tcap_ComponentSequence_item);
2088 }
2089
2090
2091 static const ber_sequence_t ComponentSequence_sequence_of[1] = {
2092   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ComponentSequence_item },
2093 };
2094
2095 static int
2096 dissect_tcap_ComponentSequence(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2097   offset = dissect_ber_sequence_of(implicit_tag, pinfo, tree, tvb, offset,
2098                                       ComponentSequence_sequence_of, hf_index, ett_tcap_ComponentSequence);
2099
2100   return offset;
2101 }
2102 static int dissect_componentPortion(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2103   return dissect_tcap_ComponentSequence(FALSE, tvb, offset, pinfo, tree, hf_tcap_componentPortion);
2104 }
2105
2106
2107 static const ber_sequence_t UniTransactionPDU_sequence[] = {
2108   { BER_CLASS_PRI, 7, BER_FLAGS_NOOWNTAG, dissect_identifier },
2109   { BER_CLASS_PRI, 25, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_dialoguePortionansi },
2110   { BER_CLASS_PRI, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_componentPortion },
2111   { 0, 0, 0, NULL }
2112 };
2113
2114 static int
2115 dissect_tcap_UniTransactionPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2116   offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
2117                                    UniTransactionPDU_sequence, hf_index, ett_tcap_UniTransactionPDU);
2118
2119   return offset;
2120 }
2121 static int dissect_ansiunidirectional_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2122   return dissect_tcap_UniTransactionPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_ansiunidirectional);
2123 }
2124
2125
2126 static const ber_sequence_t TransactionPDU_sequence[] = {
2127   { BER_CLASS_PRI, 7, BER_FLAGS_NOOWNTAG, dissect_identifier },
2128   { BER_CLASS_PRI, 25, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_dialoguePortionansi },
2129   { BER_CLASS_PRI, 8, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_componentPortion },
2130   { 0, 0, 0, NULL }
2131 };
2132
2133 static int
2134 dissect_tcap_TransactionPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2135 #line 245 "tcap.cnf"
2136 if ((hf_index == hf_tcap_ansiqueryWithPerm)&&(check_col(pinfo->cinfo, COL_INFO)))
2137                                 col_append_fstr(pinfo->cinfo, COL_INFO, " QueryWithPerm");              
2138                                 
2139 if ((hf_index == hf_tcap_ansiqueryWithoutPerm)&&(check_col(pinfo->cinfo, COL_INFO)))
2140                                 col_append_fstr(pinfo->cinfo, COL_INFO, " QueryWithOutPerm");           
2141                                 
2142 if ((hf_index == hf_tcap_ansiresponse)&&(check_col(pinfo->cinfo, COL_INFO)))
2143                                 col_append_fstr(pinfo->cinfo, COL_INFO, " Response");           
2144                                 
2145 if ((hf_index == hf_tcap_ansiconversationWithPerm)&&(check_col(pinfo->cinfo, COL_INFO)))
2146                                 col_append_fstr(pinfo->cinfo, COL_INFO, " ConversationWithPerm");               
2147                                 
2148 if ((hf_index == hf_tcap_ansiconversationWithoutPerm)&&(check_col(pinfo->cinfo, COL_INFO)))
2149                                 col_append_fstr(pinfo->cinfo, COL_INFO, " ConversationWithoutPerm");            
2150                                 
2151  offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
2152                 TransactionPDU_sequence, hf_index, ett_tcap_TransactionPDU);  
2153           
2154
2155
2156   return offset;
2157 }
2158 static int dissect_ansiqueryWithPerm_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2159   return dissect_tcap_TransactionPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_ansiqueryWithPerm);
2160 }
2161 static int dissect_ansiqueryWithoutPerm_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2162   return dissect_tcap_TransactionPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_ansiqueryWithoutPerm);
2163 }
2164 static int dissect_ansiresponse_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2165   return dissect_tcap_TransactionPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_ansiresponse);
2166 }
2167 static int dissect_ansiconversationWithPerm_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2168   return dissect_tcap_TransactionPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_ansiconversationWithPerm);
2169 }
2170 static int dissect_ansiconversationWithoutPerm_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2171   return dissect_tcap_TransactionPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_ansiconversationWithoutPerm);
2172 }
2173
2174
2175 static const value_string tcap_P_Abort_cause_vals[] = {
2176   {   1, "unrecognizedPackageType" },
2177   {   2, "incorrestTransactionPortion" },
2178   {   3, "badlyStructuredTransactionPortion" },
2179   {   4, "unassignedRespondingTransactionID" },
2180   {   5, "permissionToReleaseProblem" },
2181   {   6, "resourceUnavilable" },
2182   {   7, "unrecognizedDialoguePortionID" },
2183   {   8, "badlyStructuredDialoguePortion" },
2184   {   9, "missingDialoguePortion" },
2185   {  10, "inconsistentDialoguePortion" },
2186   { 0, NULL }
2187 };
2188
2189
2190 static int
2191 dissect_tcap_P_Abort_cause(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2192   offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index,
2193                                   NULL);
2194
2195   return offset;
2196 }
2197 static int dissect_abortCause(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2198   return dissect_tcap_P_Abort_cause(FALSE, tvb, offset, pinfo, tree, hf_tcap_abortCause);
2199 }
2200
2201
2202 static const value_string tcap_T_causeInformation_vals[] = {
2203   {   0, "abortCause" },
2204   {   1, "userInformation" },
2205   { 0, NULL }
2206 };
2207
2208 static const ber_choice_t T_causeInformation_choice[] = {
2209   {   0, BER_CLASS_PRI, 23, BER_FLAGS_NOOWNTAG, dissect_abortCause },
2210   {   1, BER_CLASS_UNI, 8, BER_FLAGS_NOOWNTAG, dissect_userInformation },
2211   { 0, 0, 0, 0, NULL }
2212 };
2213
2214 static int
2215 dissect_tcap_T_causeInformation(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2216   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
2217                                  T_causeInformation_choice, hf_index, ett_tcap_T_causeInformation,
2218                                  NULL);
2219
2220   return offset;
2221 }
2222 static int dissect_causeInformation(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2223   return dissect_tcap_T_causeInformation(FALSE, tvb, offset, pinfo, tree, hf_tcap_causeInformation);
2224 }
2225
2226
2227 static const ber_sequence_t AbortPDU_sequence[] = {
2228   { BER_CLASS_PRI, 7, BER_FLAGS_NOOWNTAG, dissect_identifier },
2229   { BER_CLASS_PRI, 25, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_dialoguePortionansi },
2230   { BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_causeInformation },
2231   { 0, 0, 0, NULL }
2232 };
2233
2234 static int
2235 dissect_tcap_AbortPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2236 #line 240 "tcap.cnf"
2237 if (check_col(pinfo->cinfo, COL_INFO))
2238                 col_append_fstr(pinfo->cinfo, COL_INFO, " Abort ");
2239    offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
2240                                 AbortPDU_sequence, hf_index, ett_tcap_AbortPDU);
2241
2242
2243   return offset;
2244 }
2245 static int dissect_ansiabort_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
2246   return dissect_tcap_AbortPDU(TRUE, tvb, offset, pinfo, tree, hf_tcap_ansiabort);
2247 }
2248
2249
2250 static const value_string tcap_MessageType_vals[] = {
2251   {   0, "unidirectional" },
2252   {   1, "begin" },
2253   {   2, "end" },
2254   {   3, "continue" },
2255   {   4, "abort" },
2256   {   5, "ansiunidirectional" },
2257   {   6, "ansiqueryWithPerm" },
2258   {   7, "ansiqueryWithoutPerm" },
2259   {   8, "ansiresponse" },
2260   {   9, "ansiconversationWithPerm" },
2261   {  10, "ansiconversationWithoutPerm" },
2262   {  11, "ansiabort" },
2263   { 0, NULL }
2264 };
2265
2266 static const ber_choice_t MessageType_choice[] = {
2267   {   0, BER_CLASS_APP, 1, BER_FLAGS_IMPLTAG, dissect_unidirectional_impl },
2268   {   1, BER_CLASS_APP, 2, BER_FLAGS_IMPLTAG, dissect_begin_impl },
2269   {   2, BER_CLASS_APP, 4, BER_FLAGS_IMPLTAG, dissect_end_impl },
2270   {   3, BER_CLASS_APP, 5, BER_FLAGS_IMPLTAG, dissect_continue_impl },
2271   {   4, BER_CLASS_APP, 7, BER_FLAGS_IMPLTAG, dissect_abort_impl },
2272   {   5, BER_CLASS_PRI, 1, BER_FLAGS_IMPLTAG, dissect_ansiunidirectional_impl },
2273   {   6, BER_CLASS_PRI, 2, BER_FLAGS_IMPLTAG, dissect_ansiqueryWithPerm_impl },
2274   {   7, BER_CLASS_PRI, 3, BER_FLAGS_IMPLTAG, dissect_ansiqueryWithoutPerm_impl },
2275   {   8, BER_CLASS_PRI, 4, BER_FLAGS_IMPLTAG, dissect_ansiresponse_impl },
2276   {   9, BER_CLASS_PRI, 5, BER_FLAGS_IMPLTAG, dissect_ansiconversationWithPerm_impl },
2277   {  10, BER_CLASS_PRI, 6, BER_FLAGS_IMPLTAG, dissect_ansiconversationWithoutPerm_impl },
2278   {  11, BER_CLASS_PRI, 22, BER_FLAGS_IMPLTAG, dissect_ansiabort_impl },
2279   { 0, 0, 0, 0, NULL }
2280 };
2281
2282 static int
2283 dissect_tcap_MessageType(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2284   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
2285                                  MessageType_choice, hf_index, ett_tcap_MessageType,
2286                                  NULL);
2287
2288   return offset;
2289 }
2290
2291
2292 static const value_string tcap_ERROR_vals[] = {
2293   {   0, "localValue" },
2294   {   1, "globalValue" },
2295   { 0, NULL }
2296 };
2297
2298 static const ber_choice_t ERROR_choice[] = {
2299   {   0, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_localValue },
2300   {   1, BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_globalValue },
2301   { 0, 0, 0, 0, NULL }
2302 };
2303
2304 static int
2305 dissect_tcap_ERROR(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) {
2306   offset = dissect_ber_choice(pinfo, tree, tvb, offset,
2307                                  ERROR_choice, hf_index, ett_tcap_ERROR,
2308                                  NULL);
2309
2310   return offset;
2311 }
2312
2313
2314 /*--- End of included file: packet-tcap-fn.c ---*/
2315 #line 141 "packet-tcap-template.c"
2316
2317
2318
2319 const value_string tcap_component_type_str[] = {
2320     { TCAP_COMP_INVOKE,         "Invoke" },
2321     { TCAP_COMP_RRL,            "Return Result(L)" },
2322     { TCAP_COMP_RE,                     "Return Error" },
2323     { TCAP_COMP_REJECT,         "Reject" },
2324     { TCAP_COMP_RRN,            "Return Result(NL)" },
2325     { 0,                        NULL } };
2326
2327
2328 static void
2329 dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
2330 {
2331     proto_item          *item=NULL;
2332     proto_tree          *tree=NULL;
2333     proto_item  *stat_item=NULL;
2334     proto_tree  *stat_tree=NULL;
2335     struct tcaphash_context_t * p_tcap_context;
2336
2337     tcap_top_tree = parent_tree;
2338     if (check_col(pinfo->cinfo, COL_PROTOCOL))
2339     {
2340                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCAP");
2341     }
2342
2343     /* create display subtree for the protocol */
2344     if(parent_tree){
2345       item = proto_tree_add_item(parent_tree, proto_tcap, tvb, 0, -1, FALSE);
2346       tree = proto_item_add_subtree(item, ett_tcap);
2347       tcap_stat_item=item;
2348       tcap_stat_tree=tree;
2349     }
2350     cur_oid = NULL;
2351     tcapext_oid = NULL;
2352     raz_tcap_private(&tcap_private);
2353
2354     pinfo->private_data = &tcap_private;
2355     gp_tcapsrt_info=tcapsrt_razinfo();
2356     tcap_subdissector_used=FALSE;
2357     gp_tcap_context=NULL;
2358     dissect_tcap_MessageType(FALSE, tvb, 0, pinfo, tree, -1);  
2359
2360     if (gtcap_HandleSRT &&
2361         !tcap_subdissector_used ) {
2362       if (gtcap_DisplaySRT && tree) {
2363         stat_item = proto_tree_add_text(tree, tvb, 0, 0, "Stat");
2364         stat_tree = proto_item_add_subtree(stat_item, ett_tcap_stat);
2365       }
2366       p_tcap_context=tcapsrt_call_matching(tvb, pinfo, stat_tree, gp_tcapsrt_info);
2367       tcap_private.context=p_tcap_context;
2368       
2369       if (gtcap_HandleSRT &&
2370           p_tcap_context &&
2371           p_tcap_context->callback) {
2372         /* Callback fonction for the upper layer */
2373         (p_tcap_context->callback)(tvb, pinfo, stat_tree, p_tcap_context);
2374       }
2375     }
2376 }
2377
2378
2379 void
2380 proto_reg_handoff_tcap(void)
2381 {
2382     
2383     static gboolean prefs_initialized = FALSE;
2384     
2385     if (! prefs_initialized) {
2386         sccp_ssn_table = find_dissector_table("sccp.ssn");
2387         prefs_initialized = TRUE;
2388     }
2389     
2390     add_oid_str_name("0.0.17.773.1.1.1",
2391                           "itu-t(0) recommendation(0) q(17) 773 as(1) dialogue-as(1) version1(1)");
2392
2393     data_handle = find_dissector("data");    
2394 }
2395
2396 static void init_tcap(void);
2397
2398 void
2399 proto_register_tcap(void)
2400 {
2401
2402 /* Setup list of header fields  See Section 1.6.1 for details*/
2403     static hf_register_info hf[] = {
2404         { &hf_tcap_tag,
2405                 { "Tag",           "tcap.msgtype",
2406                 FT_UINT8, BASE_HEX, NULL, 0,
2407                 "", HFILL }
2408         },
2409         { &hf_tcap_length,
2410                 { "Length", "tcap.len",
2411                 FT_UINT8, BASE_HEX, NULL, 0,
2412                 "", HFILL }
2413         },
2414         { &hf_tcap_data,
2415                 { "Data", "tcap.data",
2416                 FT_BYTES, BASE_HEX, NULL, 0,
2417                 "", HFILL }
2418         },
2419                 { &hf_tcap_tid,
2420                 { "Transaction Id", "tcap.tid",
2421                 FT_BYTES, BASE_HEX, NULL, 0,
2422                 "", HFILL }
2423         }, 
2424         /* Tcap Service Response Time */
2425         { &hf_tcapsrt_SessionId,
2426           { "Session Id",
2427             "tcap.srt.session_id",
2428             FT_UINT32, BASE_DEC, NULL, 0x0,
2429             "", HFILL }
2430         },
2431         { &hf_tcapsrt_BeginSession,
2432           { "Begin Session",
2433             "tcap.srt.begin",
2434             FT_FRAMENUM, BASE_NONE, NULL, 0x0,
2435             "SRT Begin of Session", HFILL }
2436         },
2437         { &hf_tcapsrt_EndSession,
2438           { "End Session",
2439             "tcap.srt.end",
2440             FT_FRAMENUM, BASE_NONE, NULL, 0x0,
2441             "SRT End of Session", HFILL }
2442         },
2443         { &hf_tcapsrt_SessionTime,
2444           { "Session duration",
2445             "tcap.srt.sessiontime",
2446             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
2447             "Duration of the TCAP session", HFILL }
2448         },
2449         { &hf_tcapsrt_Duplicate,
2450           { "Request Duplicate",
2451             "tcap.srt.duplicate",
2452             FT_UINT32, BASE_DEC, NULL, 0x0,
2453             "", HFILL }
2454         },
2455
2456 /*--- Included file: packet-tcap-hfarr.c ---*/
2457 #line 1 "packet-tcap-hfarr.c"
2458     { &hf_tcap_dialogueRequest,
2459       { "dialogueRequest", "tcap.dialogueRequest",
2460         FT_NONE, BASE_NONE, NULL, 0,
2461         "tcap.AARQ_apdu", HFILL }},
2462     { &hf_tcap_dialogueResponse,
2463       { "dialogueResponse", "tcap.dialogueResponse",
2464         FT_NONE, BASE_NONE, NULL, 0,
2465         "tcap.AARE_apdu", HFILL }},
2466     { &hf_tcap_dialogueAbort,
2467       { "dialogueAbort", "tcap.dialogueAbort",
2468         FT_NONE, BASE_NONE, NULL, 0,
2469         "tcap.ABRT_apdu", HFILL }},
2470     { &hf_tcap_oid,
2471       { "oid", "tcap.oid",
2472         FT_OID, BASE_NONE, NULL, 0,
2473         "tcap.OBJECT_IDENTIFIER", HFILL }},
2474     { &hf_tcap_dialog,
2475       { "dialog", "tcap.dialog",
2476         FT_BYTES, BASE_HEX, NULL, 0,
2477         "tcap.Dialog1", HFILL }},
2478     { &hf_tcap_useroid,
2479       { "useroid", "tcap.useroid",
2480         FT_OID, BASE_NONE, NULL, 0,
2481         "tcap.UserInfoOID", HFILL }},
2482     { &hf_tcap_externuserinfo,
2483       { "externuserinfo", "tcap.externuserinfo",
2484         FT_BYTES, BASE_HEX, NULL, 0,
2485         "tcap.ExternUserInfo", HFILL }},
2486     { &hf_tcap_protocol_versionrq,
2487       { "protocol-versionrq", "tcap.protocol_versionrq",
2488         FT_BYTES, BASE_HEX, NULL, 0,
2489         "tcap.T_protocol_versionrq", HFILL }},
2490     { &hf_tcap_application_context_name,
2491       { "application-context-name", "tcap.application_context_name",
2492         FT_OID, BASE_NONE, NULL, 0,
2493         "tcap.Applicationcontext", HFILL }},
2494     { &hf_tcap_user_information,
2495       { "user-information", "tcap.user_information",
2496         FT_BYTES, BASE_HEX, NULL, 0,
2497         "tcap.User_information", HFILL }},
2498     { &hf_tcap_protocol_versionre,
2499       { "protocol-versionre", "tcap.protocol_versionre",
2500         FT_BYTES, BASE_HEX, NULL, 0,
2501         "tcap.T_protocol_versionre", HFILL }},
2502     { &hf_tcap_result,
2503       { "result", "tcap.result",
2504         FT_INT32, BASE_DEC, VALS(tcap_Associate_result_vals), 0,
2505         "tcap.Associate_result", HFILL }},
2506     { &hf_tcap_result_source_diagnostic,
2507       { "result-source-diagnostic", "tcap.result_source_diagnostic",
2508         FT_UINT32, BASE_DEC, VALS(tcap_Associate_source_diagnostic_vals), 0,
2509         "tcap.Associate_source_diagnostic", HFILL }},
2510     { &hf_tcap_reasonrq,
2511       { "reasonrq", "tcap.reasonrq",
2512         FT_INT32, BASE_DEC, VALS(tcap_Release_request_reason_vals), 0,
2513         "tcap.Release_request_reason", HFILL }},
2514     { &hf_tcap_reasonre,
2515       { "reasonre", "tcap.reasonre",
2516         FT_INT32, BASE_DEC, VALS(tcap_Release_response_reason_vals), 0,
2517         "tcap.Release_response_reason", HFILL }},
2518     { &hf_tcap_abort_source,
2519       { "abort-source", "tcap.abort_source",
2520         FT_INT32, BASE_DEC, VALS(tcap_ABRT_source_vals), 0,
2521         "tcap.ABRT_source", HFILL }},
2522     { &hf_tcap_dialogue_service_user,
2523       { "dialogue-service-user", "tcap.dialogue_service_user",
2524         FT_INT32, BASE_DEC, VALS(tcap_T_dialogue_service_user_vals), 0,
2525         "tcap.T_dialogue_service_user", HFILL }},
2526     { &hf_tcap_dialogue_service_provider,
2527       { "dialogue-service-provider", "tcap.dialogue_service_provider",
2528         FT_INT32, BASE_DEC, VALS(tcap_T_dialogue_service_provider_vals), 0,
2529         "tcap.T_dialogue_service_provider", HFILL }},
2530     { &hf_tcap_unidialoguePDU,
2531       { "unidialoguePDU", "tcap.unidialoguePDU",
2532         FT_NONE, BASE_NONE, NULL, 0,
2533         "tcap.AUDT_apdu", HFILL }},
2534     { &hf_tcap_protocol_version3,
2535       { "protocol-version3", "tcap.protocol_version3",
2536         FT_BYTES, BASE_HEX, NULL, 0,
2537         "tcap.T_protocol_version3", HFILL }},
2538     { &hf_tcap_unidirectional,
2539       { "unidirectional", "tcap.unidirectional",
2540         FT_NONE, BASE_NONE, NULL, 0,
2541         "tcap.Unidirectional", HFILL }},
2542     { &hf_tcap_begin,
2543       { "begin", "tcap.begin",
2544         FT_NONE, BASE_NONE, NULL, 0,
2545         "tcap.Begin", HFILL }},
2546     { &hf_tcap_end,
2547       { "end", "tcap.end",
2548         FT_NONE, BASE_NONE, NULL, 0,
2549         "tcap.End", HFILL }},
2550     { &hf_tcap_continue,
2551       { "continue", "tcap.continue",
2552         FT_NONE, BASE_NONE, NULL, 0,
2553         "tcap.Continue", HFILL }},
2554     { &hf_tcap_abort,
2555       { "abort", "tcap.abort",
2556         FT_NONE, BASE_NONE, NULL, 0,
2557         "tcap.Abort", HFILL }},
2558     { &hf_tcap_ansiunidirectional,
2559       { "ansiunidirectional", "tcap.ansiunidirectional",
2560         FT_NONE, BASE_NONE, NULL, 0,
2561         "tcap.UniTransactionPDU", HFILL }},
2562     { &hf_tcap_ansiqueryWithPerm,
2563       { "ansiqueryWithPerm", "tcap.ansiqueryWithPerm",
2564         FT_NONE, BASE_NONE, NULL, 0,
2565         "tcap.TransactionPDU", HFILL }},
2566     { &hf_tcap_ansiqueryWithoutPerm,
2567       { "ansiqueryWithoutPerm", "tcap.ansiqueryWithoutPerm",
2568         FT_NONE, BASE_NONE, NULL, 0,
2569         "tcap.TransactionPDU", HFILL }},
2570     { &hf_tcap_ansiresponse,
2571       { "ansiresponse", "tcap.ansiresponse",
2572         FT_NONE, BASE_NONE, NULL, 0,
2573         "tcap.TransactionPDU", HFILL }},
2574     { &hf_tcap_ansiconversationWithPerm,
2575       { "ansiconversationWithPerm", "tcap.ansiconversationWithPerm",
2576         FT_NONE, BASE_NONE, NULL, 0,
2577         "tcap.TransactionPDU", HFILL }},
2578     { &hf_tcap_ansiconversationWithoutPerm,
2579       { "ansiconversationWithoutPerm", "tcap.ansiconversationWithoutPerm",
2580         FT_NONE, BASE_NONE, NULL, 0,
2581         "tcap.TransactionPDU", HFILL }},
2582     { &hf_tcap_ansiabort,
2583       { "ansiabort", "tcap.ansiabort",
2584         FT_NONE, BASE_NONE, NULL, 0,
2585         "tcap.AbortPDU", HFILL }},
2586     { &hf_tcap_dialoguePortion,
2587       { "dialoguePortion", "tcap.dialoguePortion",
2588         FT_BYTES, BASE_HEX, NULL, 0,
2589         "tcap.DialoguePortion", HFILL }},
2590     { &hf_tcap_components,
2591       { "components", "tcap.components",
2592         FT_UINT32, BASE_DEC, NULL, 0,
2593         "tcap.ComponentPortion", HFILL }},
2594     { &hf_tcap_otid,
2595       { "otid", "tcap.otid",
2596         FT_BYTES, BASE_HEX, NULL, 0,
2597         "tcap.OrigTransactionID", HFILL }},
2598     { &hf_tcap_dtid,
2599       { "dtid", "tcap.dtid",
2600         FT_BYTES, BASE_HEX, NULL, 0,
2601         "tcap.DestTransactionID", HFILL }},
2602     { &hf_tcap_reason,
2603       { "reason", "tcap.reason",
2604         FT_UINT32, BASE_DEC, VALS(tcap_Reason_vals), 0,
2605         "tcap.Reason", HFILL }},
2606     { &hf_tcap_p_abortCause,
2607       { "p-abortCause", "tcap.p_abortCause",
2608         FT_INT32, BASE_DEC, VALS(tcap_P_AbortCause_vals), 0,
2609         "tcap.P_AbortCause", HFILL }},
2610     { &hf_tcap_u_abortCause,
2611       { "u-abortCause", "tcap.u_abortCause",
2612         FT_BYTES, BASE_HEX, NULL, 0,
2613         "tcap.DialoguePortion", HFILL }},
2614     { &hf_tcap_ComponentPortion_item,
2615       { "Item", "tcap.ComponentPortion_item",
2616         FT_UINT32, BASE_DEC, VALS(tcap_Component_vals), 0,
2617         "tcap.Component", HFILL }},
2618     { &hf_tcap_invoke,
2619       { "invoke", "tcap.invoke",
2620         FT_NONE, BASE_NONE, NULL, 0,
2621         "tcap.Invoke", HFILL }},
2622     { &hf_tcap_returnResultLast,
2623       { "returnResultLast", "tcap.returnResultLast",
2624         FT_NONE, BASE_NONE, NULL, 0,
2625         "tcap.ReturnResult", HFILL }},
2626     { &hf_tcap_returnError,
2627       { "returnError", "tcap.returnError",
2628         FT_NONE, BASE_NONE, NULL, 0,
2629         "tcap.ReturnError", HFILL }},
2630     { &hf_tcap_reject,
2631       { "reject", "tcap.reject",
2632         FT_NONE, BASE_NONE, NULL, 0,
2633         "tcap.Reject", HFILL }},
2634     { &hf_tcap_returnResultNotLast,
2635       { "returnResultNotLast", "tcap.returnResultNotLast",
2636         FT_NONE, BASE_NONE, NULL, 0,
2637         "tcap.ReturnResult", HFILL }},
2638     { &hf_tcap_invokeID,
2639       { "invokeID", "tcap.invokeID",
2640         FT_INT32, BASE_DEC, NULL, 0,
2641         "tcap.InvokeIdType", HFILL }},
2642     { &hf_tcap_linkedID,
2643       { "linkedID", "tcap.linkedID",
2644         FT_INT32, BASE_DEC, NULL, 0,
2645         "tcap.InvokeIdType", HFILL }},
2646     { &hf_tcap_opCode,
2647       { "opCode", "tcap.opCode",
2648         FT_UINT32, BASE_DEC, VALS(tcap_OPERATION_vals), 0,
2649         "tcap.OPERATION", HFILL }},
2650     { &hf_tcap_parameter,
2651       { "parameter", "tcap.parameter",
2652         FT_NONE, BASE_NONE, NULL, 0,
2653         "tcap.Parameter", HFILL }},
2654     { &hf_tcap_resultretres,
2655       { "resultretres", "tcap.resultretres",
2656         FT_NONE, BASE_NONE, NULL, 0,
2657         "tcap.T_resultretres", HFILL }},
2658     { &hf_tcap_errorCode,
2659       { "errorCode", "tcap.errorCode",
2660         FT_UINT32, BASE_DEC, VALS(tcap_ErrorCode_vals), 0,
2661         "tcap.ErrorCode", HFILL }},
2662     { &hf_tcap_invokeIDRej,
2663       { "invokeIDRej", "tcap.invokeIDRej",
2664         FT_UINT32, BASE_DEC, VALS(tcap_T_invokeIDRej_vals), 0,
2665         "tcap.T_invokeIDRej", HFILL }},
2666     { &hf_tcap_derivable,
2667       { "derivable", "tcap.derivable",
2668         FT_INT32, BASE_DEC, NULL, 0,
2669         "tcap.InvokeIdType", HFILL }},
2670     { &hf_tcap_not_derivable,
2671       { "not-derivable", "tcap.not_derivable",
2672         FT_NONE, BASE_NONE, NULL, 0,
2673         "tcap.NULL", HFILL }},
2674     { &hf_tcap_problem,
2675       { "problem", "tcap.problem",
2676         FT_UINT32, BASE_DEC, VALS(tcap_T_problem_vals), 0,
2677         "tcap.T_problem", HFILL }},
2678     { &hf_tcap_generalProblem,
2679       { "generalProblem", "tcap.generalProblem",
2680         FT_INT32, BASE_DEC, VALS(tcap_GeneralProblem_vals), 0,
2681         "tcap.GeneralProblem", HFILL }},
2682     { &hf_tcap_invokeProblem,
2683       { "invokeProblem", "tcap.invokeProblem",
2684         FT_INT32, BASE_DEC, VALS(tcap_InvokeProblem_vals), 0,
2685         "tcap.InvokeProblem", HFILL }},
2686     { &hf_tcap_returnResultProblem,
2687       { "returnResultProblem", "tcap.returnResultProblem",
2688         FT_INT32, BASE_DEC, VALS(tcap_ReturnResultProblem_vals), 0,
2689         "tcap.ReturnResultProblem", HFILL }},
2690     { &hf_tcap_returnErrorProblem,
2691       { "returnErrorProblem", "tcap.returnErrorProblem",
2692         FT_INT32, BASE_DEC, VALS(tcap_ReturnErrorProblem_vals), 0,
2693         "tcap.ReturnErrorProblem", HFILL }},
2694     { &hf_tcap_localValue,
2695       { "localValue", "tcap.localValue",
2696         FT_INT32, BASE_DEC, NULL, 0,
2697         "tcap.INTEGER", HFILL }},
2698     { &hf_tcap_globalValue,
2699       { "globalValue", "tcap.globalValue",
2700         FT_OID, BASE_NONE, NULL, 0,
2701         "tcap.OBJECT_IDENTIFIER", HFILL }},
2702     { &hf_tcap_identifier,
2703       { "identifier", "tcap.identifier",
2704         FT_BYTES, BASE_HEX, NULL, 0,
2705         "tcap.TransactionID", HFILL }},
2706     { &hf_tcap_dialoguePortionansi,
2707       { "dialoguePortionansi", "tcap.dialoguePortionansi",
2708         FT_NONE, BASE_NONE, NULL, 0,
2709         "tcap.DialoguePortionANSI", HFILL }},
2710     { &hf_tcap_componentPortion,
2711       { "componentPortion", "tcap.componentPortion",
2712         FT_UINT32, BASE_DEC, NULL, 0,
2713         "tcap.ComponentSequence", HFILL }},
2714     { &hf_tcap_causeInformation,
2715       { "causeInformation", "tcap.causeInformation",
2716         FT_UINT32, BASE_DEC, VALS(tcap_T_causeInformation_vals), 0,
2717         "tcap.T_causeInformation", HFILL }},
2718     { &hf_tcap_abortCause,
2719       { "abortCause", "tcap.abortCause",
2720         FT_INT32, BASE_DEC, VALS(tcap_P_Abort_cause_vals), 0,
2721         "tcap.P_Abort_cause", HFILL }},
2722     { &hf_tcap_userInformation,
2723       { "userInformation", "tcap.userInformation",
2724         FT_NONE, BASE_NONE, NULL, 0,
2725         "tcap.UserInformation", HFILL }},
2726     { &hf_tcap_version,
2727       { "version", "tcap.version",
2728         FT_BYTES, BASE_HEX, NULL, 0,
2729         "tcap.ProtocolVersion", HFILL }},
2730     { &hf_tcap_applicationContext,
2731       { "applicationContext", "tcap.applicationContext",
2732         FT_UINT32, BASE_DEC, VALS(tcap_T_applicationContext_vals), 0,
2733         "tcap.T_applicationContext", HFILL }},
2734     { &hf_tcap_integerApplicationId,
2735       { "integerApplicationId", "tcap.integerApplicationId",
2736         FT_INT32, BASE_DEC, NULL, 0,
2737         "tcap.IntegerApplicationContext", HFILL }},
2738     { &hf_tcap_objectApplicationId,
2739       { "objectApplicationId", "tcap.objectApplicationId",
2740         FT_OID, BASE_NONE, NULL, 0,
2741         "tcap.ObjectIDApplicationContext", HFILL }},
2742     { &hf_tcap_securityContext,
2743       { "securityContext", "tcap.securityContext",
2744         FT_UINT32, BASE_DEC, VALS(tcap_T_securityContext_vals), 0,
2745         "tcap.T_securityContext", HFILL }},
2746     { &hf_tcap_integerSecurityId,
2747       { "integerSecurityId", "tcap.integerSecurityId",
2748         FT_INT32, BASE_DEC, NULL, 0,
2749         "tcap.INTEGER", HFILL }},
2750     { &hf_tcap_objectSecurityId,
2751       { "objectSecurityId", "tcap.objectSecurityId",
2752         FT_OID, BASE_NONE, NULL, 0,
2753         "tcap.OBJECT_IDENTIFIER", HFILL }},
2754     { &hf_tcap_confidentiality,
2755       { "confidentiality", "tcap.confidentiality",
2756         FT_NONE, BASE_NONE, NULL, 0,
2757         "tcap.Confidentiality", HFILL }},
2758     { &hf_tcap_confidentialityId,
2759       { "confidentialityId", "tcap.confidentialityId",
2760         FT_UINT32, BASE_DEC, VALS(tcap_T_confidentialityId_vals), 0,
2761         "tcap.T_confidentialityId", HFILL }},
2762     { &hf_tcap_integerConfidentialityId,
2763       { "integerConfidentialityId", "tcap.integerConfidentialityId",
2764         FT_INT32, BASE_DEC, NULL, 0,
2765         "tcap.INTEGER", HFILL }},
2766     { &hf_tcap_objectConfidentialityId,
2767       { "objectConfidentialityId", "tcap.objectConfidentialityId",
2768         FT_OID, BASE_NONE, NULL, 0,
2769         "tcap.OBJECT_IDENTIFIER", HFILL }},
2770     { &hf_tcap_ComponentSequence_item,
2771       { "Item", "tcap.ComponentSequence_item",
2772         FT_UINT32, BASE_DEC, VALS(tcap_ComponentPDU_vals), 0,
2773         "tcap.ComponentPDU", HFILL }},
2774     { &hf_tcap_invokeLastansi,
2775       { "invokeLastansi", "tcap.invokeLastansi",
2776         FT_NONE, BASE_NONE, NULL, 0,
2777         "tcap.InvokePDU", HFILL }},
2778     { &hf_tcap_returnResultLastansi,
2779       { "returnResultLastansi", "tcap.returnResultLastansi",
2780         FT_NONE, BASE_NONE, NULL, 0,
2781         "tcap.ReturnResultPDU", HFILL }},
2782     { &hf_tcap_returnErroransi,
2783       { "returnErroransi", "tcap.returnErroransi",
2784         FT_NONE, BASE_NONE, NULL, 0,
2785         "tcap.ReturnErrorPDU", HFILL }},
2786     { &hf_tcap_rejectansi,
2787       { "rejectansi", "tcap.rejectansi",
2788         FT_NONE, BASE_NONE, NULL, 0,
2789         "tcap.RejectPDU", HFILL }},
2790     { &hf_tcap_invokeNotLastansi,
2791       { "invokeNotLastansi", "tcap.invokeNotLastansi",
2792         FT_NONE, BASE_NONE, NULL, 0,
2793         "tcap.InvokePDU", HFILL }},
2794     { &hf_tcap_returnResultNotLastansi,
2795       { "returnResultNotLastansi", "tcap.returnResultNotLastansi",
2796         FT_NONE, BASE_NONE, NULL, 0,
2797         "tcap.ReturnResultPDU", HFILL }},
2798     { &hf_tcap_componentIDs,
2799       { "componentIDs", "tcap.componentIDs",
2800         FT_BYTES, BASE_HEX, NULL, 0,
2801         "tcap.OCTET_STRING_SIZE_0_2", HFILL }},
2802     { &hf_tcap_operationCode,
2803       { "operationCode", "tcap.operationCode",
2804         FT_UINT32, BASE_DEC, VALS(tcap_OperationCode_vals), 0,
2805         "tcap.OperationCode", HFILL }},
2806     { &hf_tcap_parameterinv,
2807       { "parameterinv", "tcap.parameterinv",
2808         FT_NONE, BASE_NONE, NULL, 0,
2809         "tcap.ANSIparamch", HFILL }},
2810     { &hf_tcap_ansiparams,
2811       { "ansiparams", "tcap.ansiparams",
2812         FT_NONE, BASE_NONE, NULL, 0,
2813         "tcap.ANSIParameters", HFILL }},
2814     { &hf_tcap_ansiparams1,
2815       { "ansiparams1", "tcap.ansiparams1",
2816         FT_NONE, BASE_NONE, NULL, 0,
2817         "tcap.ANSIParameters", HFILL }},
2818     { &hf_tcap_ansiparams2,
2819       { "ansiparams2", "tcap.ansiparams2",
2820         FT_NONE, BASE_NONE, NULL, 0,
2821         "tcap.ANSIParameters", HFILL }},
2822     { &hf_tcap_ansiparams3,
2823       { "ansiparams3", "tcap.ansiparams3",
2824         FT_NONE, BASE_NONE, NULL, 0,
2825         "tcap.ANSIParameters", HFILL }},
2826     { &hf_tcap_ansiparams4,
2827       { "ansiparams4", "tcap.ansiparams4",
2828         FT_NONE, BASE_NONE, NULL, 0,
2829         "tcap.ANSIParameters", HFILL }},
2830     { &hf_tcap_ansiparams5,
2831       { "ansiparams5", "tcap.ansiparams5",
2832         FT_NONE, BASE_NONE, NULL, 0,
2833         "tcap.ANSIParameters", HFILL }},
2834     { &hf_tcap_ansiparams6,
2835       { "ansiparams6", "tcap.ansiparams6",
2836         FT_NONE, BASE_NONE, NULL, 0,
2837         "tcap.ANSIParameters", HFILL }},
2838     { &hf_tcap_ansiparams7,
2839       { "ansiparams7", "tcap.ansiparams7",
2840         FT_NONE, BASE_NONE, NULL, 0,
2841         "tcap.ANSIParameters", HFILL }},
2842     { &hf_tcap_ansiparams8,
2843       { "ansiparams8", "tcap.ansiparams8",
2844         FT_NONE, BASE_NONE, NULL, 0,
2845         "tcap.ANSIParameters", HFILL }},
2846     { &hf_tcap_ansiparams9,
2847       { "ansiparams9", "tcap.ansiparams9",
2848         FT_NONE, BASE_NONE, NULL, 0,
2849         "tcap.ANSIParameters", HFILL }},
2850     { &hf_tcap_ansiparams10,
2851       { "ansiparams10", "tcap.ansiparams10",
2852         FT_NONE, BASE_NONE, NULL, 0,
2853         "tcap.ANSIParameters", HFILL }},
2854     { &hf_tcap_ansiparams11,
2855       { "ansiparams11", "tcap.ansiparams11",
2856         FT_NONE, BASE_NONE, NULL, 0,
2857         "tcap.ANSIParameters", HFILL }},
2858     { &hf_tcap_ansiparams12,
2859       { "ansiparams12", "tcap.ansiparams12",
2860         FT_NONE, BASE_NONE, NULL, 0,
2861         "tcap.ANSIParameters", HFILL }},
2862     { &hf_tcap_ansiparams13,
2863       { "ansiparams13", "tcap.ansiparams13",
2864         FT_NONE, BASE_NONE, NULL, 0,
2865         "tcap.ANSIParameters", HFILL }},
2866     { &hf_tcap_ansiparams14,
2867       { "ansiparams14", "tcap.ansiparams14",
2868         FT_NONE, BASE_NONE, NULL, 0,
2869         "tcap.ANSIParameters", HFILL }},
2870     { &hf_tcap_ansiparams15,
2871       { "ansiparams15", "tcap.ansiparams15",
2872         FT_NONE, BASE_NONE, NULL, 0,
2873         "tcap.ANSIParameters", HFILL }},
2874     { &hf_tcap_ansiparams16,
2875       { "ansiparams16", "tcap.ansiparams16",
2876         FT_NONE, BASE_NONE, NULL, 0,
2877         "tcap.ANSIParameters", HFILL }},
2878     { &hf_tcap_ansiparams17,
2879       { "ansiparams17", "tcap.ansiparams17",
2880         FT_NONE, BASE_NONE, NULL, 0,
2881         "tcap.ANSIParameters", HFILL }},
2882     { &hf_tcap_ansiparams18,
2883       { "ansiparams18", "tcap.ansiparams18",
2884         FT_NONE, BASE_NONE, NULL, 0,
2885         "tcap.ANSIParameters", HFILL }},
2886     { &hf_tcap_ansiparams19,
2887       { "ansiparams19", "tcap.ansiparams19",
2888         FT_NONE, BASE_NONE, NULL, 0,
2889         "tcap.ANSIParameters", HFILL }},
2890     { &hf_tcap_ansiparams20,
2891       { "ansiparams20", "tcap.ansiparams20",
2892         FT_NONE, BASE_NONE, NULL, 0,
2893         "tcap.ANSIParameters", HFILL }},
2894     { &hf_tcap_ansiparams21,
2895       { "ansiparams21", "tcap.ansiparams21",
2896         FT_NONE, BASE_NONE, NULL, 0,
2897         "tcap.ANSIParameters", HFILL }},
2898     { &hf_tcap_componentID,
2899       { "componentID", "tcap.componentID",
2900         FT_BYTES, BASE_HEX, NULL, 0,
2901         "tcap.ComponentID", HFILL }},
2902     { &hf_tcap_parameterrr,
2903       { "parameterrr", "tcap.parameterrr",
2904         FT_NONE, BASE_NONE, NULL, 0,
2905         "tcap.ANSIparamch", HFILL }},
2906     { &hf_tcap_parameterre,
2907       { "parameterre", "tcap.parameterre",
2908         FT_NONE, BASE_NONE, NULL, 0,
2909         "tcap.ANSIparamch", HFILL }},
2910     { &hf_tcap_rejectProblem,
2911       { "rejectProblem", "tcap.rejectProblem",
2912         FT_INT32, BASE_DEC, VALS(tcap_ProblemPDU_vals), 0,
2913         "tcap.ProblemPDU", HFILL }},
2914     { &hf_tcap_parameterrj,
2915       { "parameterrj", "tcap.parameterrj",
2916         FT_NONE, BASE_NONE, NULL, 0,
2917         "tcap.ANSIparamch", HFILL }},
2918     { &hf_tcap_national,
2919       { "national", "tcap.national",
2920         FT_INT32, BASE_DEC, NULL, 0,
2921         "tcap.INTEGER_M32768_32767", HFILL }},
2922     { &hf_tcap_private,
2923       { "private", "tcap.private",
2924         FT_INT32, BASE_DEC, NULL, 0,
2925         "tcap.INTEGER", HFILL }},
2926     { &hf_tcap_nationaler,
2927       { "nationaler", "tcap.nationaler",
2928         FT_INT32, BASE_DEC, NULL, 0,
2929         "tcap.INTEGER_M32768_32767", HFILL }},
2930     { &hf_tcap_privateer,
2931       { "privateer", "tcap.privateer",
2932         FT_INT32, BASE_DEC, NULL, 0,
2933         "tcap.INTEGER", HFILL }},
2934     { &hf_tcap_T_protocol_versionrq_version1,
2935       { "version1", "tcap.version1",
2936         FT_BOOLEAN, 8, NULL, 0x80,
2937         "", HFILL }},
2938     { &hf_tcap_T_protocol_versionre_version1,
2939       { "version1", "tcap.version1",
2940         FT_BOOLEAN, 8, NULL, 0x80,
2941         "", HFILL }},
2942     { &hf_tcap_T_protocol_version3_version1,
2943       { "version1", "tcap.version1",
2944         FT_BOOLEAN, 8, NULL, 0x80,
2945         "", HFILL }},
2946
2947 /*--- End of included file: packet-tcap-hfarr.c ---*/
2948 #line 281 "packet-tcap-template.c"
2949     };
2950
2951 /* Setup protocol subtree array */
2952     static gint *ett[] = {
2953         &ett_tcap,
2954         &ett_param,
2955         &ett_otid,
2956         &ett_dtid,
2957         &ett_tcap_stat,
2958
2959 /*--- Included file: packet-tcap-ettarr.c ---*/
2960 #line 1 "packet-tcap-ettarr.c"
2961     &ett_tcap_DialoguePDU,
2962     &ett_tcap_ExternalPDU,
2963     &ett_tcap_UserInformation,
2964     &ett_tcap_AARQ_apdu,
2965     &ett_tcap_T_protocol_versionrq,
2966     &ett_tcap_AARE_apdu,
2967     &ett_tcap_T_protocol_versionre,
2968     &ett_tcap_RLRQ_apdu,
2969     &ett_tcap_RLRE_apdu,
2970     &ett_tcap_ABRT_apdu,
2971     &ett_tcap_Associate_source_diagnostic,
2972     &ett_tcap_UniDialoguePDU,
2973     &ett_tcap_AUDT_apdu,
2974     &ett_tcap_T_protocol_version3,
2975     &ett_tcap_MessageType,
2976     &ett_tcap_Unidirectional,
2977     &ett_tcap_Begin,
2978     &ett_tcap_End,
2979     &ett_tcap_Continue,
2980     &ett_tcap_Abort,
2981     &ett_tcap_Reason,
2982     &ett_tcap_ComponentPortion,
2983     &ett_tcap_Component,
2984     &ett_tcap_Invoke,
2985     &ett_tcap_ReturnResult,
2986     &ett_tcap_T_resultretres,
2987     &ett_tcap_ReturnError,
2988     &ett_tcap_Reject,
2989     &ett_tcap_T_invokeIDRej,
2990     &ett_tcap_T_problem,
2991     &ett_tcap_OPERATION,
2992     &ett_tcap_ERROR,
2993     &ett_tcap_UniTransactionPDU,
2994     &ett_tcap_TransactionPDU,
2995     &ett_tcap_AbortPDU,
2996     &ett_tcap_T_causeInformation,
2997     &ett_tcap_DialoguePortionANSI,
2998     &ett_tcap_T_applicationContext,
2999     &ett_tcap_T_securityContext,
3000     &ett_tcap_Confidentiality,
3001     &ett_tcap_T_confidentialityId,
3002     &ett_tcap_ComponentSequence,
3003     &ett_tcap_ComponentPDU,
3004     &ett_tcap_InvokePDU,
3005     &ett_tcap_ANSIparamch,
3006     &ett_tcap_ReturnResultPDU,
3007     &ett_tcap_ReturnErrorPDU,
3008     &ett_tcap_RejectPDU,
3009     &ett_tcap_OperationCode,
3010     &ett_tcap_ErrorCode,
3011
3012 /*--- End of included file: packet-tcap-ettarr.c ---*/
3013 #line 291 "packet-tcap-template.c"
3014     };
3015
3016     /*static enum_val_t tcap_options[] = {
3017         { "itu", "ITU",  ITU_TCAP_STANDARD },
3018         { "ansi", "ANSI", ANSI_TCAP_STANDARD },
3019         { NULL, NULL, 0 }
3020     };*/
3021
3022     module_t *tcap_module;
3023
3024 /* Register the protocol name and description */
3025     proto_tcap = proto_register_protocol(PNAME, PSNAME, PFNAME);
3026
3027 /* Required function calls to register the header fields and subtrees used */
3028     proto_register_field_array(proto_tcap, hf, array_length(hf));
3029     proto_register_subtree_array(ett, array_length(ett));
3030
3031     tcap_module = prefs_register_protocol(proto_tcap, proto_reg_handoff_tcap);
3032
3033 #if 0
3034     prefs_register_enum_preference(tcap_module, "standard", "ITU TCAP standard",
3035         "The SS7 standard used in ITU TCAP packets",
3036         &tcap_standard, tcap_options, FALSE);
3037 #else
3038     prefs_register_obsolete_preference(tcap_module, "standard");
3039 #endif
3040
3041 #if 0
3042     prefs_register_bool_preference(tcap_module, "lock_info_col", "Lock Info column",
3043         "Always show TCAP in Info column",
3044         &lock_info_col);
3045 #else
3046     prefs_register_obsolete_preference(tcap_module, "lock_info_col");
3047 #endif
3048
3049     /* Set default SSNs */
3050     range_convert_str(&global_ssn_range, "", MAX_SSN);
3051     ssn_range = range_empty();
3052
3053     prefs_register_range_preference(tcap_module, "ssn", "SCCP SSNs",
3054         "SCCP (and SUA) SSNs to decode as TCAP",
3055         &global_ssn_range, MAX_SSN);
3056
3057     prefs_register_bool_preference(tcap_module, "srt",
3058                                    "Service Response Time Analyse",
3059                                    "Activate the analyse for Response Time",
3060                                    &gtcap_HandleSRT);
3061
3062     prefs_register_bool_preference(tcap_module, "persistentsrt",
3063                                    "Persistent stats for SRT",
3064                                    "Statistics for Response Time",
3065                                    &gtcap_PersistentSRT);
3066   
3067     prefs_register_uint_preference(tcap_module, "repetitiontimeout",
3068                                    "Repetition timeout",
3069                                    "Maximal delay for message repetion",
3070                                    10, &gtcap_RepetitionTimeout);
3071
3072     prefs_register_uint_preference(tcap_module, "losttimeout",
3073                                    "lost timeout",
3074                                    "Maximal delay for message lost",
3075                                    10, &gtcap_LostTimeout);
3076     
3077     ansi_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
3078     itu_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
3079
3080     /* 'globally' register dissector */
3081     register_dissector("tcap", dissect_tcap, proto_tcap);
3082
3083     tcap_handle = create_dissector_handle(dissect_tcap, proto_tcap);
3084
3085     register_init_routine(&init_tcap);
3086 }
3087
3088
3089 static void range_delete_callback(guint32 ssn)
3090 {
3091     if ( ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
3092         dissector_delete("sccp.ssn", ssn, tcap_handle);
3093     }
3094 }
3095
3096 static void range_add_callback(guint32 ssn)
3097 {
3098     if (ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
3099         dissector_add("sccp.ssn", ssn, tcap_handle);
3100     }
3101 }
3102
3103
3104 static void init_tcap(void) {
3105     if (ssn_range) {
3106         range_foreach(ssn_range, range_delete_callback);
3107         g_free(ssn_range);
3108     }
3109     
3110     ssn_range = range_copy(global_ssn_range);
3111     range_foreach(ssn_range, range_add_callback);
3112     tcapsrt_init_routine();
3113 }
3114
3115 static int
3116 dissect_tcap_param(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
3117 {
3118     gint tag_offset, saved_offset, len_offset;
3119     tvbuff_t    *next_tvb;
3120     proto_tree *subtree;
3121     proto_item *pi;
3122     gint8 class;
3123     gboolean pc;
3124     gint32 tag;
3125     guint32 len;
3126     gboolean ind_field;
3127     
3128     while (tvb_reported_length_remaining(tvb, offset) > 0)
3129     {
3130         saved_offset = offset;
3131     
3132         offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
3133         tag_offset = offset;
3134         offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
3135         len_offset = offset;
3136
3137         if (pc)
3138         {
3139             pi =
3140                 proto_tree_add_text(tree, tvb, saved_offset, len + (len_offset - saved_offset), "CONSTRUCTOR");
3141             subtree = proto_item_add_subtree(pi, ett_param);
3142             proto_tree_add_uint_format(subtree, hf_tcap_tag, tvb,
3143                 saved_offset, tag_offset-saved_offset, tag, "CONSTRUCTOR Tag");
3144             proto_tree_add_uint(subtree, hf_tcap_tag, tvb,
3145                 saved_offset, tag_offset-saved_offset, class);
3146
3147             proto_tree_add_uint(subtree, hf_tcap_length, tvb,
3148                 tag_offset, len_offset-tag_offset, len);
3149                 if (len-(2*ind_field)) /*should always be positive unless we get an empty contructor pointless? */
3150                 {
3151                 next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field), len-(2*ind_field));           
3152                         dissect_tcap_param(pinfo, subtree,next_tvb,0);
3153             }           
3154                 if (ind_field)
3155                         proto_tree_add_text(subtree, tvb, offset+len-2, 2, "CONSTRUCTOR EOC");
3156             offset += len;
3157         }
3158         else
3159         {
3160             pi = proto_tree_add_text(tree, tvb,
3161                 saved_offset, len + (len_offset - saved_offset), "Parameter (0x%.2x)", tag);
3162
3163             subtree = proto_item_add_subtree(pi, ett_param);
3164
3165             proto_tree_add_uint(subtree, hf_tcap_tag, tvb,
3166                 saved_offset, 1, tag);
3167
3168             proto_tree_add_uint(subtree, hf_tcap_length, tvb,
3169                 saved_offset+1, 1, len);
3170                 if (len) /* check for NULLS */
3171                         {
3172                 next_tvb = tvb_new_subset(tvb, offset, len, len);               
3173                 dissect_ber_octet_string(TRUE, pinfo, tree, next_tvb, 0, hf_tcap_data,
3174                                         NULL);
3175                 }
3176             offset += len;
3177         }
3178     }
3179     return offset;
3180 }
3181
3182 static void raz_tcap_private(struct tcap_private_t * p_tcap_private)
3183 {  
3184   memset(p_tcap_private,0,sizeof(struct tcap_private_t) );
3185 }
3186
3187
3188 static int
3189 dissect_tcap_TheComponent(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_)
3190 {
3191   tvbuff_t * next_tvb;
3192   dissector_handle_t subdissector_handle;
3193   gboolean is_subdissector=FALSE;
3194   struct tcaphash_context_t * p_tcap_context=NULL;
3195
3196   gint8 class;
3197   gboolean pc;
3198   gint tag;
3199   guint32 len, s_offset;
3200   gint ind_field;
3201   proto_tree * stat_tree=NULL;
3202   proto_item * stat_item=NULL;
3203   /* 
3204    * ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it.
3205    */
3206   ber_oid_dissector_table = find_dissector_table("ber.oid");
3207   s_offset = offset;
3208   offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
3209   offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
3210   /* we can believe the length now */
3211   next_tvb = tvb_new_subset(tvb, s_offset, len+(offset-s_offset), len+(offset-s_offset));
3212   if (!next_tvb)
3213     return offset+len;
3214   
3215   dissect_ber_choice(pinfo, tree, next_tvb, 0,
3216                      Component_choice, hf_index, ett_tcap_Component,NULL);
3217   
3218
3219   /*
3220    * Handle The TCAP Service Response Time
3221    */
3222   if ( gtcap_HandleSRT ) {
3223     if (!tcap_subdissector_used) {
3224       /* Create TCAP context and tree for display */
3225       if (gtcap_DisplaySRT && tree) {
3226         stat_item = proto_tree_add_text(tcap_stat_tree, tvb, offset, -1, "Stat");
3227         stat_tree = proto_item_add_subtree(stat_item, ett_tcap_stat);
3228       }
3229       p_tcap_context=tcapsrt_call_matching(tvb, pinfo, stat_tree, gp_tcapsrt_info);
3230       tcap_subdissector_used=TRUE;
3231       gp_tcap_context=p_tcap_context;
3232       tcap_private.context=p_tcap_context;
3233     } else {
3234       /* Take the last TCAP context */
3235       p_tcap_context = gp_tcap_context;
3236       tcap_private.context=p_tcap_context;
3237     }
3238   }
3239
3240   if (p_tcap_context) {
3241     if (cur_oid) {
3242       if (p_tcap_context->oid_present) {
3243         /* We have already an Application Context, check if we have
3244            to fallback to a lower version */
3245         if ( strncmp(p_tcap_context->oid,cur_oid, LENGTH_OID)!=0) {
3246           /* ACN, changed, Fallback to lower version */
3247           /* and update the subdissector (purely formal) */
3248           strncpy(p_tcap_context->oid,cur_oid, LENGTH_OID);
3249           if ( (subdissector_handle 
3250                 = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
3251             p_tcap_context->subdissector_handle=subdissector_handle;
3252           }
3253         }
3254       } else {
3255         /* We do not have the OID in the TCAP context, so store it */
3256         strncpy(p_tcap_context->oid,cur_oid, LENGTH_OID);
3257         if ( (subdissector_handle 
3258               = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
3259           p_tcap_context->subdissector_handle=subdissector_handle;
3260           p_tcap_context->oid_present=TRUE;
3261         }
3262       } /* context OID */
3263     } else {
3264       /* Copy the OID from the TCAP context to the current oid */
3265       if (p_tcap_context->oid_present) {
3266         tcap_private.oid= (void*) p_tcap_context->oid;
3267         tcap_private.acv=TRUE;
3268       }
3269     } /* no OID */
3270   } /* no TCAP context */
3271   
3272   if ( p_tcap_context 
3273        && p_tcap_context->oid_present) {
3274     /* Take the subdissector from the context */
3275     subdissector_handle=p_tcap_context->subdissector_handle;
3276     is_subdissector=TRUE;
3277   }
3278   
3279   if (!is_subdissector) {
3280     /*
3281      * If we do not currently know the subdissector, we have to find it
3282      * - first, according to the OID
3283      * - then according to the SSN
3284      * - and at least, take the default Data handler 
3285      */
3286     if (ber_oid_dissector_table && cur_oid) {
3287       /* Search if we can find the sub protocol according to the A.C.N */
3288       if ( (subdissector_handle 
3289             = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
3290         /* found */
3291         is_subdissector=TRUE;
3292       } else {
3293         /* Search if we can found the sub protocol according to the SSN table */
3294         if ( (subdissector_handle 
3295               = get_itu_tcap_subdissector(pinfo->match_port))) {
3296           /* Found according to SSN */
3297           is_subdissector=TRUE;
3298         } else {
3299           /* Nothing found, take the Data handler */
3300           subdissector_handle = data_handle;
3301           is_subdissector=TRUE;
3302         } /* SSN */
3303       } /* ACN */
3304     } else {
3305       /* There is no A.C.N for this transaction, so search in the SSN table */
3306       if ( (subdissector_handle = get_itu_tcap_subdissector(pinfo->match_port))) {
3307         /* Found according to SSN */
3308         is_subdissector=TRUE;
3309       } else {
3310         subdissector_handle = data_handle;
3311         is_subdissector=TRUE;
3312       }
3313     } /* OID */
3314   } else {
3315     /* We have it already */
3316   }
3317   /* Call the sub dissector if present, and not already called */
3318   if (is_subdissector)
3319     call_dissector(subdissector_handle, next_tvb, pinfo, tcap_top_tree);
3320   
3321   return offset+len;
3322 }
3323
3324
3325 static int
3326 dissect_tcap_TheExternUserInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_)
3327 {
3328   tvbuff_t *next_tvb;
3329   gint8 class;
3330   gboolean pc;
3331   gint tag;
3332   guint32 len, start_offset;
3333   gint ind_field;
3334
3335   /* 
3336    * ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it.
3337    */
3338   ber_oid_dissector_table = find_dissector_table("ber.oid");
3339   start_offset = offset;
3340   offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
3341   offset = get_ber_length(tree, tvb, offset, &len, &ind_field);
3342
3343   next_tvb = tvb_new_subset(tvb, start_offset, len +(offset - start_offset), len+(offset - start_offset));              
3344   if (!next_tvb)
3345     return offset+len;
3346
3347   if (ber_oid_dissector_table && tcapext_oid){
3348     if(!dissector_try_string(ber_oid_dissector_table, tcapext_oid, next_tvb, pinfo, tcap_top_tree))     
3349       {
3350       }
3351   }
3352   dissect_tcap_param(pinfo,tree,next_tvb,0);
3353   offset+=len;
3354
3355   return offset;
3356 }