0c20ea30ba6c017fe532f10d2cf22874424bd20c
[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 -p tcap -c ./tcap.cnf -s ./packet-tcap-template -D . tcap.asn UnidialoguePDUs.asn DialoguePDUs.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  *
16  * Wireshark - Network traffic analyzer
17  * By Gerald Combs <gerald@wireshark.org>
18  * Copyright 1998 Gerald Combs
19  *
20  * This program is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU General Public License
22  * as published by the Free Software Foundation; either version 2
23  * of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28  * GNU General Public License for more details.
29  *
30  * You should have received a copy of the GNU General Public License
31  * along with this program; if not, write to the Free Software
32  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
33  * References: ETSI 300 374
34  */
35
36 #ifdef HAVE_CONFIG_H
37 # include "config.h"
38 #endif
39
40 #include <glib.h>
41 #include <epan/packet.h>
42 #include <epan/prefs.h>
43 #include <epan/oids.h>
44 #include <epan/asn1.h>
45 #include <epan/strutil.h>
46
47 #include <stdio.h>
48 #include <string.h>
49 #include "packet-ber.h"
50 #include "packet-tcap.h"
51 #include "epan/tcap-persistentdata.h"
52
53 #define PNAME  "Transaction Capabilities Application Part"
54 #define PSNAME "TCAP"
55 #define PFNAME "tcap"
56
57 /* Initialize the protocol and registered fields */
58 int proto_tcap = -1;
59 static int hf_tcap_tag = -1;
60 static int hf_tcap_length = -1;
61 static int hf_tcap_data = -1;
62 static int hf_tcap_tid = -1;
63
64 int hf_tcapsrt_SessionId=-1;
65 int hf_tcapsrt_Duplicate=-1;
66 int hf_tcapsrt_BeginSession=-1;
67 int hf_tcapsrt_EndSession=-1;
68 int hf_tcapsrt_SessionTime=-1;
69
70
71 /*--- Included file: packet-tcap-hf.c ---*/
72 #line 1 "packet-tcap-hf.c"
73 static int hf_tcap_UniDialoguePDU_PDU = -1;       /* UniDialoguePDU */
74 static int hf_tcap_DialoguePDU_PDU = -1;          /* DialoguePDU */
75 static int hf_tcap_oid = -1;                      /* OBJECT_IDENTIFIER */
76 static int hf_tcap_dialog = -1;                   /* Dialog1 */
77 static int hf_tcap_unidirectional = -1;           /* Unidirectional */
78 static int hf_tcap_begin = -1;                    /* Begin */
79 static int hf_tcap_end = -1;                      /* End */
80 static int hf_tcap_continue = -1;                 /* Continue */
81 static int hf_tcap_abort = -1;                    /* Abort */
82 static int hf_tcap_dialoguePortion = -1;          /* DialoguePortion */
83 static int hf_tcap_components = -1;               /* ComponentPortion */
84 static int hf_tcap_otid = -1;                     /* OrigTransactionID */
85 static int hf_tcap_dtid = -1;                     /* DestTransactionID */
86 static int hf_tcap_reason = -1;                   /* Reason */
87 static int hf_tcap_p_abortCause = -1;             /* P_AbortCause */
88 static int hf_tcap_u_abortCause = -1;             /* DialoguePortion */
89 static int hf_tcap__untag_item = -1;              /* Component */
90 static int hf_tcap_invoke = -1;                   /* Invoke */
91 static int hf_tcap_returnResultLast = -1;         /* ReturnResult */
92 static int hf_tcap_returnError = -1;              /* ReturnError */
93 static int hf_tcap_reject = -1;                   /* Reject */
94 static int hf_tcap_returnResultNotLast = -1;      /* ReturnResult */
95 static int hf_tcap_invokeID = -1;                 /* InvokeIdType */
96 static int hf_tcap_linkedID = -1;                 /* InvokeIdType */
97 static int hf_tcap_opCode = -1;                   /* OPERATION */
98 static int hf_tcap_parameter = -1;                /* Parameter */
99 static int hf_tcap_resultretres = -1;             /* T_resultretres */
100 static int hf_tcap_errorCode = -1;                /* ErrorCode */
101 static int hf_tcap_invokeIDRej = -1;              /* T_invokeIDRej */
102 static int hf_tcap_derivable = -1;                /* InvokeIdType */
103 static int hf_tcap_not_derivable = -1;            /* NULL */
104 static int hf_tcap_problem = -1;                  /* T_problem */
105 static int hf_tcap_generalProblem = -1;           /* GeneralProblem */
106 static int hf_tcap_invokeProblem = -1;            /* InvokeProblem */
107 static int hf_tcap_returnResultProblem = -1;      /* ReturnResultProblem */
108 static int hf_tcap_returnErrorProblem = -1;       /* ReturnErrorProblem */
109 static int hf_tcap_localValue = -1;               /* INTEGER */
110 static int hf_tcap_globalValue = -1;              /* OBJECT_IDENTIFIER */
111 static int hf_tcap_nationaler = -1;               /* INTEGER_M32768_32767 */
112 static int hf_tcap_privateer = -1;                /* INTEGER */
113 static int hf_tcap_unidialoguePDU = -1;           /* AUDT_apdu */
114 static int hf_tcap_audt_protocol_version = -1;    /* AUDT_protocol_version */
115 static int hf_tcap_audt_application_context_name = -1;  /* AUDT_application_context_name */
116 static int hf_tcap_audt_user_information = -1;    /* AUDT_user_information */
117 static int hf_tcap_audt_user_information_item = -1;  /* EXTERNAL */
118 static int hf_tcap_dialogueRequest = -1;          /* AARQ_apdu */
119 static int hf_tcap_dialogueResponse = -1;         /* AARE_apdu */
120 static int hf_tcap_dialogueAbort = -1;            /* ABRT_apdu */
121 static int hf_tcap_aarq_protocol_version = -1;    /* AARQ_protocol_version */
122 static int hf_tcap_aarq_application_context_name = -1;  /* AARQ_application_context_name */
123 static int hf_tcap_aarq_user_information = -1;    /* AARQ_user_information */
124 static int hf_tcap_aarq_user_information_item = -1;  /* EXTERNAL */
125 static int hf_tcap_aare_protocol_version = -1;    /* AARE_protocol_version */
126 static int hf_tcap_aare_application_context_name = -1;  /* AARE_application_context_name */
127 static int hf_tcap_result = -1;                   /* Associate_result */
128 static int hf_tcap_result_source_diagnostic = -1;  /* Associate_source_diagnostic */
129 static int hf_tcap_aare_user_information = -1;    /* AARE_user_information */
130 static int hf_tcap_aare_user_information_item = -1;  /* EXTERNAL */
131 static int hf_tcap_abort_source = -1;             /* ABRT_source */
132 static int hf_tcap_abrt_user_information = -1;    /* ABRT_user_information */
133 static int hf_tcap_abrt_user_information_item = -1;  /* EXTERNAL */
134 static int hf_tcap_dialogue_service_user = -1;    /* T_dialogue_service_user */
135 static int hf_tcap_dialogue_service_provider = -1;  /* T_dialogue_service_provider */
136 /* named bits */
137 static int hf_tcap_AUDT_protocol_version_version1 = -1;
138 static int hf_tcap_AARQ_protocol_version_version1 = -1;
139 static int hf_tcap_AARE_protocol_version_version1 = -1;
140
141 /*--- End of included file: packet-tcap-hf.c ---*/
142 #line 63 "packet-tcap-template.c"
143
144 /* Initialize the subtree pointers */
145 static gint ett_tcap = -1;
146 static gint ett_param = -1;
147
148 static gint ett_otid = -1;
149 static gint ett_dtid = -1;
150 gint ett_tcap_stat = -1;
151
152 static struct tcapsrt_info_t * gp_tcapsrt_info;
153 static gboolean tcap_subdissector_used=FALSE;
154 static dissector_handle_t requested_subdissector_handle = NULL;
155
156 static struct tcaphash_context_t * gp_tcap_context=NULL;
157
158
159 /*--- Included file: packet-tcap-ett.c ---*/
160 #line 1 "packet-tcap-ett.c"
161 static gint ett_tcap_ExternalPDU_U = -1;
162 static gint ett_tcap_TCMessage = -1;
163 static gint ett_tcap_Unidirectional = -1;
164 static gint ett_tcap_Begin = -1;
165 static gint ett_tcap_End = -1;
166 static gint ett_tcap_Continue = -1;
167 static gint ett_tcap_Abort = -1;
168 static gint ett_tcap_Reason = -1;
169 static gint ett_tcap_SEQUENCE_SIZE_1_MAX_OF_Component = -1;
170 static gint ett_tcap_Component = -1;
171 static gint ett_tcap_Invoke = -1;
172 static gint ett_tcap_ReturnResult = -1;
173 static gint ett_tcap_T_resultretres = -1;
174 static gint ett_tcap_ReturnError = -1;
175 static gint ett_tcap_Reject = -1;
176 static gint ett_tcap_T_invokeIDRej = -1;
177 static gint ett_tcap_T_problem = -1;
178 static gint ett_tcap_OPERATION = -1;
179 static gint ett_tcap_ERROR = -1;
180 static gint ett_tcap_ErrorCode = -1;
181 static gint ett_tcap_UniDialoguePDU = -1;
182 static gint ett_tcap_AUDT_apdu_U = -1;
183 static gint ett_tcap_AUDT_protocol_version = -1;
184 static gint ett_tcap_AUDT_user_information = -1;
185 static gint ett_tcap_DialoguePDU = -1;
186 static gint ett_tcap_AARQ_apdu_U = -1;
187 static gint ett_tcap_AARQ_protocol_version = -1;
188 static gint ett_tcap_AARQ_user_information = -1;
189 static gint ett_tcap_AARE_apdu_U = -1;
190 static gint ett_tcap_AARE_protocol_version = -1;
191 static gint ett_tcap_AARE_user_information = -1;
192 static gint ett_tcap_ABRT_apdu_U = -1;
193 static gint ett_tcap_ABRT_user_information = -1;
194 static gint ett_tcap_Associate_source_diagnostic = -1;
195
196 /*--- End of included file: packet-tcap-ett.c ---*/
197 #line 79 "packet-tcap-template.c"
198
199 #define MAX_SSN 254
200 static range_t *global_ssn_range;
201 static range_t *ssn_range;
202 struct tcap_private_t tcap_private;
203
204 gboolean gtcap_HandleSRT=FALSE;
205 extern gboolean gtcap_PersistentSRT;
206 extern gboolean gtcap_DisplaySRT;
207 extern guint gtcap_RepetitionTimeout;
208 extern guint gtcap_LostTimeout;
209
210 static dissector_handle_t       tcap_handle = NULL;
211 static dissector_table_t ber_oid_dissector_table;
212 static const char * cur_oid;
213 static const char * tcapext_oid;
214 static proto_tree * tcap_top_tree=NULL;
215 static proto_tree * tcap_stat_tree=NULL;
216
217 static dissector_handle_t data_handle;
218 static dissector_handle_t ansi_tcap_handle;
219
220 static void raz_tcap_private(struct tcap_private_t * p_tcap_private);
221 static int dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset);
222 static int dissect_tcap_ITU_ComponentPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index _U_);
223
224 static GHashTable* ansi_sub_dissectors = NULL;
225 static GHashTable* itu_sub_dissectors = NULL;
226
227 static void dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);
228
229 extern void add_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
230     g_hash_table_insert(ansi_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
231     dissector_add("sccp.ssn",ssn,tcap_handle);
232 }
233
234 extern void add_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector) {
235     g_hash_table_insert(itu_sub_dissectors,GUINT_TO_POINTER(ssn),dissector);
236     dissector_add("sccp.ssn",ssn,tcap_handle);
237 }
238
239 extern void delete_ansi_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
240     g_hash_table_remove(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
241     if (!get_itu_tcap_subdissector(ssn))
242       dissector_delete("sccp.ssn",ssn,tcap_handle);
243 }
244 extern void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
245     g_hash_table_remove(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
246     if (!get_ansi_tcap_subdissector(ssn))
247       dissector_delete("sccp.ssn", ssn,tcap_handle);
248 }
249
250 dissector_handle_t get_ansi_tcap_subdissector(guint32 ssn) {
251     return g_hash_table_lookup(ansi_sub_dissectors,GUINT_TO_POINTER(ssn));
252 }
253
254 dissector_handle_t get_itu_tcap_subdissector(guint32 ssn) {
255     return g_hash_table_lookup(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
256 }
257
258
259
260
261 /*--- Included file: packet-tcap-fn.c ---*/
262 #line 1 "packet-tcap-fn.c"
263
264
265 static int
266 dissect_tcap_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
267   offset = dissect_ber_object_identifier(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
268
269   return offset;
270 }
271
272
273
274 static int
275 dissect_tcap_Dialog1(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
276 #line 69 "tcap.cnf"
277
278   offset = dissect_tcap_DialoguePDU(TRUE, tvb, offset, actx, tree, -1);
279
280
281
282   return offset;
283 }
284
285
286 static const ber_sequence_t ExternalPDU_U_sequence[] = {
287   { &hf_tcap_oid            , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_tcap_OBJECT_IDENTIFIER },
288   { &hf_tcap_dialog         , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_tcap_Dialog1 },
289   { NULL, 0, 0, 0, NULL }
290 };
291
292 static int
293 dissect_tcap_ExternalPDU_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
294   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
295                                    ExternalPDU_U_sequence, hf_index, ett_tcap_ExternalPDU_U);
296
297   return offset;
298 }
299
300
301
302 static int
303 dissect_tcap_ExternalPDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
304 #line 64 "tcap.cnf"
305
306   offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
307                                       hf_index, BER_CLASS_UNI, 8, TRUE, dissect_tcap_ExternalPDU_U);
308
309
310
311
312   return offset;
313 }
314
315
316
317 static int
318 dissect_tcap_DialogueOC(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
319 #line 59 "tcap.cnf"
320
321   offset = dissect_tcap_ExternalPDU(FALSE /*implicit_tag*/, tvb, offset, actx, tree, -1);
322
323
324
325   return offset;
326 }
327
328
329
330 static int
331 dissect_tcap_DialoguePortion(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
332   offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
333                                       hf_index, BER_CLASS_APP, 11, TRUE, dissect_tcap_DialogueOC);
334
335   return offset;
336 }
337
338
339
340 static int
341 dissect_tcap_InvokeIdType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
342   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
343                                                 NULL);
344
345   return offset;
346 }
347
348
349
350 static int
351 dissect_tcap_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
352   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
353                                                 NULL);
354
355   return offset;
356 }
357
358
359 static const value_string tcap_OPERATION_vals[] = {
360   {   0, "localValue" },
361   {   1, "globalValue" },
362   { 0, NULL }
363 };
364
365 static const ber_choice_t OPERATION_choice[] = {
366   {   0, &hf_tcap_localValue     , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_INTEGER },
367   {   1, &hf_tcap_globalValue    , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_tcap_OBJECT_IDENTIFIER },
368   { 0, NULL, 0, 0, 0, NULL }
369 };
370
371 static int
372 dissect_tcap_OPERATION(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
373   offset = dissect_ber_choice(actx, tree, tvb, offset,
374                                  OPERATION_choice, hf_index, ett_tcap_OPERATION,
375                                  NULL);
376
377   return offset;
378 }
379
380
381
382 static int
383 dissect_tcap_Parameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
384 #line 74 "tcap.cnf"
385
386   offset = dissect_tcap_param(actx,tree,tvb,offset);
387
388
389
390   return offset;
391 }
392
393
394 static const ber_sequence_t Invoke_sequence[] = {
395   { &hf_tcap_invokeID       , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_InvokeIdType },
396   { &hf_tcap_linkedID       , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_InvokeIdType },
397   { &hf_tcap_opCode         , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_OPERATION },
398   { &hf_tcap_parameter      , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_Parameter },
399   { NULL, 0, 0, 0, NULL }
400 };
401
402 static int
403 dissect_tcap_Invoke(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
404   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
405                                    Invoke_sequence, hf_index, ett_tcap_Invoke);
406
407   return offset;
408 }
409
410
411 static const ber_sequence_t T_resultretres_sequence[] = {
412   { &hf_tcap_opCode         , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_OPERATION },
413   { &hf_tcap_parameter      , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_Parameter },
414   { NULL, 0, 0, 0, NULL }
415 };
416
417 static int
418 dissect_tcap_T_resultretres(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
419   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
420                                    T_resultretres_sequence, hf_index, ett_tcap_T_resultretres);
421
422   return offset;
423 }
424
425
426 static const ber_sequence_t ReturnResult_sequence[] = {
427   { &hf_tcap_invokeID       , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_InvokeIdType },
428   { &hf_tcap_resultretres   , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_T_resultretres },
429   { NULL, 0, 0, 0, NULL }
430 };
431
432 static int
433 dissect_tcap_ReturnResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
434   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
435                                    ReturnResult_sequence, hf_index, ett_tcap_ReturnResult);
436
437   return offset;
438 }
439
440
441
442 static int
443 dissect_tcap_INTEGER_M32768_32767(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
444   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
445                                                 NULL);
446
447   return offset;
448 }
449
450
451 static const value_string tcap_ErrorCode_vals[] = {
452   {  19, "nationaler" },
453   {  20, "privateer" },
454   { 0, NULL }
455 };
456
457 static const ber_choice_t ErrorCode_choice[] = {
458   {  19, &hf_tcap_nationaler     , BER_CLASS_PRI, 19, BER_FLAGS_IMPLTAG, dissect_tcap_INTEGER_M32768_32767 },
459   {  20, &hf_tcap_privateer      , BER_CLASS_PRI, 20, BER_FLAGS_IMPLTAG, dissect_tcap_INTEGER },
460   { 0, NULL, 0, 0, 0, NULL }
461 };
462
463 static int
464 dissect_tcap_ErrorCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
465   offset = dissect_ber_choice(actx, tree, tvb, offset,
466                                  ErrorCode_choice, hf_index, ett_tcap_ErrorCode,
467                                  NULL);
468
469   return offset;
470 }
471
472
473 static const ber_sequence_t ReturnError_sequence[] = {
474   { &hf_tcap_invokeID       , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_InvokeIdType },
475   { &hf_tcap_errorCode      , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_ErrorCode },
476   { &hf_tcap_parameter      , BER_CLASS_ANY, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_Parameter },
477   { NULL, 0, 0, 0, NULL }
478 };
479
480 static int
481 dissect_tcap_ReturnError(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
482   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
483                                    ReturnError_sequence, hf_index, ett_tcap_ReturnError);
484
485   return offset;
486 }
487
488
489
490 static int
491 dissect_tcap_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
492   offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
493
494   return offset;
495 }
496
497
498 static const value_string tcap_T_invokeIDRej_vals[] = {
499   {   0, "derivable" },
500   {   1, "not-derivable" },
501   { 0, NULL }
502 };
503
504 static const ber_choice_t T_invokeIDRej_choice[] = {
505   {   0, &hf_tcap_derivable      , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_InvokeIdType },
506   {   1, &hf_tcap_not_derivable  , BER_CLASS_UNI, BER_UNI_TAG_NULL, BER_FLAGS_NOOWNTAG, dissect_tcap_NULL },
507   { 0, NULL, 0, 0, 0, NULL }
508 };
509
510 static int
511 dissect_tcap_T_invokeIDRej(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
512   offset = dissect_ber_choice(actx, tree, tvb, offset,
513                                  T_invokeIDRej_choice, hf_index, ett_tcap_T_invokeIDRej,
514                                  NULL);
515
516   return offset;
517 }
518
519
520 static const value_string tcap_GeneralProblem_vals[] = {
521   {   0, "unrecognizedComponent" },
522   {   1, "mistypedComponent" },
523   {   2, "badlyStructuredComponent" },
524   { 0, NULL }
525 };
526
527
528 static int
529 dissect_tcap_GeneralProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
530   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
531                                                 NULL);
532
533   return offset;
534 }
535
536
537 static const value_string tcap_InvokeProblem_vals[] = {
538   {   0, "duplicateInvokeID" },
539   {   1, "unrecognizedOperation" },
540   {   2, "mistypedParameter" },
541   {   3, "resourceLimitation" },
542   {   4, "initiatingRelease" },
543   {   5, "unrecognizedLinkedID" },
544   {   6, "linkedResponseUnexpected" },
545   {   7, "unexpectedLinkedOperation" },
546   { 0, NULL }
547 };
548
549
550 static int
551 dissect_tcap_InvokeProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
552   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
553                                                 NULL);
554
555   return offset;
556 }
557
558
559 static const value_string tcap_ReturnResultProblem_vals[] = {
560   {   0, "unrecognizedInvokeID" },
561   {   1, "returnResultUnexpected" },
562   {   2, "mistypedParameter" },
563   { 0, NULL }
564 };
565
566
567 static int
568 dissect_tcap_ReturnResultProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
569   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
570                                                 NULL);
571
572   return offset;
573 }
574
575
576 static const value_string tcap_ReturnErrorProblem_vals[] = {
577   {   0, "unrecognizedInvokeID" },
578   {   1, "returnErrorUnexpected" },
579   {   2, "unrecognizedError" },
580   {   3, "unexpectedError" },
581   {   4, "mistypedParameter" },
582   { 0, NULL }
583 };
584
585
586 static int
587 dissect_tcap_ReturnErrorProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
588   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
589                                                 NULL);
590
591   return offset;
592 }
593
594
595 static const value_string tcap_T_problem_vals[] = {
596   {   0, "generalProblem" },
597   {   1, "invokeProblem" },
598   {   2, "returnResultProblem" },
599   {   3, "returnErrorProblem" },
600   { 0, NULL }
601 };
602
603 static const ber_choice_t T_problem_choice[] = {
604   {   0, &hf_tcap_generalProblem , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_tcap_GeneralProblem },
605   {   1, &hf_tcap_invokeProblem  , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_tcap_InvokeProblem },
606   {   2, &hf_tcap_returnResultProblem, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnResultProblem },
607   {   3, &hf_tcap_returnErrorProblem, BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnErrorProblem },
608   { 0, NULL, 0, 0, 0, NULL }
609 };
610
611 static int
612 dissect_tcap_T_problem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
613   offset = dissect_ber_choice(actx, tree, tvb, offset,
614                                  T_problem_choice, hf_index, ett_tcap_T_problem,
615                                  NULL);
616
617   return offset;
618 }
619
620
621 static const ber_sequence_t Reject_sequence[] = {
622   { &hf_tcap_invokeIDRej    , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_T_invokeIDRej },
623   { &hf_tcap_problem        , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_T_problem },
624   { NULL, 0, 0, 0, NULL }
625 };
626
627 static int
628 dissect_tcap_Reject(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
629   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
630                                    Reject_sequence, hf_index, ett_tcap_Reject);
631
632   return offset;
633 }
634
635
636 static const value_string tcap_Component_vals[] = {
637   {   1, "invoke" },
638   {   2, "returnResultLast" },
639   {   3, "returnError" },
640   {   4, "reject" },
641   {   7, "returnResultNotLast" },
642   { 0, NULL }
643 };
644
645 static const ber_choice_t Component_choice[] = {
646   {   1, &hf_tcap_invoke         , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_tcap_Invoke },
647   {   2, &hf_tcap_returnResultLast, BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnResult },
648   {   3, &hf_tcap_returnError    , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnError },
649   {   4, &hf_tcap_reject         , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_tcap_Reject },
650   {   7, &hf_tcap_returnResultNotLast, BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, dissect_tcap_ReturnResult },
651   { 0, NULL, 0, 0, 0, NULL }
652 };
653
654 static int
655 dissect_tcap_Component(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
656 #line 79 "tcap.cnf"
657 tvbuff_t        *next_tvb;
658 gint8 class;
659 gboolean pc;
660 gint tag;
661 guint32 len, comp_offset;
662 gint ind_field;
663
664 comp_offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag);
665 comp_offset = dissect_ber_length(actx->pinfo, tree, tvb, comp_offset, &len, &ind_field);
666 /* we can believe the length now */
667 next_tvb = tvb_new_subset(tvb, offset, len+comp_offset-offset, len+comp_offset-offset);
668
669 if (!next_tvb)
670   return comp_offset;
671
672   offset = dissect_ber_choice(actx, tree, tvb, offset,
673                                  Component_choice, hf_index, ett_tcap_Component,
674                                  NULL);
675
676
677  dissect_tcap_ITU_ComponentPDU(implicit_tag, next_tvb, 0, actx, tcap_top_tree, hf_index);
678
679 /* return comp_offset+len; or return offset (will be automatically added) */
680
681
682
683   return offset;
684 }
685
686
687 static const ber_sequence_t SEQUENCE_SIZE_1_MAX_OF_Component_sequence_of[1] = {
688   { &hf_tcap__untag_item    , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_Component },
689 };
690
691 static int
692 dissect_tcap_SEQUENCE_SIZE_1_MAX_OF_Component(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
693   offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
694                                       SEQUENCE_SIZE_1_MAX_OF_Component_sequence_of, hf_index, ett_tcap_SEQUENCE_SIZE_1_MAX_OF_Component);
695
696   return offset;
697 }
698
699
700
701 static int
702 dissect_tcap_ComponentPortion(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
703   offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
704                                       hf_index, BER_CLASS_APP, 12, TRUE, dissect_tcap_SEQUENCE_SIZE_1_MAX_OF_Component);
705
706   return offset;
707 }
708
709
710 static const ber_sequence_t Unidirectional_sequence[] = {
711   { &hf_tcap_dialoguePortion, BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
712   { &hf_tcap_components     , BER_CLASS_APP, 12, BER_FLAGS_NOOWNTAG, dissect_tcap_ComponentPortion },
713   { NULL, 0, 0, 0, NULL }
714 };
715
716 static int
717 dissect_tcap_Unidirectional(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
718   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
719                                    Unidirectional_sequence, hf_index, ett_tcap_Unidirectional);
720
721   return offset;
722 }
723
724
725
726 static int
727 dissect_tcap_OCTET_STRING_SIZE_1_4(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
728   offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
729                                        NULL);
730
731   return offset;
732 }
733
734
735
736 static int
737 dissect_tcap_OrigTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
738 #line 117 "tcap.cnf"
739 tvbuff_t *parameter_tvb;
740 guint8 len, i;
741 proto_item *tid_item;
742 proto_tree *subtree;
743 tid_item = proto_tree_add_text(tree, tvb, offset, -1, "Source Transaction ID");
744 subtree = proto_item_add_subtree(tid_item, ett_otid);
745
746 offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_tid,
747                                     &parameter_tvb);
748
749 if (parameter_tvb){
750         len = tvb_length_remaining(parameter_tvb, 0);
751         switch(len) {
752         case 1:
753                 gp_tcapsrt_info->src_tid=tvb_get_guint8(parameter_tvb, 0);
754                 break;
755         case 2:
756                 gp_tcapsrt_info->src_tid=tvb_get_ntohs(parameter_tvb, 0);
757                 break;
758         case 4:
759                 gp_tcapsrt_info->src_tid=tvb_get_ntohl(parameter_tvb, 0);
760                 break;
761         default:
762                 gp_tcapsrt_info->src_tid=0;
763                 break;
764         }
765
766         if ((len)&&(check_col(actx->pinfo->cinfo, COL_INFO))){
767                 col_append_str(actx->pinfo->cinfo, COL_INFO, "otid(");
768                 for(i=0;i<len;i++)
769                           col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i));
770                 col_append_str(actx->pinfo->cinfo, COL_INFO, ") ");
771         }
772
773 }
774
775
776
777
778   return offset;
779 }
780
781
782 static const ber_sequence_t Begin_sequence[] = {
783   { &hf_tcap_otid           , BER_CLASS_APP, 8, BER_FLAGS_NOOWNTAG, dissect_tcap_OrigTransactionID },
784   { &hf_tcap_dialoguePortion, BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
785   { &hf_tcap_components     , BER_CLASS_APP, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_ComponentPortion },
786   { NULL, 0, 0, 0, NULL }
787 };
788
789 static int
790 dissect_tcap_Begin(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
791 #line 191 "tcap.cnf"
792 gp_tcapsrt_info->ope=TC_BEGIN;
793
794 /*  Do not change col_add_str() to col_append_str() here: we _want_ this call
795  *  to overwrite whatever's currently in the INFO column (e.g., "UDT" from
796  *  the SCCP dissector).
797  *
798  *  If there's something there that should not be overwritten, whoever
799  *  put that info there should call col_set_fence() to protect it.
800  */
801 if (check_col(actx->pinfo->cinfo, COL_INFO))
802                 col_set_str(actx->pinfo->cinfo, COL_INFO, "Begin ");
803
804   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
805                                    Begin_sequence, hf_index, ett_tcap_Begin);
806
807   return offset;
808 }
809
810
811
812 static int
813 dissect_tcap_DestTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
814 #line 156 "tcap.cnf"
815 tvbuff_t *parameter_tvb;
816 guint8 len , i;
817 proto_item *tid_item;
818 proto_tree *subtree;
819 tid_item = proto_tree_add_text(tree, tvb, offset, -1, "Destination Transaction ID");
820 subtree = proto_item_add_subtree(tid_item, ett_otid);
821
822 offset = dissect_ber_octet_string(implicit_tag, actx, subtree, tvb, offset, hf_tcap_tid,
823                                     &parameter_tvb);
824
825 if (parameter_tvb){
826         len = tvb_length_remaining(parameter_tvb, 0);
827         switch(len) {
828         case 1:
829                 gp_tcapsrt_info->dst_tid=tvb_get_guint8(parameter_tvb, 0);
830                 break;
831         case 2:
832                 gp_tcapsrt_info->dst_tid=tvb_get_ntohs(parameter_tvb, 0);
833                 break;
834         case 4:
835                 gp_tcapsrt_info->dst_tid=tvb_get_ntohl(parameter_tvb, 0);
836                 break;
837         default:
838                 gp_tcapsrt_info->dst_tid=0;
839                 break;
840         }
841
842         if ((len)&&(check_col(actx->pinfo->cinfo, COL_INFO))){
843                 col_append_str(actx->pinfo->cinfo, COL_INFO, "dtid(");
844                 for(i=0;i<len;i++)
845                         col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%02x",tvb_get_guint8(parameter_tvb,i));
846                 col_append_str(actx->pinfo->cinfo, COL_INFO, ") ");
847            }
848 }
849
850
851   return offset;
852 }
853
854
855 static const ber_sequence_t End_sequence[] = {
856   { &hf_tcap_dtid           , BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_tcap_DestTransactionID },
857   { &hf_tcap_dialoguePortion, BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
858   { &hf_tcap_components     , BER_CLASS_APP, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_ComponentPortion },
859   { NULL, 0, 0, 0, NULL }
860 };
861
862 static int
863 dissect_tcap_End(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
864 #line 206 "tcap.cnf"
865 gp_tcapsrt_info->ope=TC_END;
866
867 if (check_col(actx->pinfo->cinfo, COL_INFO))
868                 col_set_str(actx->pinfo->cinfo, COL_INFO, "End ");
869
870   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
871                                    End_sequence, hf_index, ett_tcap_End);
872
873   return offset;
874 }
875
876
877 static const ber_sequence_t Continue_sequence[] = {
878   { &hf_tcap_otid           , BER_CLASS_APP, 8, BER_FLAGS_NOOWNTAG, dissect_tcap_OrigTransactionID },
879   { &hf_tcap_dtid           , BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_tcap_DestTransactionID },
880   { &hf_tcap_dialoguePortion, BER_CLASS_APP, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
881   { &hf_tcap_components     , BER_CLASS_APP, 12, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_tcap_ComponentPortion },
882   { NULL, 0, 0, 0, NULL }
883 };
884
885 static int
886 dissect_tcap_Continue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
887 #line 214 "tcap.cnf"
888 gp_tcapsrt_info->ope=TC_CONT;
889
890 if (check_col(actx->pinfo->cinfo, COL_INFO))
891                 col_set_str(actx->pinfo->cinfo, COL_INFO, "Continue ");
892
893   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
894                                    Continue_sequence, hf_index, ett_tcap_Continue);
895
896   return offset;
897 }
898
899
900 static const value_string tcap_P_AbortCause_U_vals[] = {
901   {   0, "unrecognizedMessageType" },
902   {   1, "unrecognizedTransactionID" },
903   {   2, "badlyFormattedTransactionPortion" },
904   {   3, "incorrectTransactionPortion" },
905   {   4, "resourceLimitation" },
906   { 0, NULL }
907 };
908
909
910 static int
911 dissect_tcap_P_AbortCause_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
912   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
913                                                 NULL);
914
915   return offset;
916 }
917
918
919
920 static int
921 dissect_tcap_P_AbortCause(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
922   offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
923                                       hf_index, BER_CLASS_APP, 10, TRUE, dissect_tcap_P_AbortCause_U);
924
925   return offset;
926 }
927
928
929 static const value_string tcap_Reason_vals[] = {
930   {  10, "p-abortCause" },
931   {  11, "u-abortCause" },
932   { 0, NULL }
933 };
934
935 static const ber_choice_t Reason_choice[] = {
936   {  10, &hf_tcap_p_abortCause   , BER_CLASS_APP, 10, BER_FLAGS_NOOWNTAG, dissect_tcap_P_AbortCause },
937   {  11, &hf_tcap_u_abortCause   , BER_CLASS_APP, 11, BER_FLAGS_NOOWNTAG, dissect_tcap_DialoguePortion },
938   { 0, NULL, 0, 0, 0, NULL }
939 };
940
941 static int
942 dissect_tcap_Reason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
943   offset = dissect_ber_choice(actx, tree, tvb, offset,
944                                  Reason_choice, hf_index, ett_tcap_Reason,
945                                  NULL);
946
947   return offset;
948 }
949
950
951 static const ber_sequence_t Abort_sequence[] = {
952   { &hf_tcap_dtid           , BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_tcap_DestTransactionID },
953   { &hf_tcap_reason         , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_tcap_Reason },
954   { NULL, 0, 0, 0, NULL }
955 };
956
957 static int
958 dissect_tcap_Abort(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
959 #line 222 "tcap.cnf"
960 gp_tcapsrt_info->ope=TC_ABORT;
961
962 if (check_col(actx->pinfo->cinfo, COL_INFO))
963                 col_set_str(actx->pinfo->cinfo, COL_INFO, "Abort ");
964
965   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
966                                    Abort_sequence, hf_index, ett_tcap_Abort);
967
968   return offset;
969 }
970
971
972 static const value_string tcap_TCMessage_vals[] = {
973   {   1, "unidirectional" },
974   {   2, "begin" },
975   {   4, "end" },
976   {   5, "continue" },
977   {   7, "abort" },
978   { 0, NULL }
979 };
980
981 static const ber_choice_t TCMessage_choice[] = {
982   {   1, &hf_tcap_unidirectional , BER_CLASS_APP, 1, BER_FLAGS_IMPLTAG, dissect_tcap_Unidirectional },
983   {   2, &hf_tcap_begin          , BER_CLASS_APP, 2, BER_FLAGS_IMPLTAG, dissect_tcap_Begin },
984   {   4, &hf_tcap_end            , BER_CLASS_APP, 4, BER_FLAGS_IMPLTAG, dissect_tcap_End },
985   {   5, &hf_tcap_continue       , BER_CLASS_APP, 5, BER_FLAGS_IMPLTAG, dissect_tcap_Continue },
986   {   7, &hf_tcap_abort          , BER_CLASS_APP, 7, BER_FLAGS_IMPLTAG, dissect_tcap_Abort },
987   { 0, NULL, 0, 0, 0, NULL }
988 };
989
990 static int
991 dissect_tcap_TCMessage(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
992   offset = dissect_ber_choice(actx, tree, tvb, offset,
993                                  TCMessage_choice, hf_index, ett_tcap_TCMessage,
994                                  NULL);
995
996   return offset;
997 }
998
999
1000 static const value_string tcap_ERROR_vals[] = {
1001   {   0, "localValue" },
1002   {   1, "globalValue" },
1003   { 0, NULL }
1004 };
1005
1006 static const ber_choice_t ERROR_choice[] = {
1007   {   0, &hf_tcap_localValue     , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tcap_INTEGER },
1008   {   1, &hf_tcap_globalValue    , BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_tcap_OBJECT_IDENTIFIER },
1009   { 0, NULL, 0, 0, 0, NULL }
1010 };
1011
1012 static int
1013 dissect_tcap_ERROR(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1014   offset = dissect_ber_choice(actx, tree, tvb, offset,
1015                                  ERROR_choice, hf_index, ett_tcap_ERROR,
1016                                  NULL);
1017
1018   return offset;
1019 }
1020
1021
1022 static const asn_namedbit AUDT_protocol_version_bits[] = {
1023   {  0, &hf_tcap_AUDT_protocol_version_version1, -1, -1, "version1", NULL },
1024   { 0, NULL, 0, 0, NULL, NULL }
1025 };
1026
1027 static int
1028 dissect_tcap_AUDT_protocol_version(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1029   offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
1030                                     AUDT_protocol_version_bits, hf_index, ett_tcap_AUDT_protocol_version,
1031                                     NULL);
1032
1033   return offset;
1034 }
1035
1036
1037
1038 static int
1039 dissect_tcap_AUDT_application_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1040 #line 102 "tcap.cnf"
1041   offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &cur_oid);
1042
1043         tcap_private.oid= (void*) cur_oid;
1044         tcap_private.acv=TRUE;
1045
1046
1047   return offset;
1048 }
1049
1050
1051
1052 static int
1053 dissect_tcap_EXTERNAL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1054   offset = dissect_ber_external_type(implicit_tag, tree, tvb, offset, actx, hf_index, NULL);
1055
1056   return offset;
1057 }
1058
1059
1060 static const ber_sequence_t AUDT_user_information_sequence_of[1] = {
1061   { &hf_tcap_audt_user_information_item, BER_CLASS_UNI, BER_UNI_TAG_EXTERNAL, BER_FLAGS_NOOWNTAG, dissect_tcap_EXTERNAL },
1062 };
1063
1064 static int
1065 dissect_tcap_AUDT_user_information(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1066   offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1067                                       AUDT_user_information_sequence_of, hf_index, ett_tcap_AUDT_user_information);
1068
1069   return offset;
1070 }
1071
1072
1073 static const ber_sequence_t AUDT_apdu_U_sequence[] = {
1074   { &hf_tcap_audt_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AUDT_protocol_version },
1075   { &hf_tcap_audt_application_context_name, BER_CLASS_CON, 1, 0, dissect_tcap_AUDT_application_context_name },
1076   { &hf_tcap_audt_user_information, BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AUDT_user_information },
1077   { NULL, 0, 0, 0, NULL }
1078 };
1079
1080 static int
1081 dissect_tcap_AUDT_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1082   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1083                                    AUDT_apdu_U_sequence, hf_index, ett_tcap_AUDT_apdu_U);
1084
1085   return offset;
1086 }
1087
1088
1089
1090 static int
1091 dissect_tcap_AUDT_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1092   offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1093                                       hf_index, BER_CLASS_APP, 0, TRUE, dissect_tcap_AUDT_apdu_U);
1094
1095   return offset;
1096 }
1097
1098
1099 const value_string tcap_UniDialoguePDU_vals[] = {
1100   {   0, "unidialoguePDU" },
1101   { 0, NULL }
1102 };
1103
1104 static const ber_choice_t UniDialoguePDU_choice[] = {
1105   {   0, &hf_tcap_unidialoguePDU , BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_tcap_AUDT_apdu },
1106   { 0, NULL, 0, 0, 0, NULL }
1107 };
1108
1109 int
1110 dissect_tcap_UniDialoguePDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1111   offset = dissect_ber_choice(actx, tree, tvb, offset,
1112                                  UniDialoguePDU_choice, hf_index, ett_tcap_UniDialoguePDU,
1113                                  NULL);
1114
1115   return offset;
1116 }
1117
1118
1119 static const asn_namedbit AARQ_protocol_version_bits[] = {
1120   {  0, &hf_tcap_AARQ_protocol_version_version1, -1, -1, "version1", NULL },
1121   { 0, NULL, 0, 0, NULL, NULL }
1122 };
1123
1124 static int
1125 dissect_tcap_AARQ_protocol_version(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1126   offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
1127                                     AARQ_protocol_version_bits, hf_index, ett_tcap_AARQ_protocol_version,
1128                                     NULL);
1129
1130   return offset;
1131 }
1132
1133
1134
1135 static int
1136 dissect_tcap_AARQ_application_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1137 #line 107 "tcap.cnf"
1138   offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &cur_oid);
1139
1140         tcap_private.oid= (void*) cur_oid;
1141         tcap_private.acv=TRUE;
1142
1143
1144   return offset;
1145 }
1146
1147
1148 static const ber_sequence_t AARQ_user_information_sequence_of[1] = {
1149   { &hf_tcap_aarq_user_information_item, BER_CLASS_UNI, BER_UNI_TAG_EXTERNAL, BER_FLAGS_NOOWNTAG, dissect_tcap_EXTERNAL },
1150 };
1151
1152 static int
1153 dissect_tcap_AARQ_user_information(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1154   offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1155                                       AARQ_user_information_sequence_of, hf_index, ett_tcap_AARQ_user_information);
1156
1157   return offset;
1158 }
1159
1160
1161 static const ber_sequence_t AARQ_apdu_U_sequence[] = {
1162   { &hf_tcap_aarq_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AARQ_protocol_version },
1163   { &hf_tcap_aarq_application_context_name, BER_CLASS_CON, 1, 0, dissect_tcap_AARQ_application_context_name },
1164   { &hf_tcap_aarq_user_information, BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AARQ_user_information },
1165   { NULL, 0, 0, 0, NULL }
1166 };
1167
1168 static int
1169 dissect_tcap_AARQ_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1170   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1171                                    AARQ_apdu_U_sequence, hf_index, ett_tcap_AARQ_apdu_U);
1172
1173   return offset;
1174 }
1175
1176
1177
1178 static int
1179 dissect_tcap_AARQ_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1180   offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1181                                       hf_index, BER_CLASS_APP, 0, TRUE, dissect_tcap_AARQ_apdu_U);
1182
1183   return offset;
1184 }
1185
1186
1187 static const asn_namedbit AARE_protocol_version_bits[] = {
1188   {  0, &hf_tcap_AARE_protocol_version_version1, -1, -1, "version1", NULL },
1189   { 0, NULL, 0, 0, NULL, NULL }
1190 };
1191
1192 static int
1193 dissect_tcap_AARE_protocol_version(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1194   offset = dissect_ber_bitstring(implicit_tag, actx, tree, tvb, offset,
1195                                     AARE_protocol_version_bits, hf_index, ett_tcap_AARE_protocol_version,
1196                                     NULL);
1197
1198   return offset;
1199 }
1200
1201
1202
1203 static int
1204 dissect_tcap_AARE_application_context_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1205 #line 112 "tcap.cnf"
1206   offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &cur_oid);
1207
1208         tcap_private.oid= (void*) cur_oid;
1209         tcap_private.acv=TRUE;
1210
1211
1212   return offset;
1213 }
1214
1215
1216 static const value_string tcap_Associate_result_vals[] = {
1217   {   0, "accepted" },
1218   {   1, "reject-permanent" },
1219   { 0, NULL }
1220 };
1221
1222
1223 static int
1224 dissect_tcap_Associate_result(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1225   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1226                                                 NULL);
1227
1228   return offset;
1229 }
1230
1231
1232 static const value_string tcap_T_dialogue_service_user_vals[] = {
1233   {   0, "null" },
1234   {   1, "no-reason-given" },
1235   {   2, "application-context-name-not-supported" },
1236   { 0, NULL }
1237 };
1238
1239
1240 static int
1241 dissect_tcap_T_dialogue_service_user(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1242   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1243                                                 NULL);
1244
1245   return offset;
1246 }
1247
1248
1249 static const value_string tcap_T_dialogue_service_provider_vals[] = {
1250   {   0, "null" },
1251   {   1, "no-reason-given" },
1252   {   2, "no-common-dialogue-portion" },
1253   { 0, NULL }
1254 };
1255
1256
1257 static int
1258 dissect_tcap_T_dialogue_service_provider(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1259   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1260                                                 NULL);
1261
1262   return offset;
1263 }
1264
1265
1266 static const value_string tcap_Associate_source_diagnostic_vals[] = {
1267   {   1, "dialogue-service-user" },
1268   {   2, "dialogue-service-provider" },
1269   { 0, NULL }
1270 };
1271
1272 static const ber_choice_t Associate_source_diagnostic_choice[] = {
1273   {   1, &hf_tcap_dialogue_service_user, BER_CLASS_CON, 1, 0, dissect_tcap_T_dialogue_service_user },
1274   {   2, &hf_tcap_dialogue_service_provider, BER_CLASS_CON, 2, 0, dissect_tcap_T_dialogue_service_provider },
1275   { 0, NULL, 0, 0, 0, NULL }
1276 };
1277
1278 static int
1279 dissect_tcap_Associate_source_diagnostic(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1280   offset = dissect_ber_choice(actx, tree, tvb, offset,
1281                                  Associate_source_diagnostic_choice, hf_index, ett_tcap_Associate_source_diagnostic,
1282                                  NULL);
1283
1284   return offset;
1285 }
1286
1287
1288 static const ber_sequence_t AARE_user_information_sequence_of[1] = {
1289   { &hf_tcap_aare_user_information_item, BER_CLASS_UNI, BER_UNI_TAG_EXTERNAL, BER_FLAGS_NOOWNTAG, dissect_tcap_EXTERNAL },
1290 };
1291
1292 static int
1293 dissect_tcap_AARE_user_information(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1294   offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1295                                       AARE_user_information_sequence_of, hf_index, ett_tcap_AARE_user_information);
1296
1297   return offset;
1298 }
1299
1300
1301 static const ber_sequence_t AARE_apdu_U_sequence[] = {
1302   { &hf_tcap_aare_protocol_version, BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AARE_protocol_version },
1303   { &hf_tcap_aare_application_context_name, BER_CLASS_CON, 1, 0, dissect_tcap_AARE_application_context_name },
1304   { &hf_tcap_result         , BER_CLASS_CON, 2, 0, dissect_tcap_Associate_result },
1305   { &hf_tcap_result_source_diagnostic, BER_CLASS_CON, 3, BER_FLAGS_NOTCHKTAG, dissect_tcap_Associate_source_diagnostic },
1306   { &hf_tcap_aare_user_information, BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_AARE_user_information },
1307   { NULL, 0, 0, 0, NULL }
1308 };
1309
1310 static int
1311 dissect_tcap_AARE_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1312   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1313                                    AARE_apdu_U_sequence, hf_index, ett_tcap_AARE_apdu_U);
1314
1315   return offset;
1316 }
1317
1318
1319
1320 static int
1321 dissect_tcap_AARE_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1322   offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1323                                       hf_index, BER_CLASS_APP, 1, TRUE, dissect_tcap_AARE_apdu_U);
1324
1325   return offset;
1326 }
1327
1328
1329 static const value_string tcap_ABRT_source_vals[] = {
1330   {   0, "dialogue-service-user" },
1331   {   1, "dialogue-service-provider" },
1332   { 0, NULL }
1333 };
1334
1335
1336 static int
1337 dissect_tcap_ABRT_source(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1338   offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1339                                                 NULL);
1340
1341   return offset;
1342 }
1343
1344
1345 static const ber_sequence_t ABRT_user_information_sequence_of[1] = {
1346   { &hf_tcap_abrt_user_information_item, BER_CLASS_UNI, BER_UNI_TAG_EXTERNAL, BER_FLAGS_NOOWNTAG, dissect_tcap_EXTERNAL },
1347 };
1348
1349 static int
1350 dissect_tcap_ABRT_user_information(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1351   offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1352                                       ABRT_user_information_sequence_of, hf_index, ett_tcap_ABRT_user_information);
1353
1354   return offset;
1355 }
1356
1357
1358 static const ber_sequence_t ABRT_apdu_U_sequence[] = {
1359   { &hf_tcap_abort_source   , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_tcap_ABRT_source },
1360   { &hf_tcap_abrt_user_information, BER_CLASS_CON, 30, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tcap_ABRT_user_information },
1361   { NULL, 0, 0, 0, NULL }
1362 };
1363
1364 static int
1365 dissect_tcap_ABRT_apdu_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1366   offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1367                                    ABRT_apdu_U_sequence, hf_index, ett_tcap_ABRT_apdu_U);
1368
1369   return offset;
1370 }
1371
1372
1373
1374 static int
1375 dissect_tcap_ABRT_apdu(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1376   offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1377                                       hf_index, BER_CLASS_APP, 4, TRUE, dissect_tcap_ABRT_apdu_U);
1378
1379   return offset;
1380 }
1381
1382
1383 const value_string tcap_DialoguePDU_vals[] = {
1384   {   0, "dialogueRequest" },
1385   {   1, "dialogueResponse" },
1386   {   4, "dialogueAbort" },
1387   { 0, NULL }
1388 };
1389
1390 static const ber_choice_t DialoguePDU_choice[] = {
1391   {   0, &hf_tcap_dialogueRequest, BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_tcap_AARQ_apdu },
1392   {   1, &hf_tcap_dialogueResponse, BER_CLASS_APP, 1, BER_FLAGS_NOOWNTAG, dissect_tcap_AARE_apdu },
1393   {   4, &hf_tcap_dialogueAbort  , BER_CLASS_APP, 4, BER_FLAGS_NOOWNTAG, dissect_tcap_ABRT_apdu },
1394   { 0, NULL, 0, 0, 0, NULL }
1395 };
1396
1397 int
1398 dissect_tcap_DialoguePDU(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1399   offset = dissect_ber_choice(actx, tree, tvb, offset,
1400                                  DialoguePDU_choice, hf_index, ett_tcap_DialoguePDU,
1401                                  NULL);
1402
1403   return offset;
1404 }
1405
1406 /*--- PDUs ---*/
1407
1408 static void dissect_UniDialoguePDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
1409   asn1_ctx_t asn1_ctx;
1410   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
1411   dissect_tcap_UniDialoguePDU(FALSE, tvb, 0, &asn1_ctx, tree, hf_tcap_UniDialoguePDU_PDU);
1412 }
1413 static void dissect_DialoguePDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
1414   asn1_ctx_t asn1_ctx;
1415   asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
1416   dissect_tcap_DialoguePDU(FALSE, tvb, 0, &asn1_ctx, tree, hf_tcap_DialoguePDU_PDU);
1417 }
1418
1419
1420 /*--- End of included file: packet-tcap-fn.c ---*/
1421 #line 142 "packet-tcap-template.c"
1422
1423
1424
1425 const value_string tcap_component_type_str[] = {
1426     { TCAP_COMP_INVOKE,         "Invoke" },
1427     { TCAP_COMP_RRL,            "Return Result(L)" },
1428     { TCAP_COMP_RE,                     "Return Error" },
1429     { TCAP_COMP_REJECT,         "Reject" },
1430     { TCAP_COMP_RRN,            "Return Result(NL)" },
1431     { 0,                        NULL } };
1432
1433
1434 static void
1435 dissect_tcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
1436 {
1437     proto_item          *item=NULL;
1438     proto_tree          *tree=NULL;
1439
1440     struct tcaphash_context_t * p_tcap_context;
1441     dissector_handle_t subdissector_handle;
1442         asn1_ctx_t asn1_ctx;
1443         gint8 class;
1444         gboolean pc;
1445         gint tag;
1446
1447         /* Check if ANSI TCAP and call the ANSI TCAP dissector if that's the case 
1448          * PackageType ::= CHOICE { unidirectional                      [PRIVATE 1] IMPLICIT UniTransactionPDU,
1449          *                                               queryWithPerm                          [PRIVATE 2] IMPLICIT TransactionPDU,
1450          *                                               queryWithoutPerm                       [PRIVATE 3] IMPLICIT TransactionPDU,
1451          *                                               response                                       [PRIVATE 4] IMPLICIT TransactionPDU,
1452          *                                               conversationWithPerm           [PRIVATE 5] IMPLICIT TransactionPDU,
1453          *                                               conversationWithoutPerm        [PRIVATE 6] IMPLICIT TransactionPDU,
1454          *                                               abort                                          [PRIVATE 22] IMPLICIT Abort 
1455          *                                               }
1456          *      
1457          * 
1458          */
1459         get_ber_identifier(tvb, 0, &class, &pc, &tag);
1460
1461         if(class == BER_CLASS_PRI){
1462                 switch(tag){
1463                 case 1:
1464                 case 2:
1465                 case 3:
1466                 case 4:
1467                 case 5:
1468                 case 6:
1469                 case 22:
1470                         call_dissector(ansi_tcap_handle, tvb, pinfo, parent_tree);
1471                         return;
1472                         break;
1473                 default:
1474                         return;
1475                 }
1476         }
1477
1478         /* ITU TCAP */
1479         asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
1480
1481     tcap_top_tree = parent_tree;
1482     tcap_stat_tree = NULL;
1483
1484     if (check_col(pinfo->cinfo, COL_PROTOCOL))
1485     {
1486                 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TCAP");
1487     }
1488
1489     /* create display subtree for the protocol */
1490     if(parent_tree){
1491       item = proto_tree_add_item(parent_tree, proto_tcap, tvb, 0, -1, FALSE);
1492       tree = proto_item_add_subtree(item, ett_tcap);
1493       tcap_stat_tree=tree;
1494     }
1495     cur_oid = NULL;
1496     tcapext_oid = NULL;
1497     raz_tcap_private(&tcap_private);
1498
1499     pinfo->private_data = &tcap_private;
1500     gp_tcapsrt_info=tcapsrt_razinfo();
1501     tcap_subdissector_used=FALSE;
1502     gp_tcap_context=NULL;
1503     dissect_tcap_TCMessage(FALSE, tvb, 0, &asn1_ctx, tree, -1);
1504
1505     if (gtcap_HandleSRT && !tcap_subdissector_used ) {
1506       p_tcap_context=tcapsrt_call_matching(tvb, pinfo, tcap_stat_tree, gp_tcapsrt_info);
1507       tcap_private.context=p_tcap_context;
1508
1509                 /* If the current message is TCAP only,
1510                  * save the Application Context Name for the next messages
1511                  */
1512                 if ( p_tcap_context && cur_oid && !p_tcap_context->oid_present ) {
1513                         /* Save the application context and the sub dissector */
1514                         g_strlcpy(p_tcap_context->oid,cur_oid, LENGTH_OID);
1515                         p_tcap_context->oid_present=TRUE;
1516                         if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
1517                                 p_tcap_context->subdissector_handle=subdissector_handle;
1518                                 p_tcap_context->subdissector_present=TRUE;
1519                         }
1520                 }
1521                 if (gtcap_HandleSRT && p_tcap_context && p_tcap_context->callback) {
1522                         /* Callback fonction for the upper layer */
1523                         (p_tcap_context->callback)(tvb, pinfo, tcap_stat_tree, p_tcap_context);
1524                 }
1525         }
1526 }
1527
1528 void
1529 proto_reg_handoff_tcap(void)
1530 {
1531
1532     data_handle = find_dissector("data");
1533     ansi_tcap_handle = find_dissector("ansi_tcap");
1534     ber_oid_dissector_table = find_dissector_table("ber.oid");
1535
1536
1537 /*--- Included file: packet-tcap-dis-tab.c ---*/
1538 #line 1 "packet-tcap-dis-tab.c"
1539   register_ber_oid_dissector("0.0.17.773.1.1.1", dissect_DialoguePDU_PDU, proto_tcap, "id-as-dialogue");
1540   register_ber_oid_dissector("0.0.17.773.1.2.1", dissect_UniDialoguePDU_PDU, proto_tcap, "id-as-uniDialogue");
1541
1542
1543 /*--- End of included file: packet-tcap-dis-tab.c ---*/
1544 #line 257 "packet-tcap-template.c"
1545 }
1546
1547 static void init_tcap(void);
1548
1549 void
1550 proto_register_tcap(void)
1551 {
1552
1553 /* Setup list of header fields  See Section 1.6.1 for details*/
1554     static hf_register_info hf[] = {
1555         { &hf_tcap_tag,
1556                 { "Tag",           "tcap.msgtype",
1557                 FT_UINT8, BASE_HEX, NULL, 0,
1558                 NULL, HFILL }
1559         },
1560         { &hf_tcap_length,
1561                 { "Length", "tcap.len",
1562                 FT_UINT8, BASE_DEC, NULL, 0,
1563                 NULL, HFILL }
1564         },
1565         { &hf_tcap_data,
1566                 { "Data", "tcap.data",
1567                 FT_BYTES, BASE_NONE, NULL, 0,
1568                 NULL, HFILL }
1569         },
1570                 { &hf_tcap_tid,
1571                 { "Transaction Id", "tcap.tid",
1572                 FT_BYTES, BASE_NONE, NULL, 0,
1573                 NULL, HFILL }
1574         },
1575         /* Tcap Service Response Time */
1576         { &hf_tcapsrt_SessionId,
1577           { "Session Id",
1578             "tcap.srt.session_id",
1579             FT_UINT32, BASE_DEC, NULL, 0x0,
1580             NULL, HFILL }
1581         },
1582         { &hf_tcapsrt_BeginSession,
1583           { "Begin Session",
1584             "tcap.srt.begin",
1585             FT_FRAMENUM, BASE_NONE, NULL, 0x0,
1586             "SRT Begin of Session", HFILL }
1587         },
1588         { &hf_tcapsrt_EndSession,
1589           { "End Session",
1590             "tcap.srt.end",
1591             FT_FRAMENUM, BASE_NONE, NULL, 0x0,
1592             "SRT End of Session", HFILL }
1593         },
1594         { &hf_tcapsrt_SessionTime,
1595           { "Session duration",
1596             "tcap.srt.sessiontime",
1597             FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
1598             "Duration of the TCAP session", HFILL }
1599         },
1600         { &hf_tcapsrt_Duplicate,
1601           { "Session Duplicate",
1602             "tcap.srt.duplicate",
1603             FT_FRAMENUM, BASE_NONE, NULL, 0x0,
1604             "SRT Duplicated with Session", HFILL }
1605         },
1606
1607 /*--- Included file: packet-tcap-hfarr.c ---*/
1608 #line 1 "packet-tcap-hfarr.c"
1609     { &hf_tcap_UniDialoguePDU_PDU,
1610       { "UniDialoguePDU", "tcap.UniDialoguePDU",
1611         FT_UINT32, BASE_DEC, VALS(tcap_UniDialoguePDU_vals), 0,
1612         "tcap.UniDialoguePDU", HFILL }},
1613     { &hf_tcap_DialoguePDU_PDU,
1614       { "DialoguePDU", "tcap.DialoguePDU",
1615         FT_UINT32, BASE_DEC, VALS(tcap_DialoguePDU_vals), 0,
1616         "tcap.DialoguePDU", HFILL }},
1617     { &hf_tcap_oid,
1618       { "oid", "tcap.oid",
1619         FT_OID, BASE_NONE, NULL, 0,
1620         "tcap.OBJECT_IDENTIFIER", HFILL }},
1621     { &hf_tcap_dialog,
1622       { "dialog", "tcap.dialog",
1623         FT_BYTES, BASE_NONE, NULL, 0,
1624         "tcap.Dialog1", HFILL }},
1625     { &hf_tcap_unidirectional,
1626       { "unidirectional", "tcap.unidirectional",
1627         FT_NONE, BASE_NONE, NULL, 0,
1628         "tcap.Unidirectional", HFILL }},
1629     { &hf_tcap_begin,
1630       { "begin", "tcap.begin",
1631         FT_NONE, BASE_NONE, NULL, 0,
1632         "tcap.Begin", HFILL }},
1633     { &hf_tcap_end,
1634       { "end", "tcap.end",
1635         FT_NONE, BASE_NONE, NULL, 0,
1636         "tcap.End", HFILL }},
1637     { &hf_tcap_continue,
1638       { "continue", "tcap.continue",
1639         FT_NONE, BASE_NONE, NULL, 0,
1640         "tcap.Continue", HFILL }},
1641     { &hf_tcap_abort,
1642       { "abort", "tcap.abort",
1643         FT_NONE, BASE_NONE, NULL, 0,
1644         "tcap.Abort", HFILL }},
1645     { &hf_tcap_dialoguePortion,
1646       { "dialoguePortion", "tcap.dialoguePortion",
1647         FT_BYTES, BASE_NONE, NULL, 0,
1648         "tcap.DialoguePortion", HFILL }},
1649     { &hf_tcap_components,
1650       { "components", "tcap.components",
1651         FT_UINT32, BASE_DEC, NULL, 0,
1652         "tcap.ComponentPortion", HFILL }},
1653     { &hf_tcap_otid,
1654       { "otid", "tcap.otid",
1655         FT_BYTES, BASE_NONE, NULL, 0,
1656         "tcap.OrigTransactionID", HFILL }},
1657     { &hf_tcap_dtid,
1658       { "dtid", "tcap.dtid",
1659         FT_BYTES, BASE_NONE, NULL, 0,
1660         "tcap.DestTransactionID", HFILL }},
1661     { &hf_tcap_reason,
1662       { "reason", "tcap.reason",
1663         FT_UINT32, BASE_DEC, VALS(tcap_Reason_vals), 0,
1664         "tcap.Reason", HFILL }},
1665     { &hf_tcap_p_abortCause,
1666       { "p-abortCause", "tcap.p_abortCause",
1667         FT_UINT32, BASE_DEC, VALS(tcap_P_AbortCause_U_vals), 0,
1668         "tcap.P_AbortCause", HFILL }},
1669     { &hf_tcap_u_abortCause,
1670       { "u-abortCause", "tcap.u_abortCause",
1671         FT_BYTES, BASE_NONE, NULL, 0,
1672         "tcap.DialoguePortion", HFILL }},
1673     { &hf_tcap__untag_item,
1674       { "Component", "tcap.Component",
1675         FT_UINT32, BASE_DEC, VALS(tcap_Component_vals), 0,
1676         "tcap.Component", HFILL }},
1677     { &hf_tcap_invoke,
1678       { "invoke", "tcap.invoke",
1679         FT_NONE, BASE_NONE, NULL, 0,
1680         "tcap.Invoke", HFILL }},
1681     { &hf_tcap_returnResultLast,
1682       { "returnResultLast", "tcap.returnResultLast",
1683         FT_NONE, BASE_NONE, NULL, 0,
1684         "tcap.ReturnResult", HFILL }},
1685     { &hf_tcap_returnError,
1686       { "returnError", "tcap.returnError",
1687         FT_NONE, BASE_NONE, NULL, 0,
1688         "tcap.ReturnError", HFILL }},
1689     { &hf_tcap_reject,
1690       { "reject", "tcap.reject",
1691         FT_NONE, BASE_NONE, NULL, 0,
1692         "tcap.Reject", HFILL }},
1693     { &hf_tcap_returnResultNotLast,
1694       { "returnResultNotLast", "tcap.returnResultNotLast",
1695         FT_NONE, BASE_NONE, NULL, 0,
1696         "tcap.ReturnResult", HFILL }},
1697     { &hf_tcap_invokeID,
1698       { "invokeID", "tcap.invokeID",
1699         FT_INT32, BASE_DEC, NULL, 0,
1700         "tcap.InvokeIdType", HFILL }},
1701     { &hf_tcap_linkedID,
1702       { "linkedID", "tcap.linkedID",
1703         FT_INT32, BASE_DEC, NULL, 0,
1704         "tcap.InvokeIdType", HFILL }},
1705     { &hf_tcap_opCode,
1706       { "opCode", "tcap.opCode",
1707         FT_UINT32, BASE_DEC, VALS(tcap_OPERATION_vals), 0,
1708         "tcap.OPERATION", HFILL }},
1709     { &hf_tcap_parameter,
1710       { "parameter", "tcap.parameter",
1711         FT_NONE, BASE_NONE, NULL, 0,
1712         "tcap.Parameter", HFILL }},
1713     { &hf_tcap_resultretres,
1714       { "resultretres", "tcap.resultretres",
1715         FT_NONE, BASE_NONE, NULL, 0,
1716         "tcap.T_resultretres", HFILL }},
1717     { &hf_tcap_errorCode,
1718       { "errorCode", "tcap.errorCode",
1719         FT_UINT32, BASE_DEC, VALS(tcap_ErrorCode_vals), 0,
1720         "tcap.ErrorCode", HFILL }},
1721     { &hf_tcap_invokeIDRej,
1722       { "invokeIDRej", "tcap.invokeIDRej",
1723         FT_UINT32, BASE_DEC, VALS(tcap_T_invokeIDRej_vals), 0,
1724         "tcap.T_invokeIDRej", HFILL }},
1725     { &hf_tcap_derivable,
1726       { "derivable", "tcap.derivable",
1727         FT_INT32, BASE_DEC, NULL, 0,
1728         "tcap.InvokeIdType", HFILL }},
1729     { &hf_tcap_not_derivable,
1730       { "not-derivable", "tcap.not_derivable",
1731         FT_NONE, BASE_NONE, NULL, 0,
1732         "tcap.NULL", HFILL }},
1733     { &hf_tcap_problem,
1734       { "problem", "tcap.problem",
1735         FT_UINT32, BASE_DEC, VALS(tcap_T_problem_vals), 0,
1736         "tcap.T_problem", HFILL }},
1737     { &hf_tcap_generalProblem,
1738       { "generalProblem", "tcap.generalProblem",
1739         FT_INT32, BASE_DEC, VALS(tcap_GeneralProblem_vals), 0,
1740         "tcap.GeneralProblem", HFILL }},
1741     { &hf_tcap_invokeProblem,
1742       { "invokeProblem", "tcap.invokeProblem",
1743         FT_INT32, BASE_DEC, VALS(tcap_InvokeProblem_vals), 0,
1744         "tcap.InvokeProblem", HFILL }},
1745     { &hf_tcap_returnResultProblem,
1746       { "returnResultProblem", "tcap.returnResultProblem",
1747         FT_INT32, BASE_DEC, VALS(tcap_ReturnResultProblem_vals), 0,
1748         "tcap.ReturnResultProblem", HFILL }},
1749     { &hf_tcap_returnErrorProblem,
1750       { "returnErrorProblem", "tcap.returnErrorProblem",
1751         FT_INT32, BASE_DEC, VALS(tcap_ReturnErrorProblem_vals), 0,
1752         "tcap.ReturnErrorProblem", HFILL }},
1753     { &hf_tcap_localValue,
1754       { "localValue", "tcap.localValue",
1755         FT_INT32, BASE_DEC, NULL, 0,
1756         "tcap.INTEGER", HFILL }},
1757     { &hf_tcap_globalValue,
1758       { "globalValue", "tcap.globalValue",
1759         FT_OID, BASE_NONE, NULL, 0,
1760         "tcap.OBJECT_IDENTIFIER", HFILL }},
1761     { &hf_tcap_nationaler,
1762       { "nationaler", "tcap.nationaler",
1763         FT_INT32, BASE_DEC, NULL, 0,
1764         "tcap.INTEGER_M32768_32767", HFILL }},
1765     { &hf_tcap_privateer,
1766       { "privateer", "tcap.privateer",
1767         FT_INT32, BASE_DEC, NULL, 0,
1768         "tcap.INTEGER", HFILL }},
1769     { &hf_tcap_unidialoguePDU,
1770       { "unidialoguePDU", "tcap.unidialoguePDU",
1771         FT_NONE, BASE_NONE, NULL, 0,
1772         "tcap.AUDT_apdu", HFILL }},
1773     { &hf_tcap_audt_protocol_version,
1774       { "protocol-version", "tcap.protocol_version",
1775         FT_BYTES, BASE_NONE, NULL, 0,
1776         "tcap.AUDT_protocol_version", HFILL }},
1777     { &hf_tcap_audt_application_context_name,
1778       { "application-context-name", "tcap.application_context_name",
1779         FT_OID, BASE_NONE, NULL, 0,
1780         "tcap.AUDT_application_context_name", HFILL }},
1781     { &hf_tcap_audt_user_information,
1782       { "user-information", "tcap.user_information",
1783         FT_UINT32, BASE_DEC, NULL, 0,
1784         "tcap.AUDT_user_information", HFILL }},
1785     { &hf_tcap_audt_user_information_item,
1786       { "user-information item", "tcap.user_information_item",
1787         FT_NONE, BASE_NONE, NULL, 0,
1788         "tcap.EXTERNAL", HFILL }},
1789     { &hf_tcap_dialogueRequest,
1790       { "dialogueRequest", "tcap.dialogueRequest",
1791         FT_NONE, BASE_NONE, NULL, 0,
1792         "tcap.AARQ_apdu", HFILL }},
1793     { &hf_tcap_dialogueResponse,
1794       { "dialogueResponse", "tcap.dialogueResponse",
1795         FT_NONE, BASE_NONE, NULL, 0,
1796         "tcap.AARE_apdu", HFILL }},
1797     { &hf_tcap_dialogueAbort,
1798       { "dialogueAbort", "tcap.dialogueAbort",
1799         FT_NONE, BASE_NONE, NULL, 0,
1800         "tcap.ABRT_apdu", HFILL }},
1801     { &hf_tcap_aarq_protocol_version,
1802       { "protocol-version", "tcap.protocol_version",
1803         FT_BYTES, BASE_NONE, NULL, 0,
1804         "tcap.AARQ_protocol_version", HFILL }},
1805     { &hf_tcap_aarq_application_context_name,
1806       { "application-context-name", "tcap.application_context_name",
1807         FT_OID, BASE_NONE, NULL, 0,
1808         "tcap.AARQ_application_context_name", HFILL }},
1809     { &hf_tcap_aarq_user_information,
1810       { "user-information", "tcap.user_information",
1811         FT_UINT32, BASE_DEC, NULL, 0,
1812         "tcap.AARQ_user_information", HFILL }},
1813     { &hf_tcap_aarq_user_information_item,
1814       { "user-information item", "tcap.user_information_item",
1815         FT_NONE, BASE_NONE, NULL, 0,
1816         "tcap.EXTERNAL", HFILL }},
1817     { &hf_tcap_aare_protocol_version,
1818       { "protocol-version", "tcap.protocol_version",
1819         FT_BYTES, BASE_NONE, NULL, 0,
1820         "tcap.AARE_protocol_version", HFILL }},
1821     { &hf_tcap_aare_application_context_name,
1822       { "application-context-name", "tcap.application_context_name",
1823         FT_OID, BASE_NONE, NULL, 0,
1824         "tcap.AARE_application_context_name", HFILL }},
1825     { &hf_tcap_result,
1826       { "result", "tcap.result",
1827         FT_INT32, BASE_DEC, VALS(tcap_Associate_result_vals), 0,
1828         "tcap.Associate_result", HFILL }},
1829     { &hf_tcap_result_source_diagnostic,
1830       { "result-source-diagnostic", "tcap.result_source_diagnostic",
1831         FT_UINT32, BASE_DEC, VALS(tcap_Associate_source_diagnostic_vals), 0,
1832         "tcap.Associate_source_diagnostic", HFILL }},
1833     { &hf_tcap_aare_user_information,
1834       { "user-information", "tcap.user_information",
1835         FT_UINT32, BASE_DEC, NULL, 0,
1836         "tcap.AARE_user_information", HFILL }},
1837     { &hf_tcap_aare_user_information_item,
1838       { "user-information item", "tcap.user_information_item",
1839         FT_NONE, BASE_NONE, NULL, 0,
1840         "tcap.EXTERNAL", HFILL }},
1841     { &hf_tcap_abort_source,
1842       { "abort-source", "tcap.abort_source",
1843         FT_INT32, BASE_DEC, VALS(tcap_ABRT_source_vals), 0,
1844         "tcap.ABRT_source", HFILL }},
1845     { &hf_tcap_abrt_user_information,
1846       { "user-information", "tcap.user_information",
1847         FT_UINT32, BASE_DEC, NULL, 0,
1848         "tcap.ABRT_user_information", HFILL }},
1849     { &hf_tcap_abrt_user_information_item,
1850       { "user-information item", "tcap.user_information_item",
1851         FT_NONE, BASE_NONE, NULL, 0,
1852         "tcap.EXTERNAL", HFILL }},
1853     { &hf_tcap_dialogue_service_user,
1854       { "dialogue-service-user", "tcap.dialogue_service_user",
1855         FT_INT32, BASE_DEC, VALS(tcap_T_dialogue_service_user_vals), 0,
1856         "tcap.T_dialogue_service_user", HFILL }},
1857     { &hf_tcap_dialogue_service_provider,
1858       { "dialogue-service-provider", "tcap.dialogue_service_provider",
1859         FT_INT32, BASE_DEC, VALS(tcap_T_dialogue_service_provider_vals), 0,
1860         "tcap.T_dialogue_service_provider", HFILL }},
1861     { &hf_tcap_AUDT_protocol_version_version1,
1862       { "version1", "tcap.version1",
1863         FT_BOOLEAN, 8, NULL, 0x80,
1864         NULL, HFILL }},
1865     { &hf_tcap_AARQ_protocol_version_version1,
1866       { "version1", "tcap.version1",
1867         FT_BOOLEAN, 8, NULL, 0x80,
1868         NULL, HFILL }},
1869     { &hf_tcap_AARE_protocol_version_version1,
1870       { "version1", "tcap.version1",
1871         FT_BOOLEAN, 8, NULL, 0x80,
1872         NULL, HFILL }},
1873
1874 /*--- End of included file: packet-tcap-hfarr.c ---*/
1875 #line 319 "packet-tcap-template.c"
1876     };
1877
1878 /* Setup protocol subtree array */
1879     static gint *ett[] = {
1880         &ett_tcap,
1881         &ett_param,
1882         &ett_otid,
1883         &ett_dtid,
1884         &ett_tcap_stat,
1885
1886 /*--- Included file: packet-tcap-ettarr.c ---*/
1887 #line 1 "packet-tcap-ettarr.c"
1888     &ett_tcap_ExternalPDU_U,
1889     &ett_tcap_TCMessage,
1890     &ett_tcap_Unidirectional,
1891     &ett_tcap_Begin,
1892     &ett_tcap_End,
1893     &ett_tcap_Continue,
1894     &ett_tcap_Abort,
1895     &ett_tcap_Reason,
1896     &ett_tcap_SEQUENCE_SIZE_1_MAX_OF_Component,
1897     &ett_tcap_Component,
1898     &ett_tcap_Invoke,
1899     &ett_tcap_ReturnResult,
1900     &ett_tcap_T_resultretres,
1901     &ett_tcap_ReturnError,
1902     &ett_tcap_Reject,
1903     &ett_tcap_T_invokeIDRej,
1904     &ett_tcap_T_problem,
1905     &ett_tcap_OPERATION,
1906     &ett_tcap_ERROR,
1907     &ett_tcap_ErrorCode,
1908     &ett_tcap_UniDialoguePDU,
1909     &ett_tcap_AUDT_apdu_U,
1910     &ett_tcap_AUDT_protocol_version,
1911     &ett_tcap_AUDT_user_information,
1912     &ett_tcap_DialoguePDU,
1913     &ett_tcap_AARQ_apdu_U,
1914     &ett_tcap_AARQ_protocol_version,
1915     &ett_tcap_AARQ_user_information,
1916     &ett_tcap_AARE_apdu_U,
1917     &ett_tcap_AARE_protocol_version,
1918     &ett_tcap_AARE_user_information,
1919     &ett_tcap_ABRT_apdu_U,
1920     &ett_tcap_ABRT_user_information,
1921     &ett_tcap_Associate_source_diagnostic,
1922
1923 /*--- End of included file: packet-tcap-ettarr.c ---*/
1924 #line 329 "packet-tcap-template.c"
1925     };
1926
1927     /*static enum_val_t tcap_options[] = {
1928         { "itu", "ITU",  ITU_TCAP_STANDARD },
1929         { "ansi", "ANSI", ANSI_TCAP_STANDARD },
1930         { NULL, NULL, 0 }
1931     };*/
1932
1933     module_t *tcap_module;
1934
1935 /* Register the protocol name and description */
1936     proto_tcap = proto_register_protocol(PNAME, PSNAME, PFNAME);
1937
1938 /* Required function calls to register the header fields and subtrees used */
1939     proto_register_field_array(proto_tcap, hf, array_length(hf));
1940     proto_register_subtree_array(ett, array_length(ett));
1941
1942     tcap_module = prefs_register_protocol(proto_tcap, NULL);
1943
1944 #if 0
1945     prefs_register_enum_preference(tcap_module, "standard", "ITU TCAP standard",
1946         "The SS7 standard used in ITU TCAP packets",
1947         &tcap_standard, tcap_options, FALSE);
1948 #else
1949     prefs_register_obsolete_preference(tcap_module, "standard");
1950 #endif
1951
1952 #if 0
1953     prefs_register_bool_preference(tcap_module, "lock_info_col", "Lock Info column",
1954         "Always show TCAP in Info column",
1955         &lock_info_col);
1956 #else
1957     prefs_register_obsolete_preference(tcap_module, "lock_info_col");
1958 #endif
1959
1960     /* Set default SSNs */
1961     range_convert_str(&global_ssn_range, "", MAX_SSN);
1962     ssn_range = range_empty();
1963
1964     prefs_register_range_preference(tcap_module, "ssn", "SCCP SSNs",
1965         "SCCP (and SUA) SSNs to decode as TCAP",
1966         &global_ssn_range, MAX_SSN);
1967
1968     prefs_register_bool_preference(tcap_module, "srt",
1969                                    "Service Response Time Analyse",
1970                                    "Activate the analyse for Response Time",
1971                                    &gtcap_HandleSRT);
1972
1973     prefs_register_bool_preference(tcap_module, "persistentsrt",
1974                                    "Persistent stats for SRT",
1975                                    "Statistics for Response Time",
1976                                    &gtcap_PersistentSRT);
1977
1978     prefs_register_uint_preference(tcap_module, "repetitiontimeout",
1979                                    "Repetition timeout",
1980                                    "Maximal delay for message repetion",
1981                                    10, &gtcap_RepetitionTimeout);
1982
1983     prefs_register_uint_preference(tcap_module, "losttimeout",
1984                                    "lost timeout",
1985                                    "Maximal delay for message lost",
1986                                    10, &gtcap_LostTimeout);
1987
1988     ansi_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
1989     itu_sub_dissectors = g_hash_table_new(g_direct_hash,g_direct_equal);
1990
1991     /* 'globally' register dissector */
1992     register_dissector("tcap", dissect_tcap, proto_tcap);
1993
1994     tcap_handle = create_dissector_handle(dissect_tcap, proto_tcap);
1995
1996     register_init_routine(&init_tcap);
1997 }
1998
1999
2000 static void range_delete_callback(guint32 ssn)
2001 {
2002     if ( ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
2003         dissector_delete("sccp.ssn", ssn, tcap_handle);
2004     }
2005 }
2006
2007 static void range_add_callback(guint32 ssn)
2008 {
2009     if (ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
2010         dissector_add("sccp.ssn", ssn, tcap_handle);
2011     }
2012 }
2013
2014
2015 static void init_tcap(void) {
2016     if (ssn_range) {
2017         range_foreach(ssn_range, range_delete_callback);
2018         g_free(ssn_range);
2019     }
2020
2021     ssn_range = range_copy(global_ssn_range);
2022     range_foreach(ssn_range, range_add_callback);
2023     tcapsrt_init_routine();
2024 }
2025
2026 static int
2027 dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset)
2028 {
2029     gint tag_offset, saved_offset, len_offset;
2030     tvbuff_t    *next_tvb;
2031     proto_tree *subtree;
2032     proto_item *pi;
2033     gint8 class;
2034     gboolean pc;
2035     gint32 tag;
2036     guint32 len;
2037     guint32 tag_length;
2038     guint32 len_length;
2039     gboolean ind_field;
2040
2041     while (tvb_reported_length_remaining(tvb, offset) > 0)
2042     {
2043         saved_offset = offset;
2044
2045         offset = get_ber_identifier(tvb, offset, &class, &pc, &tag);
2046         tag_offset = offset;
2047         offset = get_ber_length(tvb, offset, &len, &ind_field);
2048         len_offset = offset;
2049
2050         tag_length = tag_offset - saved_offset;
2051         len_length = len_offset - tag_offset;
2052
2053         if (pc)
2054         {
2055             pi = proto_tree_add_text(tree, tvb, saved_offset,
2056                                      len + (len_offset - saved_offset),
2057                                      "CONSTRUCTOR");
2058             subtree = proto_item_add_subtree(pi, ett_param);
2059             proto_tree_add_uint_format(subtree, hf_tcap_tag, tvb,
2060                                        saved_offset, tag_length, tag,
2061                                        "CONSTRUCTOR Tag");
2062             proto_tree_add_uint(subtree, hf_tcap_tag, tvb, saved_offset,
2063                                 tag_length, class);
2064
2065             proto_tree_add_uint(subtree, hf_tcap_length, tvb, tag_offset,
2066                                 len_length, len);
2067
2068             if (len-(2*ind_field)) /*should always be positive unless we get an empty contructor pointless? */
2069             {
2070                 next_tvb = tvb_new_subset(tvb, offset, len-(2*ind_field),
2071                                           len-(2*ind_field));
2072                 dissect_tcap_param(actx, subtree,next_tvb,0);
2073             }
2074
2075             if (ind_field)
2076                     proto_tree_add_text(subtree, tvb, offset+len-2, 2, "CONSTRUCTOR EOC");
2077
2078             offset += len;
2079         }
2080         else
2081         {
2082             pi = proto_tree_add_text(tree, tvb, saved_offset,
2083                                      len + (len_offset - saved_offset),
2084                                      "Parameter (0x%.2x)", tag);
2085
2086             subtree = proto_item_add_subtree(pi, ett_param);
2087
2088             proto_tree_add_uint(subtree, hf_tcap_tag, tvb, saved_offset,
2089                                 tag_length, tag);
2090
2091             proto_tree_add_uint(subtree, hf_tcap_length, tvb,
2092                                 saved_offset+tag_length, len_length, len);
2093
2094             if (len) /* check for NULLS */
2095             {
2096                 next_tvb = tvb_new_subset(tvb, offset, len, len);
2097                 dissect_ber_octet_string(TRUE, actx, tree, next_tvb, 0,
2098                                          hf_tcap_data, NULL);
2099             }
2100
2101             offset += len;
2102         }
2103     }
2104     return offset;
2105 }
2106
2107 static void raz_tcap_private(struct tcap_private_t * p_tcap_private)
2108 {
2109   memset(p_tcap_private,0,sizeof(struct tcap_private_t) );
2110 }
2111
2112 /*
2113  * Call ITU Subdissector to decode the Tcap Component
2114  */
2115 static int
2116 dissect_tcap_ITU_ComponentPDU(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index _U_)
2117 {
2118   dissector_handle_t subdissector_handle=NULL;
2119   gboolean is_subdissector=FALSE;
2120   struct tcaphash_context_t * p_tcap_context=NULL;
2121
2122   /*
2123    * ok lets look at the oid and ssn and try and find a dissector, otherwise lets decode it.
2124    */
2125
2126   /*
2127    * Handle The TCAP Service Response Time
2128    */
2129   if ( gtcap_HandleSRT ) {
2130           if (!tcap_subdissector_used) {
2131             p_tcap_context=tcapsrt_call_matching(tvb, actx->pinfo, tcap_stat_tree, gp_tcapsrt_info);
2132             tcap_subdissector_used=TRUE;
2133             gp_tcap_context=p_tcap_context;
2134             tcap_private.context=p_tcap_context;
2135           }else{
2136                   /* Take the last TCAP context */
2137                   p_tcap_context = gp_tcap_context;
2138                   tcap_private.context=p_tcap_context;
2139           }
2140   }
2141   if (p_tcap_context) {
2142           if (cur_oid) {
2143                   if (p_tcap_context->oid_present) {
2144                           /* We have already an Application Context, check if we have
2145                              to fallback to a lower version */
2146                           if ( strncmp(p_tcap_context->oid,cur_oid, LENGTH_OID)!=0) {
2147                                   /* ACN, changed, Fallback to lower version
2148                                    * and update the subdissector (purely formal)
2149                                    */
2150                                   g_strlcpy(p_tcap_context->oid,cur_oid, LENGTH_OID);
2151                                   if ( (subdissector_handle = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
2152                                           p_tcap_context->subdissector_handle=subdissector_handle;
2153                                           p_tcap_context->subdissector_present=TRUE;
2154                                   }
2155                           }
2156                   } else {
2157                           /* We do not have the OID in the TCAP context, so store it */
2158                           g_strlcpy(p_tcap_context->oid,cur_oid, LENGTH_OID);
2159                           p_tcap_context->oid_present=TRUE;
2160                           /* Try to find a subdissector according to OID */
2161                           if ( (subdissector_handle
2162                                   = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
2163                                   p_tcap_context->subdissector_handle=subdissector_handle;
2164                                   p_tcap_context->subdissector_present=TRUE;
2165                           } else {
2166                             /* Not found, so try to find a subdissector according to SSN */
2167                             if ( (subdissector_handle = get_itu_tcap_subdissector(actx->pinfo->match_port))) {
2168                               /* Found according to SSN */
2169                               p_tcap_context->subdissector_handle=subdissector_handle;
2170                               p_tcap_context->subdissector_present=TRUE;
2171                             }
2172                           }
2173                   } /* context OID */
2174           } else {
2175                   /* Copy the OID from the TCAP context to the current oid */
2176                   if (p_tcap_context->oid_present) {
2177                           tcap_private.oid= (void*) p_tcap_context->oid;
2178                           tcap_private.acv=TRUE;
2179                   }
2180           } /* no OID */
2181   } /* no TCAP context */
2182
2183
2184   if ( p_tcap_context
2185        && p_tcap_context->subdissector_present) {
2186     /* Take the subdissector from the context */
2187     subdissector_handle=p_tcap_context->subdissector_handle;
2188     is_subdissector=TRUE;
2189   }
2190
2191   /* Have SccpUsersTable protocol taking precedence over sccp.ssn table */
2192   if (!is_subdissector && requested_subdissector_handle) {
2193           is_subdissector = TRUE;
2194           subdissector_handle = requested_subdissector_handle;
2195   }
2196
2197   if (!is_subdissector) {
2198     /*
2199      * If we do not currently know the subdissector, we have to find it
2200      * - first, according to the OID
2201      * - then according to the SSN
2202      * - and at least, take the default Data handler
2203      */
2204     if (ber_oid_dissector_table && cur_oid) {
2205       /* Search if we can find the sub protocol according to the A.C.N */
2206       if ( (subdissector_handle
2207             = dissector_get_string_handle(ber_oid_dissector_table, cur_oid)) ) {
2208                   /* found */
2209                   is_subdissector=TRUE;
2210       } else {
2211                   /* Search if we can found the sub protocol according to the SSN table */
2212                   if ( (subdissector_handle
2213                           = get_itu_tcap_subdissector(actx->pinfo->match_port))) {
2214                           /* Found according to SSN */
2215                           is_subdissector=TRUE;
2216                   } else {
2217                           /* Nothing found, take the Data handler */
2218                           subdissector_handle = data_handle;
2219                           is_subdissector=TRUE;
2220                   } /* SSN */
2221           } /* ACN */
2222         } else {
2223                 /* There is no A.C.N for this transaction, so search in the SSN table */
2224                 if ( (subdissector_handle = get_itu_tcap_subdissector(actx->pinfo->match_port))) {
2225                         /* Found according to SSN */
2226                         is_subdissector=TRUE;
2227                 } else {
2228                         subdissector_handle = data_handle;
2229                         is_subdissector=TRUE;
2230                 }
2231         } /* OID */
2232   } else {
2233           /* We have it already */
2234   }
2235
2236   /* Call the sub dissector if present, and not already called */
2237   if (is_subdissector)
2238     call_dissector(subdissector_handle, tvb, actx->pinfo, tree);
2239
2240   return offset;
2241 }
2242
2243 void call_tcap_dissector(dissector_handle_t handle, tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) {
2244
2245         requested_subdissector_handle = handle;
2246
2247         TRY {
2248                 dissect_tcap(tvb, pinfo, tree);
2249         } CATCH_ALL {
2250                 requested_subdissector_handle = NULL;
2251                 RETHROW;
2252         } ENDTRY;
2253
2254         requested_subdissector_handle = NULL;
2255
2256 }
2257
2258